Merge pull request #5838 from douzzer/20221201-fix-kcapi

20221201-fix-kcapi
This commit is contained in:
Sean Parkinson
2022-12-02 08:24:14 +10:00
committed by GitHub

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;
}