7 #include "serial-tools.h"
12 #include "nessie_bc_test.h"
14 #include "performance_test.h"
21 char* cipher_name = "RC6-32/20/16";
23 /*****************************************************************************
24 * additional validation-functions *
25 *****************************************************************************/
26 void rc6_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){
27 rc6_initl(key, keysize_b, RC6_ROUNDS, ctx);
30 void testrun_nessie_rc6(void){
32 nessie_bc_ctx.blocksize_B = 16;
33 nessie_bc_ctx.keysize_b = 128;
34 nessie_bc_ctx.name = cipher_name;
35 nessie_bc_ctx.ctx_size_B = sizeof(rc6_ctx_t);
36 nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)rc6_enc;
37 nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)rc6_dec;
38 nessie_bc_ctx.cipher_free = (nessie_bc_free_fpt)rc6_free;
39 nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)rc6_init;
43 nessie_bc_ctx.keysize_b = 192;
46 nessie_bc_ctx.keysize_b = 256;
52 void testrun_performance_rc6(void){
56 uint8_t key[16], data[16];
61 uart_putstr_P(PSTR("\r\n\r\n=== benchmark ==="));
63 uart_putstr_P(PSTR("\r\n\tconst overhead: "));
66 uart_putstr_P(PSTR("\r\n\tinterrupt overhead: "));
73 rc6_init(key, 128, &ctx);
75 uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
76 ultoa((unsigned long)t, str, 10);
82 uart_putstr_P(PSTR("\r\n\tencrypt time: "));
83 ultoa((unsigned long)t, str, 10);
89 uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
90 ultoa((unsigned long)t, str, 10);
96 uart_putstr_P(PSTR("\r\n\tfree time: "));
97 ultoa((unsigned long)t, str, 10);
99 uart_putstr_P(PSTR("\r\n"));
101 /*****************************************************************************
103 *****************************************************************************/
105 typedef void(*void_fpt)(void);
112 uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
113 uart_putstr(cipher_name);
114 uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
116 PGM_P u = PSTR("nessie\0test\0performance\0");
117 void_fpt v[] = {testrun_nessie_rc6, testrun_nessie_rc6, testrun_performance_rc6};
120 if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
121 if(execcommand_d0_P(str, u, v)<0){
122 uart_putstr_P(PSTR("\r\nunknown command\r\n"));
126 uart_putstr("ERROR\r\n");