]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
switching to new main-*-test layout and to stdio streams
authorbg <daniel.otte@rub.de>
Sun, 26 Aug 2012 22:37:31 +0000 (00:37 +0200)
committerbg <daniel.otte@rub.de>
Sun, 26 Aug 2012 22:37:31 +0000 (00:37 +0200)
62 files changed:
Makefile_sys_conf.inc
mkfiles/aes128.mk [deleted file]
mkfiles/aes192.mk [deleted file]
mkfiles/aes256.mk [deleted file]
test_src/main-a5_1-test.c
test_src/main-aes128-test.c [deleted file]
test_src/main-aes192-test.c [deleted file]
test_src/main-aes256-test.c [deleted file]
test_src/main-base64-test.c
test_src/main-bigint-test.c
test_src/main-blake-test.c
test_src/main-bmw-test.c
test_src/main-camellia-test.c
test_src/main-cast5-test.c
test_src/main-cast6-test.c
test_src/main-cscipher-test.c
test_src/main-cubehash-test.c
test_src/main-dsa-test.c
test_src/main-echo-test.c
test_src/main-entropium-test.c
test_src/main-grain-test.c
test_src/main-groestl-test.c
test_src/main-hmac-md5-test.c
test_src/main-hmac-sha1-test.c
test_src/main-hmac-sha256-test.c
test_src/main-jh-test.c
test_src/main-keccak-test.c
test_src/main-khazad-test.c
test_src/main-md5-test.c
test_src/main-mickey128-test.c
test_src/main-mqq160-sign-test.c
test_src/main-mugi-test.c
test_src/main-noekeon-test.c
test_src/main-omac-noekeon-test.c
test_src/main-rabbit-test.c
test_src/main-rc5-test.c
test_src/main-rc6-test.c
test_src/main-salsa20-test.c
test_src/main-seed-test.c
test_src/main-serpent-test.c
test_src/main-sha1-test.c
test_src/main-sha256-test.c
test_src/main-shabal-test.c
test_src/main-shabea-test.c
test_src/main-shacal1_enc-test.c
test_src/main-shacal2_enc-test.c
test_src/main-skipjack-test.c
test_src/main-tdes-test.c
test_src/main-test-common.c
test_src/main-threefish-test.c
test_src/main-trivium-test.c
test_src/main-twister-test.c
test_src/main-ubi-test.c
test_src/main-whirlpool-0-test.c
test_src/main-whirlpool-t-test.c
test_src/main-whirlpool-test.c
test_src/main-xtea-test.c
test_src/nessie_common.c
test_src/nessie_common.h
test_src/nessie_hash_test.c
test_src/nessie_mac_test.c
test_src/shavs.c

index f40623cd80d350549d544801f12cfd4773611032..3135e17460e980791da31fa5bc95cca65af70228 100644 (file)
@@ -1,3 +1,5 @@
+MAKE_DEBUG     = 1
+
 DEBUG          = -gdwarf-2
 WARNING        = -pedantic -Wall -Werror -Wstrict-prototypes
 PROGRAMMER     = jtagmkII
diff --git a/mkfiles/aes128.mk b/mkfiles/aes128.mk
deleted file mode 100644 (file)
index 6a767ad..0000000
+++ /dev/null
@@ -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
-
diff --git a/mkfiles/aes192.mk b/mkfiles/aes192.mk
deleted file mode 100644 (file)
index dc93caf..0000000
+++ /dev/null
@@ -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
-
diff --git a/mkfiles/aes256.mk b/mkfiles/aes256.mk
deleted file mode 100644 (file)
index 09292b6..0000000
+++ /dev/null
@@ -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
-
index 34e6739cc0329bbabd53e4abaa8ad702edba06ea..6addf1aa8ee5fb44ff442b61b7e5bd1e7d8d4120 100644 (file)
  * 
 */
 
-#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);
        }
        
 }
