From 55ecb812b1fd71aa829c3f5ac6030f2ed437eb30 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 6 Mar 2020 18:02:46 +0000 Subject: [PATCH] Don't crash if we fail to find a serializer for the current provider The code was assuming that a serializer would always be found - but this may not be the case. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/11271) --- crypto/serializer/serializer_pkey.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crypto/serializer/serializer_pkey.c b/crypto/serializer/serializer_pkey.c index 1b6df1da53..3f1eb5851a 100644 --- a/crypto/serializer/serializer_pkey.c +++ b/crypto/serializer/serializer_pkey.c @@ -338,12 +338,14 @@ OSSL_SERIALIZER_CTX *OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey, OSSL_SERIALIZER_free(sel_data.first); OSSL_SERIALIZER_free(sel_data.desired); - current_props = - ossl_parse_property(libctx, OSSL_SERIALIZER_properties(ser)); - if (ossl_property_match_count(check, current_props) > 0) - selection = OSSL_KEYMGMT_SELECT_ALL_PARAMETERS; + if (ser != NULL) { + current_props = + ossl_parse_property(libctx, OSSL_SERIALIZER_properties(ser)); + if (ossl_property_match_count(check, current_props) > 0) + selection = OSSL_KEYMGMT_SELECT_ALL_PARAMETERS; + ossl_property_free(current_props); + } - ossl_property_free(current_props); ossl_property_free(check); } -- 2.25.1