diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-04-06 10:29:54 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-04-11 11:45:04 +0200 |
commit | 707d4e06eba71fb8a8b2faa77a2072511189544d (patch) | |
tree | dcd3af9c74884ef80c9c9ef4b34535578adbb933 /test/evp_extra_test.c | |
parent | 2904d0a2ae0ec6ce23d5cec66ce8c7bdb005d4e5 (diff) |
Add test for resetting SM2 dist ID
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18052)
Diffstat (limited to 'test/evp_extra_test.c')
-rw-r--r-- | test/evp_extra_test.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index caceb50fb6..d8dafef3a0 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -1963,6 +1963,24 @@ static int test_EVP_SM2(void) if (!TEST_int_gt(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len), 0)) goto done; + /* + * Try verify again with non-matching 0 length id but ensure that it can + * be set on the context and overrides the previous value. + */ + + if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, check_md, NULL, + pkey))) + goto done; + + if (!TEST_int_gt(EVP_PKEY_CTX_set1_id(sctx, NULL, 0), 0)) + goto done; + + if (!TEST_true(EVP_DigestVerifyUpdate(md_ctx_verify, kMsg, sizeof(kMsg)))) + goto done; + + if (!TEST_int_eq(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len), 0)) + goto done; + /* now check encryption/decryption */ gparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST, |