diff options
author | Peiwei Hu <jlu.hpw@foxmail.com> | 2022-05-24 23:57:33 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-06-02 11:06:41 +0200 |
commit | 2cba2e160d5b028e4a777e8038744a8bc4280629 (patch) | |
tree | 806dd88d75132a8b1b91c29c171f600885a75efe /test/evp_extra_test.c | |
parent | 00d5193b688019a85d1bd0196f2837a4476394bb (diff) |
Fix the checks of EVP_PKEY_CTX_set/get_* functions
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18399)
Diffstat (limited to 'test/evp_extra_test.c')
-rw-r--r-- | test/evp_extra_test.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index 174b0890d3..b68de52dd7 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -1760,7 +1760,7 @@ static int test_EC_keygen_with_enc(int idx) if (!TEST_ptr(pctx = EVP_PKEY_CTX_new_from_name(testctx, "EC", NULL)) || !TEST_int_gt(EVP_PKEY_paramgen_init(pctx), 0) || !TEST_int_gt(EVP_PKEY_CTX_set_group_name(pctx, "P-256"), 0) - || !TEST_true(EVP_PKEY_CTX_set_ec_param_enc(pctx, enc)) + || !TEST_int_gt(EVP_PKEY_CTX_set_ec_param_enc(pctx, enc), 0) || !TEST_true(EVP_PKEY_paramgen(pctx, ¶ms)) || !TEST_ptr(params)) goto done; @@ -1897,7 +1897,7 @@ static int test_EVP_SM2(void) if (!TEST_true(EVP_PKEY_paramgen_init(pctx) == 1)) goto done; - if (!TEST_true(EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_sm2))) + if (!TEST_int_gt(EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_sm2), 0)) goto done; if (!TEST_true(EVP_PKEY_paramgen(pctx, &pkeyparams))) @@ -3325,7 +3325,7 @@ static int test_ecpub(int idx) ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL); if (!TEST_ptr(ctx) || !TEST_int_gt(EVP_PKEY_keygen_init(ctx), 0) - || !TEST_true(EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid)) + || !TEST_int_gt(EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid), 0) || !TEST_true(EVP_PKEY_keygen(ctx, &pkey))) goto done; len = i2d_PublicKey(pkey, NULL); @@ -3377,10 +3377,10 @@ 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_ptr((ctx = EVP_PKEY_CTX_new_from_name(testctx, "RSA-PSS", testpropq))) && 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_int_gt(EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md), 0) && TEST_true(EVP_PKEY_keygen(ctx, &pkey)); EVP_MD_free(md); |