1 /* main-cubehash-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 "hfal_cubehash.h"
32 #include "nessie_hash_test.h"
33 #include "performance_test.h"
34 #include "hfal-nessie.h"
35 #include "hfal-performance.h"
36 #include "hfal-test.h"
42 char* algo_name = "CubeHash";
45 const hfdesc_t* const algolist[] PROGMEM = {
46 (hfdesc_t*)&cubehash224_desc,
47 (hfdesc_t*)&cubehash256_desc,
48 (hfdesc_t*)&cubehash384_desc,
49 (hfdesc_t*)&cubehash512_desc,
53 /*****************************************************************************
54 * additional validation-functions *
55 *****************************************************************************/
57 void cubehash256_test0(void){
60 cubehash256_init(&ctx);
61 cli_putstr_P(PSTR("\r\ninit done "));
62 cubehash_lastBlock(&ctx, NULL, 0);
63 cli_putstr_P(PSTR("\r\nlastblock done "));
64 cubehash256_ctx2hash(hash, &ctx);
65 cli_putstr_P(PSTR("\r\nhash = "));
66 cli_hexdump(hash, 32);
69 void performance_cubehash(void){
70 hfal_performance_multiple(algolist);
73 void testrun_nessie_cubehash(void){
74 hfal_nessie_multiple(algolist);
76 /*****************************************************************************
78 *****************************************************************************/
80 const char nessie_str[] PROGMEM = "nessie";
81 const char test256_str[] PROGMEM = "test256";
82 const char performance_str[] PROGMEM = "performance";
83 const char echo_str[] PROGMEM = "echo";
84 const char shavs_list_str[] PROGMEM = "shavs_list";
85 const char shavs_set_str[] PROGMEM = "shavs_set";
86 const char shavs_test1_str[] PROGMEM = "shavs_test1";
87 const char shavs_test3_str[] PROGMEM = "shavs_test3";
89 const cmdlist_entry_t cmdlist[] PROGMEM = {
90 { nessie_str, NULL, testrun_nessie_cubehash },
91 { test256_str, NULL, cubehash256_test0 },
92 { performance_str, NULL, performance_cubehash },
93 { shavs_list_str, NULL, shavs_listalgos },
94 { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo },
95 { shavs_test1_str, NULL, shavs_test1 },
96 { shavs_test3_str, NULL, shavs_test3 },
97 { echo_str, (void*)1, (void_fpt)echo_ctrl },
104 cli_rx = (cli_rx_fpt)uart0_getc;
105 cli_tx = (cli_tx_fpt)uart0_putc;
106 shavs_algolist=(hfdesc_t**)algolist;
107 shavs_algo=(hfdesc_t*)&cubehash256_desc;
109 cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
110 cli_putstr(algo_name);
111 cli_putstr_P(PSTR("; "));
112 cli_putstr(__DATE__);
113 cli_putstr_P(PSTR(" "));
114 cli_putstr(__TIME__);
115 cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
117 cmd_interface(cmdlist);