]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
modifying some nessie test suits (mac & hash) to use less RAM
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Sun, 1 Mar 2009 19:29:27 +0000 (19:29 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Sun, 1 Mar 2009 19:29:27 +0000 (19:29 +0000)
58 files changed:
config.h
mkfiles/a5_1.mk
mkfiles/aes.mk
mkfiles/aes_asm_faster.mk
mkfiles/aes_c.mk
mkfiles/arcfour.mk
mkfiles/arcfour_c.mk
mkfiles/camellia.mk
mkfiles/cast5.mk
mkfiles/des.mk
mkfiles/grain.mk
mkfiles/hmac-md5.mk
mkfiles/hmac-sha1.mk
mkfiles/hmac-sha256.mk
mkfiles/md5.mk
mkfiles/md5_asm.mk
mkfiles/mugi.mk
mkfiles/noekeon.mk
mkfiles/noekeon_c.mk
mkfiles/omac_noekeon.mk
mkfiles/omac_noekeon_c.mk
mkfiles/present.mk
mkfiles/rc5.mk
mkfiles/rc6.mk
mkfiles/seed.mk
mkfiles/seed_C.mk
mkfiles/serpent-bitslice.mk
mkfiles/serpent_asm_bitslice.mk
mkfiles/serpent_asm_fast.mk
mkfiles/serpent_asm_small.mk
mkfiles/serpent_c.mk
mkfiles/sha1.mk
mkfiles/sha1_c.mk
mkfiles/sha256.mk
mkfiles/sha256_c.mk
mkfiles/shabea.mk
mkfiles/shacal1enc.mk
mkfiles/shacal2enc.mk
mkfiles/skipjack.mk
mkfiles/tdes.mk
mkfiles/trivium.mk
mkfiles/twister224.mk
mkfiles/twister224_c.mk
mkfiles/twister256.mk
mkfiles/twister256_c.mk
mkfiles/twister384.mk
mkfiles/twister384_c.mk
mkfiles/twister512.mk
mkfiles/twister512_c.mk
mkfiles/xtea.mk
mkfiles/xtea_c.mk
test_src/dbz_strings.c [new file with mode: 0644]
test_src/dbz_strings.h [new file with mode: 0644]
test_src/hexdigit_tab.c
test_src/hexdigit_tab.h
test_src/nessie_common.c
test_src/nessie_hash_test.c
test_src/nessie_mac_test.c

index 00d10efa607bdc03250985a29df82e8fd7a64c8f..60aaf4c3c8ddc90ca9384b7bc2c4a2c32f06c7cb 100644 (file)
--- a/config.h
+++ b/config.h
@@ -19,8 +19,8 @@
 #ifndef __CONFIG_H__
 #define __CONFIG_H__
 #include <avr/io.h>
-#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
 
 
index 1264b31e213d12ad27fbe893e7f0ea27ea9254ff..078d982c54da3ec773dd52d19c5d110b9698a1e9 100644 (file)
@@ -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"
 
index 950f740e56710c9fd05cc61d54e4c04dce557031..71ab1d73626760a1ab08109869c65449b1e52972 100644 (file)
@@ -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
 
index 75ae39ef3973ab4a1701b3a23a53b6465a810a5f..71f1de7ea125ebd8b21a2f62e0d9cba74799cd91 100644 (file)
@@ -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
 
index 81da3cb2815cfaa17cccec87b6fad165abcf6ca7..8bec1337f8b002d99da29b1d0c7adc1c7443969b 100644 (file)
@@ -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
 
index 7c37869e03d84838aa2bc04c6044a96450c6a3e1..6a6e24bb073807e45ce616169571f8debff636f5 100644 (file)
@@ -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"
index 33ce65f4a60f4099922b0e2d40888cffa21340e2..d6770615e86c04a9274a80034250cf489029307a 100644 (file)
@@ -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"
index 4b7974b006f15e99f817e0b85269c3606001e017..9b27fe61a0c3bf51884772581894113a262b88f8 100644 (file)
@@ -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"
 
index 18dd483691d37ed40a871d9ff85c34e45018f1ca..e2472a9d38754f03775df4e65f1efdfaa59a149a 100644 (file)
@@ -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"
 
index 7a1287350a18866e5e169ead3b8cf16acd3cb79f..f7862106dd0c4d986057655be35a96bf4f7084bb 100644 (file)
@@ -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"
 
index 406bc4d739a80c1bd3a39555b3cfa2a754271ade..a8373c297c06d5a1c4f1c9ad3e20af4ec17c21ca 100644 (file)
@@ -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"
index 40e7e4411bdd6d2b8ad2ca7552cbb42b88c387c7..a79e9bb9a696a51395b9be1028513f4bd533b38b 100644 (file)
@@ -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"
 
index d5d731c960adb4085cf00374517e0cb233f479ff..7998afaa888d0357a60eb4964af5ddb2dff8d84b 100644 (file)
@@ -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"
 
index adfe48cb31e83c8ba532e3015c035b1502059e17..871444087c40b23e1ec25e7782a07543558b017f 100644 (file)
@@ -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"
 
index 1d55c1ea4e5e0969d94acbea98c971a672d72e1f..1fee35755be26ba73ffa530c52e52c15db2d2bf1 100644 (file)
@@ -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"
 
index 41dcac88c78e24859bff098c042fac7fd80ebd48..ed2905fcc83fc62e4464b37b70f148f1696152b5 100644 (file)
@@ -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"
 
index eb3f3d8c34581dcb0c12d1344d1fe99a2e235d2d..c5f64f38d09eb5190c4256ebebcc8d41f83b939d 100644 (file)
@@ -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"
index b3fdccf66fb949ff363a2028765f6ae28eddb29f..52cb73011eeeeaa95b756b68f46e561c05de819f 100644 (file)
@@ -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
 
index ad0aa590822c9f395105a63c1e4843fd7a9f343c..504a2665b0cee7c80523f1e1f9b818d0eb626c74 100644 (file)
@@ -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
 
index d59b22fb6dcabe282eb2cb519fc611ef4d64d6d2..365e05672620de639735edf5db08a9eec26c11f6 100644 (file)
@@ -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
 
index efd6e6c42df2c7e364d3158a816eb76b2fe68f0f..290fc7de277871ca7cf20b17fd92f1484fc0d9b2 100644 (file)
@@ -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
 
index b60eb81df38ec1fb9348678fd906f23f91b67c5e..1dd39b0e7e42ec085396d0653e0b89b04018e8fc 100644 (file)
@@ -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"
 
index 3852d7b64b09a6b793d72b27640ade6efc27f715..0b1befed26a745a0b17c4955b75612999cd443f1 100644 (file)
@@ -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
 
index 1b357eb1707007cd5a5cac43d63ec45d55270648..a02f17c77e8021fcf922a05c1835e06c74328ace 100644 (file)
@@ -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
 
index a79f78ac6e4c21cdd5e5598dd2dd8c75aa1badae..12d8d59552d550d9f48475a030cb4f0704d73a80 100644 (file)
@@ -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"
index 05fd25d3600526786e6a541f73fbf76939c74879..0cc6ea3f360ab4eff5fe65eab2dea5fdb14aabdb 100644 (file)
@@ -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"
index 4d68c22b5360c6f6f22826a7390a22ec2e79370f..dbea67e64ab0d5ea498bfdb57f0e4b916af07b62 100644 (file)
@@ -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"
 
index 80e69bf0e51aaf2c86a788d4d0f747fdd1885747..e731cff8b29d69dd6636236dfe55a2acf0b3d40c 100644 (file)
@@ -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"
 
index 195f83ac67f07eda64a43fe734ef8ebfcb351c47..71f2a99506cbbabcac78a7ba56b924ce88e9ea25 100644 (file)
@@ -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"
 
index 46ad45e63c41e5c504b3a778a13193e323833171..7d5a1c3875416b0d0c3f1f79718e5f7bf20d57dc 100644 (file)
@@ -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"
 
index c6162a78de55fd539ff3b65794b4a84976521197..63b498d636a4b685d72e75bfe3434d3e3875b59b 100644 (file)
@@ -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"
 
index 335cafb264903e1a3e357c578130177858bc5c84..818a91b9ad7c672fcf87a900b4e44fee9c59804e 100644 (file)
@@ -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"
index 8a141c4e18c2f39d223cfdc5d6b94a664911bbf0..6674a3e52630cf41211b0ea968c43dbcceff195d 100644 (file)
@@ -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"
index 35c271a1445b38359c3edaaa09a609ed54f0ec31..fee84e0db8ee3c2a83b6017de3967ef54837a837 100644 (file)
@@ -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"
index 7ad81d06ebcf6bb711ff11bc302a079c37c01771..6952ca7e4221d9c72b9a4f7361e4ec9a0c3a4394 100644 (file)
@@ -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"
index 29525e608471f4f28702c054f4e62f402d221311..7747998f6909b2bf8014d81c5d9bc6325f51d847 100644 (file)
@@ -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"
 
index 0bccab15ea2a418c2f391dd26683f5f486784a99..4a579709e04ed11039ad82d6df2891e7ac241053 100644 (file)
@@ -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"
 
index 0265b10fe5efb480b038894dac157b215e1915f6..99dae3389c280f63f8d5d695edc3eefcde09c46c 100644 (file)
@@ -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"
 
index e546ea3e51b1fd42ec3aa828eff260e34286a05c..9f4eb35b75cfaadae284c378d8025fad855df130 100644 (file)
@@ -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"
index 4e03c9f3ed08006bdcf56a0b9ded37bffb502a31..96ccabaa07ed0df9f3a0c3bb26a111f07d43f24d 100644 (file)
@@ -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"
 
index 4f4f0efa9896f9ad955769d80f4ff1e411945cc2..7b8dd3f750b15b08e4e6c12bcc3bc581275c8497 100644 (file)
@@ -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"
index d57e00d3197d7f0388981e07a286acaaf8050bd7..e33e28ab7d1cc60a96e948781f11fc5e5ebe35ec 100644 (file)
@@ -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"
 
index 6ea6ad6ef5f36ed08ca55f62633811c692da7bb0..be880e0a7f2335652d6d248fc05093a7cad17c05 100644 (file)
@@ -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"
 
index 8bd3ff8174cd166d41f5671ec7107533af29688d..feb8ac52d2e7cb054994f39f7892cd4c18f71645 100644 (file)
@@ -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"
 
index 39d2829a294584e0e037dc1e7f99457d876c6a44..8b1717ed7ec99d765f7f040abfc1507dd1a7c834 100644 (file)
@@ -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"
 
index dcc40138697e5ba0d31af40006346deb11271642..c4f2f954cf41e28feba400a96d0ce978977be7b6 100644 (file)
@@ -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"
 
index 3358dec909af5ff5078253eb22824d0a38441570..56511de167d74b68a3d97acd3fc51e505cc02667 100644 (file)
@@ -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"
 
index acd7bab56566fd79516973bf9d0a34843b4066e0..484cc56ea498b667e073d2f648a2f8850b5c4a78 100644 (file)
@@ -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"
 
index 75b23e028297d8ab968d2505618da668e639cc9c..1dc2ec0ccadc4be3488456fc21647b4780ca8dea 100644 (file)
@@ -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"
 
index 01dcedfe5106df5c0ac5533c1597ece2eea5d353..67abbe6e4bbdbd457fe6ede4155bbec5c712d864 100644 (file)
@@ -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"
 
index b5b59b7a225d45bd3c83c40cf3cfba8e91252dd9..711db8390c1bb8bae4f22724a1f105691b9bcf86 100644 (file)
@@ -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 (file)
index 0000000..436bf8c
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+
+/*
+ * author: Daniel Otte
+ * email:  daniel.otte@rub.de
+ * license: GPLv3
+ * 
+ * */
+
+#include <stdint.h>
+#include <string.h>
+#include <avr/pgmspace.h>
+/******************************************************************************/
+
+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 (file)
index 0000000..7fc09e9
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+
+#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 <stdint.h>
+#include <avr/pgmspace.h>
+
+/** \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_*/
index 8e81d08a757a00cafd3c9d5b01c822618b665caf..874109ce8827d2cb4515ec10f3d6d888b424f409 100644 (file)
@@ -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'};
+
 
 
 
index 8b20da57cd436621db3b1cae0b3b667177efae24..5aa2e998dca4bd4a41d1b7dfff4c604211740954 100644 (file)
@@ -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_*/
index 6d66a1ceafe7394a89da79fd8fc9e7024c36cfab..94e19f51701a8aef71a5727cd4043b26c7c38b62 100644 (file)
@@ -31,7 +31,7 @@
 #include <avr/pgmspace.h>
 #include <stdlib.h> /* 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: "));
index 63e4b5309fa81220c3447e5a31589477cb61afe5..ef5d968ed871185b250f61d01d273221bc741526 100644 (file)
 #include <string.h>
 #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();
index 90704872c071af80da120d2a18931e380ee3d543..d95c911a20739e4ab34f1428c7eeb0e7b77b76a5 100644 (file)
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
+#include <avr/pgmspace.h>
 #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; i<KEYSIZE_B; ++i)
-               key[i] = core_key[i%(3*8)];
+               key[i] = pgm_read_byte(&(keyproto[i%(3*8)]));
        nessie_print_item("key", key, KEYSIZE_B);
        nessie_mac_ctx.mac_init(ctx, key, nessie_mac_ctx.keysize_b);
        while(n>nessie_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<KEYSIZE_B; ++i){
-               key[i] = keyproto[i%sizeof(keyproto)];
+               key[i] = pgm_read_byte(&(keyproto[i%sizeof(keyproto)]));
        }
+       PGM_P challange[20];
+       dbz_splitup_P(challange_dbz, challange);
        for(i=0; i<10; ++i){
                nessie_print_set_vector(set, i);
-               ascii_mac(challange[i][0], challange[i][1], key);
+               ascii_mac_P(challange[2*i], challange[2*i+1], key);
        }
        nessie_print_set_vector(set, i);
        amillion_mac(key);
        for(i=0; i<KEYSIZE_B; ++i){
-               key[i] = keyproto[16+i%8];
+               key[i] = pgm_read_byte(&(keyproto[0x10+i%0x8]));
        }
        for(i=0; i<10; ++i){
                nessie_print_set_vector(set, 11+i);
-               ascii_mac(challange[i][0], challange[i][1], key);
+               ascii_mac_P(challange[2*i], challange[2*i+1], key);
        }
        nessie_print_set_vector(set, 11+i);
        amillion_mac(key);
        /* test set 2 */
        set=2;
        for(i=0; i<KEYSIZE_B; ++i){
-               key[i] = keyproto[i%sizeof(keyproto)];
+               key[i] = pgm_read_byte(&(keyproto[i%sizeof(keyproto)]));
        }
        nessie_print_setheader(set);
        for(i=0; i<1024; ++i){
@@ -286,7 +298,7 @@ void nessie_mac_run(void){
                nessie_print_set_vector(set, i);
                memset(key, 0, KEYSIZE_B);
                key[i>>3]=0x80>>(i&0x7);
-               ascii_mac("ABC", "\"ABC\"", key);
+               ascii_mac_P(PSTR("ABC"), PSTR("\"ABC\""), key);
        }
        nessie_print_footer();
 }