BIO_S_CORE(3SSL)
π BIO_S_CORE π (that's the 3SSL page from the OpenSSL manual, bestie)
okay so listen. this is the page for BIO_s_core and BIO_new_from_core_bio, aka the OSSL_CORE_BIO functions, and if you're a provider author you're gonna wanna lock in because this is literally your whole vibe. π§β¨
πΈ NAME πΈ
BIO_s_core, BIO_new_from_core_bio β OSSL_CORE_BIO functions π
β¨ SYNOPSIS β¨
#include <openssl/bio.h>
const BIO_METHOD *BIO_s_core(void);
BIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio);
π¦ DESCRIPTION π¦
BIO_s_core() hands you back the core BIO method function. that's it, that's the whole job. π«Ά
okay so a core BIO is treated as a source/sink BIO that communicates to some external BIO. ngl this is mostly for provider authors β if that's you, hi bestie, this page is for you. π
here's the tea: a bunch of calls from libcrypto into a provider will supply you an OSSL_CORE_BIO parameter. and likeβ¦ that thing represents a BIO inside libcrypto, but you cannot use it directly from a provider. no cap. instead, it should be wrapped using a BIO_s_core(). π€
once a BIO is constructed based on BIO_s_core(), the associated OSSL_CORE_BIO object should be set on it using BIO_set_data(3). βοΈ but note: the BIO will only operate correctly if it is associated with a library context constructed using OSSL_LIB_CTX_new_from_dispatch(3). to associate the BIO with a library context, construct it using BIO_new_ex(3). iykyk π
BIO_new_from_core_bio() is the convenience function of the group chat β it constructs a new BIO based on BIO_s_core() and associates it with the given library context. then it also sets the OSSL_CORE_BIO object on the BIO using BIO_set_data(3). it's giving "i did the two steps for you, you're welcome." π
β RETURN VALUES β
BIO_s_core()returns a core BIOBIO_METHODstructure. π«‘BIO_new_from_core_bio()returns aBIOstructure on success, orNULLon failure. and a failure will most commonly be because the library context was not constructed usingOSSL_LIB_CTX_new_from_dispatch(3). yeah. that one. we talked about it. π
π HISTORY π
BIO_s_core() and BIO_new_from_core_bio() were added in OpenSSL 3.0. so they're not ancient, they're just iconic. π
π₯ EXAMPLES π₯
create a core BIO and write some data to it β here's the moment, the main character energy:
int some_function(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio) {
BIO *cbio = BIO_new_from_core_bio(libctx, corebio);
if (cbio == NULL)
return 0;
BIO_puts(cbio, "Hello World\n");
BIO_free(cbio);
return 1;
}
look at that. "Hello World\n". slay. πβ¨
π COPYRIGHT π
Copyright 2021-2022 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>.
fr fr, read the license, it's not optional bestie π
and that's the whole page!! this was 4.0.3, dated 2026-09-29, and you were reading the BIO_S_CORE(3SSL) page the entire time. go wrap your OSSL_CORE_BIO, set your data, and get your library context from OSSL_LIB_CTX_new_from_dispatch(3). mwah. πππ¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms