ソースを参照

Include the tables into the amalgamation

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 7 ヶ月 前
コミット
92aef0ade1
4 ファイル変更16 行追加4 行削除
  1. 10 4
      makefile
  2. 2 0
      src/ciphers/aes/aes.c
  3. 2 0
      src/hashes/whirl/whirl.c
  4. 2 0
      src/stream/sober128/sober128_stream.c

+ 10 - 4
makefile

@@ -144,15 +144,21 @@ coverage: $(call print-help,coverage,Create code-coverage of the library - but b
 # cleans everything - coverage output and standard 'clean'
 cleancov: cleancov-clean clean
 ifndef AMALGAM
-AMALGAM_FILTER_OUT = src/ciphers/aes/aes_tab.c src/ciphers/aes/aes_enc.c src/ciphers/aes/aes_enc_desc.c
+AMALGAM_FILTER_OUT = src/ciphers/aes/aes_enc.c src/ciphers/aes/aes_enc_desc.c
+TAB_SOURCES = src/ciphers/aes/aes_tab.c src/ciphers/safer/safer_tab.c src/hashes/whirl/whirltab.c src/stream/sober128/sober128tab.c
 SOURCES = $(filter-out $(AMALGAM_FILTER_OUT),$(OBJECTS:.o=.c))
-pre_gen/tomcrypt_amalgam.c: $(SOURCES)
+pre_gen/tomcrypt_amalgam.c: $(TAB_SOURCES) $(SOURCES)
 	mkdir -p pre_gen
 	printf "/*\n * This file has been auto-generated, do not edit!\n */\n\n" > $@
-	cat $(SOURCES) >> $@
+	printf "#define LTC_AES_TAB_C\n" >> $@
+	printf "#define LTC_SAFER_TAB_C\n" >> $@
+	printf "#define LTC_SOBER128TAB_C\n" >> $@
+	printf "#define LTC_WHIRLTAB_C\n\n" >> $@
+	printf "#include \"tomcrypt_private.h\"\n\n" >> $@
+	cat $^ >> $@
 
 pre_gen: pre_gen/tomcrypt_amalgam.c
 
-.PHONY: pre_gen
+.PHONY: pre_gen/tomcrypt_amalgam.c
 endif
 

+ 2 - 0
src/ciphers/aes/aes.c

@@ -62,8 +62,10 @@ const struct ltc_cipher_descriptor rijndael_enc_desc =
 
 #endif
 
+#ifndef LTC_AES_TAB_C
 #define LTC_AES_TAB_C
 #include "aes_tab.c"
+#endif
 
 static ulong32 setup_mix(ulong32 temp)
 {

+ 2 - 0
src/hashes/whirl/whirl.c

@@ -29,8 +29,10 @@ const struct ltc_hash_descriptor whirlpool_desc =
 };
 
 /* the sboxes */
+#ifndef LTC_WHIRLTAB_C
 #define LTC_WHIRLTAB_C
 #include "whirltab.c"
+#endif
 
 /* get a_{i,j} */
 #define GB(a,i,j) ((a[(i) & 7] >> (8 * (j))) & 255)

+ 2 - 0
src/stream/sober128/sober128_stream.c

@@ -10,8 +10,10 @@
 
 #ifdef LTC_SOBER128
 
+#ifndef LTC_SOBER128TAB_C
 #define LTC_SOBER128TAB_C
 #include "sober128tab.c"
+#endif
 
 /* don't change these... */
 #define N                        17