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:42:54 +0200 |
commit | 5b4cf28b6dc98c519cf9f469421696b6c984d50c (patch) | |
tree | 19719dabed398ad9bfa2f03ed41acb3b4cb45a7b /providers | |
parent | e3a2ba6abdf0dfdec4343f6de5e5539e487abdd3 (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)
(cherry picked from commit 98408852c167d895a662dcda824fd5170cad3f7d)
Diffstat (limited to 'providers')
-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, |