2 * Shacal1 encryption only test-suit
7 #include "serial-tools.h"
11 #include "shacal1_enc.h"
12 #include "nessie_bc_test.h"
14 #include "performance_test.h"
20 char* cipher_name = "Shacal1 encryption only";
22 /*****************************************************************************
23 * additional validation-functions *
24 *****************************************************************************/
25 void shacal1_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){
26 memcpy(ctx, key, (keysize_b+7)/8);
29 void shacal1_enc_dummy(void* buffer, void* ctx){
30 shacal1_enc(buffer, ctx, 512);
33 void testrun_nessie_shacal1enc(void){
34 nessie_bc_ctx.blocksize_B = SHACAL1_BLOCKSIZE_B;
35 nessie_bc_ctx.keysize_b = SHACAL1_KEYSIZE;
36 nessie_bc_ctx.name = cipher_name;
37 nessie_bc_ctx.ctx_size_B = SHACAL1_KEYSIZE_B;
38 nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)shacal1_enc_dummy;
39 nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)NULL;
40 nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)shacal1_genctx_dummy;
45 void testrun_performance_shacal1enc(void){
47 uint8_t key[SHACAL1_KEYSIZE_B], data[SHACAL1_BLOCKSIZE_B];
52 memset(key, 0, SHACAL1_KEYSIZE_B);
53 memset(data, 0, SHACAL1_BLOCKSIZE_B);
57 shacal1_enc(data, key, SHACAL1_KEYSIZE);
59 print_time_P(PSTR("\tencrypt time: "), t);
61 uart_putstr_P(PSTR("\r\n"));
64 /*****************************************************************************
66 *****************************************************************************/
73 uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
74 uart_putstr(cipher_name);
75 uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
77 PGM_P u = PSTR("nessie\0test\0performance\0");
78 void_fpt v[] = {testrun_nessie_shacal1enc,
79 testrun_nessie_shacal1enc,
80 testrun_performance_shacal1enc};
83 if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
84 if(execcommand_d0_P(str, u, v)<0){
85 uart_putstr_P(PSTR("\r\nunknown command\r\n"));
89 uart_putstr("ERROR\r\n");