diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-11-04 15:35:40 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-11-12 16:41:33 +0100 |
commit | 2e11cb796e1b46159615625c1df34800a1ebae94 (patch) | |
tree | e59e43825f18aa183a12bb6e20442949e2941a1a /test | |
parent | 33665a9389e216b5a1f64fa48c8795dc78973621 (diff) |
test: Add testing of reinitialization via EVP_DigestSignInit()
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16964)
(cherry picked from commit 816f72d08834ee35ba2615f624b4a29f2717d1c7)
Diffstat (limited to 'test')
-rw-r--r-- | test/evp_extra_test.c | 12 |
1 files changed, 11 insertions, 1 deletions
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); |