X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-sha1-test.c;h=311bb055b39f5c9a8f55d4c275ddd5c2fd19f23f;hb=cccb1d3e008592ad7e4b57653afb95deb4d4a2c5;hp=1dc476c4c0cc420d0de777fc58f615971015f397;hpb=5c68d38237aa51b91a26309c24e8e38c7fbdffbe;p=avr-crypto-lib.git diff --git a/test_src/main-sha1-test.c b/test_src/main-sha1-test.c index 1dc476c..311bb05 100644 --- a/test_src/main-sha1-test.c +++ b/test_src/main-sha1-test.c @@ -23,12 +23,13 @@ #include "config.h" #include "serial-tools.h" -#include "uart.h" +#include "uart_i.h" #include "debug.h" #include "sha1.h" #include "nessie_hash_test.h" -#include "performance_test.h" +#include "hfal_sha1.h" +#include "hfal-performance.h" #include #include @@ -40,6 +41,10 @@ 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,16 +156,11 @@ cmdlist_entry_t cmdlist[] PROGMEM = { { NULL, NULL, NULL} }; -const hfdesc_t* algolist[] PROGMEM = { - (hfdesc_t*)&sha1_desc, - NULL -}; - int main (void){ DEBUG_INIT(); - cli_rx = uart_getc; - cli_tx = uart_putc; + cli_rx = (cli_rx_fpt)uart0_getc; + cli_tx = (cli_tx_fpt)uart0_putc; shavs_algolist=(hfdesc_t**)algolist; shavs_algo=(hfdesc_t*)&sha1_desc; for(;;){