switching to new main-*-test layout and to stdio streams

This commit is contained in:
bg 2012-08-27 00:37:31 +02:00
parent 4655b60cc2
commit a45c328791
62 changed files with 389 additions and 1502 deletions

View File

@ -1,3 +1,5 @@
MAKE_DEBUG = 1
DEBUG = -gdwarf-2
WARNING = -pedantic -Wall -Werror -Wstrict-prototypes
PROGRAMMER = jtagmkII

View File

@ -1,15 +0,0 @@
# Makefile for AES
ALGO_NAME := AES128_C
# comment out the following line for removement of AES from the build process
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_DIR := aes/
$(ALGO_NAME)_INCDIR := gf256mul/ bcal/
$(ALGO_NAME)_OBJ := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
aes_keyschedule.o gf256mul.o aes128_enc.o aes128_dec.o
$(ALGO_NAME)_TESTBIN := main-aes128-test.o $(CLI_STD) $(BCAL_STD) \
bcal_aes128.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -1,15 +0,0 @@
# Makefile for AES
ALGO_NAME := AES192_C
# comment out the following line for removement of AES from the build process
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_DIR := aes/
$(ALGO_NAME)_INCDIR := gf256mul/ bcal/
$(ALGO_NAME)_OBJ := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
aes_keyschedule.o gf256mul.o aes192_enc.o aes192_dec.o
$(ALGO_NAME)_TESTBIN := main-aes192-test.o $(CLI_STD) $(BCAL_STD) \
bcal_aes192.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -1,15 +0,0 @@
# Makefile for AES
ALGO_NAME := AES256_C
# comment out the following line for removement of AES from the build process
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_DIR := aes/
$(ALGO_NAME)_INCDIR := gf256mul/ bcal/
$(ALGO_NAME)_OBJ := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
aes_keyschedule.o gf256mul.o aes256_enc.o aes256_dec.o
$(ALGO_NAME)_TESTBIN := main-aes256-test.o $(CLI_STD) $(BCAL_STD) \
bcal_aes256.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -21,18 +21,11 @@
*
*/
#include "config.h"
#include "main-test-common.h"
#include "uart_i.h"
#include "debug.h"
#include <A5_1.h>
#include "A5_1.h"
#include "nessie_stream_test.h"
#include <stdint.h>
#include <string.h>
#include "cli.h"
char* algo_name = "A5_1";
/*****************************************************************************
@ -76,16 +69,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
main_setup();
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -1,141 +0,0 @@
/* main-aes128-test.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 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/>.
*/
/*
* AES-128 test-suit
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "aes.h"
#include "cli.h"
#include "performance_test.h"
#include "blockcipher_descriptor.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_aes128.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
char* algo_name = "AES-128";
const bcdesc_t* const algolist[] PROGMEM = {
(bcdesc_t*)&aes128_desc,
NULL
};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_nessie_aes(void){
bcal_nessie_multiple(algolist);
}
void testrun_test_aes(void){
uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16,
0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88,
0x09, 0xcf, 0x4f, 0x3c };
uint8_t data[16] = { 0x32, 0x43, 0xf6, 0xa8,
0x88, 0x5a, 0x30, 0x8d,
0x31, 0x31, 0x98, 0xa2,
0xe0, 0x37, 0x07, 0x34 };
aes128_ctx_t ctx;
aes128_init(key, &ctx);
cli_putstr_P(PSTR("\r\n\r\n cipher test (FIPS 197):\r\n key: "));
cli_hexdump(key, 16);
cli_putstr_P(PSTR("\r\n plaintext: "));
cli_hexdump(data, 16);
aes128_enc(data, &ctx);
cli_putstr_P(PSTR("\r\n ciphertext: "));
cli_hexdump(data, 16);
aes128_dec(data, &ctx);
cli_putstr_P(PSTR("\r\n plaintext: "));
cli_hexdump(data, 16);
}
void testrun_testkey_aes128(void){
uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16,
0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88,
0x09, 0xcf, 0x4f, 0x3c};
aes128_ctx_t ctx;
uint8_t i;
aes128_init(key, &ctx);
cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key: "));
cli_hexdump(key, 16);
for(i=0; i<11; ++i){
cli_putstr_P(PSTR("\r\n index: "));
cli_putc('0'+i/10);
cli_putc('0'+i%10);
cli_putstr_P(PSTR(" roundkey "));
cli_hexdump(ctx.key[i].ks, 16);
}
}
void testrun_testkey_aes(void){
testrun_testkey_aes128();
}
/*****************************************************************************/
void testrun_performance_aes(void){
bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
*****************************************************************************/
const char nessie_str[] PROGMEM = "nessie";
const char test_str[] PROGMEM = "test";
const char testkey_str[] PROGMEM = "testkey";
const char performance_str[] PROGMEM = "performance";
const char echo_str[] PROGMEM = "echo";
const cmdlist_entry_t cmdlist[] PROGMEM = {
{ nessie_str, NULL, testrun_nessie_aes },
{ test_str, NULL, testrun_test_aes},
{ testkey_str, NULL, testrun_testkey_aes},
{ performance_str, NULL, testrun_performance_aes},
{ echo_str, (void*)1, (void_fpt)echo_ctrl},
{ NULL, NULL, NULL}
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
}
}

View File

@ -1,120 +0,0 @@
/* main-aes192-test.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 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/>.
*/
/*
* AES-192 test-suit
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "aes.h"
#include "cli.h"
#include "performance_test.h"
#include "blockcipher_descriptor.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_aes192.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
char* algo_name = "AES-192";
const bcdesc_t* const algolist[] PROGMEM = {
(bcdesc_t*)&aes192_desc,
NULL
};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_nessie_aes(void){
bcal_nessie_multiple(algolist);
}
void testrun_testkey_aes192(void){
uint8_t key[24] = { 0x8e, 0x73, 0xb0, 0xf7,
0xda, 0x0e, 0x64, 0x52,
0xc8, 0x10, 0xf3, 0x2b,
0x80, 0x90, 0x79, 0xe5,
0x62, 0xf8, 0xea, 0xd2,
0x52, 0x2c, 0x6b, 0x7b};
aes192_ctx_t ctx;
uint8_t i;
memset(&ctx, 0, sizeof(aes192_ctx_t));
aes192_init(key, &ctx);
cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key: "));
cli_hexdump(key, 24);
for(i=0; i<13; ++i){
cli_putstr_P(PSTR("\r\n index: "));
cli_putc('0'+i/10);
cli_putc('0'+i%10);
cli_putstr_P(PSTR(" roundkey "));
cli_hexdump(ctx.key[i].ks, 16);
}
}
void testrun_testkey_aes(void){
testrun_testkey_aes192();
}
/*****************************************************************************/
void testrun_performance_aes(void){
bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
*****************************************************************************/
const char nessie_str[] PROGMEM = "nessie";
const char test_str[] PROGMEM = "test";
const char testkey_str[] PROGMEM = "testkey";
const char performance_str[] PROGMEM = "performance";
const char echo_str[] PROGMEM = "echo";
const cmdlist_entry_t cmdlist[] PROGMEM = {
{ nessie_str, NULL, testrun_nessie_aes },
{ test_str, NULL, testrun_nessie_aes},
{ testkey_str, NULL, testrun_testkey_aes},
{ performance_str, NULL, testrun_performance_aes},
{ echo_str, (void*)1, (void_fpt)echo_ctrl},
{ NULL, NULL, NULL}
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
}
}

View File

@ -1,120 +0,0 @@
/* main-aes256-test.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 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/>.
*/
/*
* AES-256 test-suit
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "aes.h"
#include "cli.h"
#include "performance_test.h"
#include "blockcipher_descriptor.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_aes256.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
char* algo_name = "AES-256";
const bcdesc_t* const algolist[] PROGMEM = {
(bcdesc_t*)&aes256_desc,
NULL
};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_nessie_aes(void){
bcal_nessie_multiple(algolist);
}
void testrun_testkey_aes256(void){
uint8_t key[32] = { 0x60, 0x3d, 0xeb, 0x10,
0x15, 0xca, 0x71, 0xbe,
0x2b, 0x73, 0xae, 0xf0,
0x85, 0x7d, 0x77, 0x81,
0x1f, 0x35, 0x2c, 0x07,
0x3b, 0x61, 0x08, 0xd7,
0x2d, 0x98, 0x10, 0xa3,
0x09, 0x14, 0xdf, 0xf4};
aes256_ctx_t ctx;
uint8_t i;
memset(&ctx, 0, sizeof(aes256_ctx_t));
aes256_init(key, &ctx);
cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key: "));
cli_hexdump(key, 32);
for(i=0; i<15; ++i){
cli_putstr_P(PSTR("\r\n index: "));
cli_putc('0'+i/10);
cli_putc('0'+i%10);
cli_putstr_P(PSTR(" roundkey "));
cli_hexdump(ctx.key[i].ks, 16);
}
}
void testrun_testkey_aes(void){
testrun_testkey_aes256();
}
/*****************************************************************************/
void testrun_performance_aes(void){
bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
*****************************************************************************/
const char nessie_str[] PROGMEM = "nessie";
const char test_str[] PROGMEM = "test";
const char testkey_str[] PROGMEM = "testkey";
const char performance_str[] PROGMEM = "performance";
const char echo_str[] PROGMEM = "echo";
const cmdlist_entry_t cmdlist[] PROGMEM = {
{ nessie_str, NULL, testrun_nessie_aes },
{ test_str, NULL, testrun_nessie_aes},
{ testkey_str, NULL, testrun_testkey_aes},
{ performance_str, NULL, testrun_performance_aes},
{ echo_str, (void*)1, (void_fpt)echo_ctrl},
{ NULL, NULL, NULL}
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
}
}

View File

@ -21,23 +21,15 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "noekeon.h"
#include "noekeon_prng.h"
#include "base64_enc.h"
#include "base64_dec.h"
#include "cli.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Base64";
/*****************************************************************************
@ -152,14 +144,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
main_setup();
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,23 +21,15 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "noekeon.h"
#include "noekeon_prng.h"
#include "bigint.h"
#include "bigint_io.h"
#include "cli.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "BigInt";
/*****************************************************************************
@ -531,14 +523,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "blake_small.h"
#include "blake_large.h"
@ -34,17 +31,11 @@
#include "hfal-test.h"
#include "hfal-performance.h"
#include "shavs.h"
#include "cli.h"
#include "nessie_hash_test.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Blake";
const hfdesc_t* const algolist[] PROGMEM = {
(hfdesc_t*)&blake224_desc,
(hfdesc_t*)&blake256_desc,
@ -149,21 +140,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&blake256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,25 +21,19 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "bmw_small.h"
#include "bmw_large.h"
#include "cli.h"
#include "hfal_bmw_small.h"
#include "hfal_bmw_large.h"
#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>
#include <stdlib.h>
#include "performance_test.h"
char* algo_name = "BlueMidnightWish";
@ -173,21 +167,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&bmw256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,21 +21,13 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "camellia.h"
#include "performance_test.h"
#include "cli.h"
#include "bcal_camellia128.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
char* algo_name = "Camellia";
@ -183,15 +175,11 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,21 +21,13 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include <cast5.h>
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_cast5.h"
#include "cli.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "cast-128 (cast5)";
@ -172,14 +164,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -3,23 +3,14 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "cast6.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_cast6.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
char* algo_name = "CAST-256";
const bcdesc_t* const algolist[] PROGMEM = {
@ -117,13 +108,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,22 +21,14 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "cscipher.h"
#include "bcal-nessie.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal_cscipher.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "CS-Cipher";
const bcdesc_t* const algolist[] PROGMEM = {
@ -148,14 +140,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,12 +21,9 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "cubehash.h"
#include "cli.h"
#include "hfal_cubehash.h"
#include "shavs.h"
#include "nessie_hash_test.h"
@ -35,10 +32,6 @@
#include "hfal-performance.h"
#include "hfal-test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "CubeHash";
@ -99,21 +92,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&cubehash256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "noekeon.h"
#include "noekeon_prng.h"
@ -33,14 +30,10 @@
#include "dsa.h"
#include "dsa_key_blob.h"
#include "cli.h"
#include "performance_test.h"
#include "hfal_sha1.h"
#include "base64_enc.h"
#include "base64_dec.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "DSA";
@ -178,14 +171,10 @@ const const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,12 +21,9 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "echo.h"
#include "cli.h"
#include "hfal_echo.h"
#include "shavs.h"
#include "nessie_hash_test.h"
@ -35,10 +32,6 @@
#include "hfal-performance.h"
#include "hfal-test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Echo";

View File

@ -21,20 +21,12 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "entropium.h"
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Entropium";
/*****************************************************************************
@ -105,14 +97,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
main_setup();
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,11 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "cli.h"
#include "main-test-common.h"
#include "grain.h"
#include "scal_grain.h"
@ -33,10 +29,6 @@
#include "scal-nessie.h"
#include "performance_test.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* algo_name = "Grain";
/*****************************************************************************
@ -162,14 +154,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "groestl_small.h"
#include "groestl_large.h"
@ -34,14 +31,9 @@
#include "hfal-test.h"
#include "hfal-performance.h"
#include "shavs.h"
#include "cli.h"
#include "nessie_hash_test.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Groestl";
@ -147,21 +139,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&groestl256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,23 +21,12 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "md5.h"
#include "hmac-md5.h"
/*
#include "base64_enc.h"
#include "base64_dec.h"
*/
#include "nessie_mac_test.h"
#include <stdint.h>
#include <string.h>
#include "cli.h"
char* algo_name = "HMAC-MD5";
/*****************************************************************************
@ -182,13 +171,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,20 +21,13 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "sha1.h"
#include "hmac-sha1.h"
#include "nessie_mac_test.h"
#include <stdint.h>
#include <string.h>
#include "cli.h"
char* algo_name = "HMAC-SHA1";
/*****************************************************************************
@ -74,14 +67,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,20 +21,13 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "sha256.h"
#include "hmac-sha256.h"
#include "cli.h"
#include "nessie_mac_test.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "HMAC-SHA256";
/*****************************************************************************
@ -92,14 +85,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "jh_simple.h"
#include "hfal_jh.h"
@ -32,14 +29,9 @@
#include "hfal-test.h"
#include "hfal-performance.h"
#include "shavs.h"
#include "cli.h"
#include "nessie_hash_test.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "JH";
@ -101,21 +93,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&jh256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,12 +21,9 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "keccak.h"
#include "cli.h"
#include "hfal_keccak.h"
#include "shavs.h"
#include "nessie_hash_test.h"
@ -35,10 +32,6 @@
#include "hfal-performance.h"
#include "hfal-test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Keccak";
@ -100,21 +93,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&keccak256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -20,23 +20,14 @@
* khazad test-suit
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "khazad.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_khazad.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Khazad";
const bcdesc_t* const algolist[] PROGMEM = {
@ -113,14 +104,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "md5.h"
#include "nessie_hash_test.h"
@ -32,11 +29,6 @@
#include "hfal_md5.h"
#include "hfal-performance.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "cli.h"
char* algo_name = "MD5";
const hfdesc_t* const algolist[] PROGMEM = {
@ -140,15 +132,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
testrun_md5();
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -3,20 +3,14 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "cli.h"
#include "main-test-common.h"
#include "mickey128.h"
#include "scal_mickey128.h"
#include "scal-basic.h"
#include "scal-nessie.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "Mickey128";
/*****************************************************************************
@ -127,14 +121,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,19 +21,12 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "cli.h"
#include "mqq160-sign.h"
#include "mqq160-sign_P.h"
#include "mqq160-sign_testkey.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
#include "stack_measuring.h"
char* algo_name = "MQQ160-sign";
@ -186,19 +179,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,20 +21,12 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "mugi.h"
#include "nessie_stream_test.h"
#include "cli.h"
#include "performance_test.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* algo_name = "MUGI";
/*****************************************************************************
@ -127,15 +119,11 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,21 +21,13 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "noekeon.h"
#include "bcal-nessie.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal_noekeon.h"
#include "cli.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Noekeon";
@ -164,14 +156,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,22 +21,14 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "noekeon.h"
#include "omac_noekeon.h"
#include "cli.h"
#include "nessie_mac_test.h"
#include "performance_test.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* algo_name = "OMAC-Noekeon";
/*****************************************************************************
@ -166,14 +158,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -17,26 +17,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "rabbit.h"
#include "cli.h"
#include "performance_test.h"
#include "scal_rabbit.h"
#include "scal-basic.h"
#include "scal-nessie.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <avr/pgmspace.h>
const char* algo_name = "Rabbit";
/*****************************************************************************
@ -226,15 +215,11 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,22 +21,14 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "rc5.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_rc5.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#define RC5_ROUNDS 12
char* algo_name = "RC5-32/12/16";
@ -78,14 +70,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,22 +21,14 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "rc6.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_rc6.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#define RC6_ROUNDS 20
char* algo_name = "RC6-32/20/16";
@ -77,14 +69,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -18,23 +18,15 @@
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "salsa20.h"
#include "cli.h"
#include "performance_test.h"
#include "scal_salsa20.h"
#include "scal-basic.h"
#include "scal-nessie.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* algo_name = "Salsa20";
/*****************************************************************************
@ -279,15 +271,11 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -26,22 +26,16 @@
* GPLv3 or later
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "seed.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_seed.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Seed";
const bcdesc_t* const algolist[] PROGMEM = {
@ -140,14 +134,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,22 +21,15 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "serpent.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_serpent.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Serpent";
const bcdesc_t* const algolist[] PROGMEM = {
@ -90,14 +83,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,20 +21,14 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "sha1.h"
#include "nessie_hash_test.h"
#include "hfal_sha1.h"
#include "hfal-performance.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "cli.h"
#include "shavs.h"
#include "hfal_sha1.h"
#include "dump.h"
@ -210,16 +204,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&sha1_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,8 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "sha256.h"
#include "nessie_hash_test.h"
@ -32,12 +30,9 @@
#include "hfal-performance.h"
#include "hfal-nessie.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "cli.h"
#include "shavs.h"
#include "hfal_sha256.h"
#include "dump.h"
char* algo_name = "SHA-256";
@ -155,16 +150,13 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&sha256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,13 +21,10 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "shabal.h"
#include "cli.h"
#include "hfal_shabal.h"
#include "hfal-test.h"
#include "hfal-nessie.h"
@ -36,13 +33,8 @@
#include "nessie_hash_test.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Shabal";
const hfdesc_t* const algolist[] PROGMEM = {
(hfdesc_t*)&shabal192_desc,
(hfdesc_t*)&shabal224_desc,
@ -220,21 +212,13 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&shabal256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR("; "));
cli_putstr(__DATE__);
cli_putstr_P(PSTR(" "));
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -25,20 +25,13 @@
* GPLv3 or later
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "shabea.h"
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Shabea";
/*****************************************************************************
@ -180,14 +173,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,20 +21,12 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "shacal1_enc.h"
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* algo_name = "Shacal1 encryption only";
/*****************************************************************************
@ -97,14 +89,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,20 +21,12 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "shacal2_enc.h"
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* algo_name = "Shacal2 encryption only";
/*****************************************************************************
@ -97,14 +89,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,24 +21,15 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "skipjack.h"
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_skipjack.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Skipjack";
const bcdesc_t* const algolist[] PROGMEM = {
@ -175,14 +166,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,23 +21,15 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "des.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_tdes.h"
#include "bcal_tdes2.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "TDES";
const bcdesc_t* const algolist[] PROGMEM = {
@ -75,14 +67,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -52,5 +52,5 @@ void welcome_msg(const char* algoname){
cli_putstr(__TIME__);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
*/
printf_P(PSTR("\n\nAVR-Crypto-Lib VS(%s; %s %s)\nloaded and running\n"), algoname, __DATE__, __TIME__);
printf_P(PSTR("\n\nAVR-Crypto-Lib VS(%s; %s %s)\nloaded and running\n"), algoname, __DATE__, __TIME__);
}

