fix for streaming with PKCS7

This commit is contained in:
Jacob Barthelmeh
2021-03-25 18:54:09 +07:00
parent 8bee2af550
commit a472d2af4a

View File

@ -8336,18 +8336,14 @@ static int wc_PKCS7_DecryptKtri(PKCS7* pkcs7, byte* in, word32 inSz,
case WC_PKCS7_DECRYPT_KTRI_2: case WC_PKCS7_DECRYPT_KTRI_2:
#ifndef NO_PKCS7_STREAM #ifndef NO_PKCS7_STREAM
if ((ret = wc_PKCS7_AddDataToStream(pkcs7, in, inSz, pkcs7->stream->expected, if ((ret = wc_PKCS7_AddDataToStream(pkcs7, in, inSz,
&pkiMsg, idx)) != 0) { pkcs7->stream->expected, &pkiMsg, idx)) != 0) {
return ret; return ret;
} }
rc = wc_PKCS7_GetMaxStream(pkcs7, PKCS7_DEFAULT_PEEK, if (in != pkiMsg) {
in, inSz); pkiMsgSz = pkcs7->stream->length;
if (rc < 0) {
ret = (int)rc;
break;
} }
pkiMsgSz = (word32)rc;
wc_PKCS7_StreamGetVar(pkcs7, NULL, &sidType, &version); wc_PKCS7_StreamGetVar(pkcs7, NULL, &sidType, &version);