/* main-arcfour-test.c */
/*
This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 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
*
*/
-#include "config.h"
-#include "uart_i.h"
-#include "debug.h"
+#include "main-test-common.h"
#include <arcfour.h>
-#include "cli.h"
#include "performance_test.h"
#include "scal_arcfour.h"
#include "scal-basic.h"
#include "scal-nessie.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-char* algo_name = "Arcfour";
+char *algo_name = "Arcfour";
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
-void arcfour_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
+void arcfour_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){
arcfour_init(key, (uint8_t)((keysize+7)/8), ctx);
}
}
void testrun_performance_arcfour(void){
- uint64_t t;
- char str[16];
+ uint32_t t;
uint8_t key[16];
arcfour_ctx_t ctx;
memset(key, 0, 16);
+ uart0_flush();
startTimer(1);
arcfour_init(key, 16, &ctx);
t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
+ printf_P(PSTR("\tctx-gen time: %10"PRIu32"\n"), t);
+ uart0_flush();
startTimer(1);
arcfour_gen(&ctx);
t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
+ printf_P(PSTR("\tencrypt time: %10"PRIu32"\n"), t);
}
{ NULL, NULL, NULL}
};
-int main (void){
- DEBUG_INIT();
-
- cli_rx = (cli_rx_fpt)uart0_getc;
- cli_tx = (cli_tx_fpt)uart0_putc;
+int main(void) {
+ main_setup();
+
for(;;){
- cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- cli_putstr(algo_name);
- cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ welcome_msg(algo_name);
cmd_interface(cmdlist);
- }
+ }
+
}
+