[openssl] master update

tomas at openssl.org tomas at openssl.org
Mon Oct 11 08:45:50 UTC 2021


The branch master has been updated
       via  d11cab47810715ba472070300b180944a1d93633 (commit)
       via  5e199c356d09aca3b625b5ea16966b36d24b0201 (commit)
      from  518ce65d93692ecd4c004b96b47d58da8e5922ea (commit)


- Log -----------------------------------------------------------------
commit d11cab47810715ba472070300b180944a1d93633
Author: PW Hu <jlu.hpw at foxmail.com>
Date:   Fri Oct 8 17:01:47 2021 +0800

    Bugfix: unsafe return check of EVP_PKEY_fromdata
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/16783)

commit 5e199c356d09aca3b625b5ea16966b36d24b0201
Author: PW Hu <jlu.hpw at foxmail.com>
Date:   Fri Oct 8 16:59:00 2021 +0800

    Bugfix: unsafe return check of EVP_PKEY_fromdata_init
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/16783)

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

Summary of changes:
 apps/dhparam.c                     | 4 ++--
 crypto/evp/p_lib.c                 | 4 ++--
 test/helpers/predefined_dhparams.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/apps/dhparam.c b/apps/dhparam.c
index 982b2db549..db9e964cf0 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -383,8 +383,8 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
 
     ctx = EVP_PKEY_CTX_new_from_name(NULL, "DHX", NULL);
     if (ctx == NULL
-            || !EVP_PKEY_fromdata_init(ctx)
-            || !EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEY_PARAMETERS, params)) {
+            || EVP_PKEY_fromdata_init(ctx) <= 0
+            || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEY_PARAMETERS, params) <= 0) {
         BIO_printf(bio_err, "Error, failed to set DH parameters\n");
         goto err;
     }
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 2bc1237488..61cfe1efb9 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -630,7 +630,7 @@ static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
     if (ctx == NULL)
         goto err;
 
-    if (!EVP_PKEY_fromdata_init(ctx)) {
+    if (EVP_PKEY_fromdata_init(ctx) <= 0) {
         ERR_raise(ERR_LIB_EVP, EVP_R_KEY_SETUP_FAILED);
         goto err;
     }
@@ -649,7 +649,7 @@ static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
 #  endif
     *p = OSSL_PARAM_construct_end();
 
-    if (!EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params)) {
+    if (EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params) <= 0) {
         ERR_raise(ERR_LIB_EVP, EVP_R_KEY_SETUP_FAILED);
         goto err;
     }
diff --git a/test/helpers/predefined_dhparams.c b/test/helpers/predefined_dhparams.c
index a6dd8c08a5..ebb9c8891d 100644
--- a/test/helpers/predefined_dhparams.c
+++ b/test/helpers/predefined_dhparams.c
@@ -23,7 +23,7 @@ static EVP_PKEY *get_dh_from_pg_bn(OSSL_LIB_CTX *libctx, const char *type,
     OSSL_PARAM *params = NULL;
     EVP_PKEY *dhpkey = NULL;
 
-    if (pctx == NULL || !EVP_PKEY_fromdata_init(pctx))
+    if (pctx == NULL || EVP_PKEY_fromdata_init(pctx) <= 0)
         goto err;
 
     if ((tmpl = OSSL_PARAM_BLD_new()) == NULL
@@ -35,7 +35,7 @@ static EVP_PKEY *get_dh_from_pg_bn(OSSL_LIB_CTX *libctx, const char *type,
 
     params = OSSL_PARAM_BLD_to_param(tmpl);
     if (params == NULL
-        || !EVP_PKEY_fromdata(pctx, &dhpkey, EVP_PKEY_KEY_PARAMETERS, params))
+        || EVP_PKEY_fromdata(pctx, &dhpkey, EVP_PKEY_KEY_PARAMETERS, params) <= 0)
         goto err;
 
  err:


More information about the openssl-commits mailing list