diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-04 04:53:53 +0100 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-11 00:25:57 +0100 |
commit | 141cc94e44db93cded4ce3f0d97b9b5b928f43f2 (patch) | |
tree | 111a6e47c2a86347a6d969d00844a5b2dc8a5805 /providers/implementations/storemgmt | |
parent | Use BIO_f_readbuffer() in the decoder to support stdin. (diff) | |
download | openssl-141cc94e44db93cded4ce3f0d97b9b5b928f43f2.tar.xz openssl-141cc94e44db93cded4ce3f0d97b9b5b928f43f2.zip |
Add a real type for OSSL_CORE_BIO which is distinct from and not castable to BIO
Providers (particularly the FIPS provider) needs access to BIOs from libcrypto.
Libcrypto is allowed to change the internal format of the BIO structure and it
is still expected to work with providers that were already built. This means
that the libcrypto BIO must be distinct from and not castable to the provider
side OSSL_CORE_BIO.
Unfortunately, this requirement was broken in both directions. This fixes
things by forcing the two to be different and any casts break loudly.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14419)
Diffstat (limited to 'providers/implementations/storemgmt')
-rw-r--r-- | providers/implementations/storemgmt/file_store_der2obj.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/providers/implementations/storemgmt/file_store_der2obj.c b/providers/implementations/storemgmt/file_store_der2obj.c index 74a18eb70b..d34e90540d 100644 --- a/providers/implementations/storemgmt/file_store_der2obj.c +++ b/providers/implementations/storemgmt/file_store_der2obj.c @@ -85,10 +85,13 @@ static int der2obj_decode(void *provctx, OSSL_CORE_BIO *cin, int selection, * We're called from file_store.c, so we know that OSSL_CORE_BIO is a * BIO in this case. */ - BIO *in = (BIO *)cin; + BIO *in = bio_new_from_core_bio(provctx, cin); BUF_MEM *mem = NULL; int err, ok; + if (in == NULL) + return 0; + ERR_set_mark(); ok = (asn1_d2i_read_bio(in, &mem) >= 0); /* @@ -117,6 +120,7 @@ static int der2obj_decode(void *provctx, OSSL_CORE_BIO *cin, int selection, OPENSSL_free(mem->data); OPENSSL_free(mem); } + BIO_free(in); return ok; } |