diff options
author | Richard Levitte <levitte@openssl.org> | 2021-08-30 13:19:30 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-09-05 21:34:50 +0200 |
commit | 98408852c167d895a662dcda824fd5170cad3f7d (patch) | |
tree | 8444bbc4b04b7b1dbbd2791f4ef390561750cb65 | |
parent | 73dd5d67c506cfeb9bf6183f0c19832c7d3f174d (diff) |
PEM to DER decoder: Specify object type and data structure more consistently
The data structure wasn't given for recognised certificates or CRLs.
It's better, though, to specify it for those objects as well, so they
can be used to filter what actually gets decoded, which will be
helpful for our OSSL_STORE 'file:' scheme implementation.
Fixes #16224
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16466)
-rw-r--r-- | providers/implementations/encode_decode/decode_pem2der.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/providers/implementations/encode_decode/decode_pem2der.c b/providers/implementations/encode_decode/decode_pem2der.c index 5db3689f30..6c537d26ae 100644 --- a/providers/implementations/encode_decode/decode_pem2der.c +++ b/providers/implementations/encode_decode/decode_pem2der.c @@ -123,10 +123,10 @@ static int pem2der_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, * though there is no provider interface to handle such objects, yet. * However, this is beneficial for the OSSL_STORE result handler. */ - { PEM_STRING_X509, OSSL_OBJECT_CERT, NULL, NULL }, - { PEM_STRING_X509_TRUSTED, OSSL_OBJECT_CERT, NULL, NULL }, - { PEM_STRING_X509_OLD, OSSL_OBJECT_CERT, NULL, NULL }, - { PEM_STRING_X509_CRL, OSSL_OBJECT_CRL, NULL, NULL } + { PEM_STRING_X509, OSSL_OBJECT_CERT, NULL, "Certificate" }, + { PEM_STRING_X509_TRUSTED, OSSL_OBJECT_CERT, NULL, "Certificate" }, + { PEM_STRING_X509_OLD, OSSL_OBJECT_CERT, NULL, "Certificate" }, + { PEM_STRING_X509_CRL, OSSL_OBJECT_CRL, NULL, "CertificateList" } }; struct pem2der_ctx_st *ctx = vctx; char *pem_name = NULL, *pem_header = NULL; @@ -178,6 +178,7 @@ static int pem2der_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, char *data_type = (char *)pem_name_map[i].data_type; char *data_structure = (char *)pem_name_map[i].data_structure; + objtype = pem_name_map[i].object_type; if (data_type != NULL) *p++ = OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE, |