[openssl] master update

tmraz at fedoraproject.org tmraz at fedoraproject.org
Thu Sep 17 07:37:30 UTC 2020


The branch master has been updated
       via  4bb73d5409c056a878f526280f86cc3c01f8cd68 (commit)
      from  8230710f04ed70fee41ec3ed8f3e4b1af55be05a (commit)


- Log -----------------------------------------------------------------
commit 4bb73d5409c056a878f526280f86cc3c01f8cd68
Author: jwalch <jeremy.walch at gmail.com>
Date:   Wed Sep 9 22:36:00 2020 -0400

    Add a NULL check to EVP_PKEY_assign
    
    Fixes  #12619
    
    Update p_lib.c
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/12863)

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

Summary of changes:
 crypto/evp/p_lib.c | 2 +-
 test/ecdsatest.c   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index e336d91286..5e032b4053 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -709,7 +709,7 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
     int alias = type;
 
 #ifndef OPENSSL_NO_EC
-    if (EVP_PKEY_type(type) == EVP_PKEY_EC) {
+    if ((key != NULL) && (EVP_PKEY_type(type) == EVP_PKEY_EC)) {
         const EC_GROUP *group = EC_KEY_get0_group(key);
 
         if (group != NULL && EC_GROUP_get_curve_name(group) == NID_sm2)
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index f7d6608f39..471aaa184d 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -252,6 +252,7 @@ static int test_builtin(int n, int as)
         || !TEST_ptr(eckey_neg = EC_KEY_new_by_curve_name(nid))
         || !TEST_true(EC_KEY_generate_key(eckey_neg))
         || !TEST_ptr(pkey_neg = EVP_PKEY_new())
+        || !TEST_false(EVP_PKEY_assign_EC_KEY(pkey_neg, NULL))
         || !TEST_true(EVP_PKEY_assign_EC_KEY(pkey_neg, eckey_neg)))
         goto err;
 


More information about the openssl-commits mailing list