[openssl] master update

shane.lontis at oracle.com shane.lontis at oracle.com
Wed Sep 23 07:20:35 UTC 2020


The branch master has been updated
       via  81777339e9ed62cd3b801bf225fa1f2aba4b30dd (commit)
       via  ced5231b04679dc31ce981d66d08260037fa40d8 (commit)
       via  965d3f36c49e2d0144330271be7c330b572b43df (commit)
       via  ad2dbfb543ac1ba9c074fccd75c06b1d5d491393 (commit)
       via  d65ab22efdc707a3b8747d8827e2a92eafeaf786 (commit)
       via  78ef571707eeb5c19ef86eafacf0e9867eb3174a (commit)
      from  2e9ab56edc6961aad779e1d41cb6e7414ae5a71d (commit)


- Log -----------------------------------------------------------------
commit 81777339e9ed62cd3b801bf225fa1f2aba4b30dd
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Sep 21 11:42:41 2020 +1000

    Fix CID 1466709 : Negative value passed to a function that cant be negative in cms_sd.c
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/12930)

commit ced5231b04679dc31ce981d66d08260037fa40d8
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Sep 21 11:39:04 2020 +1000

    Fix CID 1466710 : Resource leak in ec_kmgmt due to new call to ossl_prov_is_running()
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/12930)

commit 965d3f36c49e2d0144330271be7c330b572b43df
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Sep 21 11:29:30 2020 +1000

    Fix CID 1466712 : Resource leak in ec_kmgmt due to new callto ossl_prov_is_running()
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/12930)

commit ad2dbfb543ac1ba9c074fccd75c06b1d5d491393
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Sep 21 11:09:10 2020 +1000

    Fix CID 1466713 : Dead code in encode_key2text.c
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/12930)

commit d65ab22efdc707a3b8747d8827e2a92eafeaf786
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Sep 21 10:59:20 2020 +1000

    Fix CID 1466714 : Null pointer dereference in EVP_PKEY_CTX_ctrl() due to new call to evp_pkey_ctx_store_cached_data()
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/12930)

commit 78ef571707eeb5c19ef86eafacf0e9867eb3174a
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Sep 21 10:47:03 2020 +1000

    Fix CID 1467068 : Null pointer dereference in self_test.c
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/12930)

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

Summary of changes:
 crypto/cms/cms_sd.c                                |  2 +-
 crypto/evp/pmeth_lib.c                             | 10 +++-----
 providers/fips/self_test.c                         |  4 ++-
 .../encode_decode/encode_key2text.c                | 29 ++++++++++------------
 providers/implementations/keymgmt/ec_kmgmt.c       | 14 ++++++++---
 5 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index 4b6822f4fd..121390a8d5 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -854,7 +854,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si)
 
     alen = ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs, &abuf,
                          ASN1_ITEM_rptr(CMS_Attributes_Verify));
