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/>.
24 #include "main-test-common.h"
27 #include "hfal_cubehash.h"
29 #include "nessie_hash_test.h"
30 #include "performance_test.h"
31 #include "hfal-nessie.h"
32 #include "hfal-performance.h"
33 #include "hfal-test.h"
35 char *algo_name = "CubeHash";
38 const hfdesc_t *const algolist[] PROGMEM = {
39 (hfdesc_t*)&cubehash224_desc,
40 (hfdesc_t*)&cubehash256_desc,
41 (hfdesc_t*)&cubehash384_desc,
42 (hfdesc_t*)&cubehash512_desc,
46 /*****************************************************************************
47 * additional validation-functions *
48 *****************************************************************************/
50 void cubehash256_test0(void){
53 cubehash256_init(&ctx);
54 cli_putstr_P(PSTR("\r\ninit done "));
55 cubehash_lastBlock(&ctx, NULL, 0);
56 cli_putstr_P(PSTR("\r\nlastblock done "));
57 cubehash256_ctx2hash(hash, &ctx);
58 cli_putstr_P(PSTR("\r\nhash = "));
59 cli_hexdump(hash, 32);
62 void performance_cubehash(void){
63 hfal_performance_multiple(algolist);
66 void testrun_nessie_cubehash(void){
67 hfal_nessie_multiple(algolist);
69 /*****************************************************************************
71 *****************************************************************************/
73 const char nessie_str[] PROGMEM = "nessie";
74 const char test256_str[] PROGMEM = "test256";
75 const char performance_str[] PROGMEM = "performance";
76 const char echo_str[] PROGMEM = "echo";
77 const char shavs_list_str[] PROGMEM = "shavs_list";
78 const char shavs_set_str[] PROGMEM = "shavs_set";
79 const char shavs_test1_str[] PROGMEM = "shavs_test1";
80 const char shavs_test3_str[] PROGMEM = "shavs_test3";
82 const cmdlist_entry_t cmdlist[] PROGMEM = {
83 { nessie_str, NULL, testrun_nessie_cubehash },
84 { test256_str, NULL, cubehash256_test0 },
85 { performance_str, NULL, performance_cubehash },
86 { shavs_list_str, NULL, shavs_listalgos },
87 { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo },
88 { shavs_test1_str, NULL, shavs_test1 },
89 { shavs_test3_str, NULL, shavs_test3 },
90 { echo_str, (void*)1, (void_fpt)echo_ctrl },
97 shavs_algolist=(hfdesc_t**)algolist;
98 shavs_algo=(hfdesc_t*)&cubehash256_desc;
100 welcome_msg(algo_name);
101 cmd_interface(cmdlist);