13 #include "performance_test.h"
14 #include "bcal-performance.h"
15 #include "bcal-nessie.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){
36 bcal_nessie_multiple(algolist);
39 void testrun_rfc_cast6(void){
40 cli_putstr_P(PSTR("\r\n testvalues from rfc-2612\r\n"));
41 uint8_t key[32], data[16];
43 memcpy_P(key, PSTR("\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
44 "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d"), 16);
47 cli_putstr_P(PSTR("\r\n key: "));
49 cli_putstr_P(PSTR("\r\n PT: "));
50 cli_hexdump(data, 16);
51 cast6_init(key, 128, &ctx);
52 cast6_enc(data, &ctx);
53 cli_putstr_P(PSTR("\r\n CT: "));
54 cli_hexdump(data, 16);
55 cast6_dec(data, &ctx);
56 cli_putstr_P(PSTR("\r\n PT: "));
57 cli_hexdump(data, 16);
59 cli_putstr_P(PSTR("\r\n\r\n"));
61 memcpy_P(key, PSTR("\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
62 "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
63 "\xba\xc7\x7a\x77\x17\x94\x28\x63"), 24);
65 cli_putstr_P(PSTR("\r\n key: "));
67 cli_putstr_P(PSTR("\r\n PT: "));
68 cli_hexdump(data, 16);
69 cast6_init(key, 192, &ctx);
70 cast6_enc(data, &ctx);
71 cli_putstr_P(PSTR("\r\n CT: "));
72 cli_hexdump(data, 16);
73 cast6_dec(data, &ctx);
74 cli_putstr_P(PSTR("\r\n PT: "));
75 cli_hexdump(data, 16);
77 cli_putstr_P(PSTR("\r\n\r\n"));
79 memcpy_P(key, PSTR("\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
80 "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
81 "\x8d\x7c\x47\xce\x26\x49\x08\x46"
82 "\x1c\xc1\xb5\x13\x7a\xe6\xb6\x04"), 32);
83 cli_putstr_P(PSTR("\r\n key: "));
85 cli_putstr_P(PSTR("\r\n PT: "));
86 cli_hexdump(data, 16);
87 cast6_init(key, 256, &ctx);
88 cast6_enc(data, &ctx);
89 cli_putstr_P(PSTR("\r\n CT: "));
90 cli_hexdump(data, 16);
91 cast6_dec(data, &ctx);
92 cli_putstr_P(PSTR("\r\n PT: "));
93 cli_hexdump(data, 16);
95 cli_putstr_P(PSTR("\r\n\r\n"));
98 void testrun_performance_cast6(void){
99 bcal_performance_multiple(algolist);
102 /*****************************************************************************
104 *****************************************************************************/
106 const char nessie_str[] PROGMEM = "nessie";
107 const char test_str[] PROGMEM = "test";
108 const char performance_str[] PROGMEM = "performance";
109 const char echo_str[] PROGMEM = "echo";
111 cmdlist_entry_t cmdlist[] PROGMEM = {
112 { nessie_str, NULL, testrun_nessie_cast6 },
113 { test_str, NULL, testrun_rfc_cast6},
114 { performance_str, NULL, testrun_performance_cast6},
115 { echo_str, (void*)1, (void_fpt)echo_ctrl},
121 cli_rx = (cli_rx_fpt)uart0_getc;
122 cli_tx = (cli_tx_fpt)uart0_putc;
124 cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
125 cli_putstr(algo_name);
126 cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
127 cmd_interface(cmdlist);