-    if (!abuf)
+    if (abuf == NULL || alen < 0)
         goto err;
     r = EVP_DigestVerifyUpdate(mctx, abuf, alen);
     OPENSSL_free(abuf);
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index 0d719943f0..26193cd644 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -1450,11 +1450,6 @@ static int evp_pkey_ctx_ctrl_int(EVP_PKEY_CTX *ctx, int keytype, int optype,
 {
     int ret = 0;
 
-    if (ctx == NULL) {
-        EVPerr(0, EVP_R_COMMAND_NOT_SUPPORTED);
-        return -2;
-    }
-
     /*
      * If the method has a |digest_custom| function, we can relax the
      * operation type check, since this can be called before the operation
@@ -1498,6 +1493,10 @@ int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
 {
     int ret = 0;
 
+    if (ctx == NULL) {
+        EVPerr(0, EVP_R_COMMAND_NOT_SUPPORTED);
+        return -2;
+    }
     /* If unsupported, we don't want that reported here */
     ERR_set_mark();
     ret = evp_pkey_ctx_store_cached_data(ctx, keytype, optype,
@@ -1514,7 +1513,6 @@ int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
         if (ret < 1 || ctx->operation == EVP_PKEY_OP_UNDEFINED)
             return ret;
     }
-
     return evp_pkey_ctx_ctrl_int(ctx, keytype, optype, cmd, p1, p2);
 }
 
diff --git a/providers/fips/self_test.c b/providers/fips/self_test.c
index 81f475e900..4bc562f822 100644
--- a/providers/fips/self_test.c
+++ b/providers/fips/self_test.c
@@ -174,8 +174,10 @@ static int verify_integrity(OSSL_CORE_BIO *bio, OSSL_FUNC_BIO_read_ex_fn read_ex
     OSSL_SELF_TEST_onbegin(ev, event_type, OSSL_SELF_TEST_DESC_INTEGRITY_HMAC);
 
     mac = EVP_MAC_fetch(libctx, MAC_NAME, NULL);
+    if (mac == NULL)
+        goto err;
     ctx = EVP_MAC_CTX_new(mac);
-    if (mac == NULL || ctx == NULL)
+    if (ctx == NULL)
         goto err;
 
     *p++ = OSSL_PARAM_construct_utf8_string("digest", DIGEST_NAME,
diff --git a/providers/implementations/encode_decode/encode_key2text.c b/providers/implementations/encode_decode/encode_key2text.c
index 2cf4fab95f..d5e8019081 100644
--- a/providers/implementations/encode_decode/encode_key2text.c
+++ b/providers/implementations/encode_decode/encode_key2text.c
@@ -390,23 +390,20 @@ static int ec_param_explicit_gen_to_text(BIO *out, const EC_GROUP *group,
         || EC_POINT_point2bn(group, point, form, gen, ctx) == NULL)
         return 0;
 
-    if (gen != NULL) {
-        switch (form) {
-        case POINT_CONVERSION_COMPRESSED:
-           glabel = "Generator (compressed):";
-           break;
-        case POINT_CONVERSION_UNCOMPRESSED:
-            glabel = "Generator (uncompressed):";
-            break;
-        case POINT_CONVERSION_HYBRID:
-            glabel = "Generator (hybrid):";
-            break;
-        default:
-            return 0;
-        }
-        return print_labeled_bignum(out, glabel, gen);
+    switch (form) {
+    case POINT_CONVERSION_COMPRESSED:
+       glabel = "Generator (compressed):";
+       break;
+    case POINT_CONVERSION_UNCOMPRESSED:
+        glabel = "Generator (uncompressed):";
+        break;
+    case POINT_CONVERSION_HYBRID:
+        glabel = "Generator (hybrid):";
+        break;
+    default:
+        return 0;
     }
-    return 1;
+    return print_labeled_bignum(out, glabel, gen);
 }
 
 /* Print explicit parameters */
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index 1e32db1b6f..2a8980ddf5 100644
--- a/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
@@ -276,12 +276,16 @@ static int ec_match(const void *keydata1, const void *keydata2, int selection)
     const EC_KEY *ec2 = keydata2;
     const EC_GROUP *group_a = EC_KEY_get0_group(ec1);
     const EC_GROUP *group_b = EC_KEY_get0_group(ec2);
-    BN_CTX *ctx = BN_CTX_new_ex(ec_key_get_libctx(ec1));
+    BN_CTX *ctx = NULL;
     int ok = 1;
 
     if (!ossl_prov_is_running())
         return 0;
 
+    ctx = BN_CTX_new_ex(ec_key_get_libctx(ec1));
+    if (ctx == NULL)
+        return 0;
+
     if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
         ok = ok && group_a != NULL && group_b != NULL
             && EC_GROUP_cmp(group_a, group_b, ctx) == 0;
@@ -784,9 +788,13 @@ int ec_validate(void *keydata, int selection)
 {
     EC_KEY *eck = keydata;
     int ok = 0;
-    BN_CTX *ctx = BN_CTX_new_ex(ec_key_get_libctx(eck));
+    BN_CTX *ctx = NULL;
+
+    if (!ossl_prov_is_running())
+        return 0;
 
-    if (!ossl_prov_is_running() || ctx == NULL)
+    ctx = BN_CTX_new_ex(ec_key_get_libctx(eck));
+    if  (ctx == NULL)
         return 0;
 
     if ((selection & EC_POSSIBLE_SELECTIONS) != 0)


More information about the openssl-commits mailing list