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/>.
29 #include "uart_lowlevel.h"
33 #include "nessie_bc_test.h"
34 #include "performance_test.h"
35 #include "bcal-performance.h"
36 #include "bcal_tdes.h"
37 #include "bcal_tdes2.h"
39 char* algo_name = "TDES";
41 void uart0_putc(char byte){
42 uart_putc(UART_0, byte);
45 char uart0_getc(void){
46 return uart_getc(UART_0);
49 const bcdesc_t* algolist[] = {
50 (bcdesc_t*)&tdes_desc,
51 (bcdesc_t*)&tdes2_desc,
55 /*****************************************************************************
56 * additional validation-functions *
57 *****************************************************************************/
58 void tdes_init_dummy(const void* key, uint16_t keysize_b, void* ctx){
59 memcpy(ctx, key, 8*3);
62 void tdes_enc_dummy(void* buffer, void* ctx){
63 tdes_enc(buffer, buffer, ctx);
66 void tdes_dec_dummy(void* buffer, void* ctx){
67 tdes_dec(buffer, buffer, ctx);
70 void testrun_nessie_tdes(void){
72 nessie_bc_ctx.blocksize_B = 8;
73 nessie_bc_ctx.keysize_b = 192;
74 nessie_bc_ctx.name = algo_name;
75 nessie_bc_ctx.ctx_size_B = 8*3;
76 nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)tdes_enc_dummy;
77 nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)tdes_dec_dummy;
78 nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)tdes_init_dummy;
84 void testrun_performance_tdes(void){
85 bcal_performance_multiple(algolist);
87 /*****************************************************************************
89 *****************************************************************************/
91 const char nessie_str[] = "nessie";
92 const char test_str[] = "test";
93 const char performance_str[] = "performance";
94 const char echo_str[] = "echo";
96 cmdlist_entry_t cmdlist[] = {
97 { nessie_str, NULL, testrun_nessie_tdes},
98 { test_str, NULL, testrun_nessie_tdes},
99 { performance_str, NULL, testrun_performance_tdes},
100 { echo_str, (void*)1, (void_fpt)echo_ctrl},
105 sysclk_set_freq(SYS_FREQ);
106 sysclk_mosc_verify_enable();
107 uart_init(UART_0, 115200, 8, UART_PARATY_NONE, UART_STOPBITS_ONE);
108 gptm_set_timer_32periodic(TIMER0);
114 cli_putstr("\r\n\r\nARM-Crypto-Lib VS (");
115 cli_putstr(algo_name);
117 cli_putstr(__DATE__);
119 cli_putstr(__TIME__);
120 cli_putstr(")\r\nloaded and running\r\n");
121 cmd_interface(cmdlist);