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);
/* 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
# 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
--- /dev/null
+CLI_STD = debug.o uart.o hexdigit_tab.o dbz_strings.o cli.o string-extras.o
--- /dev/null
+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
$(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
$(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
# 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"
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"
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"
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"
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"
$(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
$(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
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
#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){
* 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";
#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 *
*****************************************************************************/
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);
}
#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 *
*****************************************************************************/
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);
}
{ NULL, NULL, NULL}
};
-const hfdesc_t* algolist[] PROGMEM = {
- (hfdesc_t*)&sha1_desc,
- NULL
-};
-
int main (void){
DEBUG_INIT();
#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);
}
/*****************************************************************************
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},