@@ -5455,7 +5455,6 @@ static int PKCS7_VerifySignedData(wc_PKCS7* pkcs7, const byte* hashBuf,
54555455 if (ret == 0 && GetMyVersion(pkiMsg, &idx, &version, pkiMsgSz) < 0)
54565456 ret = ASN_PARSE_E;
54575457
5458-
54595458 /* version 1 follows RFC 2315 */
54605459 /* version 3 follows RFC 4108 */
54615460 if (ret == 0 && (version != 1 && version != 3)) {
@@ -5673,6 +5672,15 @@ static int PKCS7_VerifySignedData(wc_PKCS7* pkcs7, const byte* hashBuf,
56735672 * this as start of content. */
56745673 localIdx = start;
56755674 pkcs7->contentIsPkcs7Type = 1;
5675+
5676+ #ifndef NO_PKCS7_STREAM
5677+ /* Set streaming variables for PKCS#7 type content.
5678+ * length contains the size from [0] EXPLICIT wrapper */
5679+ pkcs7->stream->multi = 0;
5680+ pkcs7->stream->currContIdx = localIdx;
5681+ pkcs7->stream->currContSz = (word32)length;
5682+ pkcs7->stream->currContRmnSz = (word32)length;
5683+ #endif
56765684 }
56775685 else {
56785686 /* CMS eContent OCTET_STRING */
@@ -5762,7 +5770,6 @@ static int PKCS7_VerifySignedData(wc_PKCS7* pkcs7, const byte* hashBuf,
57625770 idx = localIdx;
57635771 }
57645772 else {
5765-
57665773 /* If either pkcs7->content and pkcs7->contentSz are set
57675774 * (detached signature where user has set content explicitly
57685775 * into pkcs7->content/contentSz) OR pkcs7->hashBuf and
@@ -5862,7 +5869,7 @@ static int PKCS7_VerifySignedData(wc_PKCS7* pkcs7, const byte* hashBuf,
58625869
58635870 /* copy content to pkcs7->contentDynamic */
58645871 if (keepContent && pkcs7->stream->content &&
5865- pkcs7->stream->contentSz >0) {
5872+ pkcs7->stream->contentSz > 0) {
58665873 pkcs7->contentDynamic = (byte*)XMALLOC(pkcs7->stream->contentSz,
58675874 pkcs7->heap, DYNAMIC_TYPE_PKCS7);
58685875 if (pkcs7->contentDynamic == NULL) {
0 commit comments