Skip to content

Commit

Permalink
Auto-enable CTR_DRBG_USE_128_BIT_KEY with AES_ONLY_128_BIT_KEY_LENGTH
Browse files Browse the repository at this point in the history
This commit adds support to auto-enable
MBEDTLS_CTR_DRBG_USE_128_BIT_KEY if
MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH enabled.
Furthermore, the corresponding check is removed in check_config.h.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
  • Loading branch information
Yanray Wang committed May 5, 2023
1 parent 8b9877b commit 1ed226f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions include/mbedtls/build_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
#include MBEDTLS_USER_CONFIG_FILE
#endif

/* Auto-enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY if
* MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH and MBEDTLS_CTR_DRBG_C defined
* to ensure a 128-bit key size in CTR_DRBG.
*/
#if defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) && defined(MBEDTLS_CTR_DRBG_C)
#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
#endif

/* Auto-enable MBEDTLS_MD_C if needed by a module that didn't require it
* in a previous release, to ensure backwards compatibility.
*/
Expand Down
5 changes: 0 additions & 5 deletions include/mbedtls/check_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@
#error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
#endif

#if defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) && \
!defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY)
#error "MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH defined, but not all prerequisites"
#endif

#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
#endif
Expand Down
2 changes: 0 additions & 2 deletions include/mbedtls/mbedtls_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,6 @@
*
* Tradeoff: Uncommenting this macro reduces the size of AES code by about 4%.
*
* If uncommented, uncomment also MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
*
* Module: library/aes.c
*
* Requires: MBEDTLS_AES_C
Expand Down
1 change: 0 additions & 1 deletion tests/scripts/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3451,7 +3451,6 @@ component_test_malloc_0_null () {
component_test_aes_only_128_bit_keys () {
msg "build: default config with AES_ONLY_128_BIT_KEY_LENGTH enabled"
scripts/config.py set MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
scripts/config.py set MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
scripts/config.py unset MBEDTLS_PADLOCK_C

make CC=gcc CFLAGS='-Werror -Wall -Wextra'
Expand Down

0 comments on commit 1ed226f

Please sign in to comment.