summaryrefslogtreecommitdiff
path: root/aes-internal.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2002-02-12 14:52:00 +0100
committerNiels Möller <nisse@lysator.liu.se>2002-02-12 14:52:00 +0100
commit97a2a0f1672ca3a237f4afee794da76626ddb6a5 (patch)
treec9b806aea850a62ad56197c1cd8f9f9785dd39d2 /aes-internal.h
parenta3a636872726e033d9d29dfd250c2f1d5025ac5a (diff)
downloadnettle-97a2a0f1672ca3a237f4afee794da76626ddb6a5.tar.gz
* aes-internal.h (AES_SMALL): New macro.
Rev: src/nettle/aes-internal.h:1.3 Rev: src/nettle/aes-tables.c:1.3
Diffstat (limited to 'aes-internal.h')
-rw-r--r--aes-internal.h16
1 files changed, 14 insertions, 2 deletions
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];