1 /* main-skipjack-test.c */
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/>.
30 #include "nessie_bc_test.h"
32 #include "performance_test.h"
33 #include "bcal-performance.h"
34 #include "bcal-nessie.h"
35 #include "bcal_skipjack.h"
42 char* algo_name = "Skipjack";
44 const bcdesc_t* const algolist[] PROGMEM = {
45 (bcdesc_t*)&skipjack_desc,
48 /*****************************************************************************
49 * additional validation-functions *
50 *****************************************************************************/
51 void skipjack_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
55 void testrun_nessie_skipjack(void){
56 bcal_nessie_multiple(algolist);
60 void testrun_performance_skipjack(void){
61 bcal_performance_multiple(algolist);
64 /*****************************************************************************
66 *****************************************************************************/
68 void testencrypt(uint8_t* block, uint8_t* key){
69 cli_putstr("\r\n==testy-encrypt==\r\n key: ");
71 cli_putstr("\r\n plain: ");
73 skipjack_enc(block,key);
74 cli_putstr("\r\n crypt: ");
78 void testdecrypt(uint8_t* block, uint8_t* key){
79 cli_putstr("\r\n==testy-decrypt==\r\n key: ");
81 cli_putstr("\r\n crypt: ");
83 skipjack_dec(block,key);
84 cli_putstr("\r\n plain: ");
88 void testrun_skipjack(void){
90 { 0x00, 0x99, 0x88, 0x77, 0x66,
91 0x55, 0x44, 0x33, 0x22, 0x11 },
92 { 0x11, 0x22, 0x33, 0x44, 0x55,
93 0x66, 0x77, 0x88, 0x99, 0x00 }
97 { 0x33, 0x22, 0x11, 0x00,
98 0xdd, 0xcc, 0xbb, 0xaa },
99 { 0xaa, 0xbb, 0xcc, 0xdd,
100 0x00, 0x11, 0x22, 0x33 }
102 testencrypt(data[0],key[0]);
103 testdecrypt(data[0],key[0]);
104 testencrypt(data[1],key[1]);
105 testdecrypt(data[1],key[1]);
110 /*****************************************************************************
112 *****************************************************************************/
114 const char nessie_str[] PROGMEM = "nessie";
115 const char test_str[] PROGMEM = "test";
116 const char performance_str[] PROGMEM = "performance";
117 const char echo_str[] PROGMEM = "echo";
119 const cmdlist_entry_t cmdlist[] PROGMEM = {
120 { nessie_str, NULL, testrun_nessie_skipjack},
121 { test_str, NULL, testrun_skipjack},
122 { performance_str, NULL, testrun_performance_skipjack},
123 { echo_str, (void*)1, (void_fpt)echo_ctrl},
130 cli_rx = (cli_rx_fpt)uart0_getc;
131 cli_tx = (cli_tx_fpt)uart0_putc;
133 cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
134 cli_putstr(algo_name);
135 cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
136 cmd_interface(cmdlist);