View File

@ -21,13 +21,10 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "threefish.h"
#include "cli.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
@ -35,10 +32,6 @@
#include "bcal_threefish512.h"
#include "bcal_threefish1024.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "Threefish";
const bcdesc_t* const algolist[] PROGMEM = {
@ -267,14 +260,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -17,15 +17,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Mickey128 test-suit
* Trivium test-suit
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "cli.h"
#include "main-test-common.h"
#include "trivium.h"
#include "scal_trivium.h"
@ -33,10 +29,6 @@
#include "scal-nessie.h"
#include "performance_test.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* algo_name = "Trivium";
/*****************************************************************************
@ -143,14 +135,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,8 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "twister-small.h"
#include "twister-large.h"
@ -39,12 +37,6 @@
#include "hfal-test.h"
#include "shavs.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "cli.h"
char* algo_name = "TWISTER";
const hfdesc_t* const algolist[] PROGMEM = {
@ -139,16 +131,13 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
main_setup();
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&twister256_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,19 +21,11 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "ubi.h"
#include "cli.h"
#include "performance_test.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
char* algo_name = "UBI-Threefish";
/*****************************************************************************
@ -194,14 +186,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "whirlpool.h"
#include "nessie_hash_test.h"
@ -32,10 +29,6 @@
#include "hfal-performance.h"
#include "hfal-nessie.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "cli.h"
#include "shavs.h"
#include "hfal_whirlpool_0.h"
#include "dump.h"
@ -156,16 +149,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&whirlpool_0_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,8 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "whirlpool.h"
#include "nessie_hash_test.h"
@ -32,10 +30,6 @@
#include "hfal-performance.h"
#include "hfal-nessie.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "cli.h"
#include "shavs.h"
#include "hfal_whirlpool_t.h"
#include "dump.h"
@ -156,16 +150,13 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&whirlpool_t_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,7 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "whirlpool.h"
#include "nessie_hash_test.h"
@ -32,10 +29,6 @@
#include "hfal-performance.h"
#include "hfal-nessie.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "cli.h"
#include "shavs.h"
#include "hfal_whirlpool.h"
#include "dump.h"
@ -156,16 +149,12 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
main_setup();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&whirlpool_desc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -21,10 +21,8 @@
*
*/
#include "config.h"
#include "uart_i.h"
#include "debug.h"
#include "main-test-common.h"
#include "xtea.h"
#include "nessie_bc_test.h"
@ -32,10 +30,6 @@
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_xtea.h"
#include "cli.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "XTEA";
@ -91,14 +85,10 @@ const cmdlist_entry_t cmdlist[] PROGMEM = {
};
int main (void){
DEBUG_INIT();
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);
cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
cmd_interface(cmdlist);
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}

View File

