X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=hfal-performance.c;h=70f2ef15eb37ed2736669bcef2c5f69b37370db2;hb=f02dfa3ab0f34d6b9ef4afc5aa336255fd21882c;hp=5108f2544d7ad5a8ef5276b7e1440b8411a35cfc;hpb=2deab9197b8d9d74c01156777b250746c36fba07;p=avr-crypto-lib.git diff --git a/hfal-performance.c b/hfal-performance.c index 5108f25..70f2ef1 100644 --- a/hfal-performance.c +++ b/hfal-performance.c @@ -22,7 +22,7 @@ * \email daniel.otte@rub.de * \date 2009-05-10 * \license GPLv3 or later - * + * */ #include "hfal-performance.h" @@ -53,22 +53,24 @@ void hfal_performance(const hfdesc_t* hd){ uint8_t data[(hf.blocksize_b+7)/8]; uint8_t digest[(hf.hashsize_b+7)/8]; uint64_t t; - + if(hf.type!=HFDESC_TYPE_HASHFUNCTION) return; calibrateTimer(); + print_overhead(); cli_putstr_P(PSTR("\r\n\r\n === ")); cli_putstr_P(hf.name); cli_putstr_P(PSTR(" performance === " + "\r\n type: hashfunction" "\r\n hashsize (bits): ")); printvalue(hf.hashsize_b); - + cli_putstr_P(PSTR("\r\n ctxsize (bytes): ")); printvalue(hf.ctxsize_B); - + cli_putstr_P(PSTR("\r\n blocksize (bits): ")); printvalue(hf.blocksize_b); - + startTimer(0); START_TIMER; hf.init(&ctx); @@ -76,7 +78,7 @@ void hfal_performance(const hfdesc_t* hd){ t = stopTimer(); cli_putstr_P(PSTR("\r\n init (cycles): ")); printvalue(t); - + startTimer(0); START_TIMER; hf.nextBlock(&ctx, data); @@ -84,7 +86,7 @@ void hfal_performance(const hfdesc_t* hd){ t = stopTimer(); cli_putstr_P(PSTR("\r\n nextBlock (cycles): ")); printvalue(t); - + startTimer(0); START_TIMER; hf.lastBlock(&ctx, data, 0); @@ -92,7 +94,7 @@ void hfal_performance(const hfdesc_t* hd){ t = stopTimer(); cli_putstr_P(PSTR("\r\n lastBlock (cycles): ")); printvalue(t); - + startTimer(0); START_TIMER; hf.ctx2hash(digest, &ctx); @@ -107,8 +109,10 @@ void hfal_performance_multiple(const hfdesc_t** hd_list){ const hfdesc_t* hd; for(;;){ hd = (void*)pgm_read_word(hd_list); - if(!hd) + if(!hd){ + cli_putstr_P(PSTR("\r\n\r\n End of performance figures\r\n")); return; + } hfal_performance(hd); hd_list = (void*)((uint8_t*)hd_list + 2); }