diff --git a/test_src/main-aes128-test.c b/test_src/main-aes128-test.c
deleted file mode 100644 (file)
index d90c8bd..0000000
+++ /dev/null
@@ -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);
-       }
-}
-
diff --git a/test_src/main-aes192-test.c b/test_src/main-aes192-test.c
deleted file mode 100644 (file)
index 0eca624..0000000
+++ /dev/null
@@ -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);
-       }
-}
-
diff --git a/test_src/main-aes256-test.c b/test_src/main-aes256-test.c
deleted file mode 100644 (file)
index a1a19dd..0000000
+++ /dev/null
@@ -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);
-       }
-}
-
-
index 6bcdde150bed802610e3c091da9e841f506650fd..9a1e4611a6305308557a3c9c1d912b533cf474a2 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 8fef0fbc9236ba3ee180656b0b5f99c2f6b95c2c..00baffc69881027a4fc69db498ea235413f36ec1 100644 (file)
  * 
 */
 
-#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);
        }
 }
index b3ad2703b2cfdb273a021a9a3667a8e7be78a718..c15dad5b03469b27f24baf91bfb02e2d8abeea4f 100644 (file)
  *
 */
 
-#include "config.h"
-
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "blake_small.h"
 #include "blake_large.h"
 #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);
        }
 }
index a78e1a5d6304501459b700ec9dc9895852a762d8..18d91a68ff3cc891c79fafeb751335b6f60f4a3e 100644 (file)
  *
 */
 
-#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);
        }
 }
index 07907282eb45a35d3006c3a017214f0debe240e8..39702db4012b67576c41f9f3ac11a22f5f02d22b 100644 (file)
  * 
  */
 
-#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);
        }
 }
 
index 56580e2c5eedbdc62ece00765419aefa263f249f..76af0848ef0c21ab32aac62517e4f3353842e2e6 100644 (file)
  * 
 */
 
-#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);
        }
 }
index bcd97744f50200846246e83096ee91f440a8dcc4..63fd3caf43a0314bdf99d1fe1cce0b4f470a5224 100644 (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);
        }
 }
index eb49a4500281a58f391dc85a4849bd0584058496..b8191f783b95b85ce34847a5d478b154c952fb29 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 4d01c63b03c6ea48ec8189ce30bae0a6d0acd688..5014476a7b13931ed6c13a3fe2acb3f5313e52c2 100644 (file)
  *
 */
 
-#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"
 #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);
        }
 }
index 89e177c292e2060200fd5c48b673efe542c947b1..7516341c8b47e9f94cb97fa824a96db7ac6063fa 100644 (file)
  *
 */
 
-#include "config.h"
-
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "noekeon.h"
 #include "noekeon_prng.h"
 #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();
-
-       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);
        }
 }
index 65b461384d62dc1fedc4ce658bc55e624dce1b6c..552c0632dcc7cad54dfe13b020bed071392b04c8 100644 (file)
  *
 */
 
-#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"
 #include "hfal-performance.h"
 #include "hfal-test.h"
 
-#include <stdint.h>
-#include <string.h>
-#include <stdlib.h>
-
 char* algo_name = "Echo";
 
 
index 92dc8efcfd3deae70bf2ad61ee05cb3e86cadb69..687f40b992fd5ccafeb2e11a46199dae3e452b23 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 7963e344d4eacd5469cd199477940cc2a0d2a346..99ab49380e895e0928ab3cd581f657fb90fa174e 100644 (file)
  * 
 */
 
-#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"
 #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);
        }
 }
index b51b049f22cc12a84a66f66630c58d8f65718e7f..0c7b0b3b1fa6dc3e253e4be30a0d49d1ed012d52 100644 (file)
  *
 */
 
-#include "config.h"
-
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "groestl_small.h"
 #include "groestl_large.h"
 #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);
        }
 }
