mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-26 14:22:21 +01:00
Fixed issue with AES ECB offloading to hardware to use full size, not
just block
This commit is contained in:
@@ -13036,6 +13036,9 @@ int wc_AesGetKeySize(Aes* aes, word32* keySize)
|
||||
#elif defined(WOLFSSL_RISCV_ASM)
|
||||
/* implemented in wolfcrypt/src/port/riscv/riscv-64-aes.c */
|
||||
|
||||
#elif defined(WOLFSSL_SILABS_SE_ACCEL)
|
||||
/* implemented in wolfcrypt/src/port/silabs/silabs_aes.c */
|
||||
|
||||
#elif defined(MAX3266X_AES)
|
||||
|
||||
int wc_AesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
|
||||
@@ -89,6 +89,48 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_AES_ECB
|
||||
int wc_AesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
sl_status_t status;
|
||||
if ((in == NULL) || (out == NULL) || (aes == NULL)) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
if ((sz % WC_AES_BLOCK_SIZE) != 0) {
|
||||
return BAD_LENGTH_E;
|
||||
}
|
||||
|
||||
status = sl_se_aes_crypt_ecb(
|
||||
&(aes->ctx.cmd_ctx),
|
||||
&(aes->ctx.key),
|
||||
SL_SE_ENCRYPT,
|
||||
sz,
|
||||
in,
|
||||
out);
|
||||
return (status != SL_STATUS_OK) ? WC_HW_E : 0;
|
||||
}
|
||||
|
||||
int wc_AesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
sl_status_t status;
|
||||
if ((in == NULL) || (out == NULL) || (aes == NULL)) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
if ((sz % WC_AES_BLOCK_SIZE) != 0) {
|
||||
return BAD_LENGTH_E;
|
||||
}
|
||||
|
||||
status = sl_se_aes_crypt_ecb(
|
||||
&(aes->ctx.cmd_ctx),
|
||||
&(aes->ctx.key),
|
||||
SL_SE_DECRYPT,
|
||||
sz,
|
||||
in,
|
||||
out);
|
||||
return (status != SL_STATUS_OK) ? WC_HW_E : 0;
|
||||
}
|
||||
#endif /* HAVE_AES_ECB */
|
||||
|
||||
#ifdef WOLFSSL_AES_DIRECT
|
||||
int wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user