X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-shabal-test.c;h=3140b769df55ee5f85acbeea90e9ed0e063a929f;hb=2e0998249aeec3ce8509af80cc56fb6a49f3268d;hp=b08d800e6c2f74dc4606bfc39023affea60d4266;hpb=52ec168ece9d61bd9cb652235dfe8faee6232a11;p=avr-crypto-lib.git diff --git a/test_src/main-shabal-test.c b/test_src/main-shabal-test.c index b08d800..3140b76 100644 --- a/test_src/main-shabal-test.c +++ b/test_src/main-shabal-test.c @@ -18,16 +18,13 @@ */ /* * shabal test-suit - * + * */ -#include "config.h" -#include "serial-tools.h" -#include "uart_i.h" -#include "debug.h" + +#include "main-test-common.h" #include "shabal.h" -#include "cli.h" #include "hfal_shabal.h" #include "hfal-test.h" #include "hfal-nessie.h" @@ -36,42 +33,37 @@ #include "nessie_hash_test.h" #include "performance_test.h" -#include -#include -#include - -char* algo_name = "Shabal"; +char *algo_name = "Shabal"; - -const hfdesc_t* algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&shabal192_desc, (hfdesc_t*)&shabal224_desc, (hfdesc_t*)&shabal256_desc, (hfdesc_t*)&shabal384_desc, - (hfdesc_t*)&shabal512_desc, + (hfdesc_t*)&shabal512_desc, NULL }; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void testrun_stdtest_shabal192(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal192(void *msg, uint16_t size_b){ hfal_test(&shabal192_desc, msg, size_b); } -void testrun_stdtest_shabal224(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal224(void *msg, uint16_t size_b){ hfal_test(&shabal224_desc, msg, size_b); } -void testrun_stdtest_shabal256(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal256(void *msg, uint16_t size_b){ hfal_test(&shabal256_desc, msg, size_b); } -void testrun_stdtest_shabal384(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal384(void *msg, uint16_t size_b){ hfal_test(&shabal384_desc, msg, size_b); } -void testrun_stdtest_shabal512(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal512(void *msg, uint16_t size_b){ hfal_test(&shabal512_desc, msg, size_b); } @@ -102,16 +94,16 @@ void testshort(void){ testrun_stdtest_shabal192(ma, 64*8); } -void shabal_ctx_dump(shabal_ctx_t* ctx){ +void shabal_ctx_dump(shabal_ctx_t *ctx){ uint8_t i; - void* p; + void *p; cli_putstr_P(PSTR("\r\n=== shabal ctx dump ===\r\n size = ")); i=sizeof(shabal_ctx_t); if(i>=100) cli_putc('0'+i/100); if(i>=10) cli_putc('0'+(i/10)%10); - cli_putc('0'+i%10); + cli_putc('0'+i%10); cli_putstr_P(PSTR("\r\n a = ")); cli_hexdump_block(ctx->a, 12*4, 5, 4*8); cli_putstr_P(PSTR("\r\n b_buffer = ")); @@ -121,7 +113,7 @@ void shabal_ctx_dump(shabal_ctx_t* ctx){ if(ctx->b == &(ctx->b_buffer[0])) cli_putstr_P(PSTR("\r\nb --> b_buffer")); if(ctx->b == &(ctx->c_buffer[0])) - cli_putstr_P(PSTR("\r\nb --> c_buffer")); + cli_putstr_P(PSTR("\r\nb --> c_buffer")); if(ctx->c == &(ctx->b_buffer[0])) cli_putstr_P(PSTR("\r\nc --> b_buffer")); if(ctx->c == &(ctx->c_buffer[0])) @@ -132,7 +124,7 @@ void shabal_ctx_dump(shabal_ctx_t* ctx){ cli_putstr_P(PSTR("\r\n b (should) = ")); cli_hexdump(&p, 2); cli_putstr_P(PSTR("\r\n c = ")); - cli_hexdump(&(ctx->c), 2); + cli_hexdump(&(ctx->c), 2); p = ctx->c_buffer; cli_putstr_P(PSTR("\r\n c (should) = ")); cli_hexdump(&p, 2); @@ -200,37 +192,33 @@ const char echo_str[] PROGMEM = "echo"; const char shavs_list_str[] PROGMEM = "shavs_list"; const char shavs_set_str[] PROGMEM = "shavs_set"; const char shavs_test1_str[] PROGMEM = "shavs_test1"; - -cmdlist_entry_t cmdlist[] PROGMEM = { - { nessie_str, NULL, testrun_nessie_shabal}, - { test_str, NULL, testrun_stdtest_shabal}, - { testinit192_str, NULL, testinit_192}, - { testinit_str, NULL, testinit}, - { testshort_str, NULL, testshort}, - { performance_str, NULL, performance_shabal}, - { shavs_list_str, NULL, shavs_listalgos}, - { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo}, - { shavs_test1_str, NULL, shavs_test1}, - { echo_str, (void*)1, (void_fpt)echo_ctrl}, - { NULL, NULL, NULL} +const char shavs_test2_str[] PROGMEM = "shavs_test2"; +const char shavs_test3_str[] PROGMEM = "shavs_test3"; + +const cmdlist_entry_t cmdlist[] PROGMEM = { + { nessie_str, NULL, testrun_nessie_shabal }, + { test_str, NULL, testrun_stdtest_shabal }, + { testinit192_str, NULL, testinit_192 }, + { testinit_str, NULL, testinit }, + { testshort_str, NULL, testshort }, + { performance_str, NULL, performance_shabal }, + { shavs_list_str, NULL, shavs_listalgos }, + { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo }, + { shavs_test1_str, NULL, shavs_test1 }, + { shavs_test2_str, NULL, shavs_test2 }, + { shavs_test3_str, NULL, shavs_test3 }, + { 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; - shavs_algolist=(hfdesc_t**)algolist; + main_setup(); + + 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); } -} +}