BIO_DUP_CHAIN(3)
πΈ BIO_DUP_CHAIN(3) πΈ
okay so this is the Library Functions Manual page for the BIO_dup_chain / BIO_dup_state girlies β copy a BIO chain energy. No cap, it's giving "we're duplicating a chain of BIOs but not in the way you think." π
π NAME π
BIO_dup_chain, BIO_dup_state β copy a BIO chain π
β¨ SYNOPSIS β¨
#include <openssl/bio.h>
BIO *
BIO_dup_chain(BIO *b);
long
BIO_dup_state(BIO *b, BIO *new_bio);
π¦ DESCRIPTION π¦
Okay bestie, BIO_dup_chain() copies the chain starting at b by iteratively copying b and all the BIOs following it, and then joining the copies in the same order as in the original chain. Important: this copying operation is neither a deep copy nor a shallow copy β it's literally its own little middle-ground vibe. π
Some parts of the state of each BIO are copied β in particular, with respect to the values returned by BIO_get_init(3), BIO_test_flags(3), and BIO_get_shutdown(3). Other parts of the state of the BIOs are not copied but instead initialized to 0 β in particular, with respect to the values returned by BIO_number_read(3), BIO_number_written(3), and BIO_get_retry_reason(3). The custom data pointer that can be used by custom BIO types and that can be retrieved with BIO_get_data(3) is set to NULL in the copied BIO objects rather than copied. The reference count of each BIO in the copied chain is set to 1. π
For each BIO in the chain, copying the data that was set with BIO_set_ex_data(3) is attempted, which may involve calling application-defined callback functions. π«Ά
The following pointers are copied rather than creating deep copies of the objects pointed to:
- The type pointer used for creating each
BIOwithBIO_new(3), implying that functions likeBIO_method_name(3)return pointers to the same strings for theBIOs in the copied chain, and that these strings are not copied. π - All function pointers, in particular those installed with
BIO_set_callback_ex(3)andBIO_get_callback_ex(3). β - The pointer installed with
BIO_set_callback_arg(3), which implies that forBIOs usingBIO_debug_callback(3), those in the copied chain use the sameBIOs for debugging output as the corresponding ones in the original chain, and none of the debugging outputBIOs are copied. π₯
BIO_dup_state() is a macro that calls BIO_ctrl(3) with a cmd argument of BIO_CTRL_DUP. It is automatically called for each BIO during BIO_dup_chain() after the copied BIO is initialized and data copied into it, but before the data set with BIO_set_ex_data(3) is copied into the new BIO and before it is linked into the new chain. π§
This control operation may modify the operation of BIO_dup_chain() for particular types of BIOs contained in the chain, for example initializing or copying additional data. For BIO types provided by the library, such additional effects are documented in the respective manual pages, in particular in BIO_f_buffer(3), BIO_f_cipher(3), BIO_f_md(3), BIO_f_ssl(3), BIO_s_bio(3), and BIO_s_connect(3). πΈ
π RETURN VALUES π
BIO_dup_chain() returns a pointer to the newly allocated copy of the BIO b on success or NULL on failure. failure is not the vibe, but there it is. π
BIO_dup_state() returns 1 on success or a value less than or equal to zero on failure. π
π SEE ALSO π
π HISTORY π
BIO_dup_chain() and BIO_dup_state() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4. π¦
okay that's the whole page, bestie β this Debian-flavored manual page is dated April 9, 2023, and that's the cute little sign-off. mwah π
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms