X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-aes128-test.c;h=d90c8bdd6836779a12b979b4f6e4d600222d3428;hb=4655b60cc205079ebafec3db4a4b47f7a8336bda;hp=72e06f6198bbcd0819395eb3ddbdbe79b810b255;hpb=9e69044519495dad3e2f76fc7795e72390b79a45;p=avr-crypto-lib.git diff --git a/test_src/main-aes128-test.c b/test_src/main-aes128-test.c index 72e06f6..d90c8bd 100644 --- a/test_src/main-aes128-test.c +++ b/test_src/main-aes128-test.c @@ -26,10 +26,13 @@ #include "uart_i.h" #include "debug.h" -#include "aes/aes.h" -#include "nessie_bc_test.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 #include #include @@ -37,19 +40,18 @@ char* algo_name = "AES-128"; +const bcdesc_t* const algolist[] PROGMEM = { + (bcdesc_t*)&aes128_desc, + NULL +}; + + /***************************************************************************** * additional validation-functions * *****************************************************************************/ void testrun_nessie_aes(void){ - nessie_bc_ctx.blocksize_B = 16; - nessie_bc_ctx.keysize_b = 128; - nessie_bc_ctx.name = algo_name; - nessie_bc_ctx.ctx_size_B = sizeof(aes128_ctx_t); - nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)aes128_enc; - nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)aes128_dec; - nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)aes_init; - nessie_bc_run(); + bcal_nessie_multiple(algolist); } void testrun_test_aes(void){ @@ -102,48 +104,8 @@ void testrun_testkey_aes(void){ /*****************************************************************************/ -void testrun_performance_aes128(void){ - uint64_t t; - char str[16]; - uint8_t key[32], data[16]; - aes128_ctx_t ctx; - - calibrateTimer(); - print_overhead(); - - memset(key, 0, 32); - memset(data, 0, 16); - - startTimer(1); - aes128_init(key, &ctx); - t = stopTimer(); - cli_putstr_P(PSTR("\r\n\tctx-gen time: ")); - ultoa((unsigned long)t, str, 10); - cli_putstr(str); - - - startTimer(1); - aes128_enc(data, &ctx); - t = stopTimer(); - cli_putstr_P(PSTR("\r\n\tencrypt time: ")); - ultoa((unsigned long)t, str, 10); - cli_putstr(str); - - - startTimer(1); - aes128_dec(data, &ctx); - t = stopTimer(); - cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); - ultoa((unsigned long)t, str, 10); - cli_putstr(str); - - cli_putstr_P(PSTR("\r\n")); -} - void testrun_performance_aes(void){ - cli_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n")); - cli_putstr_P(PSTR("\r\n AES-128\r\n")); - testrun_performance_aes128(); + bcal_performance_multiple(algolist); } /***************************************************************************** @@ -155,7 +117,7 @@ const char testkey_str[] PROGMEM = "testkey"; 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_aes }, { test_str, NULL, testrun_test_aes}, { testkey_str, NULL, testrun_testkey_aes},