index dc495367c346a73bbc60330bbf7d767c9db1d03c..410592c90f7dc8c9f23ee44fb4e3ce462e1c465b 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 02b1e6d57c17f530c7e827de47ba6b5e240406e9..c8e671016bc48133b35105b5af3f57c9787eda40 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 6034ae2880cd063b4aaefdf6049af198996cf692..3e7f51e73d127df48972dfd493f301a331dd0625 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 725e5bbc9e3ad6f6e438984fbd3c197d3929a12e..f29a6964deac7ecfa3ed243142d028ad3e667536 100644 (file)
  *
 */
 
-#include "config.h"
-
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "jh_simple.h"
 #include "hfal_jh.h"
 #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);
        }
 }
index 07a27d6812d4ee5dfb581ec21f40a504df7fec48..501eb4b28e72234fafac0d94aa6698378f5c462b 100644 (file)
  *
 */
 
-#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"
 #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);
        }
 }
index b5449fe8034f24d0e9ef0d37e58ea9f05d374df6..859e71513b5e065743b324acf1b52fc1faef00e8 100644 (file)
  * 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);
        }
 }
index 47730cd71a0e1dd0125a1479b1752fd834d15970..a4054c9add65453b55657fc11dce873d082b2156 100644 (file)
  * 
 */
 
-#include "config.h"
-
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "md5.h"
 #include "nessie_hash_test.h"
 #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);
        }
 }
index 0923e65c6b7fdc0110704a9ac304d699a7f5df4f..927680a2e8fac890073eac9a1a29bb6a6ab7623c 100644 (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);
        }
 }
index 36776b04713aeb00db6e0c7ae3a6fad364135b40..56c168e555be4f0700465efe239703323e099ca5 100644 (file)
  *
 */
 
-#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);
        }
 }
index e868907444b5d0029e85bbbb8a7d1983995255ea..a741cc00c10e6fd99acb31aebd5368785defd292 100644 (file)
  * 
 */
 
-#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);
        }
 }
 
index 0f7c6b76a0c8d10a1355317009ddf647e2d152d3..95664b0fe1b894da44eb087cfd138082969d4ee2 100644 (file)
  * 
 */
 
-#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);
        }
 }
index a5a0e7990d0746d652a026d785be7e95da241c5d..fae8b35bb833168d64e039d339f21057d9dcb927 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 02538316dd1ed9ed4d0c017c1e0ec66c3fd6415b..4f66c66702dcb6c85ccdf29fed05c0ca2d421594 100644 (file)
     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();
-
-       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);
        }
 }
 
index 64577442dfeca612d114415a6aef0f5a2464bb38..827a966dc5ffd5552a57e8038798b22af92626af 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 2c77bea450040d8c4f46d4dd59eb9ed8a2f7f7e4..f486ee3a5469dc277b50745374cd899b4a275fb6 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 9e8bb2fdc71897b96778fe6769eedeec4f993b1c..fda3cf97b2336eef809338a4f379fd3604907f8e 100644 (file)
 */
 
 
-#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();
-
-       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);
        }
 }
 
index b4c957c74d1a5b6dd97d9c971901e7b9491f60bb..d8a4ec2b253a81be4f783d52b5fc912940e3c299 100644 (file)
  * 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);
        }
 }
index ec456d66ebaa2a6876e7b0ed7dac37d2b08ea27e..14d7b07ba64ef7e523b449fda3c6109af070379d 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 44e8225c2cba310ad1043c13cc3abba12da5b11c..53ca357f6c0ee55d7a337a5ba84aa14c8f04471b 100644 (file)
  *
 */
 
-#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);
        }
 }
index 7786759c0770e86b63e31d292386884e02706219..0aac309d337631655d063481c94ffc64cbe4c959 100644 (file)
  *
 */
 
-#include "config.h"
 
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "sha256.h"
 #include "nessie_hash_test.h"
 #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);
        }
 }
index cfbd6fe17b969c3e306945e7d677ca84aa78a19e..638f5b793208d3ae248da76070333f770e4e5be8 100644 (file)
  *
 */
 
-#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"
 #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);
+           welcome_msg(algo_name);
+           cmd_interface(cmdlist);
        }
 }
