diff options
author | Jakub Zelenka <jakub.openssl@gmail.com> | 2020-09-06 19:11:34 +0100 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2020-09-08 15:43:11 +0200 |
commit | 924663c36d47066d5307937da77fed7e872730c7 (patch) | |
tree | a60cfe385cc29402bdaceaaa5a8b069ca6a6a50a /test/cmsapitest.c | |
parent | d96486dc809b5d134055785bfa6d707195d95534 (diff) |
Add CMS AuthEnvelopedData with AES-GCM support
Add the AuthEnvelopedData as defined in RFC 5083 with AES-GCM
parameter as defined in RFC 5084.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/8024)
Diffstat (limited to 'test/cmsapitest.c')
-rw-r--r-- | test/cmsapitest.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/test/cmsapitest.c b/test/cmsapitest.c index 697daa814d..f90200e9ac 100644 --- a/test/cmsapitest.c +++ b/test/cmsapitest.c @@ -21,7 +21,7 @@ DEFINE_STACK_OF(X509) static X509 *cert = NULL; static EVP_PKEY *privkey = NULL; -static int test_encrypt_decrypt(void) +static int test_encrypt_decrypt(const EVP_CIPHER *cipher) { int testresult = 0; STACK_OF(X509) *certstack = sk_X509_new_null(); @@ -37,7 +37,7 @@ static int test_encrypt_decrypt(void) if (!TEST_int_gt(sk_X509_push(certstack, cert), 0)) goto end; - content = CMS_encrypt(certstack, msgbio, EVP_aes_128_cbc(), CMS_TEXT); + content = CMS_encrypt(certstack, msgbio, cipher, CMS_TEXT); if (!TEST_ptr(content)) goto end; @@ -60,6 +60,26 @@ static int test_encrypt_decrypt(void) return testresult; } +static int test_encrypt_decrypt_aes_cbc(void) +{ + return test_encrypt_decrypt(EVP_aes_128_cbc()); +} + +static int test_encrypt_decrypt_aes_128_gcm(void) +{ + return test_encrypt_decrypt(EVP_aes_128_gcm()); +} + +static int test_encrypt_decrypt_aes_192_gcm(void) +{ + return test_encrypt_decrypt(EVP_aes_192_gcm()); +} + +static int test_encrypt_decrypt_aes_256_gcm(void) +{ + return test_encrypt_decrypt(EVP_aes_256_gcm()); +} + OPT_TEST_DECLARE_USAGE("certfile privkeyfile\n") int setup_tests(void) @@ -99,7 +119,10 @@ int setup_tests(void) } BIO_free(privkeybio); - ADD_TEST(test_encrypt_decrypt); + ADD_TEST(test_encrypt_decrypt_aes_cbc); + ADD_TEST(test_encrypt_decrypt_aes_128_gcm); + ADD_TEST(test_encrypt_decrypt_aes_192_gcm); + ADD_TEST(test_encrypt_decrypt_aes_256_gcm); return 1; } |