[openssl] openssl-3.0 update

tomas at openssl.org tomas at openssl.org
Fri Nov 12 15:41:38 UTC 2021


The branch openssl-3.0 has been updated
       via  2e11cb796e1b46159615625c1df34800a1ebae94 (commit)
      from  33665a9389e216b5a1f64fa48c8795dc78973621 (commit)


- Log -----------------------------------------------------------------
commit 2e11cb796e1b46159615625c1df34800a1ebae94
Author: Tomas Mraz <tomas at openssl.org>
Date:   Thu Nov 4 15:35:40 2021 +0100

    test: Add testing of reinitialization via EVP_DigestSignInit()
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/16964)
    
    (cherry picked from commit 816f72d08834ee35ba2615f624b4a29f2717d1c7)

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

Summary of changes:
 test/evp_extra_test.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 9433bb9098..2d463bb76e 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -1143,6 +1143,7 @@ err:
  * Test 12: Use EVP_DigestSign (Implicit fetch digest, RSA)
  * Test 13: Use EVP_DigestSign (Implicit fetch digest, DSA)
  * Test 14: Use EVP_DigestSign (Implicit fetch digest, HMAC)
+ * Test 15-29: Same as above with reinitialization
  */
 static int test_EVP_DigestSignInit(int tst)
 {
@@ -1156,10 +1157,16 @@ static int test_EVP_DigestSignInit(int tst)
     size_t written;
     const EVP_MD *md;
     EVP_MD *mdexp = NULL;
+    int reinit = 0;
 
     if (nullprov != NULL)
         return TEST_skip("Test does not support a non-default library context");
 
+    if (tst >= 15) {
+        reinit = 1;
+        tst -= 15;
+    }
+
     if (tst >= 6 && tst <= 8) {
         membio = BIO_new(BIO_s_mem());
         mdbio = BIO_new(BIO_f_md());
@@ -1198,6 +1205,9 @@ static int test_EVP_DigestSignInit(int tst)
     if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, md, NULL, pkey)))
         goto out;
 
+    if (reinit && !TEST_true(EVP_DigestSignInit(md_ctx, NULL, NULL, NULL, NULL)))
+        goto out;
+
     if (tst >= 6 && tst <= 8) {
         if (!BIO_write_ex(mdbio, kMsg, sizeof(kMsg), &written))
             goto out;
@@ -4182,7 +4192,7 @@ int setup_tests(void)
     }
 
     ADD_TEST(test_EVP_set_default_properties);
-    ADD_ALL_TESTS(test_EVP_DigestSignInit, 15);
+    ADD_ALL_TESTS(test_EVP_DigestSignInit, 30);
     ADD_TEST(test_EVP_DigestVerifyInit);
     ADD_TEST(test_EVP_Digest);
     ADD_ALL_TESTS(test_EVP_PKEY_sign, 3);


More information about the openssl-commits mailing list