fix for initialize PKCS7 structure with signer
This commit is contained in:
parent
ab01cd9be1
commit
aec980b803
@ -17450,7 +17450,7 @@ static void test_PKCS7_signed_enveloped(void)
|
||||
|
||||
/* check verify fails */
|
||||
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),
|
||||
PKCS7_SIGNEEDS_CHECK);
|
||||
|
||||
@ -17475,6 +17475,12 @@ static void test_PKCS7_signed_enveloped(void)
|
||||
|
||||
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 */
|
||||
sigSz = FOURK_BUF * 2;
|
||||
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->singleCertSz = derCertSz;
|
||||
pkcs7->cert[0] = derCert;
|
||||
pkcs7->certSz[0] = derCertSz;
|
||||
|
||||
/* create new Pkcs7Cert for recipient, freed during cleanup */
|
||||
cert = (Pkcs7Cert*)XMALLOC(sizeof(Pkcs7Cert), pkcs7->heap,
|
||||
|
Loading…
Reference in New Issue
Block a user