mirror of
https://github.com/openssl/openssl.git
synced 2025-01-30 14:01:55 +08:00
EVP_DigestVerifyFinal: fix test function and invocation
Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com> 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/17029)
This commit is contained in:
parent
6d77473251
commit
e2e5e72d5a
@ -188,7 +188,7 @@ static int demo_verify(OSSL_LIB_CTX *libctx, const char *sig_name,
|
||||
fprintf(stderr, "EVP_DigestVerifyUpdate(hamlet_2) failed.\n");
|
||||
goto cleanup;
|
||||
}
|
||||
if (!EVP_DigestVerifyFinal(verify_context, sig_value, sig_len)) {
|
||||
if (EVP_DigestVerifyFinal(verify_context, sig_value, sig_len) <= 0) {
|
||||
fprintf(stderr, "EVP_DigestVerifyFinal failed.\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1273,11 +1273,11 @@ static int test_EVP_DigestSignInit(int tst)
|
||||
sizeof(kMsg))))
|
||||
goto out;
|
||||
}
|
||||
if (!TEST_true(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len)))
|
||||
if (!TEST_int_gt(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len), 0))
|
||||
goto out;
|
||||
|
||||
/* Multiple calls to EVP_DigestVerifyFinal should work */
|
||||
if (!TEST_true(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len)))
|
||||
if (!TEST_int_gt(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len), 0))
|
||||
goto out;
|
||||
} else {
|
||||
/*
|
||||
@ -1323,15 +1323,15 @@ static int test_EVP_DigestVerifyInit(void)
|
||||
|
||||
if (!TEST_true(EVP_DigestVerifyInit(md_ctx, NULL, EVP_sha256(), NULL, pkey))
|
||||
|| !TEST_true(EVP_DigestVerifyUpdate(md_ctx, kMsg, sizeof(kMsg)))
|
||||
|| !TEST_true(EVP_DigestVerifyFinal(md_ctx, kSignature,
|
||||
sizeof(kSignature))))
|
||||
|| !TEST_int_gt(EVP_DigestVerifyFinal(md_ctx, kSignature,
|
||||
sizeof(kSignature)), 0))
|
||||
goto out;
|
||||
|
||||
/* test with reinitialization */
|
||||
if (!TEST_true(EVP_DigestVerifyInit(md_ctx, NULL, NULL, NULL, NULL))
|
||||
|| !TEST_true(EVP_DigestVerifyUpdate(md_ctx, kMsg, sizeof(kMsg)))
|
||||
|| !TEST_true(EVP_DigestVerifyFinal(md_ctx, kSignature,
|
||||
sizeof(kSignature))))
|
||||
|| !TEST_int_gt(EVP_DigestVerifyFinal(md_ctx, kSignature,
|
||||
sizeof(kSignature)), 0))
|
||||
goto out;
|
||||
ret = 1;
|
||||
|
||||
@ -1786,7 +1786,7 @@ static int test_EVP_SM2_verify(void)
|
||||
if (!TEST_true(EVP_DigestVerifyUpdate(mctx, msg, strlen(msg))))
|
||||
goto done;
|
||||
|
||||
if (!TEST_true(EVP_DigestVerifyFinal(mctx, signature, sizeof(signature))))
|
||||
if (!TEST_int_gt(EVP_DigestVerifyFinal(mctx, signature, sizeof(signature)), 0))
|
||||
goto done;
|
||||
rc = 1;
|
||||
|
||||
@ -1896,7 +1896,7 @@ static int test_EVP_SM2(void)
|
||||
if (!TEST_true(EVP_DigestVerifyUpdate(md_ctx_verify, kMsg, sizeof(kMsg))))
|
||||
goto done;
|
||||
|
||||
if (!TEST_true(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len)))
|
||||
if (!TEST_int_gt(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len), 0))
|
||||
goto done;
|
||||
|
||||
/* now check encryption/decryption */
|
||||
|
Loading…
Reference in New Issue
Block a user