forked from wolfSSL/wolfssl
Merge pull request #584 from kaleb-himes/aes-gcm-bo
sanity check on memcpy and xorbuf
This commit is contained in:
@@ -3864,6 +3864,10 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
|||||||
byte *ctr ;
|
byte *ctr ;
|
||||||
byte scratch[AES_BLOCK_SIZE];
|
byte scratch[AES_BLOCK_SIZE];
|
||||||
|
|
||||||
|
/* Sanity check for XMEMCPY in GHASH function and local xorbuf call */
|
||||||
|
if (authTagSz > AES_BLOCK_SIZE)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
#ifdef WOLFSSL_AESNI
|
#ifdef WOLFSSL_AESNI
|
||||||
if (haveAESNI) {
|
if (haveAESNI) {
|
||||||
AES_GCM_encrypt((void*)in, out, (void*)authIn, (void*)iv, authTag,
|
AES_GCM_encrypt((void*)in, out, (void*)authIn, (void*)iv, authTag,
|
||||||
@@ -3935,6 +3939,10 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
|||||||
byte *ctr ;
|
byte *ctr ;
|
||||||
byte scratch[AES_BLOCK_SIZE];
|
byte scratch[AES_BLOCK_SIZE];
|
||||||
|
|
||||||
|
/* Sanity check for local ConstantCompare call */
|
||||||
|
if (authTagSz > AES_BLOCK_SIZE)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
#ifdef WOLFSSL_AESNI
|
#ifdef WOLFSSL_AESNI
|
||||||
if (haveAESNI) {
|
if (haveAESNI) {
|
||||||
if (AES_GCM_decrypt(in, out, authIn, iv, authTag,
|
if (AES_GCM_decrypt(in, out, authIn, iv, authTag,
|
||||||
|
Reference in New Issue
Block a user