From: bg Date: Sun, 1 Mar 2009 19:29:27 +0000 (+0000) Subject: modifying some nessie test suits (mac & hash) to use less RAM X-Git-Url: https://git.cryptolib.org/?a=commitdiff_plain;h=65b5512d92a8b13973ae65201b18922b856328e5;p=avr-crypto-lib.git modifying some nessie test suits (mac & hash) to use less RAM --- diff --git a/config.h b/config.h index 00d10ef..60aaf4c 100644 --- a/config.h +++ b/config.h @@ -19,8 +19,8 @@ #ifndef __CONFIG_H__ #define __CONFIG_H__ #include -#define F_CPU 20000000 -// #define F_CPU 16000000 /* Oszillator-Frequenz in Hz */ +// #define F_CPU 20000000 + #define F_CPU 16000000 /* Oszillator-Frequenz in Hz */ // #define F_CPU 14745600 diff --git a/mkfiles/a5_1.mk b/mkfiles/a5_1.mk index 1264b31..078d982 100644 --- a/mkfiles/a5_1.mk +++ b/mkfiles/a5_1.mk @@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := A5_1.o $(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_stream_test.o nessie_common.o cli.o string-extras.o + nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/aes.mk b/mkfiles/aes.mk index 950f740..71ab1d7 100644 --- a/mkfiles/aes.mk +++ b/mkfiles/aes.mk @@ -8,7 +8,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm.o aes_sbox-asm.o aes_invsbox-asm.o \ aes_keyschedule-asm.o $(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/aes_asm_faster.mk b/mkfiles/aes_asm_faster.mk index 75ae39e..71f1de7 100644 --- a/mkfiles/aes_asm_faster.mk +++ b/mkfiles/aes_asm_faster.mk @@ -8,7 +8,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm_faster.o aes_sbox-asm.o aes_invsbox-asm.o \ aes_keyschedule-asm.o $(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/aes_c.mk b/mkfiles/aes_c.mk index 81da3cb..8bec133 100644 --- a/mkfiles/aes_c.mk +++ b/mkfiles/aes_c.mk @@ -10,7 +10,7 @@ $(ALGO_NAME)_OBJ := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \ aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \ aes256_enc.o aes256_dec.o $(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/arcfour.mk b/mkfiles/arcfour.mk index 7c37869..6a6e24b 100644 --- a/mkfiles/arcfour.mk +++ b/mkfiles/arcfour.mk @@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := arcfour-asm.o $(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_stream_test.o nessie_common.o cli.o string-extras.o \ + nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/arcfour_c.mk b/mkfiles/arcfour_c.mk index 33ce65f..d677061 100644 --- a/mkfiles/arcfour_c.mk +++ b/mkfiles/arcfour_c.mk @@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := arcfour.o $(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_stream_test.o nessie_common.o cli.o string-extras.o \ + nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/camellia.mk b/mkfiles/camellia.mk index 4b7974b..9b27fe6 100644 --- a/mkfiles/camellia.mk +++ b/mkfiles/camellia.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := camellia128-stub.o camellia-asm.o $(ALGO_NAME)_TEST_BIN := main-camellia-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ nessie_bc_test.o \ - nessie_common.o cli.o string-extras.o performance_test.o + dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/cast5.mk b/mkfiles/cast5.mk index 18dd483..e2472a9 100644 --- a/mkfiles/cast5.mk +++ b/mkfiles/cast5.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := cast5.o $(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o cli.o string-extras.o\ - nessie_bc_test.o nessie_common.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/des.mk b/mkfiles/des.mk index 7a12873..f786210 100644 --- a/mkfiles/des.mk +++ b/mkfiles/des.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := des.o $(ALGO_NAME)_TEST_BIN := main-des-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/grain.mk b/mkfiles/grain.mk index 406bc4d..a8373c2 100644 --- a/mkfiles/grain.mk +++ b/mkfiles/grain.mk @@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := grain.o $(ALGO_NAME)_TEST_BIN := main-grain-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_stream_test.o nessie_common.o cli.o string-extras.o \ + nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/hmac-md5.mk b/mkfiles/hmac-md5.mk index 40e7e44..a79e9bb 100644 --- a/mkfiles/hmac-md5.mk +++ b/mkfiles/hmac-md5.mk @@ -6,7 +6,7 @@ MACS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := hmac-md5.o md5-asm.o $(ALGO_NAME)_TEST_BIN := main-hmac-md5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o cli.o string-extras.o \ - nessie_mac_test.o nessie_common.o base64_enc.o base64_dec.o + nessie_mac_test.o dbz_strings.o nessie_common.o base64_enc.o base64_dec.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/hmac-sha1.mk b/mkfiles/hmac-sha1.mk index d5d731c..7998afa 100644 --- a/mkfiles/hmac-sha1.mk +++ b/mkfiles/hmac-sha1.mk @@ -6,7 +6,7 @@ MACS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := hmac-sha1.o sha1-asm.o $(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o hexdigit_tab.o serial-tools.o cli.o string-extras.o \ - nessie_mac_test.o nessie_common.o + nessie_mac_test.o dbz_strings.o nessie_common.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/hmac-sha256.mk b/mkfiles/hmac-sha256.mk index adfe48c..8714440 100644 --- a/mkfiles/hmac-sha256.mk +++ b/mkfiles/hmac-sha256.mk @@ -6,7 +6,7 @@ MACS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := hmac-sha256.o sha256-asm.o $(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_mac_test.o nessie_common.o cli.o string-extras.o + nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/md5.mk b/mkfiles/md5.mk index 1d55c1e..1fee357 100644 --- a/mkfiles/md5.mk +++ b/mkfiles/md5.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := md5.o $(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/md5_asm.mk b/mkfiles/md5_asm.mk index 41dcac8..ed2905f 100644 --- a/mkfiles/md5_asm.mk +++ b/mkfiles/md5_asm.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := md5-asm.o $(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/mugi.mk b/mkfiles/mugi.mk index eb3f3d8..c5f64f3 100644 --- a/mkfiles/mugi.mk +++ b/mkfiles/mugi.mk @@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := mugi.o gf256mul.o aes_sbox.o $(ALGO_NAME)_TEST_BIN := main-mugi-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_stream_test.o nessie_common.o cli.o string-extras.o \ + nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/noekeon.mk b/mkfiles/noekeon.mk index b3fdccf..52cb730 100644 --- a/mkfiles/noekeon.mk +++ b/mkfiles/noekeon.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := noekeon_asm.o $(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/noekeon_c.mk b/mkfiles/noekeon_c.mk index ad0aa59..504a266 100644 --- a/mkfiles/noekeon_c.mk +++ b/mkfiles/noekeon_c.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := noekeon.o $(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/omac_noekeon.mk b/mkfiles/omac_noekeon.mk index d59b22f..365e056 100644 --- a/mkfiles/omac_noekeon.mk +++ b/mkfiles/omac_noekeon.mk @@ -7,7 +7,7 @@ MACS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon.o memxor.o $(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_mac_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/omac_noekeon_c.mk b/mkfiles/omac_noekeon_c.mk index efd6e6c..290fc7d 100644 --- a/mkfiles/omac_noekeon_c.mk +++ b/mkfiles/omac_noekeon_c.mk @@ -7,7 +7,7 @@ MACS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon_C.o memxor.o $(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_mac_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/present.mk b/mkfiles/present.mk index b60eb81..1dd39b0 100644 --- a/mkfiles/present.mk +++ b/mkfiles/present.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := present.o $(ALGO_NAME)_TEST_BIN := main-present-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/rc5.mk b/mkfiles/rc5.mk index 3852d7b..0b1befe 100644 --- a/mkfiles/rc5.mk +++ b/mkfiles/rc5.mk @@ -8,7 +8,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := rc5.o $(ALGO_NAME)_TEST_BIN := main-rc5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ nessie_bc_test.o \ - nessie_common.o cli.o string-extras.o performance_test.o + dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/rc6.mk b/mkfiles/rc6.mk index 1b357eb..a02f17c 100644 --- a/mkfiles/rc6.mk +++ b/mkfiles/rc6.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := rc6.o $(ALGO_NAME)_TEST_BIN := main-rc6-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := test nessie $(ALGO_NAME)_PERFORMANCE_TEST := performance diff --git a/mkfiles/seed.mk b/mkfiles/seed.mk index a79f78a..12d8d59 100644 --- a/mkfiles/seed.mk +++ b/mkfiles/seed.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := seed-asm.o $(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o \ + nessie_bc_test.o dbz_strings.o nessie_common.o \ cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/seed_C.mk b/mkfiles/seed_C.mk index 05fd25d..0cc6ea3 100644 --- a/mkfiles/seed_C.mk +++ b/mkfiles/seed_C.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := seed_C.o $(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o \ + nessie_bc_test.o dbz_strings.o nessie_common.o \ cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/serpent-bitslice.mk b/mkfiles/serpent-bitslice.mk index 4d68c22..dbea67e 100644 --- a/mkfiles/serpent-bitslice.mk +++ b/mkfiles/serpent-bitslice.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-bitslice-asm.o memxor.o $(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/serpent_asm_bitslice.mk b/mkfiles/serpent_asm_bitslice.mk index 80e69bf..e731cff 100644 --- a/mkfiles/serpent_asm_bitslice.mk +++ b/mkfiles/serpent_asm_bitslice.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := serpent-sboxes-bitslice-asm.o serpent-asm.o memxor.o $(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/serpent_asm_fast.mk b/mkfiles/serpent_asm_fast.mk index 195f83a..71f2a99 100644 --- a/mkfiles/serpent_asm_fast.mk +++ b/mkfiles/serpent_asm_fast.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-fast.o memxor.o $(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/serpent_asm_small.mk b/mkfiles/serpent_asm_small.mk index 46ad45e..7d5a1c3 100644 --- a/mkfiles/serpent_asm_small.mk +++ b/mkfiles/serpent_asm_small.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-small.o memxor.o $(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/serpent_c.mk b/mkfiles/serpent_c.mk index c6162a7..63b498d 100644 --- a/mkfiles/serpent_c.mk +++ b/mkfiles/serpent_c.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := serpent.o serpent-sboxes_c.o memxor.o $(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/sha1.mk b/mkfiles/sha1.mk index 335cafb..818a91b 100644 --- a/mkfiles/sha1.mk +++ b/mkfiles/sha1.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := sha1-asm.o $(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o \ + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o hfal-basic.o hfal_sha1.o shavs.o dump.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/sha1_c.mk b/mkfiles/sha1_c.mk index 8a141c4..6674a3e 100644 --- a/mkfiles/sha1_c.mk +++ b/mkfiles/sha1_c.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := sha1.o $(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o \ + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o hfal-basic.o hfal_sha1.o shavs.o dump.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/sha256.mk b/mkfiles/sha256.mk index 35c271a..fee84e0 100644 --- a/mkfiles/sha256.mk +++ b/mkfiles/sha256.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := sha256-asm.o $(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o \ + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \ hfal-basic.o hfal_sha256.o shavs.o dump.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/sha256_c.mk b/mkfiles/sha256_c.mk index 7ad81d0..6952ca7 100644 --- a/mkfiles/sha256_c.mk +++ b/mkfiles/sha256_c.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := sha256.o $(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o \ + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \ hfal-basic.o hfal_sha256.o shavs.o dump.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/shabea.mk b/mkfiles/shabea.mk index 29525e6..7747998 100644 --- a/mkfiles/shabea.mk +++ b/mkfiles/shabea.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := shabea.o sha256-asm.o memxor.o $(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/shacal1enc.mk b/mkfiles/shacal1enc.mk index 0bccab1..4a57970 100644 --- a/mkfiles/shacal1enc.mk +++ b/mkfiles/shacal1enc.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := shacal1_enc.o sha1-asm.o $(ALGO_NAME)_TEST_BIN := main-shacal1_enc-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/shacal2enc.mk b/mkfiles/shacal2enc.mk index 0265b10..99dae33 100644 --- a/mkfiles/shacal2enc.mk +++ b/mkfiles/shacal2enc.mk @@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := shacal2_enc.o sha256-asm.o $(ALGO_NAME)_TEST_BIN := main-shacal2_enc-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/skipjack.mk b/mkfiles/skipjack.mk index e546ea3..9f4eb35 100644 --- a/mkfiles/skipjack.mk +++ b/mkfiles/skipjack.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := skipjack.o $(ALGO_NAME)_TEST_BIN := main-skipjack-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o \ + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/tdes.mk b/mkfiles/tdes.mk index 4e03c9f..96ccaba 100644 --- a/mkfiles/tdes.mk +++ b/mkfiles/tdes.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := des.o $(ALGO_NAME)_TEST_BIN := main-tdes-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/trivium.mk b/mkfiles/trivium.mk index 4f4f0ef..7b8dd3f 100644 --- a/mkfiles/trivium.mk +++ b/mkfiles/trivium.mk @@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := trivium.o $(ALGO_NAME)_TEST_BIN := main-trivium-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_stream_test.o nessie_common.o cli.o string-extras.o \ + nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \ performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister224.mk b/mkfiles/twister224.mk index d57e00d..e33e28a 100644 --- a/mkfiles/twister224.mk +++ b/mkfiles/twister224.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister-small-asm.o twister-asm.o twister224.o $(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister224_c.mk b/mkfiles/twister224_c.mk index 6ea6ad6..be880e0 100644 --- a/mkfiles/twister224_c.mk +++ b/mkfiles/twister224_c.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister.o twister-small.o memxor.o gf256mul.o $(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister256.mk b/mkfiles/twister256.mk index 8bd3ff8..feb8ac5 100644 --- a/mkfiles/twister256.mk +++ b/mkfiles/twister256.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister-asm.o twister-small-asm.o twister256.o $(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister256_c.mk b/mkfiles/twister256_c.mk index 39d2829..8b1717e 100644 --- a/mkfiles/twister256_c.mk +++ b/mkfiles/twister256_c.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister.o twister-small.o memxor.o gf256mul.o $(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister384.mk b/mkfiles/twister384.mk index dcc4013..c4f2f95 100644 --- a/mkfiles/twister384.mk +++ b/mkfiles/twister384.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister-asm.o twister-big-asm.o twister384.o $(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister384_c.mk b/mkfiles/twister384_c.mk index 3358dec..56511de 100644 --- a/mkfiles/twister384_c.mk +++ b/mkfiles/twister384_c.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister.o twister-big.o memxor.o gf256mul.o $(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister512.mk b/mkfiles/twister512.mk index acd7bab..484cc56 100644 --- a/mkfiles/twister512.mk +++ b/mkfiles/twister512.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister-asm.o twister-big-asm.o twister512.o $(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/twister512_c.mk b/mkfiles/twister512_c.mk index 75b23e0..1dc2ec0 100644 --- a/mkfiles/twister512_c.mk +++ b/mkfiles/twister512_c.mk @@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME) $(ALGO_NAME)_OBJ := twister.o twister-big.o memxor.o gf256mul.o $(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/xtea.mk b/mkfiles/xtea.mk index 01dcedf..67abbe6 100644 --- a/mkfiles/xtea.mk +++ b/mkfiles/xtea.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := xtea-asm.o $(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/mkfiles/xtea_c.mk b/mkfiles/xtea_c.mk index b5b59b7..711db83 100644 --- a/mkfiles/xtea_c.mk +++ b/mkfiles/xtea_c.mk @@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME) $(ALGO_NAME)_OBJ := xtea.o $(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \ - nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o + nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o $(ALGO_NAME)_NESSIE_TEST := "nessie" $(ALGO_NAME)_PERFORMANCE_TEST := "performance" diff --git a/test_src/dbz_strings.c b/test_src/dbz_strings.c new file mode 100644 index 0000000..436bf8c --- /dev/null +++ b/test_src/dbz_strings.c @@ -0,0 +1,95 @@ +/* dbz_strings.c */ +/* + * This file is part of AnonAccess, an access system which can be used + * to open door or doing other things with an anonymity featured + * account managment. + * Copyright (C) 2006, 2007, 2008, 2009 Daniel Otte (daniel.otte@rub.de) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +/* + * author: Daniel Otte + * email: daniel.otte@rub.de + * license: GPLv3 + * + * */ + +#include +#include +#include + +/******************************************************************************/ + +uint8_t dbz_strcount(const char* str){ + uint8_t ret=1; + if(*str=='\0' && *(str+1)=='\0') + return 0; + for(;;){ + while(*str++) + ; + if(*str=='\0') + return ret; + ++ret; + } +} + +/******************************************************************************/ + +void dbz_splitup(char* dbzstr, char** strings){ + if(*dbzstr=='\0' && *(dbzstr+1)=='\0') + return; + *strings++ = dbzstr; + for(;;){ + while(*dbzstr++) + ; + if(*dbzstr=='\0') + return; + *strings++ = dbzstr; + } +} + +/******************************************************************************/ + +uint8_t dbz_strcount_P(PGM_P str){ + uint8_t ret=1; + if(pgm_read_byte(str)=='\0' && pgm_read_byte(str+1)=='\0') + return 0; + for(;;){ + while(pgm_read_byte(str++)) + ; + if(pgm_read_byte(str)=='\0') + return ret; + ++ret; + } +} + +/******************************************************************************/ + +void dbz_splitup_P(PGM_P dbzstr, PGM_P* strings){ + if(pgm_read_byte(dbzstr)=='\0' && pgm_read_byte(dbzstr+1)=='\0') + return; + *strings++ = dbzstr; + for(;;){ + while(pgm_read_byte(dbzstr++)) + ; + if(pgm_read_byte(dbzstr)=='\0') + return; + *strings++ = dbzstr; + } +} + +/******************************************************************************/ + diff --git a/test_src/dbz_strings.h b/test_src/dbz_strings.h new file mode 100644 index 0000000..7fc09e9 --- /dev/null +++ b/test_src/dbz_strings.h @@ -0,0 +1,75 @@ +/* dbz_strings.h */ +/* + * This file is part of AnonAccess, an access system which can be used + * to open door or doing other things with an anonymity featured + * account managment. + * Copyright (C) 2006, 2007, 2008, 2009 Daniel Otte (daniel.otte@rub.de) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef DBZ_STRINGS_H_ +#define DBZ_STRINGS_H_ + +/** \file dbz_strings.h + * \author Daniel Otte + * \email daniel.otte@rub.de + * \license GPLv3 or later + * \brief functions for handling of double-zero-terminated strings + * + */ + +#include +#include + +/** \fn uint8_t dbz_strcount(const char* str) + * \brief count stings in dbz-terminated string + * + * Count the single zero terminated string in a + * double terminated string + * \param str pointer to the double-zero-terminated string + */ +uint8_t dbz_strcount(const char* str); + +/** \fn void dbz_splitup(char* dbzstr, char** strings) + * \brief split up a dbz-terminated string + * + * Fills an array with pointers to the single terminated string + * in a double-zero-terminated string + * \param dbzstr pointer to the double-zero-terminated string + * \param strings pointer to the array of strings (char pointers) + */ +void dbz_splitup(char* dbzstr, char** strings); + +/** \fn uint8_t dbz_strcount_P(PGM_P str) + * \brief count stings in dbz-terminated string in flash + * + * Count the single zero terminated string in a + * double terminated string which is placed in flash (progmem) + * \param str pointer to the double-zero-terminated string in flash + */ +uint8_t dbz_strcount_P(PGM_P str); + +/** \fn void dbz_splitup_P(PGM_P dbzstr, PGM_P* strings) + * \brief split up a dbz-terminated string in flash + * + * Fills an array with pointers (PGM_P) to the single terminated string + * in a double-zero-terminated string which is placed in flash + * \param dbzstr pointer to the double-zero-terminated string in flash + * \param strings pointer to the array of strings (PGM_P) + */ +void dbz_splitup_P(PGM_P dbzstr, PGM_P* strings); + +#endif /*DBZ_STRINGS_H_*/ diff --git a/test_src/hexdigit_tab.c b/test_src/hexdigit_tab.c index 8e81d08..874109c 100644 --- a/test_src/hexdigit_tab.c +++ b/test_src/hexdigit_tab.c @@ -30,6 +30,19 @@ char hexdigit_tab_P[] PROGMEM = '8','9','A','B', 'C','D','E','F'}; +char hexdigit_tab_uc_P[] PROGMEM = + {'0','1','2','3', + '4','5','6','7', + '8','9','A','B', + 'C','D','E','F'}; + + +char hexdigit_tab_lc_P[] PROGMEM = + {'0','1','2','3', + '4','5','6','7', + '8','9','a','b', + 'c','d','e','f'}; + diff --git a/test_src/hexdigit_tab.h b/test_src/hexdigit_tab.h index 8b20da5..5aa2e99 100644 --- a/test_src/hexdigit_tab.h +++ b/test_src/hexdigit_tab.h @@ -24,5 +24,6 @@ #define HEXDIGIT_TAB_H_ extern char hexdigit_tab_P[]; - +extern char hexdigit_tab_uc_P[]; +extern char hexdigit_tab_lc_P[]; #endif /*HEXDIGIT_TAB_H_*/ diff --git a/test_src/nessie_common.c b/test_src/nessie_common.c index 6d66a1c..94e19f5 100644 --- a/test_src/nessie_common.c +++ b/test_src/nessie_common.c @@ -31,7 +31,7 @@ #include #include /* utoa() */ #include "nessie_common.h" - +#include "hexdigit_tab.h" #ifdef NESSIE_ALIVE void nessie_send_alive(void){ @@ -39,20 +39,16 @@ void nessie_send_alive(void){ } void nessie_send_alive_a(uint16_t i){ - if((i&63)==63) + if((i&31)==0) NESSIE_PUTC(NESSIE_ALIVE_CHAR); } #endif void nessie_print_block(uint8_t* block, uint16_t blocksize_bit){ - char tab [] = {'0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F'}; uint16_t i; for(i=0; i<(blocksize_bit+7)/8; ++i){ - NESSIE_PUTC(tab[(block[i])>>4]); - NESSIE_PUTC(tab[(block[i])&0xf]); + NESSIE_PUTC(pgm_read_byte(hexdigit_tab_uc_P+((block[i])>>4))); + NESSIE_PUTC(pgm_read_byte(hexdigit_tab_uc_P+((block[i])&0xf))); } } @@ -136,7 +132,7 @@ void nessie_print_header(char* name, uint16_t i; NESSIE_PUTSTR_P(PSTR("\r\n\r\n" "********************************************************************************\r\n" - "* micro-crypt - crypto primitives for microcontrolles by Daniel Otte *\r\n" + "* AVR-Crypto-Lib - crypto primitives for AVR microcontrolles by Daniel Otte *\r\n" "********************************************************************************\r\n" "\r\n")); NESSIE_PUTSTR_P(PSTR("Primitive Name: ")); diff --git a/test_src/nessie_hash_test.c b/test_src/nessie_hash_test.c index 63e4b53..ef5d968 100644 --- a/test_src/nessie_hash_test.c +++ b/test_src/nessie_hash_test.c @@ -29,26 +29,32 @@ #include #include "nessie_hash_test.h" #include "nessie_common.h" -#include "uart.h" +#include "dbz_strings.h" nessie_hash_ctx_t nessie_hash_ctx; +#define HASHSIZE_B ((nessie_hash_ctx.hashsize_b+7)/8) +#define BLOCKSIZE_B (nessie_hash_ctx.blocksize_B) + static -void ascii_hash(char* data, char* desc){ +void ascii_hash_P(PGM_P data, PGM_P desc){ uint8_t ctx[nessie_hash_ctx.ctx_size_B]; - uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8]; + uint8_t hash[HASHSIZE_B]; uint16_t sl; + uint8_t buffer[BLOCKSIZE_B]; NESSIE_PUTSTR_P(PSTR("\r\n message=")); - NESSIE_PUTSTR(desc); + NESSIE_PUTSTR_P(desc); nessie_hash_ctx.hash_init(ctx); - sl = strlen(data); - while(sl>=nessie_hash_ctx.blocksize_B){ - nessie_hash_ctx.hash_next(data, ctx); - data += nessie_hash_ctx.blocksize_B; - sl -= nessie_hash_ctx.blocksize_B; + sl = strlen_P(data); + while(sl>=BLOCKSIZE_B){ + memcpy_P(buffer, data, BLOCKSIZE_B); + nessie_hash_ctx.hash_next(buffer, ctx); + data += BLOCKSIZE_B; + sl -= BLOCKSIZE_B; } - nessie_hash_ctx.hash_last(data, sl*8, ctx); + memcpy_P(buffer, data, sl); + nessie_hash_ctx.hash_last(buffer, sl*8, ctx); nessie_hash_ctx.hash_conv(hash, ctx); nessie_print_item("hash", hash, (nessie_hash_ctx.hashsize_b+7)/8); } @@ -206,26 +212,34 @@ void nessie_hash_run(void){ nessie_print_header(nessie_hash_ctx.name, 0, 0, nessie_hash_ctx.hashsize_b, 0, 0); /* test set 1 */ - char* challange[8][2]= { - {"", "\"\" (empty string)"}, - {"a", "\"a\""}, - {"abc", "\"abc\""}, - {"message digest", "\"message digest\""}, - {"abcdefghijklmnopqrstuvwxyz","\"abcdefghijklmnopqrstuvwxyz\""}, - {"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "\"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\""}, - {"ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" , "\"A...Za...z0...9\""}, - {"1234567890" "1234567890" "1234567890" "1234567890" - "1234567890" "1234567890" "1234567890" "1234567890", - "8 times \"1234567890\""} - }; + char* challange_dbz= PSTR( + "\0" + "\"\" (empty string)\0" + "a\0" + "\"a\"\0" + "abc\0" + "\"abc\"\0" + "message digest\0" + "\"message digest\"\0" + "abcdefghijklmnopqrstuvwxyz\0" + "\"abcdefghijklmnopqrstuvwxyz\"\0" + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\0" + "\"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\"\0" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789\0" + "\"A...Za...z0...9\"\0" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890\0" + "8 times \"1234567890\"\0" + ); + PGM_P challange[16]; set=1; nessie_print_setheader(set); + dbz_splitup_P(challange_dbz, challange); for(i=0; i<8; ++i){ nessie_print_set_vector(set, i); - ascii_hash(challange[i][0], challange[i][1]); + ascii_hash_P(challange[2*i], challange[2*i+1]); } nessie_print_set_vector(set, i); amillion_hash(); diff --git a/test_src/nessie_mac_test.c b/test_src/nessie_mac_test.c index 9070487..d95c911 100644 --- a/test_src/nessie_mac_test.c +++ b/test_src/nessie_mac_test.c @@ -28,35 +28,47 @@ #include #include #include +#include #include "nessie_mac_test.h" #include "nessie_common.h" +#include "dbz_strings.h" #include "uart.h" nessie_mac_ctx_t nessie_mac_ctx; -#define KEYSIZE_B ((nessie_mac_ctx.keysize_b+7)/8) -#define MACSIZE_B ((nessie_mac_ctx.macsize_b+7)/8) +#define KEYSIZE_B ((nessie_mac_ctx.keysize_b+7)/8) +#define MACSIZE_B ((nessie_mac_ctx.macsize_b+7)/8) +#define BLOCKSIZE_B (nessie_mac_ctx.blocksize_B) #define PRINTKEY nessie_print_item("key", key, KEYSIZE_B) #define PRINTMAC nessie_print_item("MAC", mac, MACSIZE_B) + +static uint8_t keyproto[] PROGMEM = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }; + static -void ascii_mac(char* data, char* desc, uint8_t* key){ +void ascii_mac_P(PGM_P data, PGM_P desc, uint8_t* key){ uint8_t ctx[nessie_mac_ctx.ctx_size_B]; uint8_t mac[MACSIZE_B]; uint16_t sl; + uint8_t buffer[BLOCKSIZE_B]; NESSIE_PUTSTR_P(PSTR("\r\n message=")); - NESSIE_PUTSTR(desc); + NESSIE_PUTSTR_P(desc); PRINTKEY; nessie_mac_ctx.mac_init(ctx, key, nessie_mac_ctx.keysize_b); - sl = strlen(data); + sl = strlen_P(data); while(sl>nessie_mac_ctx.blocksize_B){ - nessie_mac_ctx.mac_next(ctx, data); - data += nessie_mac_ctx.blocksize_B; - sl -= nessie_mac_ctx.blocksize_B; + memcpy_P(buffer, data, BLOCKSIZE_B); + nessie_mac_ctx.mac_next(ctx, buffer); + data += BLOCKSIZE_B; + sl -= BLOCKSIZE_B; } - nessie_mac_ctx.mac_last(ctx, data, sl*8); + memcpy_P(buffer, data, sl); + nessie_mac_ctx.mac_last(ctx, buffer, sl*8); nessie_mac_ctx.mac_conv(mac, ctx); PRINTMAC; } @@ -169,11 +181,6 @@ void tv4_mac(void){ uint8_t ctx[nessie_mac_ctx.ctx_size_B]; uint8_t mac[MACSIZE_B]; uint8_t block[MACSIZE_B]; - uint8_t core_key[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF - }; uint8_t key[KEYSIZE_B]; uint16_t n=MACSIZE_B*8; uint32_t i; @@ -185,7 +192,7 @@ void tv4_mac(void){ NESSIE_PUTSTR_P(PSTR(" zero bits")); memset(block, 0, MACSIZE_B); for(i=0; inessie_mac_ctx.blocksize_B*8){ @@ -200,65 +207,70 @@ void tv4_mac(void){ nessie_mac_ctx.mac_last(ctx, mac, nessie_mac_ctx.macsize_b); nessie_mac_ctx.mac_conv(mac, ctx); NESSIE_SEND_ALIVE_A(i); - NESSIE_SEND_ALIVE_A(i+32); } nessie_print_item("iterated 100000 times", mac, MACSIZE_B); } - void nessie_mac_run(void){ uint16_t i; uint8_t set; - uint8_t keyproto[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }; uint8_t key[KEYSIZE_B]; nessie_print_header(nessie_mac_ctx.name, nessie_mac_ctx.keysize_b, 0, 0, nessie_mac_ctx.macsize_b, 0); /* test set 1 */ - char* challange[10][2]= { - {"", "\"\" (empty string)"}, - {"a", "\"a\""}, - {"abc", "\"abc\""}, - {"message digest", "\"message digest\""}, - {"abcdefghijklmnopqrstuvwxyz","\"abcdefghijklmnopqrstuvwxyz\""}, - {"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "\"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\""}, - {"ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" , "\"A...Za...z0...9\""}, - {"1234567890" "1234567890" "1234567890" "1234567890" - "1234567890" "1234567890" "1234567890" "1234567890", - "8 times \"1234567890\""}, - {"Now is the time for all ", "\"Now is the time for all \""}, - {"Now is the time for it", "\"Now is the time for it\""} - }; + char* challange_dbz= PSTR( + "\0" + "\"\" (empty string)\0" + "a\0" + "\"a\"\0" + "abc\0" + "\"abc\"\0" + "message digest\0" + "\"message digest\"\0" + "abcdefghijklmnopqrstuvwxyz\0" + "\"abcdefghijklmnopqrstuvwxyz\"\0" + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\0" + "\"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\"\0" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789\0" + "\"A...Za...z0...9\"\0" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890\0" + "8 times \"1234567890\"\0" + "Now is the time for all \0" + "\"Now is the time for all \"\0" + "Now is the time for it\0" + "\"Now is the time for it\"\0" + ); set=1; nessie_print_setheader(set); for(i=0; i>3]=0x80>>(i&0x7); - ascii_mac("ABC", "\"ABC\"", key); + ascii_mac_P(PSTR("ABC"), PSTR("\"ABC\""), key); } nessie_print_footer(); }