7 #include "serial-tools.h"
12 #include "nessie_bc_test.h"
14 #include "performance_test.h"
21 char* cipher_name = "RC5-32/12/16";
23 /*****************************************************************************
24 * additional validation-functions *
25 *****************************************************************************/
26 void rc5_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){
27 rc5_init(key, keysize_b, RC5_ROUNDS, ctx);
30 void testrun_nessie_rc5(void){
32 nessie_bc_ctx.blocksize_B = 8;
33 nessie_bc_ctx.keysize_b = 128;
34 nessie_bc_ctx.name = cipher_name;
35 nessie_bc_ctx.ctx_size_B = sizeof(rc5_ctx_t);
36 nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)rc5_enc;
37 nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)rc5_dec;
38 nessie_bc_ctx.cipher_free = (nessie_bc_free_fpt)rc5_free;
39 nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)rc5_genctx_dummy;
45 void testrun_performance_rc5(void){
49 uint8_t key[16], data[16];
54 uart_putstr_P(PSTR("\r\n\r\n=== benchmark ==="));
56 uart_putstr_P(PSTR("\r\n\tconst overhead: "));
59 uart_putstr_P(PSTR("\r\n\tinterrupt overhead: "));
66 rc5_init(key, 128, RC5_ROUNDS, &ctx);
68 uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
69 ultoa((unsigned long)t, str, 10);
75 uart_putstr_P(PSTR("\r\n\tencrypt time: "));
76 ultoa((unsigned long)t, str, 10);
82 uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
83 ultoa((unsigned long)t, str, 10);
89 uart_putstr_P(PSTR("\r\n\tfree time: "));
90 ultoa((unsigned long)t, str, 10);
92 uart_putstr_P(PSTR("\r\n"));
94 /*****************************************************************************
96 *****************************************************************************/
98 typedef void(*void_fpt)(void);
105 uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
106 uart_putstr(cipher_name);
107 uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
109 PGM_P u = PSTR("nessie\0test\0performance\0");
110 void_fpt v[] = {testrun_nessie_rc5, testrun_nessie_rc5, testrun_performance_rc5};
113 if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
114 if(execcommand_d0_P(str, u, v)<0){
115 uart_putstr_P(PSTR("\r\nunknown command\r\n"));
119 uart_putstr("ERROR\r\n");