diff options
author | Matt Caswell <matt@openssl.org> | 2021-04-27 19:56:39 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-05-04 12:00:21 +0100 |
commit | b0ee1de9ab4fb8586934f3a8126432f06abf7115 (patch) | |
tree | a835c73699f9c0b1235e5004b8af292c52fa030f /include | |
parent | e3188bae04769242e62ae2fba96a0aca5b7ce605 (diff) |
Create libcrypto support for BIO_new_from_core_bio()
Previously the concept of wrapping an OSSL_CORE_BIO in a real BIO was an
internal only concept for our own providers. Since this is likely to be
generally useful, we make it a part of the public API.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15072)
Diffstat (limited to 'include')
-rw-r--r-- | include/internal/bio.h | 2 | ||||
-rw-r--r-- | include/internal/cryptlib.h | 7 | ||||
-rw-r--r-- | include/openssl/bio.h.in | 6 | ||||
-rw-r--r-- | include/openssl/crypto.h.in | 1 |
4 files changed, 12 insertions, 4 deletions
diff --git a/include/internal/bio.h b/include/internal/bio.h index b905845a1a..2d36a7b980 100644 --- a/include/internal/bio.h +++ b/include/internal/bio.h @@ -86,4 +86,6 @@ int ossl_core_bio_up_ref(OSSL_CORE_BIO *cb); int ossl_core_bio_free(OSSL_CORE_BIO *cb); int ossl_core_bio_vprintf(OSSL_CORE_BIO *cb, const char *format, va_list args); +int ossl_bio_init_core(OSSL_LIB_CTX *libctx, const OSSL_DISPATCH *fns); + #endif diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h index e7dd1f65b4..d583153b89 100644 --- a/include/internal/cryptlib.h +++ b/include/internal/cryptlib.h @@ -156,14 +156,15 @@ typedef struct ossl_ex_data_global_st { # define OSSL_LIB_CTX_RAND_CRNGT_INDEX 7 # define OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX 8 # define OSSL_LIB_CTX_FIPS_PROV_INDEX 9 -# define OSSL_LIB_CTX_ENCODER_STORE_INDEX 10 -# define OSSL_LIB_CTX_DECODER_STORE_INDEX 11 +# define OSSL_LIB_CTX_ENCODER_STORE_INDEX 10 +# define OSSL_LIB_CTX_DECODER_STORE_INDEX 11 # define OSSL_LIB_CTX_SELF_TEST_CB_INDEX 12 # define OSSL_LIB_CTX_BIO_PROV_INDEX 13 # define OSSL_LIB_CTX_GLOBAL_PROPERTIES 14 # define OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX 15 # define OSSL_LIB_CTX_PROVIDER_CONF_INDEX 16 -# define OSSL_LIB_CTX_MAX_INDEXES 17 +# define OSSL_LIB_CTX_BIO_CORE_INDEX 17 +# define OSSL_LIB_CTX_MAX_INDEXES 18 typedef struct ossl_lib_ctx_method { void *(*new_func)(OSSL_LIB_CTX *ctx); diff --git a/include/openssl/bio.h.in b/include/openssl/bio.h.in index 336e386459..66ebfc5c7e 100644 --- a/include/openssl/bio.h.in +++ b/include/openssl/bio.h.in @@ -30,6 +30,7 @@ use OpenSSL::stackhash qw(generate_stack_macros); # include <openssl/crypto.h> # include <openssl/bioerr.h> +# include <openssl/core.h> #ifdef __cplusplus extern "C" { @@ -66,7 +67,7 @@ extern "C" { # ifndef OPENSSL_NO_SCTP # define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) # endif -# define BIO_TYPE_CORE_TO_PROV (25|BIO_TYPE_FILTER) +# define BIO_TYPE_CORE_TO_PROV (25|BIO_TYPE_SOURCE_SINK) #define BIO_TYPE_START 128 @@ -590,9 +591,11 @@ int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, const BIO_METHOD *BIO_s_file(void); BIO *BIO_new_file(const char *filename, const char *mode); +BIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio); # ifndef OPENSSL_NO_STDIO BIO *BIO_new_fp(FILE *stream, int close_flag); # endif +BIO *BIO_new_ex(OSSL_LIB_CTX *libctx, const BIO_METHOD *method); BIO *BIO_new(const BIO_METHOD *type); int BIO_free(BIO *a); void BIO_set_data(BIO *a, void *ptr); @@ -651,6 +654,7 @@ const BIO_METHOD *BIO_f_readbuffer(void); const BIO_METHOD *BIO_f_linebuffer(void); const BIO_METHOD *BIO_f_nbio_test(void); const BIO_METHOD *BIO_f_prefix(void); +const BIO_METHOD *BIO_s_core(void); # ifndef OPENSSL_NO_DGRAM const BIO_METHOD *BIO_s_datagram(void); int BIO_dgram_non_fatal_error(int error); diff --git a/include/openssl/crypto.h.in b/include/openssl/crypto.h.in index ec6f94d985..e868172acc 100644 --- a/include/openssl/crypto.h.in +++ b/include/openssl/crypto.h.in @@ -517,6 +517,7 @@ CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); OSSL_LIB_CTX *OSSL_LIB_CTX_new(void); +OSSL_LIB_CTX *OSSL_LIB_CTX_new_from_dispatch(const OSSL_DISPATCH *in); int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file); void OSSL_LIB_CTX_free(OSSL_LIB_CTX *); OSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void); |