fixing bug in skein (asm); + new tools for hfal
This commit is contained in:
parent
2bded0b1cb
commit
7605b81a4b
|
@ -0,0 +1,61 @@
|
|||
/* hfal-nessie.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
* \file hfal-nessie.c
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nessie_hash_test.h"
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include <stdint.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
void hfal_nessie(const hfdesc_t* hd){
|
||||
if(pgm_read_byte(&(hd->type))!=HFDESC_TYPE_HASHFUNCTION)
|
||||
return;
|
||||
char name[1+strlen_P((void*)pgm_read_word(&(hd->name)))];
|
||||
strcpy_P(name, (void*)pgm_read_word(&(hd->name)));
|
||||
|
||||
nessie_hash_ctx.hashsize_b = pgm_read_word(&(hd->hashsize_b));
|
||||
nessie_hash_ctx.name = name;
|
||||
nessie_hash_ctx.blocksize_B = pgm_read_word(&(hd->blocksize_b))/8;
|
||||
nessie_hash_ctx.ctx_size_B = pgm_read_word(&(hd->ctxsize_B));
|
||||
nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)pgm_read_word(&(hd->init));
|
||||
nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)pgm_read_word(&(hd->nextBlock));
|
||||
nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)pgm_read_word(&(hd->lastBlock));
|
||||
nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)pgm_read_word(&(hd->ctx2hash));
|
||||
|
||||
nessie_hash_run();
|
||||
}
|
||||
|
||||
void hfal_nessie_multiple(const hfdesc_t** hd_list){
|
||||
const hfdesc_t* hd;
|
||||
for(;;){
|
||||
hd = (void*)pgm_read_word(hd_list);
|
||||
if(!hd)
|
||||
return;
|
||||
hfal_nessie(hd);
|
||||
hd_list = (void*)((uint8_t*)hd_list + 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* hfal-nessie.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
* \file hfal-nessie.h
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_NESSIE_H_
|
||||
#define HFAL_NESSIE_H_
|
||||
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
void hfal_nessie(const hfdesc_t* hd);
|
||||
void hfal_nessie_multiple(const hfdesc_t** hd_list);
|
||||
|
||||
#endif /* HFAL_NESSIE_H_ */
|
|
@ -0,0 +1,108 @@
|
|||
/* hfal-performance.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
* \file hfal-performance.c
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hfal-performance.h"
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "cli.h"
|
||||
#include "performance_test.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
|
||||
static
|
||||
void printvalue(unsigned int v){
|
||||
char str[20];
|
||||
int i;
|
||||
ultoa(v, str, 10);
|
||||
for(i=0; i<10-strlen(str); ++i){
|
||||
cli_putc(' ');
|
||||
}
|
||||
cli_putstr(str);
|
||||
}
|
||||
|
||||
void hfal_performance(const hfdesc_t* hd){
|
||||
hfdesc_t hf;
|
||||
memcpy_P(&hf, hd, sizeof(hfdesc_t));
|
||||
uint8_t ctx[hf.ctxsize_B];
|
||||
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();
|
||||
cli_putstr_P(PSTR("\r\n\r\n === "));
|
||||
cli_putstr_P(hf.name);
|
||||
cli_putstr_P(PSTR(" performance === "
|
||||
"\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(1);
|
||||
hf.init(&ctx);
|
||||
t = stopTimer();
|
||||
cli_putstr_P(PSTR("\r\n init (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
startTimer(1);
|
||||
hf.nextBlock(&ctx, data);
|
||||
t = stopTimer();
|
||||
cli_putstr_P(PSTR("\r\n nextBlock (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
startTimer(1);
|
||||
hf.lastBlock(&ctx, data, 0);
|
||||
t = stopTimer();
|
||||
cli_putstr_P(PSTR("\r\n lastBlock (cycles): "));
|
||||
printvalue(t);
|
||||
|
||||
startTimer(1);
|
||||
hf.ctx2hash(digest, &ctx);
|
||||
t = stopTimer();
|
||||
cli_putstr_P(PSTR("\r\n ctx2hash (cycles): "));
|
||||
printvalue(t);
|
||||
}
|
||||
|
||||
|
||||
void hfal_performance_multiple(const hfdesc_t** hd_list){
|
||||
const hfdesc_t* hd;
|
||||
for(;;){
|
||||
hd = (void*)pgm_read_word(hd_list);
|
||||
if(!hd)
|
||||
return;
|
||||
hfal_performance(hd);
|
||||
hd_list = (void*)((uint8_t*)hd_list + 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/* hfal-performance.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
* \file hfal-performance.h
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_PERFORMANCE_H_
|
||||
#define HFAL_PERFORMANCE_H_
|
||||
|
||||
#include "hashfunction_descriptor.h"
|
||||
|
||||
void hfal_performance(const hfdesc_t* hd);
|
||||
void hfal_performance_multiple(const hfdesc_t** hd_list);
|
||||
#endif /* HFAL_PERFORMANCE_H_ */
|
|
@ -0,0 +1,50 @@
|
|||
/* hfal-test.c */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
* \file hfal-test.c
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nessie_hash_test.h"
|
||||
#include "hfal-basic.h"
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include "cli.h"
|
||||
#include <stdint.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
void hfal_test(const hfdesc_t* hd, void* msg, uint32_t length_b){
|
||||
if(pgm_read_byte(&(hd->type))!=HFDESC_TYPE_HASHFUNCTION)
|
||||
return;
|
||||
uint16_t dlen = (pgm_read_word(&(hd->hashsize_b))+7)/8;
|
||||
uint8_t digest[dlen];
|
||||
cli_putstr_P(PSTR("\r\n=== "));
|
||||
cli_putstr_P((void*)pgm_read_word(&(hd->name)));
|
||||
cli_putstr_P(PSTR(" ===\r\n message:"));
|
||||
cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
|
||||
hfal_hash_mem(hd, digest, msg, length_b);
|
||||
cli_putstr_P(PSTR(" \r\n digest:"));
|
||||
cli_hexdump_block(digest, dlen, 4, 16);
|
||||
cli_putstr_P(PSTR("\r\n"));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/* hfal-test.h */
|
||||
/*
|
||||
This file is part of the AVR-Crypto-Lib.
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
* \file hfal-test.h
|
||||
* \author Daniel Otte
|
||||
* \email daniel.otte@rub.de
|
||||
* \date 2009-05-10
|
||||
* \license GPLv3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HFAL_TEST_H_
|
||||
#define HFAL_TEST_H_
|
||||
|
||||
#include "hashfunction_descriptor.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void hfal_test(const hfdesc_t* hd, void* msg, uint32_t length_b);
|
||||
|
||||
#endif /* HFAL_TEST_H_ */
|
|
@ -8,7 +8,8 @@ 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
|
||||
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)_NESSIE_TEST := test nessie
|
||||
$(ALGO_NAME)_PERFORMANCE_TEST := performance
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ $(ALGO_NAME)_OBJ := threefish_mix.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-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)_NESSIE_TEST := test nessie
|
||||
$(ALGO_NAME)_PERFORMANCE_TEST := performance
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ skein1024_ctx2hash:
|
|||
dec r24
|
||||
brne 6b
|
||||
/* store new dest */
|
||||
movw DEST0, r26
|
||||
movw DEST0, r30
|
||||
/* adjust counter and outsize_b*/
|
||||
subi OUTSIZE_B1, 2
|
||||
movw r30, UCTX0
|
||||
|
|
|
@ -228,7 +228,7 @@ skein256_ctx2hash:
|
|||
dec r24
|
||||
brne 6b
|
||||
/* store new dest */
|
||||
movw DEST0, r26
|
||||
movw DEST0, r30 ;XXX r26
|
||||
/* adjust counter and outsize_b*/
|
||||
dec OUTSIZE_B1
|
||||
movw r30, UCTX0
|
||||
|
|
|
@ -233,7 +233,7 @@ skein512_ctx2hash:
|
|||
dec r24
|
||||
brne 6b
|
||||
/* store new dest */
|
||||
movw DEST0, r26
|
||||
movw DEST0, r30
|
||||
/* adjust counter and outsize_b*/
|
||||
subi OUTSIZE_B1, 2
|
||||
movw r30, UCTX0
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include "blake_large.h"
|
||||
#include "hfal_blake_small.h"
|
||||
#include "hfal_blake_large.h"
|
||||
#include "hfal-nessie.h"
|
||||
#include "hfal-test.h"
|
||||
#include "hfal-performance.h"
|
||||
#include "shavs.h"
|
||||
#include "cli.h"
|
||||
#include "nessie_hash_test.h"
|
||||
|
@ -41,67 +44,36 @@
|
|||
|
||||
char* algo_name = "Blake";
|
||||
|
||||
|
||||
const hfdesc_t* algolist[] PROGMEM = {
|
||||
(hfdesc_t*)&blake28_desc,
|
||||
(hfdesc_t*)&blake32_desc,
|
||||
(hfdesc_t*)&blake48_desc,
|
||||
(hfdesc_t*)&blake64_desc,
|
||||
NULL
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* additional validation-functions *
|
||||
*****************************************************************************/
|
||||
|
||||
void testrun_nessie_blake(void){
|
||||
nessie_hash_ctx.hashsize_b = 224;
|
||||
nessie_hash_ctx.name = "Blake28";
|
||||
nessie_hash_ctx.blocksize_B = 512/8;
|
||||
nessie_hash_ctx.ctx_size_B = sizeof(blake28_ctx_t);
|
||||
nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)blake28_init;
|
||||
nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)blake28_nextBlock;
|
||||
nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)blake28_lastBlock;
|
||||
nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)blake28_ctx2hash;
|
||||
|
||||
nessie_hash_run();
|
||||
|
||||
nessie_hash_ctx.hashsize_b = 256;
|
||||
nessie_hash_ctx.name = "Blake32";
|
||||
nessie_hash_ctx.blocksize_B = 512/8;
|
||||
nessie_hash_ctx.ctx_size_B = sizeof(blake32_ctx_t);
|
||||
nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)blake32_init;
|
||||
nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)blake32_nextBlock;
|
||||
nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)blake32_lastBlock;
|
||||
nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)blake32_ctx2hash;
|
||||
|
||||
nessie_hash_run();
|
||||
hfal_nessie_multiple(algolist);
|
||||
}
|
||||
void blake28_test(void* msg, uint32_t length_b){
|
||||
uint8_t diggest[224/8];
|
||||
cli_putstr_P(PSTR("\r\n=== Blake28 test ===\r\n message:\r\n"));
|
||||
cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
|
||||
blake28(diggest, msg, length_b);
|
||||
cli_putstr_P(PSTR("\r\n diggest:\r\n"));
|
||||
cli_hexdump_block(diggest, 224/8, 4, 16);
|
||||
hfal_test(&blake28_desc, msg, length_b);
|
||||
}
|
||||
|
||||
void blake32_test(void* msg, uint32_t length_b){
|
||||
uint8_t diggest[256/8];
|
||||
cli_putstr_P(PSTR("\r\n=== Blake32 test ===\r\n message:\r\n"));
|
||||
cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
|
||||
blake32(diggest, msg, length_b);
|
||||
cli_putstr_P(PSTR("\r\n diggest:\r\n"));
|
||||
cli_hexdump_block(diggest, 256/8, 4, 16);
|
||||
hfal_test(&blake32_desc, msg, length_b);
|
||||
}
|
||||
|
||||
void blake48_test(void* msg, uint32_t length_b){
|
||||
uint8_t diggest[384/8];
|
||||
cli_putstr_P(PSTR("\r\n=== Blake48 test ===\r\n message:\r\n"));
|
||||
cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
|
||||
blake48(diggest, msg, length_b);
|
||||
cli_putstr_P(PSTR("\r\n diggest:\r\n"));
|
||||
cli_hexdump_block(diggest, 384/8, 4, 16);
|
||||
hfal_test(&blake48_desc, msg, length_b);
|
||||
}
|
||||
|
||||
void blake64_test(void* msg, uint32_t length_b){
|
||||
uint8_t diggest[512/8];
|
||||
cli_putstr_P(PSTR("\r\n=== Blake48 test ===\r\n message:\r\n"));
|
||||
cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
|
||||
blake64(diggest, msg, length_b);
|
||||
cli_putstr_P(PSTR("\r\n diggest:\r\n"));
|
||||
cli_hexdump_block(diggest, 512/8, 4, 16);
|
||||
hfal_test(&blake64_desc, msg, length_b);
|
||||
}
|
||||
void testrun_stdtest_blake(void){
|
||||
uint8_t msg1[144];
|
||||
|
@ -226,27 +198,25 @@ void performance_blake(void){
|
|||
|
||||
}
|
||||
|
||||
void autoperformance_blake(void){
|
||||
hfal_performance_multiple(algolist);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* main *
|
||||
*****************************************************************************/
|
||||
|
||||
const hfdesc_t* algolist[] PROGMEM = {
|
||||
(hfdesc_t*)&blake28_desc,
|
||||
(hfdesc_t*)&blake32_desc,
|
||||
(hfdesc_t*)&blake48_desc,
|
||||
(hfdesc_t*)&blake64_desc,
|
||||
NULL
|
||||
};
|
||||
|
||||
const char nessie_str[] PROGMEM = "nessie";
|
||||
const char test_str[] PROGMEM = "test";
|
||||
const char testshort_str[] PROGMEM = "short";
|
||||
const char testlshort_str[] PROGMEM = "lshort";
|
||||
const char performance_str[] PROGMEM = "performance";
|
||||
const char echo_str[] PROGMEM = "echo";
|
||||
const char shavs_list_str[] PROGMEM = "shavs_list";
|
||||
const char shavs_set_str[] PROGMEM = "shavs_set";
|
||||
const char shavs_test1_str[] PROGMEM = "shavs_test1";
|
||||
const char nessie_str[] PROGMEM = "nessie";
|
||||
const char test_str[] PROGMEM = "test";
|
||||
const char testshort_str[] PROGMEM = "short";
|
||||
const char testlshort_str[] PROGMEM = "lshort";
|
||||
const char performance_str[] PROGMEM = "performance";
|
||||
const char aperformance_str[] PROGMEM = "autoperformance";
|
||||
const char echo_str[] PROGMEM = "echo";
|
||||
const char shavs_list_str[] PROGMEM = "shavs_list";
|
||||
const char shavs_set_str[] PROGMEM = "shavs_set";
|
||||
const char shavs_test1_str[] PROGMEM = "shavs_test1";
|
||||
|
||||
cmdlist_entry_t cmdlist[] PROGMEM = {
|
||||
{ nessie_str, NULL, testrun_nessie_blake},
|
||||
|
@ -254,6 +224,7 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
|
|||
{ testshort_str, NULL, testshort},
|
||||
{ testlshort_str, NULL, testlshort},
|
||||
{ performance_str, NULL, performance_blake},
|
||||
{ aperformance_str, NULL, autoperformance_blake},
|
||||
{ shavs_list_str, NULL, shavs_listalgos},
|
||||
{ shavs_set_str, (void*)1, (void_fpt)shavs_setalgo},
|
||||
{ shavs_test1_str, NULL, shavs_test1},
|
||||
|
|
|
@ -32,7 +32,11 @@
|
|||
#include "hfal_skein1024.h"
|
||||
#include "cli.h"
|
||||
#include "shavs.h"
|
||||
#include "nessie_hash_test.h"
|
||||
#include "performance_test.h"
|
||||
#include "hfal-performance.h"
|
||||
#include "hfal-nessie.h"
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
@ -40,6 +44,32 @@
|
|||
|
||||
char* algo_name = "Skein";
|
||||
|
||||
const hfdesc_t* algolist[] PROGMEM = {
|
||||
(hfdesc_t*)&skein256_128_desc,
|
||||
(hfdesc_t*)&skein256_160_desc,
|
||||
(hfdesc_t*)&skein256_224_desc,
|
||||
(hfdesc_t*)&skein256_256_desc,
|
||||
(hfdesc_t*)&skein256_384_desc,
|
||||
(hfdesc_t*)&skein256_512_desc,
|
||||
|
||||
(hfdesc_t*)&skein512_128_desc,
|
||||
(hfdesc_t*)&skein512_160_desc,
|
||||
(hfdesc_t*)&skein512_224_desc,
|
||||
(hfdesc_t*)&skein512_256_desc,
|
||||
(hfdesc_t*)&skein512_384_desc,
|
||||
(hfdesc_t*)&skein512_512_desc,
|
||||
(hfdesc_t*)&skein512_1024_desc,
|
||||
|
||||
(hfdesc_t*)&skein1024_128_desc,
|
||||
(hfdesc_t*)&skein1024_160_desc,
|
||||
(hfdesc_t*)&skein1024_224_desc,
|
||||
(hfdesc_t*)&skein1024_256_desc,
|
||||
(hfdesc_t*)&skein1024_384_desc,
|
||||
(hfdesc_t*)&skein1024_512_desc,
|
||||
(hfdesc_t*)&skein1024_1024_desc,
|
||||
NULL
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* additional validation-functions *
|
||||
*****************************************************************************/
|
||||
|
@ -175,6 +205,12 @@ void zeromsg_test_common(char* p){
|
|||
}
|
||||
|
||||
void performance_skein(void){
|
||||
hfal_performance_multiple(algolist);
|
||||
}
|
||||
|
||||
void testrun_nessie_skein(void){
|
||||
nessie_hash_quick = 1;
|
||||
hfal_nessie_multiple(algolist);
|
||||
}
|
||||
|
||||
|
||||
|
@ -182,31 +218,6 @@ void performance_skein(void){
|
|||
* main *
|
||||
*****************************************************************************/
|
||||
|
||||
const hfdesc_t* algolist[] PROGMEM = {
|
||||
(hfdesc_t*)&skein256_128_desc,
|
||||
(hfdesc_t*)&skein256_160_desc,
|
||||
(hfdesc_t*)&skein256_224_desc,
|
||||
(hfdesc_t*)&skein256_256_desc,
|
||||
(hfdesc_t*)&skein256_384_desc,
|
||||
(hfdesc_t*)&skein256_512_desc,
|
||||
|
||||
(hfdesc_t*)&skein512_128_desc,
|
||||
(hfdesc_t*)&skein512_160_desc,
|
||||
(hfdesc_t*)&skein512_224_desc,
|
||||
(hfdesc_t*)&skein512_256_desc,
|
||||
(hfdesc_t*)&skein512_384_desc,
|
||||
(hfdesc_t*)&skein512_512_desc,
|
||||
(hfdesc_t*)&skein512_1024_desc,
|
||||
|
||||
(hfdesc_t*)&skein1024_128_desc,
|
||||
(hfdesc_t*)&skein1024_160_desc,
|
||||
(hfdesc_t*)&skein1024_224_desc,
|
||||
(hfdesc_t*)&skein1024_256_desc,
|
||||
(hfdesc_t*)&skein1024_384_desc,
|
||||
(hfdesc_t*)&skein1024_512_desc,
|
||||
(hfdesc_t*)&skein1024_1024_desc,
|
||||
NULL
|
||||
};
|
||||
|
||||
const char nessie_str[] PROGMEM = "nessie";
|
||||
const char test_str[] PROGMEM = "test";
|
||||
|
@ -218,7 +229,7 @@ const char shavs_set_str[] PROGMEM = "shavs_set";
|
|||
const char shavs_test1_str[] PROGMEM = "shavs_test1";
|
||||
|
||||
cmdlist_entry_t cmdlist[] PROGMEM = {
|
||||
// { nessie_str, NULL, testrun_nessie_skein},
|
||||
{ nessie_str, NULL, testrun_nessie_skein},
|
||||
{ performance_str, NULL, performance_skein},
|
||||
{ test_str, NULL, testrun_stdtest_skein},
|
||||
{ ztest_str, (void*)1, (void_fpt)zeromsg_test_common},
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "dbz_strings.h"
|
||||
|
||||
nessie_hash_ctx_t nessie_hash_ctx;
|
||||
uint8_t nessie_hash_quick=0;
|
||||
|
||||
#define HASHSIZE_B ((nessie_hash_ctx.hashsize_b+7)/8)
|
||||
#define BLOCKSIZE_B (nessie_hash_ctx.blocksize_B)
|
||||
|
@ -185,6 +186,8 @@ void tv4_hash(void){
|
|||
nessie_hash_ctx.hash_last(ctx, block, n);
|
||||
nessie_hash_ctx.hash_conv(hash, ctx);
|
||||
nessie_print_item("hash", hash, (nessie_hash_ctx.hashsize_b+7)/8);
|
||||
if(nessie_hash_quick)
|
||||
return;
|
||||
for(i=1; i<100000L; ++i){ /* this assumes BLOCKSIZE >= HASHSIZE */
|
||||
nessie_hash_ctx.hash_init(ctx);
|
||||
nessie_hash_ctx.hash_last(ctx, hash, nessie_hash_ctx.hashsize_b);
|
||||
|
@ -242,7 +245,8 @@ void nessie_hash_run(void){
|
|||
ascii_hash_P(challange[2*i], challange[2*i+1]);
|
||||
}
|
||||
nessie_print_set_vector(set, i);
|
||||
amillion_hash();
|
||||
if(!nessie_hash_quick)
|
||||
amillion_hash();
|
||||
/* test set 2 */
|
||||
set=2;
|
||||
nessie_print_setheader(set);
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef struct nessie_hash_ctx_st{
|
|||
|
||||
|
||||
extern nessie_hash_ctx_t nessie_hash_ctx;
|
||||
|
||||
extern uint8_t nessie_hash_quick;
|
||||
void nessie_hash_run(void);
|
||||
|
||||
#endif /*NESSIE_HASH_TEST_H_*/
|
||||
|
|
Loading…
Reference in New Issue