diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 04554e1f4..8b0543841 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -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) diff --git a/wolfcrypt/src/port/silabs/silabs_aes.c b/wolfcrypt/src/port/silabs/silabs_aes.c index 9a871acff..958005d49 100644 --- a/wolfcrypt/src/port/silabs/silabs_aes.c +++ b/wolfcrypt/src/port/silabs/silabs_aes.c @@ -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) {