[openssl] master update

tomas at openssl.org tomas at openssl.org
Tue Nov 16 16:33:33 UTC 2021


The branch master has been updated
       via  bf4ceeded1497c79e72fba4f9ff15febae58108d (commit)
      from  6e0b05f3008a3f22105fd2bed9314b0bfa381f93 (commit)


- Log -----------------------------------------------------------------
commit bf4ceeded1497c79e72fba4f9ff15febae58108d
Author: Peiwei Hu <jlu.hpw at foxmail.com>
Date:   Mon Nov 15 00:05:04 2021 +0800

    EVP_PKEY_keygen_init: fix return check
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/17031)

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

Summary of changes:
 apps/dsaparam.c        | 2 +-
 test/evp_extra_test.c  | 8 ++++----
 test/evp_libctx_test.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index df98532459..8025b8be67 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -211,7 +211,7 @@ int dsaparam_main(int argc, char **argv)
                        "Error, DSA key generation context allocation failed\n");
             goto end;
         }
-        if (!EVP_PKEY_keygen_init(ctx)) {
+        if (EVP_PKEY_keygen_init(ctx) <= 0) {
             BIO_printf(bio_err,
                        "Error, unable to initialise for key generation\n");
             goto end;
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 8d053ddc93..7026753965 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -1704,7 +1704,7 @@ static int test_EC_keygen_with_enc(int idx)
 
     /* Create key */
     if (!TEST_ptr(kctx = EVP_PKEY_CTX_new_from_pkey(testctx, params, NULL))
-        || !TEST_true(EVP_PKEY_keygen_init(kctx))
+        || !TEST_int_gt(EVP_PKEY_keygen_init(kctx), 0)
         || !TEST_true(EVP_PKEY_keygen(kctx, &key))
         || !TEST_ptr(key))
         goto done;
@@ -1844,7 +1844,7 @@ static int test_EVP_SM2(void)
                                                     pkeyparams, testpropq)))
         goto done;
 
-    if (!TEST_true(EVP_PKEY_keygen_init(kctx)))
+    if (!TEST_int_gt(EVP_PKEY_keygen_init(kctx), 0))
         goto done;
 
     if (!TEST_true(EVP_PKEY_keygen(kctx, &pkey)))
@@ -3218,7 +3218,7 @@ static int test_ecpub(int idx)
 
     ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL);
     if (!TEST_ptr(ctx)
-        || !TEST_true(EVP_PKEY_keygen_init(ctx))
+        || !TEST_int_gt(EVP_PKEY_keygen_init(ctx), 0)
         || !TEST_true(EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid))
         || !TEST_true(EVP_PKEY_keygen(ctx, &pkey)))
         goto done;
@@ -3272,7 +3272,7 @@ static int test_EVP_rsa_pss_with_keygen_bits(void)
     md = EVP_MD_fetch(testctx, "sha256", testpropq);
     ret = TEST_ptr(md)
         && TEST_ptr((ctx = EVP_PKEY_CTX_new_from_name(testctx, "RSA", testpropq)))
-        && TEST_true(EVP_PKEY_keygen_init(ctx))
+        && TEST_int_gt(EVP_PKEY_keygen_init(ctx), 0)
         && TEST_int_gt(EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 512), 0)
         && TEST_true(EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md))
         && TEST_true(EVP_PKEY_keygen(ctx, &pkey));
diff --git a/test/evp_libctx_test.c b/test/evp_libctx_test.c
index e3eac8a068..e2663dc029 100644
--- a/test/evp_libctx_test.c
+++ b/test/evp_libctx_test.c
@@ -669,7 +669,7 @@ static EVP_PKEY *gen_dh_key(void)
     params[1] = OSSL_PARAM_construct_end();
 
     if (!TEST_ptr(gctx = EVP_PKEY_CTX_new_from_name(libctx, "DH", NULL))
-        || !TEST_true(EVP_PKEY_keygen_init(gctx))
+        || !TEST_int_gt(EVP_PKEY_keygen_init(gctx), 0)
         || !TEST_true(EVP_PKEY_CTX_set_params(gctx, params))
         || !TEST_true(EVP_PKEY_keygen(gctx, &pkey)))
         goto err;


More information about the openssl-commits mailing list