fix AES-CCM tag size check on decryption
This commit is contained in:
parent
b73e52f33f
commit
505fbed4df
@ -7305,10 +7305,7 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
/* sanity check on tag size */
|
||||
if (authTagSz != 4 && authTagSz != 6 && authTagSz != 8 &&
|
||||
authTagSz != 10 && authTagSz != 12 && authTagSz != 14 &&
|
||||
authTagSz != 16) {
|
||||
WOLFSSL_MSG("Bad auth tag size AES-CCM");
|
||||
if (wc_AesCcmCheckTagSize(authTagSz) != 0) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
|
@ -4510,6 +4510,10 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
|| authTag == NULL || nonceSz < 7 || nonceSz > 13)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (wc_AesCcmCheckTagSize(authTagSz) != 0) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
o = out;
|
||||
oSz = inSz;
|
||||
XMEMCPY(B+1, nonce, nonceSz);
|
||||
|
@ -580,6 +580,10 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out,
|
||||
authTagSz > AES_BLOCK_SIZE)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (wc_AesCcmCheckTagSize(authTagSz) != 0) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if (wc_AesGetKeySize(aes, &keySz) != 0) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user