7 #include "serial-tools.h"
12 #include "nessie_bc_test.h"
14 #include "performance_test.h"
20 char* cipher_name = "Serpent";
22 /*****************************************************************************
23 * additional validation-functions *
24 *****************************************************************************/
25 void serpent_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
26 serpent_genctx(key, keysize&0xff, ctx);
29 void testrun_nessie_serpent(void){
30 nessie_bc_ctx.blocksize_B = 16;
31 nessie_bc_ctx.keysize_b = 128;
32 nessie_bc_ctx.name = cipher_name;
33 nessie_bc_ctx.ctx_size_B = sizeof(serpent_ctx_t);
34 nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)serpent_enc;
35 nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)serpent_dec;
36 nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)serpent_genctx_dummy;
40 nessie_bc_ctx.keysize_b = 192;
43 nessie_bc_ctx.keysize_b = 256;
48 void testrun_performance_serpent(void){
52 uint8_t key[32], data[16];
57 uart_putstr_P(PSTR("\r\n\r\n=== benchmark ==="));
59 uart_putstr_P(PSTR("\r\n\tconst overhead: "));
62 uart_putstr_P(PSTR("\r\n\tinterrupt overhead: "));
69 serpent_genctx(key, 0, &ctx);
71 uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
76 serpent_enc(data, &ctx);
78 uart_putstr_P(PSTR("\r\n\tencrypt time: "));
83 serpent_dec(data, &ctx);
85 uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
87 uart_putstr_P(PSTR("\r\n"));
89 /*****************************************************************************
91 *****************************************************************************/
93 typedef void(*void_fpt)(void);
100 uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
101 uart_putstr(cipher_name);
102 uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
104 PGM_P u = PSTR("nessie\0test\0performance\0");
105 void_fpt v[] = {testrun_nessie_serpent, testrun_nessie_serpent, testrun_performance_serpent};
108 if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
109 if(execcommand_d0_P(str, u, v)<0){
110 uart_putstr_P(PSTR("\r\nunknown command\r\n"));
114 uart_putstr("ERROR\r\n");