Skip to content

Commit

Permalink
Implement peer review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kaleb-himes committed Jun 21, 2024
1 parent a1645d6 commit 871dc9c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions wolfcrypt/src/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -10643,11 +10643,6 @@ static WARN_UNUSED_RESULT int roll_auth(
word32 remainder;
int ret;

/* Sanity check on authIn to prevent segfault in xorbuf() where
* variable 'in' is dereferenced as the mask 'm' in misc.c */
if (in == NULL)
return BAD_FUNC_ARG;

/* encode the length in */
if (inSz <= 0xFEFF) {
authLenSz = 2;
Expand Down Expand Up @@ -10766,6 +10761,11 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
authTagSz > AES_BLOCK_SIZE)
return BAD_FUNC_ARG;

/* Sanity check on authIn to prevent segfault in xorbuf() where
* variable 'in' is dereferenced as the mask 'm' in misc.c */
if (authIn == NULL && authInSz > 0)
return BAD_FUNC_ARG;

/* sanity check on tag size */
if (wc_AesCcmCheckTagSize((int)authTagSz) != 0) {
return BAD_FUNC_ARG;
Expand Down Expand Up @@ -10908,6 +10908,12 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
authTagSz > AES_BLOCK_SIZE)
return BAD_FUNC_ARG;

/* Sanity check on authIn to prevent segfault in xorbuf() where
* variable 'in' is dereferenced as the mask 'm' in misc.c */
if (authIn == NULL && authInSz > 0)
return BAD_FUNC_ARG;


/* sanity check on tag size */
if (wc_AesCcmCheckTagSize((int)authTagSz) != 0) {
return BAD_FUNC_ARG;
Expand Down

0 comments on commit 871dc9c

Please sign in to comment.