12 #include "nessie_bc_test.h"
14 #include "performance_test.h"
15 #include "bcal-performance.h"
16 #include "bcal_cast6.h"
21 #include <avr/pgmspace.h>
23 char* algo_name = "CAST-256";
25 const bcdesc_t* algolist[] PROGMEM = {
26 (bcdesc_t*)&cast6_desc,
30 /*****************************************************************************
31 * additional validation-functions *
32 *****************************************************************************/
35 void testrun_nessie_cast6(void){
37 nessie_bc_ctx.blocksize_B = 16;
38 nessie_bc_ctx.keysize_b = 128;
39 nessie_bc_ctx.name = algo_name;
40 nessie_bc_ctx.ctx_size_B = sizeof(cast6_ctx_t);
41 nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)cast6_enc;
42 nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)cast6_dec;
43 nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)cast6_init;
47 nessie_bc_ctx.keysize_b = 192;
50 nessie_bc_ctx.keysize_b = 256;
54 void testrun_rfc_cast6(void){
55 cli_putstr_P(PSTR("\r\n testvalues from rfc-2612\r\n"));
56 uint8_t key[32], data[16];
58 memcpy_P(key, PSTR("\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
59 "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d"), 16);
62 cli_putstr_P(PSTR("\r\n key: "));
64 cli_putstr_P(PSTR("\r\n PT: "));
65 cli_hexdump(data, 16);
66 cast6_init(key, 128, &ctx);
67 cast6_enc(data, &ctx);
68 cli_putstr_P(PSTR("\r\n CT: "));
69 cli_hexdump(data, 16);
70 cast6_dec(data, &ctx);
71 cli_putstr_P(PSTR("\r\n PT: "));
72 cli_hexdump(data, 16);
74 cli_putstr_P(PSTR("\r\n\r\n"));
76 memcpy_P(key, PSTR("\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
77 "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
78 "\xba\xc7\x7a\x77\x17\x94\x28\x63"), 24);
80 cli_putstr_P(PSTR("\r\n key: "));
82 cli_putstr_P(PSTR("\r\n PT: "));
83 cli_hexdump(data, 16);
84 cast6_init(key, 192, &ctx);
85 cast6_enc(data, &ctx);
86 cli_putstr_P(PSTR("\r\n CT: "));
87 cli_hexdump(data, 16);
88 cast6_dec(data, &ctx);
89 cli_putstr_P(PSTR("\r\n PT: "));
90 cli_hexdump(data, 16);
92 cli_putstr_P(PSTR("\r\n\r\n"));
94 memcpy_P(key, PSTR("\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
95 "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
96 "\x8d\x7c\x47\xce\x26\x49\x08\x46"
97 "\x1c\xc1\xb5\x13\x7a\xe6\xb6\x04"), 32);
98 cli_putstr_P(PSTR("\r\n key: "));
100 cli_putstr_P(PSTR("\r\n PT: "));
101 cli_hexdump(data, 16);
102 cast6_init(key, 256, &ctx);
103 cast6_enc(data, &ctx);
104 cli_putstr_P(PSTR("\r\n CT: "));
105 cli_hexdump(data, 16);
106 cast6_dec(data, &ctx);
107 cli_putstr_P(PSTR("\r\n PT: "));
108 cli_hexdump(data, 16);
110 cli_putstr_P(PSTR("\r\n\r\n"));
113 void testrun_performance_cast6(void){
114 bcal_performance_multiple(algolist);
117 /*****************************************************************************
119 *****************************************************************************/
121 const char nessie_str[] PROGMEM = "nessie";
122 const char test_str[] PROGMEM = "test";
123 const char performance_str[] PROGMEM = "performance";
124 const char echo_str[] PROGMEM = "echo";
126 cmdlist_entry_t cmdlist[] PROGMEM = {
127 { nessie_str, NULL, testrun_nessie_cast6 },
128 { test_str, NULL, testrun_rfc_cast6},
129 { performance_str, NULL, testrun_performance_cast6},
130 { echo_str, (void*)1, (void_fpt)echo_ctrl},
136 cli_rx = (cli_rx_fpt)uart0_getc;
137 cli_tx = (cli_tx_fpt)uart0_putc;
139 cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
140 cli_putstr(algo_name);
141 cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
142 cmd_interface(cmdlist);