3 This file is part of the AVR-Crypto-Lib.
4 Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
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.
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.
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/>.
20 * \file main-seed-test.c
22 * \email daniel.otte@rub.de
24 * \brief test suit for SEED
36 #include "performance_test.h"
37 #include "bcal-performance.h"
38 #include "bcal-nessie.h"
39 #include "bcal_seed.h"
45 char* algo_name = "Seed";
47 const bcdesc_t* algolist[] PROGMEM = {
48 (bcdesc_t*)&seed_desc,
51 /*****************************************************************************
52 * additional validation-functions *
53 *****************************************************************************/
54 void seed_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
58 void testrun_nessie_seed(void){
59 bcal_nessie_multiple(algolist);
63 void testrun_performance_seed(void){
64 bcal_performance_multiple(algolist);
67 /*****************************************************************************
69 *****************************************************************************/
71 void testencrypt(uint8_t* block, uint8_t* key){
73 cli_putstr("\r\n==testy-encrypt==\r\n key: ");
76 cli_putstr("\r\n plain: ");
77 cli_hexdump(block,16);
78 seed_enc(block, &ctx);
79 cli_putstr("\r\n crypt: ");
80 cli_hexdump(block,16);
83 void testdecrypt(uint8_t* block, uint8_t* key){
85 cli_putstr("\r\n==testy-decrypt==\r\n key: ");
88 cli_putstr("\r\n crypt: ");
89 cli_hexdump(block,16);
90 seed_dec(block, &ctx);
91 cli_putstr("\r\n plain: ");
92 cli_hexdump(block,16);
95 void testrun_seed(void){
97 { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
99 { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
100 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
101 { 0x47, 0x06, 0x48, 0x08, 0x51, 0xE6, 0x1B, 0xE8,
102 0x5D, 0x74, 0xBF, 0xB3, 0xFD, 0x95, 0x61, 0x85 },
103 { 0x28, 0xDB, 0xC3, 0xBC, 0x49, 0xFF, 0xD8, 0x7D,
104 0xCF, 0xA5, 0x09, 0xB1, 0x1D, 0x42, 0x2B, 0xE7,}
106 uint8_t datas[4][16]=
107 { { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
108 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
109 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
111 { 0x83, 0xA2, 0xF8, 0xA2, 0x88, 0x64, 0x1F, 0xB9,
112 0xA4, 0xE9, 0xA5, 0xCC, 0x2F, 0x13, 0x1C, 0x7D },
113 { 0xB4, 0x1E, 0x6B, 0xE2, 0xEB, 0xA8, 0x4A, 0x14,
114 0x8E, 0x2E, 0xED, 0x84, 0x59, 0x3C, 0x5E, 0xC7 }
118 testencrypt(datas[i],keys[i]);
119 testdecrypt(datas[i],keys[i]);
125 /*****************************************************************************
127 *****************************************************************************/
129 const char nessie_str[] PROGMEM = "nessie";
130 const char test_str[] PROGMEM = "test";
131 const char performance_str[] PROGMEM = "performance";
132 const char echo_str[] PROGMEM = "echo";
134 cmdlist_entry_t cmdlist[] PROGMEM = {
135 { nessie_str, NULL, testrun_nessie_seed},
136 { test_str, NULL, testrun_seed},
137 { performance_str, NULL, testrun_performance_seed},
138 { echo_str, (void*)1, (void_fpt)echo_ctrl},
145 cli_rx = (cli_rx_fpt)uart0_getc;
146 cli_tx = (cli_tx_fpt)uart0_putc;
148 cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
149 cli_putstr(algo_name);
150 cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
151 cmd_interface(cmdlist);