diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2022-09-12 20:50:28 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2023-02-24 08:49:26 +0100 |
commit | 65def9de8088ae39d8f251e0b57f1a0f204daa14 (patch) | |
tree | 9b4236604d7d4ed956ec0f18633ed65c5cba5fd8 /test/cmsapitest.c | |
parent | 6f9e531003fd736e8e96d9a1a57f7763da9722b8 (diff) | |
download | openssl-new-65def9de8088ae39d8f251e0b57f1a0f204daa14.tar.gz |
CMS_add0_cert: if cert already present, do not throw error but ignore it
Also add checks on failing cert/CRL up_ref calls; improve coding style.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/19199)
Diffstat (limited to 'test/cmsapitest.c')
-rw-r--r-- | test/cmsapitest.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cmsapitest.c b/test/cmsapitest.c index ee08c0c974..6e59b48813 100644 --- a/test/cmsapitest.c +++ b/test/cmsapitest.c @@ -88,6 +88,19 @@ static int test_encrypt_decrypt_aes_256_gcm(void) return test_encrypt_decrypt(EVP_aes_256_gcm()); } +static int test_CMS_add1_cert(void) +{ + CMS_ContentInfo *cms = NULL; + int ret = 0; + + ret = TEST_ptr(cms = CMS_ContentInfo_new()) + && TEST_ptr(CMS_add1_signer(cms, cert, privkey, NULL, 0)) + && TEST_true(CMS_add1_cert(cms, cert)); /* add cert again */ + + CMS_ContentInfo_free(cms); + return ret; +} + static int test_d2i_CMS_bio_NULL(void) { BIO *bio, *content = NULL; @@ -413,6 +426,7 @@ int setup_tests(void) ADD_TEST(test_encrypt_decrypt_aes_128_gcm); ADD_TEST(test_encrypt_decrypt_aes_192_gcm); ADD_TEST(test_encrypt_decrypt_aes_256_gcm); + ADD_TEST(test_CMS_add1_cert); ADD_TEST(test_d2i_CMS_bio_NULL); ADD_ALL_TESTS(test_d2i_CMS_decode, 2); return 1; |