AES: masked config: increase total transfer speed by 5% by removing zeroing

On MBEDTLS_AES_128_BIT_MASKED config the overall DTLS transfer speed can be
increased by 3..5% or so on a Cortex-M4 by removing 472 bytes worth of
buffer zeroing done on each block {en|de}cryption. The buffer zeroings
were done before overwriting them on in masking code.

Signed-off-by: Tero Jääskö <tero.jaasko@arm.com>
This commit is contained in:
Tero Jääskö 2021-01-15 17:02:37 +02:00
parent a4ffa3c474
commit 0241f81cbc

View File

@ -1421,9 +1421,9 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
uint8_t round_ctrl_table[( 14 + AES_SCA_CM_ROUNDS + 2 )]; uint8_t round_ctrl_table[( 14 + AES_SCA_CM_ROUNDS + 2 )];
#if defined MBEDTLS_AES_128_BIT_MASKED #if defined MBEDTLS_AES_128_BIT_MASKED
uint32_t rk_masked[MBEDTLS_AES_128_EXPANDED_KEY_SIZE_IN_WORDS] = {0}; uint32_t rk_masked[MBEDTLS_AES_128_EXPANDED_KEY_SIZE_IN_WORDS];
uint8_t sbox_masked[256] = {0}; uint8_t sbox_masked[256];
uint32_t mask[10] = {0}; uint32_t mask[10];
#endif #endif
#if defined(MBEDTLS_VALIDATE_AES_KEYS_INTEGRITY) #if defined(MBEDTLS_VALIDATE_AES_KEYS_INTEGRITY)