X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-omac-noekeon-test.c;h=503c886ffaf7c4333a2e536ed1a585fedfff105a;hb=2e0998249aeec3ce8509af80cc56fb6a49f3268d;hp=377a921f1199419e4ca450387196e16623c7341e;hpb=83d0614d8b17eac97f891f7de2bb3ef265751dea;p=avr-crypto-lib.git diff --git a/test_src/main-omac-noekeon-test.c b/test_src/main-omac-noekeon-test.c index 377a921..503c886 100644 --- a/test_src/main-omac-noekeon-test.c +++ b/test_src/main-omac-noekeon-test.c @@ -21,29 +21,21 @@ * */ -#include "config.h" -#include "serial-tools.h" -#include "uart.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 -#include -#include - -char* algo_name = "OMAC-Noekeon"; +char *algo_name = "OMAC-Noekeon"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void test_mac(void* key, void* data, uint16_t datalength_b){ +void test_mac(void *key, void *data, uint16_t datalength_b){ uint8_t mac[16]; cli_putstr_P(PSTR("\r\n-----------\r\n msg length (bit): 0x")); cli_hexdump(((uint8_t*)&datalength_b)+1, 1); @@ -72,25 +64,25 @@ void testrun_test_omac_noekeon(void){ uint8_t stat_key[16]; -void omac_noekeon_next_dummy(void* buffer, void* ctx){ +void omac_noekeon_next_dummy(void *ctx, const void *buffer){ omac_noekeon_next(buffer, stat_key, ctx); } -void omac_noekeon_init_dummy(void* key, uint16_t keysize_b, void* ctx){ +void omac_noekeon_init_dummy(void *ctx, const void *key, uint16_t keysize_b){ omac_noekeon_init(ctx); memcpy(stat_key, key, 16); } -void omac_noekeon_last_dummy(void* buffer, uint16_t size_b, void* key, uint16_t keysize_b, void* ctx){ +void omac_noekeon_last_dummy(void *ctx, const void *buffer, uint16_t size_b){ while(size_b>128){ - omac_noekeon_next(buffer, key, ctx); + omac_noekeon_next(buffer, stat_key, ctx); size_b -= 128; buffer = (uint8_t*)buffer +16; } - omac_noekeon_last(buffer, size_b, key, ctx); + omac_noekeon_last(buffer, size_b, stat_key, ctx); } -void omac_noekeon_conv_dummy(void* buffer, void* ctx){ +void omac_noekeon_conv_dummy(void *buffer, void *ctx){ memcpy(buffer, ctx, 16); } @@ -157,7 +149,7 @@ const char test_str[] PROGMEM = "test"; const char performance_str[] PROGMEM = "performance"; const char echo_str[] PROGMEM = "echo"; -cmdlist_entry_t cmdlist[] PROGMEM = { +const cmdlist_entry_t cmdlist[] PROGMEM = { { nessie_str, NULL, testrun_nessie_omac_noekeon }, { test_str, NULL, testrun_test_omac_noekeon}, { performance_str, NULL, testrun_performance_omac_noekeon}, @@ -166,14 +158,10 @@ cmdlist_entry_t cmdlist[] PROGMEM = { }; int main (void){ - DEBUG_INIT(); - - cli_rx = uart_getc; - cli_tx = uart_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); } }