BIO_GET_DATA(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… bestie's guide to BIO_GET_DATA(3ossl) πŸ’…

okay so this is the OpenSSL manual page BIO_GET_DATA(3ossl), and it's literally about a whole little squad of functions for managing BIO state information. If you're implementing a custom BIO, this is your group chat. If you're not, bestie, read the warnings first. 🫢


✨ NAME ✨

BIO_set_data, BIO_get_data, BIO_set_init, BIO_get_init, BIO_set_shutdown, BIO_get_shutdown β€” functions for managing BIO state information. Periodt. πŸ‘‘

🌸 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 πŸ¦‹

These functions are for when you're implementing a custom BIO. That's the vibe. ✨

  • BIO_set_data() β€” associates the custom data pointed to by ptr with the BIO. You can get it back later with BIO_get_data(). Custom BIOs use this for storing implementation specific information. iykyk.
  • BIO_set_init() β€” sets the value of the BIO's "init" flag to say whether initialisation has been completed for this BIO or not. A nonzero value means initialisation is complete; zero means it's not. Often initialisation finishes during the initial construction of the BIO. For some BIOs, though, initialisation may not complete until after additional steps have happened (for example, through calling custom ctrls). The BIO_get_init() function returns the value of the "init" flag.
  • BIO_set_shutdown() and BIO_get_shutdown() β€” set and get the state of this BIO's shutdown (i.e. BIO_CLOSE) flag. If it's set, then the underlying resource is also closed when the BIO is freed. πŸŽ€

🚨 WARNINGS 🚨

Do not use BIO_set_data(), BIO_get_data(), BIO_set_init(), or BIO_get_init() outside the implementation of a custom BIO. That's the rule, no cap.

Calling BIO_set_data() on an existing BIO implementation with data that it does not expect will lead to unexpected results. πŸ’€

πŸŽ€ 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 stat of the BIO's shutdown (i.e. BIO_CLOSE) flag. Yes, the original really says "stat" 😭 keep the sacred text.

πŸ‘‘ SEE ALSO πŸ‘‘

bio(7), BIO_meth_new(3)

🌈 HISTORY 🌈

The functions described here were added in OpenSSL 1.1.0.

Copyright 2016-2026 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>.


okay bestie, that's the whole BIO_GET_DATA(3ossl) era. This manual page is from OpenSSL 3.5.6, dated 2026-04-07. Go manage your BIO state responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from