BIO_GET_DATA(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… BIO_GET_DATA(3ossl) β€” bestie, it's an OpenSSL situation

okay so this is the OpenSSL manual page for a little bundle of functions that let you poke at a BIO's internal state πŸ‘‘. Six functions, all about data / init / shutdown flags. Grab a snack, we're getting into it.


✨ NAME ✨

BIO_set_data, BIO_get_data, BIO_set_init, BIO_get_init, BIO_set_shutdown, BIO_get_shutdown β€” literally the functions for managing BIO state information πŸŽ€


✨ SYNOPSIS ✨

#include <openssl/bio.h>

void BIO_set_data(BIO *a, void *ptr);
void *BIO_get_data(BIO *a);
void BIO_set_init(BIO *a, int init);
int BIO_get_init(BIO *a);
void BIO_set_shutdown(BIO *a, int shut);
int BIO_get_shutdown(BIO *a);

🌸 DESCRIPTION 🌸

So here's the vibe: these functions are mainly useful when you're implementing a custom BIO 🧚. Like, if you're building your own BIO from scratch, this is your little toolkit.

BIO_set_data() associates the custom data pointed to by ptr with the BIO. Later on you can snatch that data back with a call to BIO_get_data(). Custom BIOs use this to stash their implementation-specific info β€” very "my private little pocket" energy πŸ’….

BIO_set_init() sets the value of the BIO's "init" flag, which tells you whether initialisation has been completed for this BIO or not. A nonzero value = init is done βœ…. Zero = not done yet πŸ™ˆ. Often initialisation finishes during the initial construction of the BIO. But for some BIOs, init might not complete until after some extra steps have happened (for example, through calling custom ctrls). BIO_get_init() just returns whatever the "init" flag is currently set to.

BIO_set_shutdown() and BIO_get_shutdown() set and get the state of this BIO's shutdown (i.e. BIO_CLOSE) flag. It's giving "close the door behind you" πŸšͺ. If it's set, then the underlying resource also gets closed when the BIO is freed.

no cap: remember the shutdown flag is basically the BIO_CLOSE flag. Same thing, different name, iykyk.

πŸ¦‹ RETURN VALUES πŸ¦‹

  • BIO_get_data() returns a pointer to the implementation-specific custom data associated with this BIO β€” or NULL if none has been set πŸ«₯
  • BIO_get_init() returns the state of the BIO's init flag ⭐
  • BIO_get_shutdown() returns the state of the BIO's shutdown (i.e. BIO_CLOSE) flag πŸ”₯

🌈 SEE ALSO 🌈

go read those too, bestie, they're iconic πŸ‘‘


πŸ’œ HISTORY πŸ’œ

The functions described here were added in OpenSSL 1.1.0. so like, they've been serving for a minute πŸŽ€


Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


that's the whole page, periodt πŸ’– this was version 3.5.0, dated 2026-09-25 β€” go forth and manage your BIO state, main character 🧚✨

πŸ“¦ where this page comes from