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_skipjack.h"
41 char* algo_name = "Skipjack";
43 const bcdesc_t* algolist[] PROGMEM = {
44 (bcdesc_t*)&skipjack_desc,
47 /*****************************************************************************
48 * additional validation-functions *
49 *****************************************************************************/
50 void skipjack_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
54 void testrun_nessie_skipjack(void){
55 nessie_bc_ctx.blocksize_B = 8;
56 nessie_bc_ctx.keysize_b = 80;
57 nessie_bc_ctx.name = algo_name;
58 nessie_bc_ctx.ctx_size_B = 10;
59 nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)skipjack_enc;
60 nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)skipjack_dec;
61 nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)skipjack_genctx_dummy;
67 void testrun_performance_skipjack(void){
68 bcal_performance_multiple(algolist);
71 /*****************************************************************************
73 *****************************************************************************/
75 void testencrypt(uint8_t* block, uint8_t* key){
76 cli_putstr("\r\n==testy-encrypt==\r\n key: ");
78 cli_putstr("\r\n plain: ");
80 skipjack_enc(block,key);
81 cli_putstr("\r\n crypt: ");
85 void testdecrypt(uint8_t* block, uint8_t* key){
86 cli_putstr("\r\n==testy-decrypt==\r\n key: ");
88 cli_putstr("\r\n crypt: ");
90 skipjack_dec(block,key);
91 cli_putstr("\r\n plain: ");
95 void testrun_skipjack(void){
97 { 0x00, 0x99, 0x88, 0x77, 0x66,
98 0x55, 0x44, 0x33, 0x22, 0x11 },
99 { 0x11, 0x22, 0x33, 0x44, 0x55,
100 0x66, 0x77, 0x88, 0x99, 0x00 }
104 { 0x33, 0x22, 0x11, 0x00,
105 0xdd, 0xcc, 0xbb, 0xaa },
106 { 0xaa, 0xbb, 0xcc, 0xdd,
107 0x00, 0x11, 0x22, 0x33 }
109 testencrypt(data[0],key[0]);
110 testdecrypt(data[0],key[0]);
111 testencrypt(data[1],key[1]);
112 testdecrypt(data[1],key[1]);
117 /*****************************************************************************
119 *****************************************************************************/
121 const char nessie_str[] PROGMEM = "nessie";
122 const char test_str[] PROGMEM = "test";
123 const char performance_str[] PROGMEM = "performance";
124 const char echo_str[] PROGMEM = "echo";
126 cmdlist_entry_t cmdlist[] PROGMEM = {
127 { nessie_str, NULL, testrun_nessie_skipjack},
128 { test_str, NULL, testrun_skipjack},
129 { performance_str, NULL, testrun_performance_skipjack},
130 { echo_str, (void*)1, (void_fpt)echo_ctrl},
137 cli_rx = (cli_rx_fpt)uart0_getc;
138 cli_tx = (cli_tx_fpt)uart0_putc;
140 cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
141 cli_putstr(algo_name);
142 cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
143 cmd_interface(cmdlist);