]> git.cryptolib.org Git - avr-crypto-lib.git/blob - test_src/main-jh-test.c
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / test_src / main-jh-test.c
1 /* main-jh-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  * JH test-suit
21  *
22 */
23
24 #include "main-test-common.h"
25
26 #include "jh_simple.h"
27 #include "hfal_jh.h"
28 #include "hfal-nessie.h"
29 #include "hfal-test.h"
30 #include "hfal-performance.h"
31 #include "shavs.h"
32 #include "nessie_hash_test.h"
33 #include "performance_test.h"
34
35 char *algo_name = "JH";
36
37
38 const hfdesc_t *const algolist[] PROGMEM = {
39         (hfdesc_t*)&jh224_desc,
40         (hfdesc_t*)&jh256_desc,
41         (hfdesc_t*)&jh384_desc,
42         (hfdesc_t*)&jh512_desc,
43         NULL
44 };
45
46 /*****************************************************************************
47  *  additional validation-functions                                                                                      *
48  *****************************************************************************/
49
50 void performance_jh(void){
51         hfal_performance_multiple(algolist);
52 }
53
54 void testrun_nessie_jh(void){
55         hfal_nessie_multiple(algolist);
56 }
57
58 void test256Null(void){
59         jh_ctx_t ctx;
60         uint8_t hash[32];
61         jh256_init(&ctx);
62         jh_lastBlock(&ctx, NULL, 0);
63         jh256_ctx2hash(hash, &ctx);
64         cli_putstr_P(PSTR("\r\nresult:\r\n"));
65         cli_hexdump_block(hash, 32, 4, 8);
66 }
67
68 /*****************************************************************************
69  *  main                                                                                                                                         *
70  *****************************************************************************/
71
72
73 const char nessie_str[]       PROGMEM = "nessie";
74 const char test_str[]         PROGMEM = "test";
75 const char test256_str[]      PROGMEM = "test256";
76 const char performance_str[]  PROGMEM = "performance";
77 const char singleround_str[]  PROGMEM = "singleround";
78 const char echo_str[]         PROGMEM = "echo";
79 const char shavs_list_str[]   PROGMEM = "shavs_list";
80 const char shavs_set_str[]    PROGMEM = "shavs_set";
81 const char shavs_test1_str[]  PROGMEM = "shavs_test1";
82
83 const cmdlist_entry_t cmdlist[] PROGMEM = {
84         { nessie_str,          NULL, testrun_nessie_jh},
85         { performance_str,     NULL, performance_jh},
86         { test256_str,         NULL, test256Null},
87 //      { singleround_str,     NULL, singleround_jh},
88         { shavs_list_str,      NULL, shavs_listalgos},
89         { shavs_set_str,   (void*)1, (void_fpt)shavs_setalgo},
90         { shavs_test1_str,     NULL, shavs_test1},
91         { echo_str,        (void*)1, (void_fpt)echo_ctrl},
92         { NULL,                NULL, NULL}
93 };
94
95 int main (void){
96     main_setup();
97
98     shavs_algolist=(hfdesc_t**)algolist;
99         shavs_algo=(hfdesc_t*)&jh256_desc;
100         for(;;){
101             welcome_msg(algo_name);
102                 cmd_interface(cmdlist);
103         }
104 }