3 This file is part of the AVR-Crypto-Lib.
4 Copyright (C) 2006-2014 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/>.
21 /* main-arcfour-test.c */
23 This file is part of the AVR-Crypto-Lib.
24 Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
26 This program is free software: you can redistribute it and/or modify
27 it under the terms of the GNU General Public License as published by
28 the Free Software Foundation, either version 3 of the License, or
29 (at your option) any later version.
31 This program is distributed in the hope that it will be useful,
32 but WITHOUT ANY WARRANTY; without even the implied warranty of
33 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 GNU General Public License for more details.
36 You should have received a copy of the GNU General Public License
37 along with this program. If not, see <http://www.gnu.org/licenses/>.
40 * arcfour (RC4 compatible) test-suit
45 #include "main-test-common.h"
48 #include "performance_test.h"
50 char *algo_name = "norx";
52 /*****************************************************************************
53 * additional validation-functions *
54 *****************************************************************************/
56 #define DUMP(x) do { printf("%s", "\n\n" #x ":"); \
57 cli_hexdump_block((x), sizeof(x), 4, 16); } while (0)
60 void g32(uint32_t *(a[4]));
61 void f32(norx32_ctx_t *ctx);
64 void g32_dump(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
66 uint32_t *(x[4]) = {&a, &b, &c, &d};
67 printf("\n (a,b,c,d) = (%08lX, %08lX, %08lX, %08lX)", *(x[0]), *(x[1]), *(x[2]), *(x[3]));
69 printf("\nG(a,b,c,d) = (%08lX, %08lX, %08lX, %08lX)\n", *(x[0]), *(x[1]), *(x[2]), *(x[3]));
72 void testrun_g32(void)
89 g32_dump(0x01234567l, 0x89abcdefl, 0xfedcba98l, 0x76543210l);
92 void testrun_f32(void)
95 memset(ctx.s, 0, sizeof(ctx.s));
102 void testrun_norx32(void)
104 const uint8_t key[] = {
105 0x33, 0x22, 0x11, 0x00,
106 0x77, 0x66, 0x55, 0x44,
107 0xBB, 0xAA, 0x99, 0x88,
108 0xFF, 0xEE, 0xDD, 0xCC,
110 const uint8_t nonce[] = {
111 0xFF, 0xFF, 0xFF, 0xFF,
112 0xFF, 0xFF, 0xFF, 0xFF
114 const uint8_t header[] = {
115 0x02, 0x00, 0x00, 0x10,
116 0x04, 0x00, 0x00, 0x30,
118 const uint8_t payload[] = {
119 0x07, 0x00, 0x00, 0x80,
120 0x05, 0x00, 0x00, 0x60,
121 0x03, 0x00, 0x00, 0x40,
122 0x01, 0x00, 0x00, 0x20,
124 // const uint8_t trailer[0];
127 norx32_default_simple(
146 cli_hexdump_block(crypt, sizeof(payload), 4, 16);
147 cli_hexdump_block(tag, sizeof(tag), 4, 16);
152 /*****************************************************************************
154 *****************************************************************************/
156 const char nessie_str[] PROGMEM = "nessie";
157 const char test_str[] PROGMEM = "test";
158 const char ftest_str[] PROGMEM = "ftest";
159 const char gtest_str[] PROGMEM = "gtest";
160 const char performance_str[] PROGMEM = "performance";
161 const char echo_str[] PROGMEM = "echo";
163 const cmdlist_entry_t cmdlist[] PROGMEM = {
164 // { nessie_str, NULL, NULL },
165 { test_str, NULL, testrun_norx32},
166 // { ftest_str, NULL, testrun_f32},
167 // { gtest_str, NULL, testrun_g32},
168 // { performance_str, NULL, testrun_performance_arcfour},
169 { echo_str, (void*)1, (void_fpt)echo_ctrl},
177 welcome_msg(algo_name);
178 cmd_interface(cmdlist);