1 /* main-blake-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"
26 #include "blake_small.h"
27 #include "blake_large.h"
28 #include "hfal_blake_small.h"
29 #include "hfal_blake_large.h"
30 #include "hfal-nessie.h"
31 #include "hfal-test.h"
32 #include "hfal-performance.h"
34 #include "nessie_hash_test.h"
35 #include "performance_test.h"
37 char* algo_name = "Blake";
39 const hfdesc_t* const algolist[] PROGMEM = {
40 (hfdesc_t*)&blake224_desc,
41 (hfdesc_t*)&blake256_desc,
42 (hfdesc_t*)&blake384_desc,
43 (hfdesc_t*)&blake512_desc,
47 /*****************************************************************************
48 * additional validation-functions *
49 *****************************************************************************/
51 void testrun_nessie_blake(void){
52 hfal_nessie_multiple(algolist);
54 void blake224_test(void* msg, uint32_t length_b){
55 hfal_test(&blake224_desc, msg, length_b);
58 void blake256_test(void* msg, uint32_t length_b){
59 hfal_test(&blake256_desc, msg, length_b);
62 void blake384_test(void* msg, uint32_t length_b){
63 hfal_test(&blake384_desc, msg, length_b);
66 void blake512_test(void* msg, uint32_t length_b){
67 hfal_test(&blake512_desc, msg, length_b);
69 void testrun_stdtest_blake(void){
74 blake224_test(msg1, 576);
77 blake256_test(msg1, 576);
80 blake384_test(msg1, 1152);
83 blake512_test(msg1, 1152);
90 void testlshort(void){
94 void test512_32(void){
95 uint8_t d[] = { 0xE9, 0x26, 0xAE, 0x8B, 0x0A, 0xF6, 0xE5, 0x31,
96 0x76, 0xDB, 0xFF, 0xCC, 0x2A, 0x6B, 0x88, 0xC6,
97 0xBD, 0x76, 0x5F, 0x93, 0x9D, 0x3D, 0x17, 0x8A,
98 0x9B, 0xDE, 0x9E, 0xF3, 0xAA, 0x13, 0x1C, 0x61,
99 0xE3, 0x1C, 0x1E, 0x42, 0xCD, 0xFA, 0xF4, 0xB4,
100 0xDC, 0xDE, 0x57, 0x9A, 0x37, 0xE1, 0x50, 0xEF,
101 0xBE, 0xF5, 0x55, 0x5B, 0x4C, 0x1C, 0xB4, 0x04,
102 0x39, 0xD8, 0x35, 0xA7, 0x24, 0xE2, 0xFA, 0xE7 };
103 blake256_test(d, 512);
106 void performance_blake(void){
107 hfal_performance_multiple(algolist);
110 /*****************************************************************************
112 *****************************************************************************/
115 const char nessie_str[] PROGMEM = "nessie";
116 const char test_str[] PROGMEM = "test";
117 const char testshort_str[] PROGMEM = "short";
118 const char testlshort_str[] PROGMEM = "lshort";
119 const char test512_str[] PROGMEM = "test512";
120 const char performance_str[] PROGMEM = "performance";
121 const char echo_str[] PROGMEM = "echo";
122 const char shavs_list_str[] PROGMEM = "shavs_list";
123 const char shavs_set_str[] PROGMEM = "shavs_set";
124 const char shavs_test1_str[] PROGMEM = "shavs_test1";
125 const char shavs_test3_str[] PROGMEM = "shavs_test3";
127 const cmdlist_entry_t cmdlist[] PROGMEM = {
128 { nessie_str, NULL, testrun_nessie_blake},
129 { test_str, NULL, testrun_stdtest_blake},
130 { testshort_str, NULL, testshort},
131 { testlshort_str, NULL, testlshort},
132 { test512_str, NULL, test512_32},
133 { performance_str, NULL, performance_blake},
134 { shavs_list_str, NULL, shavs_listalgos},
135 { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo},
136 { shavs_test1_str, NULL, shavs_test1},
137 { shavs_test3_str, NULL, shavs_test3},
138 { echo_str, (void*)1, (void_fpt)echo_ctrl},
145 shavs_algolist=(hfdesc_t**)algolist;
146 shavs_algo=(hfdesc_t*)&blake256_desc;
148 welcome_msg(algo_name);
149 cmd_interface(cmdlist);