forked from wolfSSL/wolfssl
NXP-DCP: Fixed AES-GCM setkey; added AES direct.
This commit is contained in:
committed by
David Garske
parent
05098f7ab8
commit
9244bbbf83
@@ -1743,6 +1743,13 @@ static void wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(WOLFSSL_IMXRT_DCP)
|
||||||
|
if (aes->keylen == 16) {
|
||||||
|
DCPAesEcbEncrypt(aes, outBlock, inBlock, AES_BLOCK_SIZE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* map byte array block to cipher state
|
* map byte array block to cipher state
|
||||||
* and add initial round key:
|
* and add initial round key:
|
||||||
@@ -2027,6 +2034,12 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
|||||||
#if defined(WOLFSSL_SCE) && !defined(WOLFSSL_SCE_NO_AES)
|
#if defined(WOLFSSL_SCE) && !defined(WOLFSSL_SCE_NO_AES)
|
||||||
return AES_ECB_decrypt(aes, inBlock, outBlock, AES_BLOCK_SIZE);
|
return AES_ECB_decrypt(aes, inBlock, outBlock, AES_BLOCK_SIZE);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(WOLFSSL_IMXRT_DCP)
|
||||||
|
if (aes->keylen == 16) {
|
||||||
|
DCPAesEcbDecrypt(aes, outBlock, inBlock, AES_BLOCK_SIZE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* map byte array block to cipher state
|
* map byte array block to cipher state
|
||||||
@@ -2585,7 +2598,6 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
|||||||
#elif defined(WOLFSSL_DEVCRYPTO_AES)
|
#elif defined(WOLFSSL_DEVCRYPTO_AES)
|
||||||
/* implemented in wolfcrypt/src/port/devcrypto/devcrypto_aes.c */
|
/* implemented in wolfcrypt/src/port/devcrypto/devcrypto_aes.c */
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Software AES - SetKey */
|
/* Software AES - SetKey */
|
||||||
@@ -4184,6 +4196,14 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len)
|
|||||||
ForceZero(local, sizeof(local));
|
ForceZero(local, sizeof(local));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_IMXRT_DCP
|
||||||
|
ret = 0;
|
||||||
|
if (len == 16)
|
||||||
|
ret = DCPAesSetKey(aes, key, len, iv, AES_ENCRYPTION);
|
||||||
|
if (ret != 0)
|
||||||
|
return WC_HW_E;
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user