]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
modifyed build system (removed some redundance)
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Thu, 14 May 2009 00:31:18 +0000 (00:31 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Thu, 14 May 2009 00:31:18 +0000 (00:31 +0000)
19 files changed:
hfal-performance.c
hfal_blake_small.c
host/get_test.rb
mkfiles/001_cli_std.mk [new file with mode: 0644]
mkfiles/001_hfal_std.mk [new file with mode: 0644]
mkfiles/blake_c.mk
mkfiles/bmw_c.mk
mkfiles/md5.mk
mkfiles/sha1.mk
mkfiles/sha1_c.mk
mkfiles/sha256.mk
mkfiles/sha256_c.mk
mkfiles/shabal.mk
mkfiles/shabal_c.mk
mkfiles/skein.mk
test_src/main-bmw-test.c
test_src/main-md5-test.c
test_src/main-sha1-test.c
test_src/main-sha256-test.c

index 5108f2544d7ad5a8ef5276b7e1440b8411a35cfc..26fd891de4326014e08755e65162eea58b7bc6a9 100644 (file)
@@ -60,6 +60,7 @@ void hfal_performance(const hfdesc_t* hd){
        cli_putstr_P(PSTR("\r\n\r\n === "));
        cli_putstr_P(hf.name);
        cli_putstr_P(PSTR(" performance === "
+                         "\r\n    type:                     hash"
                          "\r\n    hashsize (bits):    "));
        printvalue(hf.hashsize_b);
        
index f63cea553d2fa5a3b60c99b7bac5fa4884dba211..1d890f650295aa25e65f291811ca7362a03caddd 100644 (file)
@@ -1,7 +1,7 @@
 /* hfal_blake_small.c */
 /*
     This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+    Copyright (C) 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
index 0c3eb1bea1ae0e8a2c5a466fcffd27fb860e8de5..337ef3f4034bf7caf974e4f8cc314ee137b0a9be 100644 (file)
@@ -2,7 +2,7 @@
 # get_test.rb
 =begin
     This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+    Copyright (C) 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
diff --git a/mkfiles/001_cli_std.mk b/mkfiles/001_cli_std.mk
new file mode 100644 (file)
index 0000000..a13bf72
--- /dev/null
@@ -0,0 +1 @@
+CLI_STD =  debug.o uart.o hexdigit_tab.o dbz_strings.o cli.o string-extras.o
diff --git a/mkfiles/001_hfal_std.mk b/mkfiles/001_hfal_std.mk
new file mode 100644 (file)
index 0000000..0404803
--- /dev/null
@@ -0,0 +1,2 @@
+HFAL_STD = nessie_common.o nessie_hash_test.o performance_test.o \
+           hfal-basic.o hfal-performance.o hfal-nessie.o hfal-test.o shavs.o
index 4dc8349db9747396ea258f013ab8695913a2449f..cee254725e040169f7083312d07ba4bb5b341811 100644 (file)
@@ -6,10 +6,7 @@ HASHES += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := blake_small.o blake_large.o blake_common.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-blake-test.o debug.o uart.o hexdigit_tab.o  \
-                         dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \
-                        nessie_hash_test.o hfal-basic.o hfal_blake_small.o hfal_blake_large.o \
-                        shavs.o hfal-nessie.o hfal-test.o hfal-performance.o
+$(ALGO_NAME)_TEST_BIN := main-blake-test.o hfal_blake_small.o hfal_blake_large.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index bb65d9c818d9418539de35e8211645513aa52a47..63059321ad138ac9d8294538fbd1dae07f2d312b 100644 (file)
@@ -6,9 +6,7 @@ HASHES += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := bmw_small.o bmw_large.o
-$(ALGO_NAME)_TEST_BIN := main-bmw-test.o debug.o uart.o hexdigit_tab.o  \
-                         dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \
-                        nessie_hash_test.o hfal-basic.o hfal_bmw_small.o hfal_bmw_large.o shavs.o
+$(ALGO_NAME)_TEST_BIN := main-bmw-test.o hfal_bmw_small.o hfal_bmw_large.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index 1f7375558ec6331e8ea8aaa94e25e18e203b6547..025e9eb29206d6ea46da94e631dfe0e9263df67b 100644 (file)
@@ -4,9 +4,8 @@ ALGO_NAME := MD5
 # comment out the following line for removement of MD5 from the build process
 HASHES += $(ALGO_NAME)
 
-$(ALGO_NAME)_OBJ      := md5.o
-$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o hexdigit_tab.o  \
-                         nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
+$(ALGO_NAME)_OBJ      := md5-asm.o
+$(ALGO_NAME)_TEST_BIN := main-md5-test.o hfal_md5.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
 
index f8400bed9044f614c482e3432f9141547c7fc680..434697ee1f6f9104e77b1359930813a7f37a3159 100644 (file)
@@ -5,9 +5,7 @@ ALGO_NAME := SHA1
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha1-asm.o
-$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.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)_TEST_BIN := main-sha1-test.o hfal_sha1.o $(CLI_STD) $(HFAL_STD) dump.o 
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
 
index 3b8776c75661507fdb6b828e666697f76b226d6c..4ce9f0ad2e82ecb3c53af86062cae6e8afea852c 100644 (file)
@@ -5,9 +5,7 @@ ALGO_NAME := SHA1_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha1.o
-$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.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)_TEST_BIN := main-sha1-test.o hfal_sha1.o dump.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
 
index 60925ed2660c9b2b56eecd1fcb13ba0e350e5378..92dc0bcfdc7b85273d5e2cdd8a77f14f193ef1d2 100644 (file)
@@ -5,9 +5,9 @@ ALGO_NAME := SHA256
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha256-asm.o
-$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.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)_TEST_BIN := main-sha256-test.o dump.o hfal_sha256.o $(CLI_STD) $(HFAL_STD)
+                       
+                       
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
 
index fa9ca75f048c56626ecddf9cc7a38c24b1e82e30..0e172dbcec374d7fedba6608ddb066511a1a2e09 100644 (file)
@@ -5,9 +5,7 @@ ALGO_NAME := SHA256_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha256.o
-$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.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)_TEST_BIN := main-sha256-test.o $(CLI_STD) $(HFAL_STD) hfal_sha256.o dump.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
 
index 20ab49e5d8751bc151a287e8f7247518a53d27fe..15ed87561717cf2f717f58fe5b40bbb52648c99f 100644 (file)
@@ -7,10 +7,7 @@ HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := shabal-asm.o shabal192-asm.o shabal224-asm.o \
                          shabal256-asm.o shabal384-asm.o shabal512-asm.o
-$(ALGO_NAME)_TEST_BIN := main-shabal-test.o debug.o uart.o hexdigit_tab.o  \
-                         dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \
-                        nessie_hash_test.o hfal-basic.o hfal_shabal.o shavs.o \
-                        hfal-nessie.o hfal-performance.o hfal-test.o
+$(ALGO_NAME)_TEST_BIN := main-shabal-test.o hfal_shabal.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index 7d1d66b452bb6d10d9da3d8f8521f2c918dff6cc..427afa7b04aab468cf9d0b41321231347a9ab855 100644 (file)
@@ -6,10 +6,7 @@ HASHES += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := shabal.o shabal192.o shabal224.o shabal256.o shabal384.o shabal512.o
-$(ALGO_NAME)_TEST_BIN := main-shabal-test.o debug.o uart.o hexdigit_tab.o  \
-                         dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \
-                        nessie_hash_test.o hfal-basic.o hfal_shabal.o shavs.o \
-                        hfal-nessie.o hfal-performance.o hfal-test.o
+$(ALGO_NAME)_TEST_BIN := main-shabal-test.o hfal_shabal.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index 2e8851e4a91c69297999853a493bfb277c2eabaa..537988ee18352799f61bd68009189b8bdf50213d 100644 (file)
@@ -9,10 +9,7 @@ $(ALGO_NAME)_OBJ      := threefish_mix.o \
                          threefish256_enc_asm.o  ubi256_asm.o  skein256_asm.o \
                          threefish512_enc_asm.o  ubi512_asm.o  skein512_asm.o \
                         threefish1024_enc_asm.o ubi1024_asm.o skein1024_asm.o
-$(ALGO_NAME)_TEST_BIN := main-skein-test.o debug.o uart.o hexdigit_tab.o  \
-                         dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \
-                         hfal-basic.o hfal_skein256.o hfal_skein512.o hfal_skein1024.o shavs.o \
-                        hfal-performance.o hfal-nessie.o nessie_hash_test.o
+$(ALGO_NAME)_TEST_BIN := main-skein-test.o hfal_skein256.o hfal_skein512.o hfal_skein1024.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index 74aa8ff594e4164188f252993f936adb5e9d1215..22a370d0fd032febe6e82397e4e418eeedbcc62b 100644 (file)
@@ -34,6 +34,9 @@
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
+#include "hfal-nessie.h"
+#include "hfal-performance.h"
+#include "hfal-test.h"
 
 #include <stdint.h>
 #include <string.h>
 
 char* algo_name = "BlueMidnightWish";
 
+
+const hfdesc_t* algolist[] PROGMEM = {
+       (hfdesc_t*)&bmw224_desc,
+       (hfdesc_t*)&bmw256_desc,
+       (hfdesc_t*)&bmw384_desc,
+       (hfdesc_t*)&bmw512_desc,
+       NULL
+};
+
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
 
 void performance_bmw(void){
-       uint64_t t;
-       char str[16];
-       uint8_t data[128];
-       uint8_t hash[512/8];
-       bmw_small_ctx_t ctx1;
-       bmw_large_ctx_t ctx2;
-
-       calibrateTimer();
-       print_overhead();
-       
-       memset(data, 0, 64);
-       
-       startTimer(1);
-       bmw224_init(&ctx1);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time (224): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw256_init(&ctx1);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time (256): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw384_init(&ctx2);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time (384): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw512_init(&ctx2);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time (512): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-               
-       startTimer(1);
-       bmw_small_nextBlock(&ctx1, data);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tone-block (small) time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw_large_nextBlock(&ctx2, data);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tone-block (large) time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw_small_lastBlock(&ctx1, data, 0);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tlast block (small) time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw_large_lastBlock(&ctx2, data, 0);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tlast block (large) time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw224_ctx2hash(hash, &ctx1);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx2hash time (224): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw256_ctx2hash(hash, &ctx1);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx2hash time (256): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw384_ctx2hash(hash, &ctx2);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx2hash time (384): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       startTimer(1);
-       bmw512_ctx2hash(hash, &ctx2);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx2hash time (512): "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-               
-       cli_putstr_P(PSTR("\r\n"));
+       hfal_performance_multiple(algolist);
 }
 
 void testrun_nessie_bmw(void){
-       nessie_hash_ctx.hashsize_b  = 224;
-       nessie_hash_ctx.name = "BlueMidnigthWish-224";
-       nessie_hash_ctx.blocksize_B = 512/8;
-       nessie_hash_ctx.ctx_size_B  = sizeof(bmw224_ctx_t);
-       nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)bmw224_init;
-       nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)bmw224_nextBlock;
-       nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)bmw224_lastBlock;
-       nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)bmw224_ctx2hash;
-       
-       nessie_hash_run();
-       
-       nessie_hash_ctx.hashsize_b  = 256;
-       nessie_hash_ctx.name = "BlueMidnigthWish-256";
-       nessie_hash_ctx.blocksize_B = 512/8;
-       nessie_hash_ctx.ctx_size_B  = sizeof(bmw256_ctx_t);
-       nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)bmw256_init;
-       nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)bmw256_nextBlock;
-       nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)bmw256_lastBlock;
-       nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)bmw256_ctx2hash;
-       
-       nessie_hash_run();
-       
-       nessie_hash_ctx.hashsize_b  = 384;
-       nessie_hash_ctx.name = "BlueMidnigthWish-384";
-       nessie_hash_ctx.blocksize_B = 1024/8;
-       nessie_hash_ctx.ctx_size_B  = sizeof(bmw384_ctx_t);
-       nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)bmw384_init;
-       nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)bmw384_nextBlock;
-       nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)bmw384_lastBlock;
-       nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)bmw384_ctx2hash;
-       
-       nessie_hash_run();
-       
-       nessie_hash_ctx.hashsize_b  = 512;
-       nessie_hash_ctx.name = "BlueMidnigthWish-512";
-       nessie_hash_ctx.blocksize_B = 1024/8;
-       nessie_hash_ctx.ctx_size_B  = sizeof(bmw512_ctx_t);
-       nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)bmw512_init;
-       nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)bmw512_nextBlock;
-       nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)bmw512_lastBlock;
-       nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)bmw512_ctx2hash;
-       
-       nessie_hash_run();
+       hfal_nessie_multiple(algolist);
 }
+
 void bmw224_test(void* msg, uint32_t length_b){
-       uint8_t diggest[224/8];
-       cli_putstr_P(PSTR("\r\n=== BMW224 test ===\r\n message:\r\n"));
-       cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
-       bmw224(diggest, msg, length_b);
-       cli_putstr_P(PSTR("\r\n diggest:\r\n"));
-       cli_hexdump_block(diggest, 224/8, 4, 16);
+       hfal_test(&bmw224_desc, msg, length_b);
 }
 
 void bmw256_test(void* msg, uint32_t length_b){
-       uint8_t diggest[256/8];
-       cli_putstr_P(PSTR("\r\n=== BMW256 test ===\r\n message:\r\n"));
-       cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
-       bmw256(diggest, msg, length_b);
-       cli_putstr_P(PSTR("\r\n diggest:\r\n"));
-       cli_hexdump_block(diggest, 256/8, 4, 16);
+       hfal_test(&bmw256_desc, msg, length_b);
 }
 
 void bmw384_test(void* msg, uint32_t length_b){
-       uint8_t diggest[384/8];
-       cli_putstr_P(PSTR("\r\n=== BMW384 test ===\r\n message:\r\n"));
-       cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
-       bmw384(diggest, msg, length_b);
-       cli_putstr_P(PSTR("\r\n diggest:\r\n"));
-       cli_hexdump_block(diggest, 384/8, 4, 16);
+       hfal_test(&bmw384_desc, msg, length_b);
 }
 
 void bmw512_test(void* msg, uint32_t length_b){
-       uint8_t diggest[512/8];
-       cli_putstr_P(PSTR("\r\n=== BMW512 test ===\r\n message:\r\n"));
-       cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
-       bmw512(diggest, msg, length_b);
-       cli_putstr_P(PSTR("\r\n diggest:\r\n"));
-       cli_hexdump_block(diggest, 512/8, 4, 16);
+       hfal_test(&bmw512_desc, msg, length_b);
 }
 
 void testrun_stdtest_bmw(void){
@@ -253,14 +108,6 @@ void testlshort(void){
  *  main                                                                                                                                        *
  *****************************************************************************/
 
-const hfdesc_t* algolist[] PROGMEM = {
-       (hfdesc_t*)&bmw224_desc,
-       (hfdesc_t*)&bmw256_desc,
-       (hfdesc_t*)&bmw384_desc,
-       (hfdesc_t*)&bmw512_desc,
-       NULL
-};
-
 const char nessie_str[]      PROGMEM = "nessie";
 const char test_str[]        PROGMEM = "test";
 const char testshort_str[]   PROGMEM = "short";
index be4f69271d15ef3c1d2fc0937c73293d0cce761a..7cd6049d1830b8f173d3e62f823366c8bd05b108 100644 (file)
@@ -29,6 +29,8 @@
 #include "md5.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
+#include "hfal_md5.h"
+#include "hfal-performance.h"
 
 #include <stdint.h>
 #include <string.h>
 
 char* algo_name = "MD5";
 
+const hfdesc_t* algolist[] PROGMEM = {
+       (hfdesc_t*)&md5_desc,
+       NULL
+};
+
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
@@ -111,40 +118,7 @@ void testrun_md5(void){
 
 
 void testrun_performance_md5(void){
-       uint64_t t;
-       char str[16];
-       uint8_t data[32];
-       md5_ctx_t ctx;
-       
-       calibrateTimer();
-       print_overhead();
-       
-       memset(data, 0, 32);
-       
-       startTimer(1);
-       md5_init(&ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       
-       startTimer(1);
-       md5_nextBlock(&ctx, data);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tone-block time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       
-       startTimer(1);
-       md5_lastBlock(&ctx, data, 0);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tlast block time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       cli_putstr_P(PSTR("\r\n"));
+       hfal_performance_multiple(algolist);
 }
 
 
index 1dc476c4c0cc420d0de777fc58f615971015f397..77104b945acb07a5a989418f74e048d0567ba429 100644 (file)
@@ -28,7 +28,8 @@
 
 #include "sha1.h"
 #include "nessie_hash_test.h"
-#include "performance_test.h"
+#include "hfal_sha1.h"
+#include "hfal-performance.h"
 
 #include <stdint.h>
 #include <string.h>
 
 char* algo_name = "SHA-1";
 
+const hfdesc_t* algolist[] PROGMEM = {
+       (hfdesc_t*)&sha1_desc,
+       NULL
+};
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
@@ -119,40 +124,7 @@ void testrun_sha1_2(void){
 
 
 void testrun_performance_sha1(void){
-       uint64_t t;
-       char str[16];
-       uint8_t data[32];
-       sha1_ctx_t ctx;
-       
-       calibrateTimer();
-       print_overhead();
-       
-       memset(data, 0, 32);
-       
-       startTimer(1);
-       sha1_init(&ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       
-       startTimer(1);
-       sha1_nextBlock(&ctx, data);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tone-block time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       
-       startTimer(1);
-       sha1_lastBlock(&ctx, data, 0);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tlast block time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       cli_putstr_P(PSTR("\r\n"));
+       hfal_performance_multiple(algolist);
 }
 
 
@@ -184,11 +156,6 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
        { NULL,                NULL, NULL}
 };
 
-const hfdesc_t* algolist[] PROGMEM = {
-       (hfdesc_t*)&sha1_desc,
-       NULL
-};
-
 int main (void){
        DEBUG_INIT();
        
index c52d9ed9014351c43e3d249bcf020be2c70f29e6..80c864e1d7266199a2362cb9fe5e943a735fa47c 100644 (file)
@@ -29,6 +29,8 @@
 #include "sha256.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
+#include "hfal-performance.h"
+#include "hfal-nessie.h"
 
 #include <stdint.h>
 #include <string.h>
 
 char* algo_name = "SHA-256";
 
+const hfdesc_t* algolist[] PROGMEM = {
+       (hfdesc_t*)&sha256_desc,
+       NULL
+};
+
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
 
 void testrun_nessie_sha256(void){
-       nessie_hash_ctx.hashsize_b  = 256;
-       nessie_hash_ctx.blocksize_B = 512/8;
-       nessie_hash_ctx.ctx_size_B  = sizeof(sha256_ctx_t);
-       nessie_hash_ctx.name = algo_name;
-       nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)sha256_init;
-       nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)sha256_nextBlock;
-       nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)sha256_lastBlock;
-       nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)sha256_ctx2hash;
-       
-       nessie_hash_run();
+       hfal_nessie_multiple(algolist);
 }
 
 void testrun_performance_sha256(void){
-       uint64_t t;
-       char str[16];
-       uint8_t data[32];
-       sha256_ctx_t ctx;
-       
-       calibrateTimer();
-       print_overhead();
-       
-       memset(data, 0, 32);
-       
-       startTimer(1);
-       sha256_init(&ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       
-       startTimer(1);
-       sha256_nextBlock(&ctx, data);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tone-block time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       
-       startTimer(1);
-       sha256_lastBlock(&ctx, data, 0);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tlast block time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-       
-       cli_putstr_P(PSTR("\r\n"));
+       hfal_performance_multiple(algolist);
 }
 
 /*****************************************************************************
@@ -107,11 +72,6 @@ const char shavs_set_str[]   PROGMEM = "shavs_set";
 const char shavs_test1_str[] PROGMEM = "shavs_test1";
 const char dump_str[]        PROGMEM = "dump";
 
-const hfdesc_t* algolist[] PROGMEM = {
-       (hfdesc_t*)&sha256_desc,
-       NULL
-};
-
 cmdlist_entry_t cmdlist[] PROGMEM = {
        { nessie_str,          NULL, testrun_nessie_sha256},
        { test_str,            NULL, testrun_nessie_sha256},