[openssl] master update

tomas at openssl.org tomas at openssl.org
Tue Nov 16 16:31:26 UTC 2021


The branch master has been updated
       via  e2e5e72d5aec4d8d633cc5e9930f762da7973ab6 (commit)
      from  6d774732517f1d63b7999c5691fc0bf046023faf (commit)


- Log -----------------------------------------------------------------
commit e2e5e72d5aec4d8d633cc5e9930f762da7973ab6
Author: Peiwei Hu <jlu.hpw at foxmail.com>
Date:   Sun Nov 14 22:42:35 2021 +0800

    EVP_DigestVerifyFinal: fix test function and invocation
    
    Signed-off-by: Peiwei Hu <jlu.hpw at foxmail.com>
    
    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/17029)

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

Summary of changes:
 demos/signature/EVP_Signature_demo.c |  2 +-
 test/evp_extra_test.c                | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/demos/signature/EVP_Signature_demo.c b/demos/signature/EVP_Signature_demo.c
index d7f26f164b..123c95c26a 100644
--- a/demos/signature/EVP_Signature_demo.c
+++ b/demos/signature/EVP_Signature_demo.c
@@ -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;
     }
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 0f280e9f82..69cab3194b 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -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 */


More information about the openssl-commits mailing list