index 5748b9499ac987de6032dbe83932bd2366d7289f..471881eac18c81fb40cb68cbf39e703e71f0d9a9 100644 (file)
  * 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);
        }
 }
index 48b5051dc7c81f6e9fa0caecb858f4462b45132c..e3267b54d6ed7a2245d1e5f31af28392b8620c4f 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 0d6110b8c7a6d8d18f09c553cb0b3fb3b935aeaa..bf631ebb29bd2ed3f7352c7e20d4296d5a2ea578 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 48de3cf327ab1cd9bace25b7dd92039460681b7c..0d2fe022e47a5a16417900bb2ff802e09356fa00 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 749032947e7a83258985611cc120f4317404e9a5..e26cc912d59d20013e1caa3cd5e472959f9b8e2e 100644 (file)
  * 
 */
 
-#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);
        }
 }
index 12ce7b63a3ae46012be6945e61616fa7671e7904..51dc8a3f161fa47155ec289ab5e8ad30bd526acf 100644 (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__);
 }
index 45ecd0097430e2df31da1f3caeb413ad5403d5cf..a1e0a63596d92b326bb2f476f58e4de7d2e30390 100644 (file)
  * 
 */
 
-#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"
 #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);
        }
 }
index bf05a81f0b3568249ffbf02bf73772616317715b..bee2710cf82ca8a08d56ab0ac8287334f5a6c435 100644 (file)
     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"
 #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);
        }
 }
index 2ac3180795f340c23fde9164d1c425247f1e9a6b..6e23154ed378cb2ce3ef71d83d5c8c9fabfa5ac4 100644 (file)
  * 
 */
 
-#include "config.h"
 
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "twister-small.h"
 #include "twister-large.h"
 #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);
        }
 }
index 5a839c468e8770c485acfaf1cc2acfa34669db35..435b7163fadcc91adf3cc68bd851b348552bbb9c 100644 (file)
  * 
 */
 
-#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);
        }
 }
index c06618879af65939eb143e350ced348f397fa083..a044ddf8690e62e7f2c4497590af8d2468be622e 100644 (file)
  *
 */
 
-#include "config.h"
-
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "whirlpool.h"
 #include "nessie_hash_test.h"
 #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);
        }
 }
index 1b446802f0e744eb98c4001d33610556c25e0622..0474039997c4a71d89d154829976fdd563ff86e2 100644 (file)
  *
 */
 
-#include "config.h"
 
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "whirlpool.h"
 #include "nessie_hash_test.h"
 #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);
        }
 }
index c2cc71b7e645bbda04bafdda95a57d337023099e..4d2978b2fb25c9211b7868f26386b8e0147eaa0a 100644 (file)
  *
 */
 
-#include "config.h"
-
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "whirlpool.h"
 #include "nessie_hash_test.h"
 #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);
        }
 }
index 42b5ee51ea0e240baa40743246a45bf744dace55..26a42a3785874530c5a211d10361ce08536df40a 100644 (file)
  * 
 */
 
-#include "config.h"
 
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
 
 #include "xtea.h"
 #include "nessie_bc_test.h"
 #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);
        }
 }
index 8798dd2b51735464cfcdcaf60db1b609516b593f..4a8cfbc19ae4a5f9bd18535eff55c131e86ee163 100644 (file)
 
 #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"));
 }
 
index 65b05b6b190cf8abe58fe785daad1b858814f114..bfbcc1ff1fcd40497402a53ffdc01d23225ee35a 100644 (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, 
index 5dc117e31dc373e31f91ade30abb8bd1666f859d..f112f4c229dabb842a5aee9d0a7ad60a7cea99bf 100644 (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);
index 2813a51b036dd99a1085e8affbb0dc47ca63308b..90f3be6d4efbba01417abda9ff1b44180457ab66 100644 (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)]));
index 1dfc56db3468194e8e730e82086202bfcd020b64..84cf9f2ce9de5aea5089ec5675c46ea99803d6c0 100644 (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"
 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;
                                }