wolfcrypt/src/port/kcapi/kcapi_aes.c: fix error checking on KCAPI wc_AesGcmEncrypt() and wc_AesGcmDecrypt().

This commit is contained in:
Daniel Pouzzner
2022-12-01 12:54:57 -06:00
parent d1e6ce064f
commit 1c7826b199

View File

@ -241,7 +241,9 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
#endif
/* argument checks */
if (aes == NULL || authTagSz > AES_BLOCK_SIZE) {
if ((aes == NULL) || ((sz != 0 && (in == NULL || out == NULL))) ||
(iv == NULL) || ((authTag == NULL) && (authTagSz > 0)) ||
(authTagSz > AES_BLOCK_SIZE) || ((authIn == NULL) && (authInSz > 0))) {
ret = BAD_FUNC_ARG;
}
@ -352,8 +354,9 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
#endif
/* argument checks */
if (aes == NULL || (sz != 0 && (in == NULL || out == NULL)) ||
authTagSz > AES_BLOCK_SIZE) {
if ((aes == NULL) || ((sz != 0 && (in == NULL || out == NULL))) ||
(iv == NULL) || ((authTag == NULL) && (authTagSz > 0)) ||
(authTagSz > AES_BLOCK_SIZE) || ((authIn == NULL) && (authInSz > 0))) {
ret = BAD_FUNC_ARG;
}