X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=test_src%2Fmain-twister-test.c;h=cdfa865d6b8c594e7334b0fdbd0a1eb1d6002f0c;hp=b9a47cb659304fdf0f133fb8f4a7598e07a138fd;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=7b5401ab9ce23a5da1de8b6c7de3a1aa20ac4cf8 diff --git a/test_src/main-twister-test.c b/test_src/main-twister-test.c index b9a47cb..cdfa865 100644 --- a/test_src/main-twister-test.c +++ b/test_src/main-twister-test.c @@ -1,7 +1,7 @@ /* main-twister-test.c */ /* This file is part of the AVR-Crypto-Lib. - Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de) + Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) 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 @@ -21,33 +21,25 @@ * */ -#include "config.h" -#include "uart_i.h" -#include "debug.h" +#include "main-test-common.h" #include "twister-small.h" #include "twister-large.h" #include "nessie_hash_test.h" #include "performance_test.h" -#include "hfal/hfal_twister224.h" -#include "hfal/hfal_twister256.h" -#include "hfal/hfal_twister384.h" -#include "hfal/hfal_twister512.h" -#include "hfal/hfal-nessie.h" -#include "hfal/hfal-performance.h" -#include "hfal/hfal-test.h" +#include "hfal_twister224.h" +#include "hfal_twister256.h" +#include "hfal_twister384.h" +#include "hfal_twister512.h" +#include "hfal-nessie.h" +#include "hfal-performance.h" +#include "hfal-test.h" #include "shavs.h" +char *algo_name = "TWISTER"; -#include -#include -#include -#include "cli.h" - -char* algo_name = "TWISTER"; - -const hfdesc_t* algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&twister224_desc, (hfdesc_t*)&twister256_desc, (hfdesc_t*)&twister384_desc, @@ -68,27 +60,27 @@ void testrun_nessie_twister(void){ * *****************************************************************************/ -void test_twister224( void* msg, uint32_t length_b){ +void test_twister224( void *msg, uint32_t length_b){ hfal_test(&twister224_desc, msg, length_b); } -void test_twister256( void* msg, uint32_t length_b){ +void test_twister256( void *msg, uint32_t length_b){ hfal_test(&twister256_desc, msg, length_b); } -void test_twister384( void* msg, uint32_t length_b){ +void test_twister384( void *msg, uint32_t length_b){ hfal_test(&twister384_desc, msg, length_b); } -void test_twister512( void* msg, uint32_t length_b){ +void test_twister512( void *msg, uint32_t length_b){ hfal_test(&twister512_desc, msg, length_b); } void testrun_twister(void){ - const hfdesc_t* desc[4] = { &twister224_desc, &twister256_desc, + const hfdesc_t *desc[4] = { &twister224_desc, &twister256_desc, &twister384_desc, &twister512_desc }; uint8_t i,j; - char* testv[]={ + char *testv[]={ "", "a", "abc", @@ -127,7 +119,7 @@ const char shavs_list_str[] PROGMEM = "shavs_list"; const char shavs_set_str[] PROGMEM = "shavs_set"; const char shavs_test1_str[] PROGMEM = "shavs_test1"; -cmdlist_entry_t cmdlist[] PROGMEM = { +const cmdlist_entry_t cmdlist[] PROGMEM = { { nessie_str, NULL, testrun_nessie_twister}, { test_str, NULL, testrun_twister}, { performance_str, NULL, testrun_performance_twister}, @@ -139,16 +131,13 @@ 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); } }