1 /* main-skipjack-test.c */
3 This file is part of the Crypto-avr-lib/microcrypt-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/>.
25 #include "serial-tools.h"
35 /*****************************************************************************
36 * additional validation-functions *
37 *****************************************************************************/
39 /*****************************************************************************
41 *****************************************************************************/
43 void testencrypt(uint8_t* block, uint8_t* key){
44 uart_putstr("\r\n==testy-encrypt==\r\n key: ");
46 uart_putstr("\r\n plain: ");
47 uart_hexdump(block,8);
48 skipjack_enc(block,key);
49 uart_putstr("\r\n crypt: ");
50 uart_hexdump(block,8);
53 void testdecrypt(uint8_t* block, uint8_t* key){
54 uart_putstr("\r\n==testy-decrypt==\r\n key: ");
56 uart_putstr("\r\n crypt: ");
57 uart_hexdump(block,8);
58 skipjack_dec(block,key);
59 uart_putstr("\r\n plain: ");
60 uart_hexdump(block,8);
63 void testrun_skipjack(void){
64 uint8_t key[]={ 0x00, 0x99, 0x88, 0x77, 0x66,
65 0x55, 0x44, 0x33, 0x22, 0x11};
66 uint8_t data[]={ 0x33, 0x22, 0x11, 0x00, 0xdd, 0xcc, 0xbb, 0xaa};
67 testencrypt(data,key);
68 testdecrypt(data,key);
73 /*****************************************************************************
75 *****************************************************************************/
83 uart_putstr("\r\n\r\nCrypto-VS (skipjack)\r\nloaded and running\r\n");
87 if (!getnextwordn(str,20)) {DEBUG_S("DBG: W1\r\n"); goto error;}
88 if (strcmp(str, "test")) {DEBUG_S("DBG: 1b\r\n"); goto error;}
93 uart_putstr("ERROR\r\n");