add aes counter on esp32
This commit is contained in:
parent
9a1687d00e
commit
302e1d6818
@ -43,6 +43,10 @@
|
||||
#define CURVE25519_SMALL
|
||||
#define HAVE_ED25519
|
||||
|
||||
/* when you want to use aes counter mode */
|
||||
/* #define WOLFSSL_AES_DIRECT */
|
||||
/* #define WOLFSSL_AES_COUNTER */
|
||||
|
||||
/* esp32-wroom-32se specific definition */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE)
|
||||
#define WOLFSSL_ATECC508A
|
||||
|
@ -2416,7 +2416,9 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
||||
aes->rounds = keylen/4 + 6;
|
||||
|
||||
XMEMCPY(aes->key, userKey, keylen);
|
||||
|
||||
#if defined(WOLFSSL_AES_COUNTER)
|
||||
aes->left = 0;
|
||||
#endif
|
||||
return wc_AesSetIV(aes, iv);
|
||||
}
|
||||
|
||||
@ -2905,6 +2907,21 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
}
|
||||
#endif /* HAVE_AES_DECRYPT */
|
||||
|
||||
#elif defined(WOLFSSL_ESP32WROOM32_CRYPT) && \
|
||||
!defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_AES)
|
||||
|
||||
/* Allow direct access to one block encrypt */
|
||||
void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in)
|
||||
{
|
||||
wc_AesEncrypt(aes, in, out);
|
||||
}
|
||||
#ifdef HAVE_AES_DECRYPT
|
||||
/* Allow direct access to one block decrypt */
|
||||
void wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in)
|
||||
{
|
||||
wc_AesDecrypt(aes, in, out);
|
||||
}
|
||||
#endif /* HAVE_AES_DECRYPT */
|
||||
#else
|
||||
/* Allow direct access to one block encrypt */
|
||||
void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in)
|
||||
@ -3875,6 +3892,12 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
|
||||
#elif defined(WOLFSSL_DEVCRYPTO_AES)
|
||||
/* implemented in wolfcrypt/src/port/devcrypt/devcrypto_aes.c */
|
||||
|
||||
#elif defined(WOLFSSL_ESP32WROOM32_CRYPT) && \
|
||||
!defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_AES)
|
||||
/* esp32 doesn't support CRT mode by hw. */
|
||||
/* use aes ecnryption plus sw implementation */
|
||||
#define NEED_AES_CTR_SOFT
|
||||
|
||||
#else
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user