]> git.cryptolib.org Git - avr-crypto-lib.git/blob - test_src/main-cubehash-test.c
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / test_src / main-cubehash-test.c
1 /* main-cubehash-test.c */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
5
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.
10
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.
15
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/>.
18 */
19 /*
20  * CubeHash test-suit
21  *
22 */
23
24 #include "main-test-common.h"
25
26 #include "cubehash.h"
27 #include "hfal_cubehash.h"
28 #include "shavs.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"
34
35 char *algo_name = "CubeHash";
36
37
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,
43         NULL
44 };
45
46 /*****************************************************************************
47  *  additional validation-functions                                                                                      *
48  *****************************************************************************/
49
50 void cubehash256_test0(void){
51         cubehash_ctx_t ctx;
52         uint8_t hash[32];
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);
60 }
61
62 void performance_cubehash(void){
63         hfal_performance_multiple(algolist);
64 }
65
66 void testrun_nessie_cubehash(void){
67         hfal_nessie_multiple(algolist);
68 }
69 /*****************************************************************************
70  *  main                                                                                                                                         *
71  *****************************************************************************/
72
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";
81
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         },
91         { NULL,                      NULL, NULL                        }
92 };
93
94 int main (void){
95     main_setup();
96
97         shavs_algolist=(hfdesc_t**)algolist;
98         shavs_algo=(hfdesc_t*)&cubehash256_desc;
99         for(;;){
100             welcome_msg(algo_name);
101                 cmd_interface(cmdlist);
102         }
103 }