@ -28,62 +28,69 @@
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <stdlib.h> /* utoa() */
#include "nessie_common.h"
#include "hexdigit_tab.h"
#define nessie_out_file stdout
void nessie_set_output_stream(FILE* out_stream){
nessie_out_file = out_stream;
}
#ifdef NESSIE_ALIVE
void nessie_send_alive(void){
NESSIE_PUTC(NESSIE_ALIVE_CHAR);
putc(NESSIE_ALIVE_CHAR, nessie_out_file);
}
void nessie_send_alive_a(uint16_t i){
if((i&31)==0)
NESSIE_PUTC(NESSIE_ALIVE_CHAR);
putc(NESSIE_ALIVE_CHAR, nessie_out_file);
}
#endif
void nessie_print_block(uint8_t* block, uint16_t blocksize_bit){
uint16_t i;
for(i=0; i<(blocksize_bit+7)/8; ++i){
NESSIE_PUTC(pgm_read_byte(hexdigit_tab_uc_P+((block[i])>>4)));
NESSIE_PUTC(pgm_read_byte(hexdigit_tab_uc_P+((block[i])&0xf)));
putc(pgm_read_byte(hexdigit_tab_uc_P + ((block[i]) >> 4)), nessie_out_file);
putc(pgm_read_byte(hexdigit_tab_uc_P + ((block[i]) & 0xf)), nessie_out_file);
}
}
#define SPACES 31
#define BYTESPERLINE 16
void nessie_print_item(char* name, uint8_t* buffer, uint16_t size_B){
void nessie_print_item(const char* name, uint8_t* buffer, uint16_t size_B){
uint8_t name_len;
uint8_t i;
name_len=strlen(name);
if(name_len>SPACES-1){
NESSIE_PUTSTR_P(PSTR("\r\n!!! formatting error !!!\r\n"));
name_len = strlen(name);
if(name_len > SPACES - 1){
fputs_P(PSTR("\n!!! formatting error !!!\n"), nessie_out_file);
return;
}
NESSIE_PUTSTR_P(PSTR("\r\n"));
for(i=0; i<SPACES-name_len-1; ++i){
NESSIE_PUTC(' ');
putc('\n', nessie_out_file);
for(i = 0; i < SPACES-name_len - 1; ++i){
putc(' ', nessie_out_file);
}
NESSIE_PUTSTR(name);
NESSIE_PUTC('=');
fputs(name, stdout);
putc('=', nessie_out_file);
/* now the data printing begins */
if(size_B<=BYTESPERLINE){
if(size_B <= BYTESPERLINE){
/* one line seems sufficient */
nessie_print_block(buffer, size_B*8);
nessie_print_block(buffer, size_B * 8);
} else {
/* we need more lines */
nessie_print_block(buffer, BYTESPERLINE*8); /* first line */
nessie_print_block(buffer, BYTESPERLINE * 8); /* first line */
int16_t toprint = size_B - BYTESPERLINE;
buffer += BYTESPERLINE;
while(toprint > 0){
NESSIE_PUTSTR_P(PSTR("\r\n"));
for(i=0; i<SPACES; ++i){
NESSIE_PUTC(' ');
putc('\n', nessie_out_file);
for(i = 0; i < SPACES; ++i){
putc(' ', nessie_out_file);
}
nessie_print_block(buffer, ((toprint>BYTESPERLINE)?BYTESPERLINE:toprint)*8);
nessie_print_block(buffer, ((toprint > BYTESPERLINE) ? BYTESPERLINE : toprint) * 8);
buffer += BYTESPERLINE;
toprint -= BYTESPERLINE;
}
@ -92,14 +99,7 @@ void nessie_print_item(char* name, uint8_t* buffer, uint16_t size_B){
void nessie_print_set_vector(uint8_t set, uint16_t vector){
NESSIE_PUTSTR_P(PSTR("\r\n\r\nSet "));
NESSIE_PUTC('0'+set%10);
NESSIE_PUTSTR_P(PSTR(", vector#"));
NESSIE_PUTC((vector<1000)?' ':'0'+vector/1000);
NESSIE_PUTC((vector<100)?' ':'0'+(vector/100)%10);
NESSIE_PUTC((vector<10 )?' ':'0'+(vector/10)%10);
NESSIE_PUTC('0'+vector%10);
NESSIE_PUTC(':');
fprintf_P(nessie_out_file, PSTR("\n\nSet %"PRIu8", vector#%4"PRIu16":"), set, vector);
}
/* example:
@ -107,9 +107,7 @@ Test vectors -- set 3
=====================
*/
void nessie_print_setheader(uint8_t set){
NESSIE_PUTSTR_P(PSTR("\r\n\r\nTest vectors -- set "));
NESSIE_PUTC('0'+set%10);
NESSIE_PUTSTR_P(PSTR("\r\n====================="));
fprintf_P(nessie_out_file, PSTR("\r\n\r\nTest vectors -- set %"PRIu8"\n====================="), set);
}
/* example:
@ -123,64 +121,47 @@ Key size: 256 bits
Block size: 128 bits
*/
void nessie_print_header(char* name,
void nessie_print_header(const char* name,
uint16_t keysize_b,
uint16_t blocksize_b,
uint16_t hashsize_b,
uint16_t macsize_b,
uint16_t ivsize_b ){
uint16_t i;
NESSIE_PUTSTR_P(PSTR("\r\n\r\n"
"********************************************************************************\r\n"
"* AVR-Crypto-Lib - crypto primitives for AVR microcontrolles by Daniel Otte *\r\n"
"********************************************************************************\r\n"
"\r\n"));
NESSIE_PUTSTR_P(PSTR("Primitive Name: "));
NESSIE_PUTSTR(name);
NESSIE_PUTSTR_P(PSTR("\r\n"));
fputs_P(PSTR("\n\n"
"********************************************************************************\n"
"* AVR-Crypto-Lib - crypto primitives for AVR microcontrollers by Daniel Otte *\n"
"********************************************************************************\n\n"),
nessie_out_file);
fprintf_P(nessie_out_file, PSTR("Primitive Name: %s\n"), name);
/* underline */
for(i=0; i<16+strlen(name); ++i){
NESSIE_PUTC('=');
putc('=', nessie_out_file);
}
char str[6]; /* must catch numbers up to 65535 + terminatin \0 */
if(keysize_b){
NESSIE_PUTSTR_P(PSTR("\r\nKey size: "));
utoa(keysize_b, str, 10);
NESSIE_PUTSTR(str);
NESSIE_PUTSTR_P(PSTR(" bits"));
fprintf_P(nessie_out_file, PSTR("\nKey size: %"PRIu16" bits"), keysize_b);
}
if(blocksize_b){
NESSIE_PUTSTR_P(PSTR("\r\nBlock size: "));
utoa(blocksize_b, str, 10);
NESSIE_PUTSTR(str);
NESSIE_PUTSTR_P(PSTR(" bits"));
fprintf_P(nessie_out_file, PSTR("\nBlock size: %"PRIu16" bits"), blocksize_b);
}
if(hashsize_b){
NESSIE_PUTSTR_P(PSTR("\r\nHash size: "));
utoa(hashsize_b, str, 10);
NESSIE_PUTSTR(str);
NESSIE_PUTSTR_P(PSTR(" bits"));
fprintf_P(nessie_out_file, PSTR("\nHash size: %"PRIu16" bits"), hashsize_b);
}
if(macsize_b){
NESSIE_PUTSTR_P(PSTR("\r\nMac size: "));
utoa(macsize_b, str, 10);
NESSIE_PUTSTR(str);
NESSIE_PUTSTR_P(PSTR(" bits"));
fprintf_P(nessie_out_file, PSTR("\nMac size: %"PRIu16" bits"), macsize_b);
}
if(ivsize_b){
if(ivsize_b==(uint16_t)-1){
NESSIE_PUTSTR_P(PSTR("\r\nNo initial value (IV) mode"));
fputs_P(PSTR("\nNo initial value (IV) mode"), stdout);
}else{
NESSIE_PUTSTR_P(PSTR("\r\nIV size: "));
utoa(ivsize_b, str, 10);
NESSIE_PUTSTR(str);
NESSIE_PUTSTR_P(PSTR(" bits"));
fprintf_P(nessie_out_file, PSTR("\nIV size: %"PRIu16" bits"), ivsize_b);
}
}
NESSIE_PUTSTR_P(PSTR("\r\n"));
putc('\n', nessie_out_file);
}
void nessie_print_footer(void){
NESSIE_PUTSTR_P(PSTR("\r\n\r\n\r\n\r\nEnd of test vectors\r\n\r\n"));
puts_P(PSTR("\n\n\n\nEnd of test vectors\n\n"));
}

View File

@ -34,6 +34,7 @@
#define NESSIE_USE_CLI
#include <stdint.h>
#include <stdio.h>
#ifdef NESSIE_ALIVE
#define NESSIE_SEND_ALIVE nessie_send_alive()
@ -45,7 +46,7 @@ void nessie_send_alive_a(uint16_t i);
#define NESSIE_SEND_ALIVE_A(i)
#endif
/*
#ifdef NESSIE_USE_CLI
#include "cli.h"
#define NESSIE_PUTC cli_putc
@ -54,12 +55,15 @@ void nessie_send_alive_a(uint16_t i);
#else
# error "direct uart output removed for nessie"
#endif
*/
void nessie_set_output_stream(FILE* out_stream);
void nessie_print_block(uint8_t* block, uint16_t blocksize_bit);
void nessie_print_item(char* name, uint8_t* buffer, uint16_t size_B);
void nessie_print_item(const char* name, uint8_t* buffer, uint16_t size_B);
void nessie_print_set_vector(uint8_t set, uint16_t vector);
void nessie_print_setheader(uint8_t set);
void nessie_print_header(char* name,
void nessie_print_header(const char* name,
uint16_t keysize_b,
uint16_t blocksize_b,
uint16_t hashsize_b,

View File

@ -27,6 +27,7 @@
* */
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "nessie_hash_test.h"
#include "nessie_common.h"
#include "dbz_strings.h"
@ -44,8 +45,8 @@ void ascii_hash_P(PGM_P data, PGM_P desc){
uint16_t sl;
uint8_t buffer[BLOCKSIZE_B];
NESSIE_PUTSTR_P(PSTR("\r\n message="));
NESSIE_PUTSTR_P(desc);
fputs_P(PSTR("\n message="), stdout);
fputs_P(desc, stdout);
nessie_hash_ctx.hash_init(ctx);
sl = strlen_P(data);
while(sl>=BLOCKSIZE_B){
@ -70,8 +71,8 @@ void amillion_hash(void){
uint32_t n=1000000LL;
uint16_t i=0;
NESSIE_PUTSTR_P(PSTR("\r\n message="));
NESSIE_PUTSTR_P(PSTR("1 million times \"a\""));
fputs_P(PSTR("\n message="), stdout);
fputs_P(PSTR("1 million times \"a\""), stdout);
memset(block, 'a', nessie_hash_ctx.blocksize_B);
nessie_hash_ctx.hash_init(ctx);
while(n>=nessie_hash_ctx.blocksize_B){
@ -91,17 +92,8 @@ void zero_hash(uint16_t n){
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint8_t block[nessie_hash_ctx.blocksize_B];
NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(n>=10000)
NESSIE_PUTC('0'+n/10000);
if(n>=1000)
NESSIE_PUTC('0'+(n/1000)%10);
if(n>=100)
NESSIE_PUTC('0'+(n/100)%10);
if(n>=10)
NESSIE_PUTC('0'+(n/10)%10);
NESSIE_PUTC('0'+n%10);
NESSIE_PUTSTR_P(PSTR(" zero bits"));
fputs_P(PSTR("\n message="), stdout);
fprintf_P(stdout, PSTR("%"PRIu16" zero bits"));
memset(block, 0, nessie_hash_ctx.blocksize_B);
nessie_hash_ctx.hash_init(ctx);
@ -120,28 +112,14 @@ void one_in512_hash(uint16_t pos){
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint8_t block[nessie_hash_ctx.blocksize_B];
uint16_t n=512;
char* tab[8]={"80", "40", "20", "10",
"08", "04", "02", "01" };
char* tab[8] = { "80", "40", "20", "10",
"08", "04", "02", "01" };
pos&=511;
NESSIE_PUTSTR_P(PSTR("\r\n message="));
NESSIE_PUTSTR_P(PSTR("512-bit string: "));
if((pos/8) >=10){
NESSIE_PUTC('0'+(pos/8/10)%10);
} else {
NESSIE_PUTC(' ');
}
NESSIE_PUTC('0'+(pos/8)%10);
NESSIE_PUTSTR_P(PSTR("*00,"));
NESSIE_PUTSTR(tab[pos&7]);
NESSIE_PUTC(',');
if(63-(pos/8) >=10){
NESSIE_PUTC('0'+((63-pos/8)/10)%10);
} else {
NESSIE_PUTC(' ');
}
NESSIE_PUTC('0'+(63-pos/8)%10);
NESSIE_PUTSTR_P(PSTR("*00"));
fputs_P(PSTR("\n message="), stdout);
fputs_P(PSTR("512-bit string: "), stdout);
fprintf_P(stdout, PSTR("%2"PRIu16"*00,%s,%2"PRIu16"*00"), pos / 8, tab[pos & 7], 63 - pos / 8);
/* now the real stuff */
memset(block, 0, 512/8);
@ -164,18 +142,9 @@ void tv4_hash(void){
uint16_t n=nessie_hash_ctx.hashsize_b;
uint32_t i;
NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(nessie_hash_ctx.hashsize_b>=10000)
NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/10000)%10);
if(nessie_hash_ctx.hashsize_b>=1000)
NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/1000)%10);
if(nessie_hash_ctx.hashsize_b>=100)
NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/100)%10);
if(nessie_hash_ctx.hashsize_b>=10)
NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/10)%10);
NESSIE_PUTC('0' + nessie_hash_ctx.hashsize_b%10);
fputs_P(PSTR("\r\n message="), stdout);
fprintf_P(stdout, PSTR("%"PRIu16" zero bits"), nessie_hash_ctx.hashsize_b);
NESSIE_PUTSTR_P(PSTR(" zero bits"));
memset(block, 0, nessie_hash_ctx.hashsize_b/8);
nessie_hash_ctx.hash_init(ctx);

View File

@ -28,6 +28,7 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include "nessie_mac_test.h"
#include "nessie_common.h"
@ -55,8 +56,8 @@ void ascii_mac_P(PGM_P data, PGM_P desc, uint8_t* key){
uint16_t sl;
uint8_t buffer[BLOCKSIZE_B];
NESSIE_PUTSTR_P(PSTR("\r\n message="));
NESSIE_PUTSTR_P(desc);
fputs_P(PSTR("\r\n message="), stdout);
fputs_P(desc, stdout);
PRINTKEY;
nessie_mac_ctx.mac_init(ctx, key, nessie_mac_ctx.keysize_b);
sl = strlen_P(data);
@ -82,8 +83,8 @@ void amillion_mac(uint8_t* key){
uint32_t n=1000000LL;
uint16_t i=0;
NESSIE_PUTSTR_P(PSTR("\r\n message="));
NESSIE_PUTSTR_P(PSTR("1 million times \"a\""));
fputs_P(PSTR("\r\n message="), stdout);
fputs_P(PSTR("1 million times \"a\""), stdout);
PRINTKEY;
memset(block, 'a', nessie_mac_ctx.blocksize_B);
@ -105,17 +106,8 @@ void zero_mac(uint16_t n, uint8_t* key){
uint8_t mac[MACSIZE_B];
uint8_t block[nessie_mac_ctx.blocksize_B];
NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(n>=10000)
NESSIE_PUTC('0'+n/10000);
if(n>=1000)
NESSIE_PUTC('0'+(n/1000)%10);
if(n>=100)
NESSIE_PUTC('0'+(n/100)%10);
if(n>=10)
NESSIE_PUTC('0'+(n/10)%10);
NESSIE_PUTC('0'+n%10);
NESSIE_PUTSTR_P(PSTR(" zero bits"));
fputs_P(PSTR("\r\n message="), stdout);
fprintf_P(stdout, PSTR("%"PRIu16" zero bits"), n);
PRINTKEY;
memset(block, 0, nessie_mac_ctx.blocksize_B);
@ -135,28 +127,14 @@ void one_in512_mac(uint16_t pos, uint8_t* key){
uint8_t mac[MACSIZE_B];
uint8_t block[nessie_mac_ctx.blocksize_B];
uint16_t n=512;
char* tab[8]={"80", "40", "20", "10",
"08", "04", "02", "01" };
char* tab[8] = { "80", "40", "20", "10",
"08", "04", "02", "01" };
pos&=511;
NESSIE_PUTSTR_P(PSTR("\r\n message="));
NESSIE_PUTSTR_P(PSTR("512-bit string: "));
if((pos/8) >=10){
NESSIE_PUTC('0'+(pos/8/10)%10);
} else {
NESSIE_PUTC(' ');
}
NESSIE_PUTC('0'+(pos/8)%10);
NESSIE_PUTSTR_P(PSTR("*00,"));
NESSIE_PUTSTR(tab[pos&7]);
NESSIE_PUTC(',');
if(63-(pos/8) >=10){
NESSIE_PUTC('0'+((63-pos/8)/10)%10);
} else {
NESSIE_PUTC(' ');
}
NESSIE_PUTC('0'+(63-pos/8)%10);
NESSIE_PUTSTR_P(PSTR("*00"));
fputs_P(PSTR("\r\n message="), stdout);
fputs_P(PSTR("512-bit string: "), stdout);
fprintf_P(stdout, PSTR("%2"PRIu16"*00,%s,%2"PRIu16"*00"), pos / 8, tab[pos & 7], 63 - pos / 8);
PRINTKEY;
/* now the real stuff */
@ -183,12 +161,10 @@ void tv4_mac(void){
uint8_t key[KEYSIZE_B];
uint16_t n=MACSIZE_B*8;
uint32_t i;
char str[6];
NESSIE_PUTSTR_P(PSTR("\r\n message="));
utoa(MACSIZE_B*8, str, 10);
NESSIE_PUTSTR(str);
NESSIE_PUTSTR_P(PSTR(" zero bits"));
fputs_P(PSTR("\r\n message="), stdout);
fprintf_P(stdout, PSTR("%"PRIu16" zero bits"), nessie_mac_ctx.macsize_b);
memset(block, 0, MACSIZE_B);
for(i=0; i<KEYSIZE_B; ++i)
key[i] = pgm_read_byte(&(keyproto[i%(3*8)]));

View File

@ -28,6 +28,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include "hashfunction_descriptor.h"
#include "hfal-basic.h"
@ -50,19 +51,17 @@
hfdesc_t* shavs_algo=NULL;
hfdesc_t** shavs_algolist=NULL;
#define shavs_out_file stdout
void shavs_listalgos(void){
char option = 'a';
hfdesc_t* t;
uint8_t i=0;
cli_putstr_P(PSTR("\r\nthe following algorithms are available:\r\n"));
while(option<='z' && (t=(hfdesc_t*)pgm_read_word(&(shavs_algolist[i])))){
cli_putc('\t');
cli_putc((t==shavs_algo)?'*':' ');
cli_putc(option++);
cli_putstr_P(PSTR(":\t"));
cli_putstr_P((void*)(pgm_read_word(&(t->name))));
cli_putstr_P(PSTR("\r\n"));
fputs_P(PSTR("\nthe following algorithms are available:\n"), shavs_out_file);
while(option <= 'z' && (t = (hfdesc_t*)pgm_read_word(&(shavs_algolist[i])))){
fprintf_P(shavs_out_file, PSTR("\t%c%c:\t%S\n"),
(t == shavs_algo) ? '*' : ' ', option++, pgm_read_word(&(t->name)));
i++;
}
}
@ -70,15 +69,15 @@ void shavs_listalgos(void){
void shavs_setalgo(char* param){
param = strstrip(param);
if(param[1]=='\0'){ /* single letter specified */
uint8_t i,option = param[0]-'a';
uint8_t i, option = param[0] - 'a';
if(!shavs_algolist){
cli_putstr_P(PSTR("\r\nERROR: shavs_algolist not set!"));
fputs_P(PSTR("\nERROR: shavs_algolist not set!"), shavs_out_file);
return;
}
for(i=0; i<=option; ++i){
if((void*)pgm_read_word(&(shavs_algolist[i]))==NULL){
cli_putstr_P(PSTR("\r\nERROR: invalid selection!"));
fputs_P(PSTR("\r\nERROR: invalid selection!"), shavs_out_file);
return;
}
}
@ -92,6 +91,7 @@ void shavs_setalgo(char* param){
if(t){
shavs_algo=t;
}else{
fprintf_P(shavs_out_file, PSTR("\nERROR: could not find \"%s\"!"), param);
cli_putstr_P(PSTR("\r\nERROR: could not find \""));
cli_putstr(param);
cli_putstr_P(PSTR("\"!"));
@ -184,6 +184,7 @@ int32_t getLength(void){
}
}
}
return -1;
}
void shavs_test1(void){ /* KAT tests */
@ -191,7 +192,7 @@ void shavs_test1(void){ /* KAT tests */
int32_t expect_input=0;
if(!shavs_algo){
cli_putstr_P(PSTR("\r\nERROR: select algorithm first!"));
fputs_P(PSTR("\r\nERROR: select algorithm first!"), shavs_out_file);
return;
}
char c;
@ -199,9 +200,7 @@ void shavs_test1(void){ /* KAT tests */
shavs_ctx.buffersize_B=pgm_read_word(&(shavs_algo->blocksize_b))/8;
uint8_t buffer[shavs_ctx.buffersize_B+5];
shavs_ctx.buffer = buffer;
cli_putstr_P(PSTR("\r\nbuffer_size = 0x"));
cli_hexdump_rev(&(shavs_ctx.buffersize_B), 2);
cli_putstr_P(PSTR(" bytes"));
fprintf_P(shavs_out_file, PSTR("\nbuffer_size = 0x%04"PRIx16" bytes"));
for(;;){
shavs_ctx.blocks = 0;
memset(buffer, 0, shavs_ctx.buffersize_B);
@ -211,8 +210,7 @@ void shavs_test1(void){ /* KAT tests */
}
#if DEBUG
cli_putstr_P(PSTR("\r\nLen == "));
cli_hexdump_rev(&length, 4);
fprintf_P(shavs_out_file, PSTR("\nLen == %"PRIu32), length)
#endif
if(length==0){
expect_input=2;
@ -220,59 +218,49 @@ void shavs_test1(void){ /* KAT tests */
expect_input=((length + 7) >> 2) & (~1L);
}
#if DEBUG
cli_putstr_P(PSTR("\r\nexpected_input == "));
cli_hexdump_rev(&expect_input, 4);
if(expect_input==0)
cli_putstr_P(PSTR("\r\nexpected_input == 0 !!!"));
fprintf_P(shavs_out_file, PSTR("\r\nexpected_input == %"PRId32), expected_input);
#endif
shavs_ctx.buffer_idx = 0;
shavs_ctx.in_byte = 0;
shavs_ctx.blocks = 0;
uint8_t ret;
#if DEBUG
cli_putstr_P(PSTR("\r\n HFAL init"));
cli_putstr_P(PSTR("\r\n (2) expected_input == "));
cli_hexdump_rev(&expect_input, 4);
fprintf_P(shavs_out_file, PSTR("\n HFAL init\n (2) expected_input == "), expected_input);
#endif
ret = hfal_hash_init(shavs_algo, &(shavs_ctx.ctx));
if(ret){
cli_putstr_P(PSTR("\r\n HFAL init returned with: "));
cli_hexdump(&ret, 1);
fprintf_P(shavs_out_file, PSTR("\r\n HFAL init returned with: %"PRIx8), ret);
return;
}
#if DEBUG
cli_putstr_P(PSTR("\r\n (3) expected_input == "));
cli_hexdump_rev(&expect_input, 4);
cli_putstr_P(PSTR("\r\n"));
fprintf_P(shavs_out_file, PSTR("\r\n (3) expected_input == %"PRId32"\n"), expected_input)
#endif
while((c=cli_getc_cecho())!='M' && c!='m'){
if(!isblank(c)){
cli_putstr_P(PSTR("\r\nERROR: wrong input (1) [0x"));
cli_hexdump(&c, 1);
cli_putstr_P(PSTR("]!\r\n"));
fprintf_P(shavs_out_file, PSTR("\nERROR: wrong input (1) [0x%"PRIx8"]!\n"), c);
hfal_hash_free(&(shavs_ctx.ctx));
return;
}
}
if((c=cli_getc_cecho())!='s' && c!='S'){
cli_putstr_P(PSTR("\r\nERROR: wrong input (2)!\r\n"));
hfal_hash_free(&(shavs_ctx.ctx));
return;
fputs_P(PSTR("\nERROR: wrong input (2)!\n"), shavs_out_file);
hfal_hash_free(&(shavs_ctx.ctx));
return;
}
if((c=cli_getc_cecho())!='g' && c!='G'){
cli_putstr_P(PSTR("\r\nERROR: wrong input (3)!\r\n"));
hfal_hash_free(&(shavs_ctx.ctx));
return;
fputs_P(PSTR("\nERROR: wrong input (3)!\n"), shavs_out_file);
hfal_hash_free(&(shavs_ctx.ctx));
return;
}
while((c=cli_getc_cecho())!='='){
if(!isblank(c)){
cli_putstr_P(PSTR("\r\nERROR: wrong input (4)!\r\n"));
fputs_P(PSTR("\nERROR: wrong input (4)!\n"), shavs_out_file);
hfal_hash_free(&(shavs_ctx.ctx));
return;
}
}
#if DEBUG
cli_putstr_P(PSTR("\r\nparsing started"));
fputs_P(PSTR("\r\nparsing started"), shavs_out_file);
#endif
shavs_ctx.buffer_idx = 0;
shavs_ctx.in_byte = 0;
@ -280,18 +268,14 @@ void shavs_test1(void){ /* KAT tests */
while(expect_input>0){
c=cli_getc_cecho();
#if DEBUG
cli_putstr_P(PSTR("\r\n\t("));
cli_hexdump_rev(&expect_input, 4);
cli_putstr_P(PSTR(") "));
fprintf_P(shavs_out_file, PSTR("\n\t(%"PRId32") "), expected_input);
_delay_ms(500);
#endif
if(buffer_add(c)==0){
--expect_input;
}else{
if(!isblank((uint16_t)c)){
cli_putstr_P(PSTR("\r\nERROR: wrong input (5) ("));
cli_putc(c);
cli_putstr_P(PSTR(")!\r\n"));
fprintf_P(shavs_out_file, PSTR("\nERROR: wrong input (5) (%c)!\n"), c);
hfal_hash_free(&(shavs_ctx.ctx));
return;
}