From a06b34cffa1bfbb18da68ea7b48a6cbad53145bf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niels=20M=C3=B6ller?= Date: Mon, 24 Mar 2025 21:27:09 +0100 Subject: [PATCH] Halve allocation size for precomputed values in gcm_key. --- ChangeLog | 6 ++++++ gcm.h | 3 +-- ghash-set-key.c | 4 ---- ghash-update.c | 4 ---- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17cb1bc3..58aa4081 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-03-24 Niels Möller + + * gcm.h (GCM_TABLE_BITS): Delete constant. + (struct gcm_key): Halve the allocation size for precomputed + values, to 2048 bytes, or 128 16-byte blocks. + 2025-03-18 Niels Möller Delete the output size argument from almost all digest functions. diff --git a/gcm.h b/gcm.h index ca3f9c40..f442ed8f 100644 --- a/gcm.h +++ b/gcm.h @@ -106,12 +106,11 @@ extern "C" { #define GCM_BLOCK_SIZE 16 #define GCM_IV_SIZE (GCM_BLOCK_SIZE - 4) #define GCM_DIGEST_SIZE 16 -#define GCM_TABLE_BITS 8 /* Hashing subkey */ struct gcm_key { - union nettle_block16 h[1 << GCM_TABLE_BITS]; + union nettle_block16 h[0x80]; }; /* Per-message state, depending on the iv */ diff --git a/ghash-set-key.c b/ghash-set-key.c index da1c90f0..180bb9d6 100644 --- a/ghash-set-key.c +++ b/ghash-set-key.c @@ -51,10 +51,6 @@ _nettle_ghash_set_key_c (struct gcm_key *ctx, const union nettle_block16 *key); #define _nettle_ghash_set_key _nettle_ghash_set_key_c #endif -#if GCM_TABLE_BITS < 7 -# error Unsupported table size. -#endif - /* Implements a lookup table for processors without carryless-mul instruction. */ void diff --git a/ghash-update.c b/ghash-update.c index bdeaa38d..dc25a32b 100644 --- a/ghash-update.c +++ b/ghash-update.c @@ -44,10 +44,6 @@ #include "ghash-internal.h" #include "block-internal.h" -#if GCM_TABLE_BITS < 7 -# error Unsupported table size. -#endif - /* For fat builds */ #if HAVE_NATIVE_ghash_update const uint8_t * -- 2.47.3