mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Merge pull request #2367 from JacobBarthelmeh/PKCS7
fix for initialize PKCS7 structure with signer
This commit is contained in:
@ -17450,7 +17450,7 @@ static void test_PKCS7_signed_enveloped(void)
|
|||||||
|
|
||||||
/* check verify fails */
|
/* check verify fails */
|
||||||
AssertNotNull(pkcs7 = wc_PKCS7_New(NULL, 0));
|
AssertNotNull(pkcs7 = wc_PKCS7_New(NULL, 0));
|
||||||
AssertIntEQ(wc_PKCS7_InitWithCert(pkcs7, cert, certSz), 0);
|
AssertIntEQ(wc_PKCS7_InitWithCert(pkcs7, NULL, 0), 0);
|
||||||
AssertIntEQ(wc_PKCS7_VerifySignedData(pkcs7, sig, sigSz),
|
AssertIntEQ(wc_PKCS7_VerifySignedData(pkcs7, sig, sigSz),
|
||||||
PKCS7_SIGNEEDS_CHECK);
|
PKCS7_SIGNEEDS_CHECK);
|
||||||
|
|
||||||
@ -17475,6 +17475,12 @@ static void test_PKCS7_signed_enveloped(void)
|
|||||||
|
|
||||||
wc_PKCS7_Free(pkcs7);
|
wc_PKCS7_Free(pkcs7);
|
||||||
|
|
||||||
|
/* initializing the PKCS7 struct with the signing certificate should pass */
|
||||||
|
AssertNotNull(pkcs7 = wc_PKCS7_New(NULL, 0));
|
||||||
|
AssertIntEQ(wc_PKCS7_InitWithCert(pkcs7, cert, certSz), 0);
|
||||||
|
AssertIntEQ(wc_PKCS7_VerifySignedData(pkcs7, sig, sigSz), 0);
|
||||||
|
wc_PKCS7_Free(pkcs7);
|
||||||
|
|
||||||
/* create valid degenerate bundle */
|
/* create valid degenerate bundle */
|
||||||
sigSz = FOURK_BUF * 2;
|
sigSz = FOURK_BUF * 2;
|
||||||
AssertNotNull(pkcs7 = wc_PKCS7_New(NULL, 0));
|
AssertNotNull(pkcs7 = wc_PKCS7_New(NULL, 0));
|
||||||
|
@ -946,6 +946,8 @@ int wc_PKCS7_InitWithCert(PKCS7* pkcs7, byte* derCert, word32 derCertSz)
|
|||||||
|
|
||||||
pkcs7->singleCert = derCert;
|
pkcs7->singleCert = derCert;
|
||||||
pkcs7->singleCertSz = derCertSz;
|
pkcs7->singleCertSz = derCertSz;
|
||||||
|
pkcs7->cert[0] = derCert;
|
||||||
|
pkcs7->certSz[0] = derCertSz;
|
||||||
|
|
||||||
/* create new Pkcs7Cert for recipient, freed during cleanup */
|
/* create new Pkcs7Cert for recipient, freed during cleanup */
|
||||||
cert = (Pkcs7Cert*)XMALLOC(sizeof(Pkcs7Cert), pkcs7->heap,
|
cert = (Pkcs7Cert*)XMALLOC(sizeof(Pkcs7Cert), pkcs7->heap,
|
||||||
|
Reference in New Issue
Block a user