[openssl] master update

Dr. Paul Dale pauli at openssl.org
Tue Jun 15 09:01:35 UTC 2021


The branch master has been updated
       via  60d13c8ff824720580db9665489832fb50f9e60a (commit)
       via  dfb0b8d63a1b627c5d796ba0174ee4693b330989 (commit)
       via  8dff167dfe5a85932ccb1fc67c8f66af00a616ce (commit)
      from  a1fb5eb920fb156eda474f0e59d268316b6c893d (commit)


- Log -----------------------------------------------------------------
commit 60d13c8ff824720580db9665489832fb50f9e60a
Author: Pauli <pauli at openssl.org>
Date:   Tue Jun 15 19:01:00 2021 +1000

    remove end of line whitespace
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    Reviewed-by: David von Oheimb <david.von.oheimb at siemens.com>

commit dfb0b8d63a1b627c5d796ba0174ee4693b330989
Author: Pauli <pauli at openssl.org>
Date:   Mon Jun 14 21:22:55 2021 +1000

    cms: free PKEY_CTX
    
    Preventing a memory leak.
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    Reviewed-by: David von Oheimb <david.von.oheimb at siemens.com>
    (Merged from https://github.com/openssl/openssl/pull/15731)

commit 8dff167dfe5a85932ccb1fc67c8f66af00a616ce
Author: Pauli <pauli at openssl.org>
Date:   Mon Jun 14 09:50:36 2021 +1000

    cms: fix coverity 1485981: unchecked return value
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    Reviewed-by: David von Oheimb <david.von.oheimb at siemens.com>
    (Merged from https://github.com/openssl/openssl/pull/15731)

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

Summary of changes:
 crypto/cms/cms_ec.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c
index 4cf208f5f2..65018956a8 100644
--- a/crypto/cms/cms_ec.c
+++ b/crypto/cms/cms_ec.c
@@ -20,12 +20,12 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
 {
     EVP_PKEY *pkey = NULL;
     EVP_PKEY_CTX *pctx = NULL;
+    OSSL_DECODER_CTX *ctx = NULL;
 
     if (ptype == V_ASN1_SEQUENCE) {
         const ASN1_STRING *pstr = pval;
         const unsigned char *pm = pstr->data;
         size_t pmlen = (size_t)pstr->length;
-        OSSL_DECODER_CTX *ctx = NULL;
         int selection = OSSL_KEYMGMT_SELECT_ALL_PARAMETERS;
 
         ctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, "DER", NULL, "EC",
@@ -33,8 +33,12 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
         if (ctx == NULL)
             goto err;
 
-        OSSL_DECODER_from_data(ctx, &pm, &pmlen);
+        if (!OSSL_DECODER_from_data(ctx, &pm, &pmlen)) {
+            ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
+            goto err;
+        }
         OSSL_DECODER_CTX_free(ctx);
+        return pkey;
     } else if (ptype == V_ASN1_OBJECT) {
         const ASN1_OBJECT *poid = pval;
         char groupname[OSSL_MAX_NAME_SIZE];
@@ -50,16 +54,17 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
         }
         if (EVP_PKEY_paramgen(pctx, &pkey) <= 0)
             goto err;
-    } else {
-        ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
-        goto err;
+        EVP_PKEY_CTX_free(pctx);
+        return pkey;
     }
 
-    return pkey;
+    ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
+    return NULL;
 
  err:
     EVP_PKEY_free(pkey);
     EVP_PKEY_CTX_free(pctx);
+    OSSL_DECODER_CTX_free(ctx);
     return NULL;
 }
 


More information about the openssl-commits mailing list