@@ -4790,6 +4790,9 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
47904790
47914791 pkiMsg2 = pkiMsg ;
47924792 pkiMsg2Sz = pkiMsgSz ;
4793+
4794+ /* reset ret */
4795+ ret = 0 ;
47934796 }
47944797
47954798 #ifndef NO_PKCS7_STREAM
@@ -4963,14 +4966,14 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
49634966 ret = 0 ; /* reset ret state on degenerate case */
49644967 }
49654968
4966- #ifndef NO_PKCS7_STREAM
49674969 /* save content */
49684970 if (detached == 1 ) {
49694971 /* if detached, use content from user in pkcs7 struct */
49704972 content = pkcs7 -> content ;
49714973 contentSz = pkcs7 -> contentSz ;
49724974 }
49734975
4976+ #ifndef NO_PKCS7_STREAM
49744977 if (content != NULL ) {
49754978 XFREE (pkcs7 -> stream -> content , pkcs7 -> heap , DYNAMIC_TYPE_PKCS7 );
49764979 pkcs7 -> stream -> content = (byte * )XMALLOC (contentSz , pkcs7 -> heap ,
@@ -4986,6 +4989,7 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
49864989 }
49874990 #endif /* !NO_PKCS7_STREAM */
49884991
4992+ /* Certificates begin "footer" section (ie pkiMsg2) if being used */
49894993 /* Get the implicit[0] set of certificates */
49904994 if (ret == 0 && idx >= pkiMsg2Sz )
49914995 ret = BUFFER_E ;
@@ -5270,6 +5274,9 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
52705274 break ;
52715275 }
52725276 stateIdx = idx ;
5277+ #else
5278+ /* if not streaming, maxIdx is just pkiMsg2Sz */
5279+ maxIdx = pkiMsg2Sz ;
52735280 #endif
52745281
52755282 /* set contentType and size after init of PKCS7 structure */
@@ -11619,7 +11626,7 @@ WOLFSSL_API int wc_PKCS7_DecodeAuthEnvelopedData(PKCS7* pkcs7, byte* in,
1161911626{
1162011627#if defined(HAVE_AESGCM ) || defined(HAVE_AESCCM )
1162111628 int recipFound = 0 ;
11622- int ret = 0 , length ;
11629+ int ret = 0 , length = 0 ;
1162311630 word32 idx = 0 ;
1162411631#ifndef NO_PKCS7_STREAM
1162511632 word32 tmpIdx = 0 ;
@@ -12019,8 +12026,6 @@ WOLFSSL_API int wc_PKCS7_DecodeAuthEnvelopedData(PKCS7* pkcs7, byte* in,
1201912026
1202012027 length = pkcs7 -> stream -> expected ;
1202112028 encodedAttribs = pkcs7 -> stream -> aad ;
12022- #else
12023- length = 0 ;
1202412029 #endif
1202512030
1202612031 /* save pointer and length */
@@ -12541,7 +12546,7 @@ int wc_PKCS7_DecodeEncryptedData(PKCS7* pkcs7, byte* in, word32 inSz,
1254112546#ifndef NO_PKCS7_STREAM
1254212547 word32 tmpIdx = 0 ;
1254312548#endif
12544- word32 contentType = 0 , encOID ;
12549+ word32 contentType = 0 , encOID = 0 ;
1254512550
1254612551 int expBlockSz = 0 ;
1254712552 byte tmpIvBuf [MAX_CONTENT_IV_SIZE ];
@@ -12797,8 +12802,6 @@ int wc_PKCS7_DecodeEncryptedData(PKCS7* pkcs7, byte* in, word32 inSz,
1279712802 encryptedContentSz = pkcs7 -> stream -> varThree ;
1279812803 version = pkcs7 -> stream -> vers ;
1279912804 tmpIv = pkcs7 -> stream -> tmpIv ;
12800- #else
12801- encOID = 0 ;
1280212805#endif
1280312806 if (ret == 0 && (encryptedContent = (byte * )XMALLOC (
1280412807 encryptedContentSz , pkcs7 -> heap , DYNAMIC_TYPE_PKCS7 )) == NULL ) {
0 commit comments