From a6ac0f1330f427362a349af4fb2560636b6fe023 Mon Sep 17 00:00:00 2001 From: Matthias Schulz Date: Fri, 9 Feb 2024 17:09:42 +0100 Subject: [PATCH] Replaced MBEDTLS_GCM_LARGETABLE by MBEDTLS_GCM_LARGE_TABLE. Removed empty comment line in doc block. Signed-off-by: Matthias Schulz --- include/mbedtls/gcm.h | 2 +- include/mbedtls/mbedtls_config.h | 5 ++--- library/gcm.c | 8 ++++---- tests/scripts/all.sh | 6 +++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/mbedtls/gcm.h b/include/mbedtls/gcm.h index 745cd28aa..98faa4361 100644 --- a/include/mbedtls/gcm.h +++ b/include/mbedtls/gcm.h @@ -46,7 +46,7 @@ extern "C" { #if !defined(MBEDTLS_GCM_ALT) -#if defined(MBEDTLS_GCM_LARGETABLE) +#if defined(MBEDTLS_GCM_LARGE_TABLE) #define MBEDTLS_GCM_HTABLE_SIZE 256 #else #define MBEDTLS_GCM_HTABLE_SIZE 16 diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h index bf11377d3..ada62048b 100644 --- a/include/mbedtls/mbedtls_config.h +++ b/include/mbedtls/mbedtls_config.h @@ -2801,7 +2801,7 @@ #define MBEDTLS_GCM_C /** - * \def MBEDTLS_GCM_LARGETABLE + * \def MBEDTLS_GCM_LARGE_TABLE * * Enable large pre-computed tables for Galois/Counter Mode (GCM). * Can significantly increase throughput on systems without GCM hardware @@ -2813,9 +2813,8 @@ * Module: library/gcm.c * * Requires: MBEDTLS_GCM_C - * */ -//#define MBEDTLS_GCM_LARGETABLE +//#define MBEDTLS_GCM_LARGE_TABLE /** * \def MBEDTLS_HKDF_C diff --git a/library/gcm.c b/library/gcm.c index d7acacedb..90c1d1d4e 100644 --- a/library/gcm.c +++ b/library/gcm.c @@ -57,7 +57,7 @@ void mbedtls_gcm_init(mbedtls_gcm_context *ctx) static inline void gcm_set_acceleration(mbedtls_gcm_context *ctx) { -#if defined(MBEDTLS_GCM_LARGETABLE) +#if defined(MBEDTLS_GCM_LARGE_TABLE) ctx->acceleration = MBEDTLS_GCM_ACC_LARGETABLE; #else ctx->acceleration = MBEDTLS_GCM_ACC_SMALLTABLE; @@ -138,7 +138,7 @@ static int gcm_gen_table(mbedtls_gcm_context *ctx) gcm_gen_table_rightshift(ctx->H[i], ctx->H[i*2]); } -#if !defined(MBEDTLS_GCM_LARGETABLE) +#if !defined(MBEDTLS_GCM_LARGE_TABLE) /* pack elements of H as 64-bits ints, big-endian */ for (i = MBEDTLS_GCM_HTABLE_SIZE/2; i > 0; i >>= 1) { MBEDTLS_PUT_UINT64_BE(ctx->H[i][0], &ctx->H[i][0], 0); @@ -212,7 +212,7 @@ int mbedtls_gcm_setkey(mbedtls_gcm_context *ctx, return 0; } -#if defined(MBEDTLS_GCM_LARGETABLE) +#if defined(MBEDTLS_GCM_LARGE_TABLE) static const uint16_t last8[256] = { 0x0000, 0xc201, 0x8403, 0x4602, 0x0807, 0xca06, 0x8c04, 0x4e05, 0x100e, 0xd20f, 0x940d, 0x560c, 0x1809, 0xda08, 0x9c0a, 0x5e0b, @@ -360,7 +360,7 @@ static void gcm_mult(mbedtls_gcm_context *ctx, const unsigned char x[16], break; #endif -#if defined(MBEDTLS_GCM_LARGETABLE) +#if defined(MBEDTLS_GCM_LARGE_TABLE) case MBEDTLS_GCM_ACC_LARGETABLE: gcm_mult_largetable(output, x, ctx->H); break; diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 5a61c3cec..736d9448a 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -4942,15 +4942,15 @@ component_test_aes_only_128_bit_keys_have_builtins () { } component_test_gcm_largetable () { - msg "build: default config + GCM_LARGETABLE - AESNI_C - AESCE_C" - scripts/config.py set MBEDTLS_GCM_LARGETABLE + msg "build: default config + GCM_LARGE_TABLE - AESNI_C - AESCE_C" + scripts/config.py set MBEDTLS_GCM_LARGE_TABLE scripts/config.py unset MBEDTLS_PADLOCK_C scripts/config.py unset MBEDTLS_AESNI_C scripts/config.py unset MBEDTLS_AESCE_C make CFLAGS='-O2 -Werror -Wall -Wextra' - msg "test: default config - GCM_LARGETABLE - AESNI_C - AESCE_C" + msg "test: default config - GCM_LARGE_TABLE - AESNI_C - AESCE_C" make test }