From 66a8903f4a84772ec3aae8d19f92226e144803b3 Mon Sep 17 00:00:00 2001 From: Simon Butcher Date: Fri, 15 Jun 2018 18:20:29 +0100 Subject: [PATCH] Fix for missing len var when XTS config'd and CTR not The AES XTS self-test was using a variable len, which was declared only when CTR was enabled. Changed the declaration of len to be conditional on CTR and XTS. --- library/aes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/aes.c b/library/aes.c index 5cd96ecf5..23efdb839 100644 --- a/library/aes.c +++ b/library/aes.c @@ -1713,8 +1713,10 @@ int mbedtls_aes_self_test( int verbose ) #if defined(MBEDTLS_CIPHER_MODE_CTR) || defined(MBEDTLS_CIPHER_MODE_CFB) size_t offset; #endif -#if defined(MBEDTLS_CIPHER_MODE_CTR) +#if defined(MBEDTLS_CIPHER_MODE_CTR) || defined(MBEDTLS_CIPHER_MODE_XTS) int len; +#endif +#if defined(MBEDTLS_CIPHER_MODE_CTR) unsigned char nonce_counter[16]; unsigned char stream_block[16]; #endif