]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - test_src/main-aes-test.c
clean up
[avr-crypto-lib.git] / test_src / main-aes-test.c
index b17382a4ee853d92fa38a3f9d1823db005095681..88f87d5b266544e165143b8f734d046b72b8473e 100644 (file)
 #include "performance_test.h"
 #include "dump.h"
 
-#include "bcal_aes128.h"
-#include "bcal_aes192.h"
-#include "bcal_aes256.h"
-#include "bcal-cbc.h"
-#include "bcal-cfb_byte.h"
-#include "bcal-cfb_bit.h"
-#include "bcal-ofb.h"
-#include "bcal-ctr.h"
-#include "bcal-cmac.h"
-#include "bcal-eax.h"
+#include "bcal/bcal_aes128.h"
+#include "bcal/bcal_aes192.h"
+#include "bcal/bcal_aes256.h"
+#include "bcal/bcal-cbc.h"
+#include "bcal/bcal-cfb_byte.h"
+#include "bcal/bcal-cfb_bit.h"
+#include "bcal/bcal-ofb.h"
+#include "bcal/bcal-ctr.h"
+#include "bcal/bcal-cmac.h"
+#include "bcal/bcal-eax.h"
 #include "cmacvs.h"
+#include "bcal/bcal-performance.h"
 
 #include <stdint.h>
 #include <string.h>
@@ -670,131 +671,10 @@ void testrun_aes128_eax(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_aes192(void){
-       uint64_t t;
-       char str[16];
-       uint8_t key[32], data[16];
-       aes192_ctx_t ctx;
-
-       calibrateTimer();
-       print_overhead();
-
-       memset(key,  0, 32);
-       memset(data, 0, 16);
-
-       startTimer(1);
-       aes192_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);
-       aes192_enc(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes192_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_aes256(void){
-       uint64_t t;
-       char str[16];
-       uint8_t key[32], data[16];
-       aes256_ctx_t ctx;
-
-       calibrateTimer();
-       print_overhead();
-
-       memset(key,  0, 32);
-       memset(data, 0, 16);
-
-       startTimer(1);
-       aes256_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);
-       aes256_enc(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes256_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();
-       cli_putstr_P(PSTR("\r\n       AES-192\r\n"));
-       testrun_performance_aes192();
-       cli_putstr_P(PSTR("\r\n       AES-256\r\n"));
-       testrun_performance_aes256();
+       bcal_performance_multiple(algolist);
 }
+
 /*****************************************************************************
  *  main                                                                                                                                        *
  *****************************************************************************/