Skip to content

Commit 0513815

Browse files
check trailing 0's in signeeds check case
1 parent 95eb179 commit 0513815

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

wolfcrypt/src/pkcs7.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6012,12 +6012,10 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
60126012
}
60136013
}
60146014

6015-
if (ret < 0)
6016-
break;
6017-
60186015
#ifndef NO_PKCS7_STREAM
60196016
/* make sure that terminating zero's follow */
6020-
if (ret >= 0 && pkcs7->stream->indefLen == 1) {
6017+
if ((ret == PKCS7_SIGNEEDS_CHECK || ret >= 0) &&
6018+
pkcs7->stream->indefLen == 1) {
60216019
int i;
60226020
for (i = 0; i < 3 * ASN_INDEF_END_SZ; i++) {
60236021
if (pkiMsg2[idx + i] != 0) {
@@ -6026,9 +6024,11 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
60266024
}
60276025
}
60286026
}
6027+
#endif /* NO_PKCS7_STREAM */
6028+
60296029
if (ret < 0)
60306030
break;
6031-
#endif /* NO_PKCS7_STREAM */
6031+
60326032

60336033
ret = 0; /* success */
60346034
#ifndef NO_PKCS7_STREAM

0 commit comments

Comments
 (0)