summaryrefslogtreecommitdiffstats
path: root/test/cmsapitest.c
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2022-06-27 17:05:21 +0200
committerDr. David von Oheimb <dev@ddvo.net>2022-07-16 08:15:49 +0200
commitd7d3dae694fa4611c1cd953dccf81b3d2b4121c6 (patch)
treed4210058c101d76fc666b53c183fbd3e5fa6cff5 /test/cmsapitest.c
parent4329a321c9f939f06e7705fa25ac55af3160acf6 (diff)
CMS: add CMS_SignedData_verify(), a variant of CMS_verify() with extensions
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/18667)
Diffstat (limited to 'test/cmsapitest.c')
-rw-r--r--test/cmsapitest.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/cmsapitest.c b/test/cmsapitest.c
index b40089becd..460e4693c2 100644
--- a/test/cmsapitest.c
+++ b/test/cmsapitest.c
@@ -13,6 +13,7 @@
#include <openssl/bio.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
+#include "../crypto/cms/cms_local.h" /* for access to cms->d.signedData */
#include "testutil.h"
@@ -81,8 +82,9 @@ static int test_encrypt_decrypt_aes_256_gcm(void)
static int test_d2i_CMS_bio_NULL(void)
{
- BIO *bio;
+ BIO *bio, *content = NULL;
CMS_ContentInfo *cms = NULL;
+ unsigned int flags = CMS_NO_SIGNER_CERT_VERIFY;
int ret = 0;
/*
@@ -281,9 +283,12 @@ static int test_d2i_CMS_bio_NULL(void)
};
ret = TEST_ptr(bio = BIO_new_mem_buf(cms_data, sizeof(cms_data)))
- && TEST_ptr(cms = d2i_CMS_bio(bio, NULL))
- && TEST_true(CMS_verify(cms, NULL, NULL, NULL, NULL,
- CMS_NO_SIGNER_CERT_VERIFY));
+ && TEST_ptr(cms = d2i_CMS_bio(bio, NULL))
+ && TEST_true(CMS_verify(cms, NULL, NULL, NULL, NULL, flags))
+ && TEST_ptr(content =
+ CMS_SignedData_verify(cms->d.signedData, NULL, NULL, NULL,
+ NULL, NULL, flags, NULL, NULL));
+ BIO_free(content);
CMS_ContentInfo_free(cms);
BIO_free(bio);
return ret;