summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPeiwei Hu <jlu.hpw@foxmail.com>2022-05-28 23:51:32 +0800
committerTodd Short <todd.short@me.com>2022-06-02 10:54:17 -0400
commit3c1d05e1bb95085ad3e47871cd3ab98fbcddeba1 (patch)
tree7086aad34d8922e51641f5e444f6d32d66885f29 /test
parent6d5f63e57b7d7294b891b6de406d767468314dfe (diff)
Fix the checks of EVP_PKEY_check
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/18424) (cherry picked from commit 92d0d7ea9be40909ee79fb8861641a61eead2431)
Diffstat (limited to 'test')
-rw-r--r--test/evp_pkey_provided_test.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c
index 87d3e826e3..2b5de0fb1e 100644
--- a/test/evp_pkey_provided_test.c
+++ b/test/evp_pkey_provided_test.c
@@ -396,7 +396,7 @@ static int test_fromdata_rsa(void)
if (!TEST_ptr(key_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pk, "")))
goto err;
- if (!TEST_true(EVP_PKEY_check(key_ctx))
+ if (!TEST_int_gt(EVP_PKEY_check(key_ctx), 0)
|| !TEST_true(EVP_PKEY_public_check(key_ctx))
|| !TEST_true(EVP_PKEY_private_check(key_ctx))
|| !TEST_true(EVP_PKEY_pairwise_check(key_ctx)))
@@ -660,7 +660,7 @@ static int test_fromdata_dh_named_group(void)
if (!TEST_ptr(key_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pk, "")))
goto err;
- if (!TEST_true(EVP_PKEY_check(key_ctx))
+ if (!TEST_int_gt(EVP_PKEY_check(key_ctx), 0)
|| !TEST_true(EVP_PKEY_public_check(key_ctx))
|| !TEST_true(EVP_PKEY_private_check(key_ctx))
|| !TEST_true(EVP_PKEY_pairwise_check(key_ctx)))
@@ -841,7 +841,7 @@ static int test_fromdata_dh_fips186_4(void)
if (!TEST_ptr(key_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pk, "")))
goto err;
- if (!TEST_true(EVP_PKEY_check(key_ctx))
+ if (!TEST_int_gt(EVP_PKEY_check(key_ctx), 0)
|| !TEST_true(EVP_PKEY_public_check(key_ctx))
|| !TEST_true(EVP_PKEY_private_check(key_ctx))
|| !TEST_true(EVP_PKEY_pairwise_check(key_ctx)))
@@ -1096,7 +1096,7 @@ static int test_fromdata_ecx(int tst)
if (!TEST_ptr(ctx2 = EVP_PKEY_CTX_new_from_pkey(NULL, pk, NULL)))
goto err;
if (tst <= 7) {
- if (!TEST_true(EVP_PKEY_check(ctx2)))
+ if (!TEST_int_gt(EVP_PKEY_check(ctx2), 0))
goto err;
if (!TEST_true(EVP_PKEY_get_octet_string_param(
pk, orig_fromdata_params[PRIV_KEY].key,
@@ -1115,7 +1115,7 @@ static int test_fromdata_ecx(int tst)
/* The private key check should fail if there is only a public key */
if (!TEST_true(EVP_PKEY_public_check(ctx2))
|| !TEST_false(EVP_PKEY_private_check(ctx2))
- || !TEST_false(EVP_PKEY_check(ctx2)))
+ || !TEST_int_le(EVP_PKEY_check(ctx2), 0))
goto err;
}
EVP_PKEY_CTX_free(ctx2);
@@ -1606,7 +1606,7 @@ static int test_fromdata_dsa_fips186_4(void)
if (!TEST_ptr(key_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pk, "")))
goto err;
- if (!TEST_true(EVP_PKEY_check(key_ctx))
+ if (!TEST_int_gt(EVP_PKEY_check(key_ctx), 0)
|| !TEST_true(EVP_PKEY_public_check(key_ctx))
|| !TEST_true(EVP_PKEY_private_check(key_ctx))
|| !TEST_true(EVP_PKEY_pairwise_check(key_ctx)))
@@ -1660,7 +1660,7 @@ static int test_check_dsa(void)
EVP_PKEY_CTX *ctx = NULL;
if (!TEST_ptr(ctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL))
- || !TEST_false(EVP_PKEY_check(ctx))
+ || !TEST_int_le(EVP_PKEY_check(ctx), 0)
|| !TEST_false(EVP_PKEY_public_check(ctx))
|| !TEST_false(EVP_PKEY_private_check(ctx))
|| !TEST_false(EVP_PKEY_pairwise_check(ctx)))