diff options
author | Peiwei Hu <jlu.hpw@foxmail.com> | 2021-11-15 00:05:04 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-11-16 17:33:38 +0100 |
commit | 20ca6f0ad1d621f7cd2b939b7e2e58ba29df2e08 (patch) | |
tree | cb019b4eedc82badadc972b72c898cd9b61d645e /test | |
parent | 84201d47b4a8f2c358f014448d89dfde5c6217fe (diff) |
EVP_PKEY_keygen_init: fix return check
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17031)
(cherry picked from commit bf4ceeded1497c79e72fba4f9ff15febae58108d)
Diffstat (limited to 'test')
-rw-r--r-- | test/evp_extra_test.c | 8 | ||||
-rw-r--r-- | test/evp_libctx_test.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index ac989935d6..965de2e2c8 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; |