forked from wolfSSL/wolfssl
Merge pull request #7350 from JacobBarthelmeh/scan_build_fix
scan-build fixes for pkcs7
This commit is contained in:
@@ -2596,6 +2596,12 @@ static int wc_PKCS7_EncodeContentStream(PKCS7* pkcs7, ESD* esd, void* aes,
|
|||||||
{
|
{
|
||||||
int szLeft = BER_OCTET_LENGTH;
|
int szLeft = BER_OCTET_LENGTH;
|
||||||
|
|
||||||
|
if (in == NULL) {
|
||||||
|
XFREE(encContentOut, heap, DYNAMIC_TYPE_PKCS7);
|
||||||
|
XFREE(contentData, heap, DYNAMIC_TYPE_PKCS7);
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
if (szLeft + totalSz > (word32)inSz)
|
if (szLeft + totalSz > (word32)inSz)
|
||||||
szLeft = inSz - totalSz;
|
szLeft = inSz - totalSz;
|
||||||
|
|
||||||
@@ -2669,6 +2675,10 @@ static int wc_PKCS7_EncodeContentStream(PKCS7* pkcs7, ESD* esd, void* aes,
|
|||||||
XFREE(contentData, heap, DYNAMIC_TYPE_PKCS7);
|
XFREE(contentData, heap, DYNAMIC_TYPE_PKCS7);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (in == NULL || out == NULL) {
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
switch (cipherType) {
|
switch (cipherType) {
|
||||||
case WC_CIPHER_NONE:
|
case WC_CIPHER_NONE:
|
||||||
if (!pkcs7->detached) {
|
if (!pkcs7->detached) {
|
||||||
@@ -8168,12 +8178,15 @@ static int wc_PKCS7_EncryptContent(PKCS7* pkcs7, int encryptOID, byte* key,
|
|||||||
WOLFSSL_MSG("Not AES-GCM stream support compiled in");
|
WOLFSSL_MSG("Not AES-GCM stream support compiled in");
|
||||||
ret = NOT_COMPILED_IN;
|
ret = NOT_COMPILED_IN;
|
||||||
}
|
}
|
||||||
ret = wc_AesGcmEncrypt(aes, out, in, inSz, iv, ivSz,
|
else {
|
||||||
|
ret = wc_AesGcmEncrypt(aes, out, in, inSz, iv, ivSz,
|
||||||
authTag, authTagSz, aad, aadSz);
|
authTag, authTagSz, aad, aadSz);
|
||||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
/* async encrypt not available here, so block till done */
|
/* async encrypt not available here, so block till done */
|
||||||
ret = wc_AsyncWait(ret, &aes->asyncDev, WC_ASYNC_FLAG_NONE);
|
ret = wc_AsyncWait(ret, &aes->asyncDev,
|
||||||
#endif
|
WC_ASYNC_FLAG_NONE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
ret = wc_AesGcmEncryptInit(aes, key, keySz, iv, ivSz);
|
ret = wc_AesGcmEncryptInit(aes, key, keySz, iv, ivSz);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
Reference in New Issue
Block a user