From 97a2a0f1672ca3a237f4afee794da76626ddb6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Tue, 12 Feb 2002 14:52:00 +0100 Subject: * aes-internal.h (AES_SMALL): New macro. Rev: src/nettle/aes-internal.h:1.3 Rev: src/nettle/aes-tables.c:1.3 --- aes-internal.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'aes-internal.h') diff --git a/aes-internal.h b/aes-internal.h index 081f8864..79d34e44 100644 --- a/aes-internal.h +++ b/aes-internal.h @@ -28,6 +28,11 @@ #include "aes.h" +/* Define to use only small tables. */ +#ifndef AES_SMALL +# define AES_SMALL 1 +#endif + /* Macros */ #define ROTBYTE(x) (((x) >> 8) | (((x) & 0xff) << 24)) #define ROTRBYTE(x) (((x) << 8) | (((x) >> 24) & 0xff)) @@ -37,13 +42,20 @@ ((box)[(((x) >> 24) & 0xff)] << 24)) /* Don't pollute global namespace too much */ -#define dtbl _aes_dtbl +#if AES_SMALL +# define dtbl _aes_dtbl_small +# define _AES_TABLE_SIZE 1 +#else +# define dtbl _aes_dtbl +# define _AES_TABLE_SIZE 4 +#endif + #define itbl _aes_itbl #define sbox _aes_sbox #define isbox _aes_isbox /* Internal tables */ -extern const uint32_t dtbl[4][0x100]; +extern const uint32_t dtbl[_AES_TABLE_SIZE][0x100]; extern const uint32_t itbl[]; extern const uint8_t sbox[0x100]; extern const uint8_t isbox[0x100]; -- cgit v1.2.1