[openssl] master update

Matt Caswell matt at openssl.org
Wed Mar 11 15:19:29 UTC 2020


The branch master has been updated
       via  0e6f62e3e1c4cdaa8e3bda7d459f978541dfb1fe (commit)
       via  55ecb812b1fd71aa829c3f5ac6030f2ed437eb30 (commit)
      from  4d6d787c4937706676355ce241c6e538475295d2 (commit)


- Log -----------------------------------------------------------------
commit 0e6f62e3e1c4cdaa8e3bda7d459f978541dfb1fe
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Mar 6 18:05:37 2020 +0000

    If the first serializer we find is the desired one that's ok
    
    Stop looking for a desired serializer if the first one is desired.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/11271)

commit 55ecb812b1fd71aa829c3f5ac6030f2ed437eb30
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Mar 6 18:02:46 2020 +0000

    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 <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/11271)

-----------------------------------------------------------------------

Summary of changes:
 crypto/serializer/serializer_pkey.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/crypto/serializer/serializer_pkey.c b/crypto/serializer/serializer_pkey.c
index 1b6df1da53..4b1bf5c3ee 100644
--- a/crypto/serializer/serializer_pkey.c
+++ b/crypto/serializer/serializer_pkey.c
@@ -121,13 +121,13 @@ static void select_serializer(const char *name, void *data)
         return;
 
     if ((s = OSSL_SERIALIZER_fetch(d->libctx, name, d->propquery)) != NULL) {
-        if (d->first == NULL && s->serialize_data != NULL) {
-            d->first = s;
-        } else if (OSSL_SERIALIZER_provider(s) == d->desired_provider
-                   && s->serialize_object != NULL) {
+        if (OSSL_SERIALIZER_provider(s) == d->desired_provider
+                && s->serialize_object != NULL) {
             OSSL_SERIALIZER_free(d->first);
             d->first = NULL;
             d->desired = s;
+        } else if (d->first == NULL && s->serialize_data != NULL) {
+            d->first = s;
         } else {
             OSSL_SERIALIZER_free(s);
         }
@@ -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);
     }
 


More information about the openssl-commits mailing list