3 This file is part of the AVR-Crypto-Lib.
4 Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
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 bg@nerilex.org
24 * \brief test suit for SEED
31 #include "main-test-common.h"
34 #include "performance_test.h"
35 #include "bcal-performance.h"
36 #include "bcal-nessie.h"
37 #include "bcal_seed.h"
39 char *algo_name = "Seed";
41 const bcdesc_t *const algolist[] PROGMEM = {
42 (bcdesc_t*)&seed_desc,
45 /*****************************************************************************
46 * additional validation-functions *
47 *****************************************************************************/
48 void seed_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){
52 void testrun_nessie_seed(void){
53 bcal_nessie_multiple(algolist);
57 void testrun_performance_seed(void){
58 bcal_performance_multiple(algolist);
61 /*****************************************************************************
63 *****************************************************************************/
65 void testencrypt(uint8_t *block, uint8_t *key){
67 cli_putstr("\r\n==testy-encrypt==\r\n key: ");
70 cli_putstr("\r\n plain: ");
71 cli_hexdump(block,16);
72 seed_enc(block, &ctx);
73 cli_putstr("\r\n crypt: ");
74 cli_hexdump(block,16);
77 void testdecrypt(uint8_t *block, uint8_t *key){
79 cli_putstr("\r\n==testy-decrypt==\r\n key: ");
82 cli_putstr("\r\n crypt: ");
83 cli_hexdump(block,16);
84 seed_dec(block, &ctx);
85 cli_putstr("\r\n plain: ");
86 cli_hexdump(block,16);
89 void testrun_seed(void){
91 { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
93 { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
94 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
95 { 0x47, 0x06, 0x48, 0x08, 0x51, 0xE6, 0x1B, 0xE8,
96 0x5D, 0x74, 0xBF, 0xB3, 0xFD, 0x95, 0x61, 0x85 },
97 { 0x28, 0xDB, 0xC3, 0xBC, 0x49, 0xFF, 0xD8, 0x7D,
98 0xCF, 0xA5, 0x09, 0xB1, 0x1D, 0x42, 0x2B, 0xE7,}
100 uint8_t datas[4][16]=
101 { { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
102 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
103 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
105 { 0x83, 0xA2, 0xF8, 0xA2, 0x88, 0x64, 0x1F, 0xB9,
106 0xA4, 0xE9, 0xA5, 0xCC, 0x2F, 0x13, 0x1C, 0x7D },
107 { 0xB4, 0x1E, 0x6B, 0xE2, 0xEB, 0xA8, 0x4A, 0x14,
108 0x8E, 0x2E, 0xED, 0x84, 0x59, 0x3C, 0x5E, 0xC7 }
112 testencrypt(datas[i],keys[i]);
113 testdecrypt(datas[i],keys[i]);
119 /*****************************************************************************
121 *****************************************************************************/
123 const char nessie_str[] PROGMEM = "nessie";
124 const char test_str[] PROGMEM = "test";
125 const char performance_str[] PROGMEM = "performance";
126 const char echo_str[] PROGMEM = "echo";
128 const cmdlist_entry_t cmdlist[] PROGMEM = {
129 { nessie_str, NULL, testrun_nessie_seed},
130 { test_str, NULL, testrun_seed},
131 { performance_str, NULL, testrun_performance_seed},
132 { echo_str, (void*)1, (void_fpt)echo_ctrl},
140 welcome_msg(algo_name);
141 cmd_interface(cmdlist);