[openssl] master update

Richard Levitte levitte at openssl.org
Fri Apr 19 08:26:04 UTC 2019


The branch master has been updated
       via  1393722af384cdf310645c598bbd06a3bbaa2f31 (commit)
       via  bcb5d42171386709c716312b711a0c15aa368f3f (commit)
       via  e019da7b6ff54822e307daf804f7fe78ec352457 (commit)
      from  4f29f3a29b8b416a501c7166dbbca5284b198f81 (commit)


- Log -----------------------------------------------------------------
commit 1393722af384cdf310645c598bbd06a3bbaa2f31
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Apr 18 17:46:32 2019 +0200

    ossl_method_store_cache_get(): ensure non-NULL property query
    
    The comparator further down the call stack doesn't tolerate NULL, so
    if we got that as input, use the empty string.
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/8781)

commit bcb5d42171386709c716312b711a0c15aa368f3f
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Apr 18 16:33:21 2019 +0200

    OPENSSL_LH_flush(): assign NULL after freeing
    
    OPENSSL_LH_flush() frees the linked lists for each slot, but didn't
    set the list head to NULL after doing so, with the result that an
    operation that affects these lists is likely to cause a crash.
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/8781)

commit e019da7b6ff54822e307daf804f7fe78ec352457
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Apr 18 12:23:21 2019 +0200

    Fix the generic EVP algorithm fetch to actually cache them
    
    ossl_method_store_cache_get() and ossl_method_store_cache_set() were
    called with a NULL argument for store, which means no caching is
    done.  Give them a real store instead.
    
    Also, increment the refcount when we do get a method out of the cache.
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/8781)

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

Summary of changes:
 crypto/evp/evp_fetch.c     | 10 ++++++++--
 crypto/lhash/lhash.c       |  1 +
 crypto/property/property.c |  2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c
index 012383f..c054f31 100644
--- a/crypto/evp/evp_fetch.c
+++ b/crypto/evp/evp_fetch.c
@@ -173,11 +173,15 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
                         void (*free_method)(void *),
                         int (*nid_method)(void *))
 {
+    OSSL_METHOD_STORE *store = get_default_method_store(libctx);
     int nid = OBJ_sn2nid(algorithm);
     void *method = NULL;
 
+    if (store == NULL)
+        return NULL;
+
     if (nid == NID_undef
-        || !ossl_method_store_cache_get(NULL, nid, properties, &method)) {
+        || !ossl_method_store_cache_get(store, nid, properties, &method)) {
         OSSL_METHOD_CONSTRUCT_METHOD mcm = {
             alloc_tmp_method_store,
             dealloc_tmp_method_store,
@@ -198,7 +202,9 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
         method = ossl_method_construct(libctx, operation_id, algorithm,
                                        properties, 0 /* !force_cache */,
                                        &mcm, &mcmdata);
-        ossl_method_store_cache_set(NULL, nid, properties, method);
+        ossl_method_store_cache_set(store, nid, properties, method);
+    } else {
+        upref_method(method);
     }
 
     return method;
diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c
index aa0ca1c..e3c7ac4 100644
--- a/crypto/lhash/lhash.c
+++ b/crypto/lhash/lhash.c
@@ -98,6 +98,7 @@ void OPENSSL_LH_flush(OPENSSL_LHASH *lh)
             OPENSSL_free(n);
             n = nn;
         }
+        lh->b[i] = NULL;
     }
 }
 
diff --git a/crypto/property/property.c b/crypto/property/property.c
index 1a3d0c4..a2122dc 100644
--- a/crypto/property/property.c
+++ b/crypto/property/property.c
@@ -450,7 +450,7 @@ int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, int nid,
         return 0;
     }
 
-    elem.query = prop_query;
+    elem.query = prop_query != NULL ? prop_query : "";
     r = lh_QUERY_retrieve(alg->cache, &elem);
     if (r == NULL) {
         ossl_property_unlock(store);


More information about the openssl-commits mailing list