Skip to content

Commit 92aef0a

Browse files
committed
Include the tables into the amalgamation
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent 22e71d7 commit 92aef0a

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,21 @@ coverage: $(call print-help,coverage,Create code-coverage of the library - but b
144144
# cleans everything - coverage output and standard 'clean'
145145
cleancov: cleancov-clean clean
146146
ifndef AMALGAM
147-
AMALGAM_FILTER_OUT = src/ciphers/aes/aes_tab.c src/ciphers/aes/aes_enc.c src/ciphers/aes/aes_enc_desc.c
147+
AMALGAM_FILTER_OUT = src/ciphers/aes/aes_enc.c src/ciphers/aes/aes_enc_desc.c
148+
TAB_SOURCES = src/ciphers/aes/aes_tab.c src/ciphers/safer/safer_tab.c src/hashes/whirl/whirltab.c src/stream/sober128/sober128tab.c
148149
SOURCES = $(filter-out $(AMALGAM_FILTER_OUT),$(OBJECTS:.o=.c))
149-
pre_gen/tomcrypt_amalgam.c: $(SOURCES)
150+
pre_gen/tomcrypt_amalgam.c: $(TAB_SOURCES) $(SOURCES)
150151
mkdir -p pre_gen
151152
printf "/*\n * This file has been auto-generated, do not edit!\n */\n\n" > $@
152-
cat $(SOURCES) >> $@
153+
printf "#define LTC_AES_TAB_C\n" >> $@
154+
printf "#define LTC_SAFER_TAB_C\n" >> $@
155+
printf "#define LTC_SOBER128TAB_C\n" >> $@
156+
printf "#define LTC_WHIRLTAB_C\n\n" >> $@
157+
printf "#include \"tomcrypt_private.h\"\n\n" >> $@
158+
cat $^ >> $@
153159

154160
pre_gen: pre_gen/tomcrypt_amalgam.c
155161

156-
.PHONY: pre_gen
162+
.PHONY: pre_gen/tomcrypt_amalgam.c
157163
endif
158164

src/ciphers/aes/aes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ const struct ltc_cipher_descriptor rijndael_enc_desc =
6262

6363
#endif
6464

65+
#ifndef LTC_AES_TAB_C
6566
#define LTC_AES_TAB_C
6667
#include "aes_tab.c"
68+
#endif
6769

6870
static ulong32 setup_mix(ulong32 temp)
6971
{

src/hashes/whirl/whirl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ const struct ltc_hash_descriptor whirlpool_desc =
2929
};
3030

3131
/* the sboxes */
32+
#ifndef LTC_WHIRLTAB_C
3233
#define LTC_WHIRLTAB_C
3334
#include "whirltab.c"
35+
#endif
3436

3537
/* get a_{i,j} */
3638
#define GB(a,i,j) ((a[(i) & 7] >> (8 * (j))) & 255)

src/stream/sober128/sober128_stream.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
#ifdef LTC_SOBER128
1212

13+
#ifndef LTC_SOBER128TAB_C
1314
#define LTC_SOBER128TAB_C
1415
#include "sober128tab.c"
16+
#endif
1517

1618
/* don't change these... */
1719
#define N 17

0 commit comments

Comments
 (0)