update sanity checks with ARMv8 port

This commit is contained in:
Jacob Barthelmeh
2017-07-26 11:05:20 -06:00
parent 4fead493e7
commit 637ca44e6a

View File

@ -677,7 +677,8 @@ void wc_AesFree(Aes* aes)
{
word32 numBlocks = sz / AES_BLOCK_SIZE;
if (aes == NULL || out == NULL || (in == NULL && sz > 0)) {
if (aes == NULL || out == NULL || (in == NULL && sz > 0)
|| sz % AES_BLOCK_SIZE != 0) {
return BAD_FUNC_ARG;
}
@ -2545,8 +2546,8 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
return BAD_FUNC_ARG;
}
if (authTagSz < WOLFSSL_MIN_AUTH_TAG_SZ) {
WOLFSSL_MSG("GcmEncrypt authTagSz too small error");
if (authTagSz < WOLFSSL_MIN_AUTH_TAG_SZ || authTagSz > AES_BLOCK_SIZE) {
WOLFSSL_MSG("GcmEncrypt authTagSz error");
return BAD_FUNC_ARG;
}
@ -3269,7 +3270,8 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
{
word32 numBlocks = sz / AES_BLOCK_SIZE;
if (aes == NULL || out == NULL || (in == NULL && sz > 0)) {
if (aes == NULL || out == NULL || (in == NULL && sz > 0)
|| sz % AES_BLOCK_SIZE != 0) {
return BAD_FUNC_ARG;
}
@ -4193,6 +4195,11 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
return BAD_FUNC_ARG;
}
if (authTagSz < WOLFSSL_MIN_AUTH_TAG_SZ || authTagSz > AES_BLOCK_SIZE) {
WOLFSSL_MSG("GcmEncrypt authTagSz error");
return BAD_FUNC_ARG;
}
XMEMSET(initialCounter, 0, AES_BLOCK_SIZE);
if (ivSz == NONCE_SZ) {
XMEMCPY(initialCounter, iv, ivSz);