1 /* main-cubehash-test.c */
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/>.
28 #include "uart_lowlevel.h"
33 #include "nessie_hash_test.h"
34 #include "performance_test.h"
35 #include "hfal-nessie.h"
36 #include "hfal-performance.h"
37 #include "hfal-test.h"
40 #include "hfal_cubehash.h"
46 const char* algo_name = "CubeHash";
49 const hfdesc_t* algolist[] = {
50 (hfdesc_t*)&cubehash224_desc,
51 (hfdesc_t*)&cubehash256_desc,
52 (hfdesc_t*)&cubehash384_desc,
53 (hfdesc_t*)&cubehash512_desc,
57 void uart0_putc(char byte){
58 uart_putc(UART_0, byte);
61 char uart0_getc(void){
62 return uart_getc(UART_0);
65 /*****************************************************************************
66 * additional validation-functions *
67 *****************************************************************************/
69 void cubehash256_test0(void){
72 cubehash256_init(&ctx);
73 cli_putstr("\r\ninit done ");
74 cubehash_lastBlock(&ctx, NULL, 0);
75 cli_putstr("\r\nlastblock done ");
76 cubehash256_ctx2hash(hash, &ctx);
77 cli_putstr("\r\nhash = ");
78 cli_hexdump(hash, 32);
81 void performance_cubehash(void){
82 hfal_performance_multiple(algolist);
85 void testrun_nessie_cubehash(void){
86 hfal_nessie_multiple(algolist);
88 /*****************************************************************************
90 *****************************************************************************/
92 const char nessie_str[] = "nessie";
93 const char test256_str[] = "test256";
94 const char performance_str[] = "performance";
95 const char echo_str[] = "echo";
96 const char shavs_list_str[] = "shavs_list";
97 const char shavs_set_str[] = "shavs_set";
98 const char shavs_test1_str[] = "shavs_test1";
99 const char shavs_test3_str[] = "shavs_test3";
101 cmdlist_entry_t cmdlist[] = {
102 { nessie_str, NULL, testrun_nessie_cubehash },
103 { test256_str, NULL, cubehash256_test0 },
104 { performance_str, NULL, performance_cubehash },
105 { shavs_list_str, NULL, shavs_listalgos },
106 { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo },
107 { shavs_test1_str, NULL, shavs_test1 },
108 { shavs_test3_str, NULL, shavs_test3 },
109 { echo_str, (void*)1, (void_fpt)echo_ctrl },
116 sysclk_mosc_verify_enable();
117 uart_init(UART_0, 115200, 8, UART_PARATY_NONE, UART_STOPBITS_ONE);
118 gptm_set_timer_32periodic(TIMER0);
123 shavs_algolist=(hfdesc_t**)algolist;
124 shavs_algo=(hfdesc_t*)&cubehash256_desc;
127 cli_putstr("\r\n\r\nARM-Crypto-Lib VS (");
128 cli_putstr(algo_name);
130 cli_putstr(__DATE__);
132 cli_putstr(__TIME__);
133 cli_putstr(")\r\nloaded and running\r\n");
134 cmd_interface(cmdlist);