1BIO_S_CORE(3ossl) OpenSSL BIO_S_CORE(3ossl)
2
3
4
6 BIO_s_core, BIO_new_from_core_bio - OSSL_CORE_BIO functions
7
9 #include <openssl/bio.h>
10
11 const BIO_METHOD *BIO_s_core(void);
12
13 BIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio);
14
16 BIO_s_core() returns the core BIO method function.
17
18 A core BIO is treated as source/sink BIO which communicates to some
19 external BIO. This is primarily useful to provider authors. A number of
20 calls from libcrypto into a provider supply an OSSL_CORE_BIO parameter.
21 This represents a BIO within libcrypto, but cannot be used directly by
22 a provider. Instead it should be wrapped using a BIO_s_core().
23
24 Once a BIO is contructed based on BIO_s_core(), the associated
25 OSSL_CORE_BIO object should be set on it using BIO_set_data(3). Note
26 that the BIO will only operate correctly if it is associated with a
27 library context constructed using OSSL_LIB_CTX_new_from_dispatch(3). To
28 associate the BIO with a library context construct it using
29 BIO_new_ex(3).
30
31 BIO_new_from_core_bio() is a convenience function that constructs a new
32 BIO based on BIO_s_core() and that is associated with the given library
33 context. It then also sets the OSSL_CORE_BIO object on the BIO using
34 BIO_set_data(3).
35
37 BIO_s_core() return a core BIO BIO_METHOD structure.
38
39 BIO_new_from_core_bio() returns a BIO structure on success or NULL on
40 failure. A failure will most commonly be because the library context
41 was not constructed using OSSL_LIB_CTX_new_from_dispatch(3).
42
44 BIO_s_core() and BIO_new_from_core_bio() were added in OpenSSL 3.0.
45
47 Create a core BIO and write some data to it:
48
49 int some_function(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio) {
50 BIO *cbio = BIO_new_from_core_bio(libctx, corebio);
51
52 if (cbio == NULL)
53 return 0;
54
55 BIO_puts(cbio, "Hello World\n");
56
57 BIO_free(cbio);
58 return 1;
59 }
60
62 Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
63
64 Licensed under the Apache License 2.0 (the "License"). You may not use
65 this file except in compliance with the License. You can obtain a copy
66 in the file LICENSE in the source distribution or at
67 <https://www.openssl.org/source/license.html>.
68
69
70
713.0.5 2022-07-05 BIO_S_CORE(3ossl)