Skip to content

Commit 4751af9

Browse files
scan-build fixes for pkcs7
1 parent ffb43d0 commit 4751af9

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

wolfcrypt/src/pkcs7.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,6 +2596,10 @@ static int wc_PKCS7_EncodeContentStream(PKCS7* pkcs7, ESD* esd, void* aes,
25962596
{
25972597
int szLeft = BER_OCTET_LENGTH;
25982598

2599+
if (in == NULL) {
2600+
return BAD_FUNC_ARG;
2601+
}
2602+
25992603
if (szLeft + totalSz > (word32)inSz)
26002604
szLeft = inSz - totalSz;
26012605

@@ -2669,6 +2673,10 @@ static int wc_PKCS7_EncodeContentStream(PKCS7* pkcs7, ESD* esd, void* aes,
26692673
XFREE(contentData, heap, DYNAMIC_TYPE_PKCS7);
26702674
}
26712675
else {
2676+
if (in == NULL || out == NULL) {
2677+
return BAD_FUNC_ARG;
2678+
}
2679+
26722680
switch (cipherType) {
26732681
case WC_CIPHER_NONE:
26742682
if (!pkcs7->detached) {
@@ -8168,12 +8176,15 @@ static int wc_PKCS7_EncryptContent(PKCS7* pkcs7, int encryptOID, byte* key,
81688176
WOLFSSL_MSG("Not AES-GCM stream support compiled in");
81698177
ret = NOT_COMPILED_IN;
81708178
}
8171-
ret = wc_AesGcmEncrypt(aes, out, in, inSz, iv, ivSz,
8179+
else {
8180+
ret = wc_AesGcmEncrypt(aes, out, in, inSz, iv, ivSz,
81728181
authTag, authTagSz, aad, aadSz);
8173-
#ifdef WOLFSSL_ASYNC_CRYPT
8174-
/* async encrypt not available here, so block till done */
8175-
ret = wc_AsyncWait(ret, &aes->asyncDev, WC_ASYNC_FLAG_NONE);
8176-
#endif
8182+
#ifdef WOLFSSL_ASYNC_CRYPT
8183+
/* async encrypt not available here, so block till done */
8184+
ret = wc_AsyncWait(ret, &aes->asyncDev,
8185+
WC_ASYNC_FLAG_NONE);
8186+
#endif
8187+
}
81778188
#else
81788189
ret = wc_AesGcmEncryptInit(aes, key, keySz, iv, ivSz);
81798190
if (ret == 0) {

0 commit comments

Comments
 (0)