Skip to content

Commit

Permalink
Merge pull request #7902 from gasbytes/wc_pkcs7_decodeauthenvelopedda…
Browse files Browse the repository at this point in the history
…ta-problem

Added check on error out from wc_PKCS7_EncodeAuthEnvelopedData
  • Loading branch information
douzzer authored Aug 27, 2024
2 parents 2537e08 + 25dd8b6 commit 90152fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions wolfcrypt/src/pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -13624,7 +13624,14 @@ WOLFSSL_API int wc_PKCS7_DecodeAuthEnvelopedData(PKCS7* pkcs7, byte* in,
}
XFREE(decryptedKey, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
}
#else
if (ret < 0) {
ForceZero(encryptedContent, (word32)encryptedContentSz);
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
ForceZero(decryptedKey, MAX_ENCRYPTED_KEY_SZ);
}
#endif

#ifndef NO_PKCS7_STREAM
if (ret != 0 && ret != WC_NO_ERR_TRACE(WC_PKCS7_WANT_READ_E)) {
wc_PKCS7_ResetStream(pkcs7);
Expand Down

0 comments on commit 90152fe

Please sign in to comment.