3 This file is part of the ARM-Crypto-Lib.
4 Copyright (C) 2006-2010 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 "uart_lowlevel.h"
35 #include "nessie_hash_test.h"
36 #include "performance_test.h"
37 #include "hfal-nessie.h"
38 #include "hfal-performance.h"
39 #include "hfal-test.h"
41 #include "jh_simple.h"
44 char* algo_name = "JH";
46 void uart0_putc(char byte){
47 uart_putc(UART_0, byte);
50 char uart0_getc(void){
51 return uart_getc(UART_0);
54 const hfdesc_t* algolist[] = {
55 (hfdesc_t*)&jh224_desc,
56 (hfdesc_t*)&jh256_desc,
57 (hfdesc_t*)&jh384_desc,
58 (hfdesc_t*)&jh512_desc,
62 /*****************************************************************************
63 * additional validation-functions *
64 *****************************************************************************/
66 void performance_jh(void){
67 hfal_performance_multiple(algolist);
70 void testrun_nessie_jh(void){
71 hfal_nessie_multiple(algolist);
74 void test256Null(void){
78 jh_lastBlock(&ctx, NULL, 0);
79 jh256_ctx2hash(hash, &ctx);
80 cli_putstr("\r\nresult:\r\n");
81 cli_hexdump_block(hash, 32, 4, 8);
84 /*****************************************************************************
86 *****************************************************************************/
89 const char nessie_str[] = "nessie";
90 const char test_str[] = "test";
91 const char test256_str[] = "test256";
92 const char performance_str[] = "performance";
93 const char singleround_str[] = "singleround";
94 const char echo_str[] = "echo";
95 const char shavs_list_str[] = "shavs_list";
96 const char shavs_set_str[] = "shavs_set";
97 const char shavs_test1_str[] = "shavs_test1";
99 cmdlist_entry_t cmdlist[] = {
100 { nessie_str, NULL, testrun_nessie_jh},
101 { performance_str, NULL, performance_jh},
102 { test256_str, NULL, test256Null},
103 // { singleround_str, NULL, singleround_jh},
104 { shavs_list_str, NULL, shavs_listalgos},
105 { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo},
106 { shavs_test1_str, NULL, shavs_test1},
107 { echo_str, (void*)1, (void_fpt)echo_ctrl},
112 sysclk_set_freq(SYS_FREQ);
113 sysclk_mosc_verify_enable();
114 uart_init(UART_0, 115200, 8, UART_PARATY_NONE, UART_STOPBITS_ONE);
115 gptm_set_timer_32periodic(TIMER0);
120 shavs_algolist=(hfdesc_t**)algolist;
121 shavs_algo=(hfdesc_t*)&jh256_desc;
124 cli_putstr("\r\n\r\nARM-Crypto-Lib VS (");
125 cli_putstr(algo_name);
127 cli_putstr(__DATE__);
129 cli_putstr(__TIME__);
130 cli_putstr(")\r\nloaded and running\r\n");
131 cmd_interface(cmdlist);