Fixed issue with AES ECB offloading to hardware to use full size, not

just block
This commit is contained in:
David Garske
2025-10-29 15:52:33 -07:00
parent d45678472d
commit c5ae76e40d
2 changed files with 45 additions and 0 deletions

View File

@@ -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)

View File

@@ -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)
{