]> git.cryptolib.org Git - avr-crypto-lib.git/blob - test_src/main-aes-test.c
08181902bacbf1917c56ae3129d9c07bc08c7685
[avr-crypto-lib.git] / test_src / main-aes-test.c
1 /* main-aes-test.c */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 /*
20  * AES test-suit
21  *
22 */
23
24 #include "config.h"
25
26 #include "uart_i.h"
27 #include "debug.h"
28
29 #include "aes/aes.h"
30
31 #include "nessie_bc_test.h"
32 #include "cli.h"
33 #include "performance_test.h"
34 #include "dump.h"
35
36 #include "bcal_aes128.h"
37 #include "bcal_aes192.h"
38 #include "bcal_aes256.h"
39 #include "bcal-cbc.h"
40 #include "bcal-cfb_byte.h"
41 #include "bcal-cfb_bit.h"
42 #include "bcal-ofb.h"
43 #include "bcal-ctr.h"
44
45 #include <stdint.h>
46 #include <string.h>
47 #include <stdlib.h>
48 #include <avr/pgmspace.h>
49
50 char* algo_name = "AES";
51
52 /*****************************************************************************
53  *  additional validation-functions                                                                                      *
54  *****************************************************************************/
55
56 void testrun_nessie_aes(void){
57         nessie_bc_ctx.blocksize_B =  16;
58         nessie_bc_ctx.keysize_b   = 128;
59         nessie_bc_ctx.name        = algo_name;
60         nessie_bc_ctx.ctx_size_B  = sizeof(aes128_ctx_t);
61         nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes128_enc;
62         nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes128_dec;
63         nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)aes_init;
64         nessie_bc_run();
65
66         nessie_bc_ctx.keysize_b   = 192;
67         nessie_bc_ctx.ctx_size_B  = sizeof(aes192_ctx_t);
68         nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes192_enc;
69         nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes192_dec;
70         nessie_bc_run();
71
72         nessie_bc_ctx.keysize_b   = 256;
73         nessie_bc_ctx.ctx_size_B  = sizeof(aes256_ctx_t);
74         nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes256_enc;
75         nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes256_dec;
76         nessie_bc_run();
77 }
78
79 void testrun_test_aes(void){
80         uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16,
81                             0x28, 0xae, 0xd2, 0xa6,
82                             0xab, 0xf7, 0x15, 0x88,
83                             0x09, 0xcf, 0x4f, 0x3c };
84         uint8_t data[16] = { 0x32, 0x43, 0xf6, 0xa8,
85                              0x88, 0x5a, 0x30, 0x8d,
86                              0x31, 0x31, 0x98, 0xa2,
87                              0xe0, 0x37, 0x07, 0x34 };
88         aes128_ctx_t ctx;
89         aes128_init(key, &ctx);
90         cli_putstr_P(PSTR("\r\n\r\n cipher test (FIPS 197):\r\n key:        "));
91         cli_hexdump(key, 16);
92         cli_putstr_P(PSTR("\r\n plaintext:  "));
93         cli_hexdump(data, 16);
94         aes128_enc(data, &ctx);
95         cli_putstr_P(PSTR("\r\n ciphertext: "));
96         cli_hexdump(data, 16);
97         aes128_dec(data, &ctx);
98         cli_putstr_P(PSTR("\r\n plaintext:  "));
99         cli_hexdump(data, 16);
100         cli_putstr(PSTR("\r\n testing bcal:"));
101         bcgen_ctx_t bcal_ctx;
102         uint8_t r;
103         r = bcal_cipher_init(&aes128_desc, key, 128, &bcal_ctx);
104         cli_putstr_P(PSTR("\r\n init = 0x"));
105         cli_hexdump(&r, 1);
106
107         bcal_cipher_enc(data, &bcal_ctx);
108         cli_putstr_P(PSTR("\r\n ciphertext: "));
109         cli_hexdump(data, 16);
110         bcal_cipher_dec(data, &bcal_ctx);
111         cli_putstr_P(PSTR("\r\n plaintext:  "));
112         cli_hexdump(data, 16);
113         bcal_cipher_free(&bcal_ctx);
114 }
115
116 void testrun_testkey_aes128(void){
117         uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16,
118                             0x28, 0xae, 0xd2, 0xa6,
119                             0xab, 0xf7, 0x15, 0x88,
120                             0x09, 0xcf, 0x4f, 0x3c};
121         aes128_ctx_t ctx;
122         uint8_t i;
123         aes128_init(key, &ctx);
124         cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
125         cli_hexdump(key, 16);
126         for(i=0; i<11; ++i){
127                 cli_putstr_P(PSTR("\r\n index: "));
128                 cli_putc('0'+i/10);
129                 cli_putc('0'+i%10);
130                 cli_putstr_P(PSTR(" roundkey "));
131                 cli_hexdump(ctx.key[i].ks, 16);
132         }
133 }
134
135 void testrun_testkey_aes192(void){
136         uint8_t key[24] = { 0x8e, 0x73, 0xb0, 0xf7,
137                             0xda, 0x0e, 0x64, 0x52,
138                             0xc8, 0x10, 0xf3, 0x2b,
139                             0x80, 0x90, 0x79, 0xe5,
140                             0x62, 0xf8, 0xea, 0xd2,
141                             0x52, 0x2c, 0x6b, 0x7b};
142         aes192_ctx_t ctx;
143         uint8_t i;
144         memset(&ctx, 0, sizeof(aes192_ctx_t));
145         aes192_init(key, &ctx);
146         cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
147         cli_hexdump(key, 24);
148         for(i=0; i<13; ++i){
149                 cli_putstr_P(PSTR("\r\n index: "));
150                 cli_putc('0'+i/10);
151                 cli_putc('0'+i%10);
152                 cli_putstr_P(PSTR(" roundkey "));
153                 cli_hexdump(ctx.key[i].ks, 16);
154         }
155 }
156
157
158 void testrun_testkey_aes256(void){
159         uint8_t key[32] = { 0x60, 0x3d, 0xeb, 0x10,
160                             0x15, 0xca, 0x71, 0xbe,
161                             0x2b, 0x73, 0xae, 0xf0,
162                             0x85, 0x7d, 0x77, 0x81,
163                             0x1f, 0x35, 0x2c, 0x07,
164                             0x3b, 0x61, 0x08, 0xd7,
165                             0x2d, 0x98, 0x10, 0xa3,
166                             0x09, 0x14, 0xdf, 0xf4};
167         aes256_ctx_t ctx;
168         uint8_t i;
169         memset(&ctx, 0, sizeof(aes256_ctx_t));
170         aes256_init(key, &ctx);
171         cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
172         cli_hexdump(key, 32);
173         for(i=0; i<15; ++i){
174                 cli_putstr_P(PSTR("\r\n index: "));
175                 cli_putc('0'+i/10);
176                 cli_putc('0'+i%10);
177                 cli_putstr_P(PSTR(" roundkey "));
178                 cli_hexdump(ctx.key[i].ks, 16);
179         }
180 }
181
182 void testrun_testkey_aes(void){
183         testrun_testkey_aes128();
184         testrun_testkey_aes192();
185         testrun_testkey_aes256();
186 }
187
188 uint8_t modes_key[]   PROGMEM = {
189                 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
190                 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
191                 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
192                 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4
193         };
194 uint8_t modes_iv[]    PROGMEM = {
195                 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
196                 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
197     };
198
199 uint8_t modes_ctriv[] PROGMEM = {
200                 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
201                 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
202         };
203
204 uint8_t modes_plain[] PROGMEM = {
205                 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
206                 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
207                 /* --- */
208                 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
209                 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
210                 /* --- */
211                 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
212                 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
213                 /* --- */
214                 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
215                 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
216     };
217
218
219 void testrun_aes128_cbc(void){
220         uint8_t key[16];
221         uint8_t iv[16];
222         uint8_t plain[64];
223
224         bcal_cbc_ctx_t ctx;
225         uint8_t r;
226
227         memcpy_P(key,   modes_key,   16);
228         memcpy_P(iv,    modes_iv,    16);
229         memcpy_P(plain, modes_plain, 64);
230
231         cli_putstr_P(PSTR("\r\n** AES128-CBC-TEST **"));
232         r = bcal_cbc_init(&aes128_desc, key, 128, &ctx);
233         cli_putstr_P(PSTR("\r\n  init = 0x"));
234         cli_hexdump(&r, 1);
235         cli_putstr_P(PSTR("\r\n  key:   "));
236         cli_hexdump(key, 128/8);
237         cli_putstr_P(PSTR("\r\n  IV:    "));
238         cli_hexdump(iv, 128/8);
239         cli_putstr_P(PSTR("\r\n  plaintext:"));
240         cli_hexdump_block(plain, 4*128/8, 4, 16);
241         if(r)
242                 return;
243         bcal_cbc_encMsg(iv, plain, 4, &ctx);
244         cli_putstr_P(PSTR("\r\n  ciphertext:  "));
245         cli_hexdump_block(plain, 4*128/8, 4, 16);
246         bcal_cbc_decMsg(iv, plain, 4, &ctx);
247         cli_putstr_P(PSTR("\r\n  plaintext:   "));
248         cli_hexdump_block(plain, 4*128/8, 4, 16);
249         bcal_cbc_free(&ctx);
250 }
251
252 void testrun_aes128_cfb8(void){
253         uint8_t key[16];
254         uint8_t iv[16];
255         uint8_t plain[64];
256
257         bcal_cfb_B_ctx_t ctx;
258         uint8_t r;
259
260         memcpy_P(key,   modes_key,   16);
261         memcpy_P(iv,    modes_iv,    16);
262         memcpy_P(plain, modes_plain, 64);
263
264         cli_putstr_P(PSTR("\r\n** AES128-CFB8-TEST **"));
265         r = bcal_cfb_B_init(&aes128_desc, key, 128, 8, &ctx);
266         cli_putstr_P(PSTR("\r\n  init = 0x"));
267         cli_hexdump(&r, 1);
268         cli_putstr_P(PSTR("\r\n  key:   "));
269         cli_hexdump(key, 128/8);
270         cli_putstr_P(PSTR("\r\n  IV:    "));
271         cli_hexdump(iv, 128/8);
272         cli_putstr_P(PSTR("\r\n  plaintext:"));
273         cli_hexdump_block(plain, 4*128/8, 4, 16);
274         if(r)
275                 return;
276         bcal_cfb_B_encMsg(iv, plain, 64, &ctx);
277         cli_putstr_P(PSTR("\r\n  ciphertext:  "));
278         cli_hexdump_block(plain, 64, 4, 16);
279
280         bcal_cfb_B_decMsg(iv, plain, 64, &ctx);
281         cli_putstr_P(PSTR("\r\n  plaintext:   "));
282         cli_hexdump_block(plain, 64, 4, 16);
283
284         bcal_cfb_B_free(&ctx);
285
286 }
287
288 void testrun_aes128_cfb1(void){
289         uint8_t key[16];
290         uint8_t iv[16];
291         uint8_t plain[64];
292
293         bcal_cfb_b_ctx_t ctx;
294         uint8_t r;
295
296         memcpy_P(key,   modes_key,   16);
297         memcpy_P(iv,    modes_iv,    16);
298         memcpy_P(plain, modes_plain, 64);
299
300         cli_putstr_P(PSTR("\r\n** AES128-CFB1-TEST **"));
301         r = bcal_cfb_b_init(&aes128_desc, key, 128, 1, &ctx);
302         cli_putstr_P(PSTR("\r\n  init = 0x"));
303         cli_hexdump(&r, 1);
304         cli_putstr_P(PSTR("\r\n  key:   "));
305         cli_hexdump(key, 128/8);
306         cli_putstr_P(PSTR("\r\n  IV:    "));
307         cli_hexdump(iv, 128/8);
308         cli_putstr_P(PSTR("\r\n  plaintext:"));
309         cli_hexdump_block(plain, 2, 4, 16);
310         if(r)
311                 return;
312         uint8_t i, bit_offset, byte_offset;
313         bcal_cfb_b_loadIV(iv, &ctx);
314         for(i=0; i<16; ++i){
315                 byte_offset = i/8;
316                 bit_offset = i&7;
317                 cli_putstr_P(PSTR("\r\n  plain bit:   "));
318                 cli_putc((plain[byte_offset]&(1<<(7-bit_offset)))?'1':'0');
319                 bcal_cfb_b_encNext(plain+byte_offset, bit_offset, &ctx);
320                 cli_putstr_P(PSTR("\r\n  cipher bit:  "));
321                 cli_putc((plain[byte_offset]&(1<<(7-bit_offset)))?'1':'0');
322         }
323         cli_putstr_P(PSTR("\r\n  ciphertext:  "));
324         cli_hexdump_block(plain, 2, 4, 16);
325
326         bcal_cfb_b_loadIV(iv, &ctx);
327         for(i=0; i<16; ++i){
328                 byte_offset = i/8;
329                 bit_offset = i&7;
330                 cli_putstr_P(PSTR("\r\n  plain bit:   "));
331                 cli_putc((plain[byte_offset]&(1<<(7-bit_offset)))?'1':'0');
332                 bcal_cfb_b_decNext(plain+byte_offset, bit_offset, &ctx);
333                 cli_putstr_P(PSTR("\r\n  cipher bit:  "));
334                 cli_putc((plain[byte_offset]&(1<<(7-bit_offset)))?'1':'0');
335         }
336         cli_putstr_P(PSTR("\r\n  plaintext:   "));
337         cli_hexdump_block(plain, 2, 4, 16);
338
339
340         bcal_cfb_b_encMsg(iv, plain, 0, 64*8, &ctx);
341         cli_putstr_P(PSTR("\r\n  ciphertext:  "));
342         cli_hexdump_block(plain, 64, 4, 16);
343
344         bcal_cfb_b_decMsg(iv, plain, 0, 64*8, &ctx);
345         cli_putstr_P(PSTR("\r\n  plaintext:   "));
346         cli_hexdump_block(plain, 64, 4, 16);
347
348         bcal_cfb_b_free(&ctx);
349 }
350
351 void testrun_aes128_ofb(void){
352         uint8_t key[16];
353         uint8_t iv[16];
354         uint8_t plain[64];
355
356         bcal_ofb_ctx_t ctx;
357         uint8_t r;
358
359         memcpy_P(key,   modes_key,   16);
360         memcpy_P(iv,    modes_iv,    16);
361         memcpy_P(plain, modes_plain, 64);
362
363         cli_putstr_P(PSTR("\r\n** AES128-OFB-TEST **"));
364         r = bcal_ofb_init(&aes128_desc, key, 128, &ctx);
365         cli_putstr_P(PSTR("\r\n  init = 0x"));
366         cli_hexdump(&r, 1);
367         cli_putstr_P(PSTR("\r\n  key:   "));
368         cli_hexdump(key, 128/8);
369         cli_putstr_P(PSTR("\r\n  IV:    "));
370         cli_hexdump(iv, 128/8);
371         cli_putstr_P(PSTR("\r\n  plaintext:"));
372         cli_hexdump_block(plain, 4*128/8, 4, 16);
373         if(r)
374                 return;
375         bcal_ofb_encMsg(iv, plain, 4*128, &ctx);
376         cli_putstr_P(PSTR("\r\n  ciphertext:  "));
377         cli_hexdump_block(plain, 4*128/8, 4, 16);
378         bcal_ofb_decMsg(iv, plain, 4*128, &ctx);
379         cli_putstr_P(PSTR("\r\n  plaintext:   "));
380         cli_hexdump_block(plain, 4*128/8, 4, 16);
381         bcal_ofb_free(&ctx);
382 }
383
384 void testrun_aes128_ctr(void){
385         uint8_t key[16];
386         uint8_t iv[16];
387         uint8_t plain[64];
388
389         bcal_ctr_ctx_t ctx;
390         uint8_t r;
391
392         memcpy_P(key,   modes_key,   16);
393         memcpy_P(iv,    modes_ctriv, 16);
394         memcpy_P(plain, modes_plain, 64);
395
396         cli_putstr_P(PSTR("\r\n** AES128-CTR-TEST **"));
397         r = bcal_ctr_init(&aes128_desc, key, 128, NULL, &ctx);
398         cli_putstr_P(PSTR("\r\n  init = 0x"));
399         cli_hexdump(&r, 1);
400         cli_putstr_P(PSTR("\r\n  key:   "));
401         cli_hexdump(key, 128/8);
402         cli_putstr_P(PSTR("\r\n  IV:    "));
403         cli_hexdump(iv, 128/8);
404         cli_putstr_P(PSTR("\r\n  plaintext:"));
405         cli_hexdump_block(plain, 4*128/8, 4, 16);
406         if(r)
407                 return;
408         bcal_ctr_encMsg(iv, plain, 4*128, &ctx);
409         cli_putstr_P(PSTR("\r\n  ciphertext:  "));
410         cli_hexdump_block(plain, 4*128/8, 4, 16);
411         bcal_ctr_decMsg(iv, plain, 4*128, &ctx);
412         cli_putstr_P(PSTR("\r\n  plaintext:   "));
413         cli_hexdump_block(plain, 4*128/8, 4, 16);
414         bcal_ctr_free(&ctx);
415 }
416
417 /*****************************************************************************/
418
419 void testrun_performance_aes128(void){
420         uint64_t t;
421         char str[16];
422         uint8_t key[32], data[16];
423         aes128_ctx_t ctx;
424
425         calibrateTimer();
426         print_overhead();
427
428         memset(key,  0, 32);
429         memset(data, 0, 16);
430
431         startTimer(1);
432         aes128_init(key, &ctx);
433         t = stopTimer();
434         cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
435         ultoa((unsigned long)t, str, 10);
436         cli_putstr(str);
437
438
439         startTimer(1);
440         aes128_enc(data, &ctx);
441         t = stopTimer();
442         cli_putstr_P(PSTR("\r\n\tencrypt time: "));
443         ultoa((unsigned long)t, str, 10);
444         cli_putstr(str);
445
446
447         startTimer(1);
448         aes128_dec(data, &ctx);
449         t = stopTimer();
450         cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
451         ultoa((unsigned long)t, str, 10);
452         cli_putstr(str);
453
454         cli_putstr_P(PSTR("\r\n"));
455 }
456
457
458 void testrun_performance_aes192(void){
459         uint64_t t;
460         char str[16];
461         uint8_t key[32], data[16];
462         aes192_ctx_t ctx;
463
464         calibrateTimer();
465         print_overhead();
466
467         memset(key,  0, 32);
468         memset(data, 0, 16);
469
470         startTimer(1);
471         aes192_init(key, &ctx);
472         t = stopTimer();
473         cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
474         ultoa((unsigned long)t, str, 10);
475         cli_putstr(str);
476
477
478         startTimer(1);
479         aes192_enc(data, &ctx);
480         t = stopTimer();
481         cli_putstr_P(PSTR("\r\n\tencrypt time: "));
482         ultoa((unsigned long)t, str, 10);
483         cli_putstr(str);
484
485
486         startTimer(1);
487         aes192_dec(data, &ctx);
488         t = stopTimer();
489         cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
490         ultoa((unsigned long)t, str, 10);
491         cli_putstr(str);
492
493         cli_putstr_P(PSTR("\r\n"));
494 }
495
496
497 void testrun_performance_aes256(void){
498         uint64_t t;
499         char str[16];
500         uint8_t key[32], data[16];
501         aes256_ctx_t ctx;
502
503         calibrateTimer();
504         print_overhead();
505
506         memset(key,  0, 32);
507         memset(data, 0, 16);
508
509         startTimer(1);
510         aes256_init(key, &ctx);
511         t = stopTimer();
512         cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
513         ultoa((unsigned long)t, str, 10);
514         cli_putstr(str);
515
516
517         startTimer(1);
518         aes256_enc(data, &ctx);
519         t = stopTimer();
520         cli_putstr_P(PSTR("\r\n\tencrypt time: "));
521         ultoa((unsigned long)t, str, 10);
522         cli_putstr(str);
523
524
525         startTimer(1);
526         aes256_dec(data, &ctx);
527         t = stopTimer();
528         cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
529         ultoa((unsigned long)t, str, 10);
530         cli_putstr(str);
531
532         cli_putstr_P(PSTR("\r\n"));
533 }
534
535 void testrun_performance_aes(void){
536         cli_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n"));
537         cli_putstr_P(PSTR("\r\n       AES-128\r\n"));
538         testrun_performance_aes128();
539         cli_putstr_P(PSTR("\r\n       AES-192\r\n"));
540         testrun_performance_aes192();
541         cli_putstr_P(PSTR("\r\n       AES-256\r\n"));
542         testrun_performance_aes256();
543 }
544 /*****************************************************************************
545  *  main                                                                                                                                         *
546  *****************************************************************************/
547
548 const char nessie_str[]      PROGMEM = "nessie";
549 const char test_str[]        PROGMEM = "test";
550 const char testkey_str[]     PROGMEM = "testkey";
551 const char testcbc_str[]     PROGMEM = "testcbc";
552 const char testcfb8_str[]    PROGMEM = "testcfb8";
553 const char testcfb1_str[]    PROGMEM = "testcfb1";
554 const char testofb_str[]     PROGMEM = "testofb";
555 const char testctr_str[]     PROGMEM = "testctr";
556 const char performance_str[] PROGMEM = "performance";
557 const char dump_str[]        PROGMEM = "dump";
558 const char echo_str[]        PROGMEM = "echo";
559
560 cmdlist_entry_t cmdlist[] PROGMEM = {
561         { nessie_str,      NULL, testrun_nessie_aes },
562         { test_str,        NULL, testrun_test_aes},
563         { testkey_str,     NULL, testrun_testkey_aes},
564         { testcbc_str,     NULL, testrun_aes128_cbc},
565         { testcfb8_str,    NULL, testrun_aes128_cfb8},
566         { testcfb1_str,    NULL, testrun_aes128_cfb1},
567         { testofb_str,     NULL, testrun_aes128_ofb},
568         { testctr_str,     NULL, testrun_aes128_ctr},
569         { performance_str, NULL, testrun_performance_aes},
570         { dump_str,    (void*)1, (void_fpt)dump},
571         { echo_str,    (void*)1, (void_fpt)echo_ctrl},
572         { NULL,            NULL, NULL}
573 };
574
575
576 int main (void){
577         DEBUG_INIT();
578
579         cli_rx = (cli_rx_fpt)uart0_getc;
580         cli_tx = (cli_tx_fpt)uart0_putc;
581         for(;;){
582                 cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
583                 cli_putstr(algo_name);
584                 cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
585                 cmd_interface(cmdlist);
586         }
587 }
588