#define __CONFIG_H__
#include <avr/io.h>
-
#define F_CPU 16000000 /* Oszillator-Frequenz in Hz */
// #define F_CPU 14745600
/* gf256_table_gen.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* gf256mul.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* gf256mul.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
$(ALGO_NAME)_OBJ := A5_1.o
$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o serial-tools.o \
- nessie_stream_test.o nessie_common.o
+ nessie_stream_test.o nessie_common.o cli.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
/* cli.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
*
**/
+#include <stdlib.h>
#include <stdint.h>
+#include <ctype.h>
#include <string.h>
#include <avr/pgmspace.h>
+#include "cli.h"
#include "config.h"
int16_t findstring_d0(const char* str, const char* v){
}
return -1;
}
+
+#ifdef CLI_OLD
int16_t findstring_d0_P(const char* str, PGM_P v){
uint8_t i=0;
uart_putstr_P(PSTR("\r\n"));
}
-#endif
-
int16_t execcommand_d0_P(const char* str, PGM_P v, void(*fpt[])(void) ){
int16_t i=0;
i=findstring_d0_P(str, v);
}
}
+#endif
+
+#else /* CLI_OLD */
+
+cli_rx_fpt cli_rx = NULL;
+cli_tx_fpt cli_tx = NULL;
+uint8_t cli_echo=1;
+
+void cli_putstr(char* s){
+ if(!cli_tx)
+ return;
+ while(*s)
+ cli_tx(*s++);
+}
+
+void cli_putstr_P(PGM_P s){
+ char c;
+ if(!cli_tx)
+ return;
+ for(;;){
+ c = pgm_read_byte(s++);
+ if(!c)
+ return;
+ cli_tx(c);
+ }
+}
+
+void cli_hexdump(void* data, uint16_t length){
+ char hex_tab[] = {'0', '1', '2', '3',
+ '4', '5', '6', '7',
+ '8', '9', 'A', 'B',
+ 'C', 'D', 'E', 'F'};
+ if(!cli_tx)
+ return;
+ while(length--){
+ cli_tx(hex_tab[(*((uint8_t*)data))>>4]);
+ cli_tx(hex_tab[(*((uint8_t*)data))&0xf]);
+ data = (uint8_t*)data +1;
+ }
+}
+
+void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist){
+ cmdlist_entry_t item;
+ uint16_t i;
+ if(!cli_tx)
+ return;
+
+ cli_putstr_P(PSTR("\r\n[auto help] available commands:\r\n"
+ " <command> - <params> - <address>\r\n"));
+ for(;;){
+ item.cmd_name = (void*)pgm_read_word(cmdlist+0);
+ item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
+ item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
+ cmdlist = (uint8_t*)cmdlist+6;
+ if(item.cmd_name==NULL){
+ return;
+ }
+ cli_tx(' ');
+ cli_putstr_P(item.cmd_name);
+ i=maxcmdlength-strlen_P(item.cmd_name);
+ while(i--)
+ cli_tx(' ');
+ cli_putstr_P(PSTR(" - "));
+ if(item.cmd_param_str==NULL){
+ cli_putstr_P(PSTR("none \t- 0x"));
+ } else {
+ if(item.cmd_param_str==(void*)1){
+ cli_putstr_P(PSTR("yes \t- 0x"));
+ } else {
+ cli_putstr_P(item.cmd_param_str);
+ cli_putstr_P(PSTR(" \t- 0x"));
+ }
+ }
+ cli_hexdump(&item.cmd_function, 2);
+ cli_putstr_P(PSTR("\r\n"));
+ }
+}
+
+uint16_t firstword_length(char* s){
+ uint16_t ret=0;
+ while(isalnum(*s++))
+ ret++;
+ return ret;
+}
+
+void echo_ctrl(char* s){
+ if(s==NULL || *s=='\0'){
+ cli_putstr_P(PSTR("\r\necho is "));
+ cli_putstr_P(cli_echo?PSTR("on"):PSTR("off"));
+ cli_putstr_P(PSTR("\r\n"));
+ }
+ strlwr(s);
+ if(!strcmp_P(s, PSTR("true")) || !strcmp_P(s, PSTR("on")) || *s=='1'){
+ cli_echo=1;
+ }
+ if(!strcmp_P(s, PSTR("false")) || !strcmp_P(s, PSTR("off")) || *s=='0'){
+ cli_echo=0;
+ }
+}
+
+typedef void(*str_fpt)(char*);
+#define CLI_ENTER 13
+#define CLI_BACKSPACE 8
+#define CLI_TABULATOR 9
+
+int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
+ PGM_VOID_P cmdlist_orig = cmdlist;
+ if(*cmd=='\0' || *cmd=='#')
+ return 1;
+ if(!strcmp_P(cmd, PSTR("exit")))
+ return 0;
+ if((!strcmp_P(cmd, PSTR("help"))) || (!strcmp_P(cmd, PSTR("?")))){
+ cli_auto_help(maxcmdlength, cmdlist);
+ return 1;
+ }
+ uint16_t fwlength=firstword_length(cmd);
+ char fw[fwlength+1];
+ memcpy(fw, cmd, fwlength);
+ fw[fwlength] = '\0';
+ cmdlist_entry_t item;
+ do{
+ item.cmd_name = (void*)pgm_read_word(cmdlist+0);
+ item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
+ item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
+ cmdlist = (uint8_t*)cmdlist+6;
+ }while(item.cmd_name!=NULL && strcmp_P(fw, item.cmd_name));
+ if(item.cmd_name==NULL){
+ cli_auto_help(maxcmdlength, cmdlist_orig);
+ } else {
+ if(item.cmd_function==NULL)
+ return 2;
+ switch((uint16_t)item.cmd_param_str){
+ case 0:
+ item.cmd_function();
+ break;
+ case 1:
+ if(cmd[fwlength]=='\0'){
+ ((str_fpt)item.cmd_function)(cmd+fwlength);
+ } else {
+ ((str_fpt)item.cmd_function)(cmd+fwlength+1);
+ }
+ break;
+ default:
+ cli_putstr_P(PSTR("\r\nparam parsing currently not implemented!\r\n"));
+ break;
+ }
+
+ }
+ return 1;
+}
+
+uint16_t max_cmd_length(PGM_VOID_P cmdlist){
+ uint16_t t,ret=0;
+ char* str;
+ for(;;){
+ str = (char*)pgm_read_word(cmdlist);
+ cmdlist = (uint8_t*)cmdlist + 6;
+ if(str==NULL)
+ return ret;
+ t = strlen_P(str);
+ if(t>ret)
+ ret=t;
+ }
+}
+
+uint16_t stridentcnt_P(char* a, PGM_P b){
+ uint16_t i=0;
+ char c;
+ for(;;){
+ c = pgm_read_byte(b++);
+ if(*a != c || c=='\0')
+ return i;
+ i++;
+ a++;
+ }
+}
+
+uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
+ uint8_t i=0;
+ char ref[maxcmdlength+1];
+ char* itemstr;
+ ref[0]='\0';
+ /* check if we are behind the first word */
+ while(buffer[i]){
+ if(!isalnum(buffer[i++]))
+ return 0;
+ }
+ for(;;){
+ itemstr = (char*)pgm_read_word(cmdlist);
+ if(itemstr==NULL)
+ break;
+ cmdlist = (uint8_t*)cmdlist +6;
+ if(!strncmp_P(buffer, itemstr, i)){
+ if(!ref[0]){
+ strcpy_P(ref, itemstr);
+ }else{
+ ref[stridentcnt_P(ref, itemstr)]='\0';
+ }
+ }
+ }
+ i = strcmp(buffer, ref);
+ if(i)
+ strcpy(buffer, ref);
+ return ~i;
+}
+
+void cli_option_listing(char* buffer, PGM_VOID_P cmdlist){
+ char* itemstr;
+ uint16_t len=strlen(buffer);
+ for(;;){
+ itemstr = (char*)pgm_read_word(cmdlist);
+ if(itemstr==NULL){
+ cli_putstr_P(PSTR("\r\n>"));
+ cli_putstr(buffer);
+ return;
+ }
+ cmdlist = (uint8_t*)cmdlist +6;
+ if(!strncmp_P(buffer, itemstr, len)){
+ cli_putstr_P(PSTR("\r\n "));
+ cli_putstr_P(itemstr);
+ }
+ }
+}
+
+int8_t cmd_interface(PGM_VOID_P cmd_desc){
+ uint16_t cli_buffer_size;
+ uint16_t cli_buffer_index;
+ int8_t exit_code;
+ uint8_t completion_failed=0;
+ char* cli_buffer;
+ char c;
+ uint16_t maxcmdlength = max_cmd_length(cmd_desc);
+ cli_buffer = calloc(1,cli_buffer_size=maxcmdlength+2);
+ cli_buffer_index=0;
+ if(!cli_rx)
+ return -1;
+ if(cli_tx)
+ cli_tx('>');
+ for(;;){
+ c = cli_rx();
+ switch (c){
+ case CLI_ENTER:
+ if((exit_code=search_and_call(cli_buffer, maxcmdlength, cmd_desc))<=0){
+ free(cli_buffer);
+ return exit_code;
+ }
+ memset(cli_buffer, 0, cli_buffer_size);
+ cli_buffer_index=0;
+ cli_putstr_P(PSTR("\r\n>"));
+ completion_failed=0;
+ break;
+ case CLI_BACKSPACE:
+ completion_failed=0;
+ if(cli_buffer_index==0)
+ break;
+ cli_buffer_index--;
+ cli_buffer[cli_buffer_index] = '\0';
+ if(cli_echo && cli_tx){
+ cli_tx(c);
+ }
+ break;
+ case CLI_TABULATOR:
+ if(completion_failed || cli_buffer_index==0){
+ if(cli_tx)
+ cli_option_listing(cli_buffer, cmd_desc);
+ } else {
+ uint16_t old_idx = cli_buffer_index;
+ completion_failed =
+ ~cli_completion(cli_buffer, maxcmdlength, cmd_desc);
+ cli_buffer_index = strlen(cli_buffer);
+ if(cli_echo && cli_tx){
+ while(old_idx<cli_buffer_index){
+ cli_tx(cli_buffer[old_idx++]);
+ }
+ }
+ }
+ break;
+ default:
+ completion_failed=0;
+ if(cli_echo && cli_tx){
+ cli_tx(c);
+ }
+ if(cli_buffer_index+1==cli_buffer_size){
+ cli_buffer = realloc(cli_buffer, cli_buffer_size+=CLI_BUFFER_BS);
+ if(!cli_buffer){
+ return -2;
+ }
+ memset(cli_buffer+cli_buffer_index+1, 0, CLI_BUFFER_BS);
+ }
+ cli_buffer[cli_buffer_index++] = c;
+ }
+ }
+}
+
+#endif
/* cli.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
typedef void(*void_fpt)(void);
+#ifdef CLI_OLD
+
int16_t findstring_d0(const char* str, const char* v);
int16_t findstring_d0_P(const char* str, PGM_P v);
int16_t execcommand_d0_P(const char* str, PGM_P v, void(*fpt[])(void) );
+
+#else
+
+typedef char (*cli_rx_fpt)(void);
+typedef void (*cli_tx_fpt)(char);
+
+#define CLI_BUFFER_BS 20
+
+typedef struct {
+ PGM_P cmd_name; /* string containing the function name */
+ PGM_P cmd_param_str; /* param descriptor string */
+ void_fpt cmd_function; /* function pointer */
+} cmdlist_entry_t;
+
+extern cli_rx_fpt cli_rx;
+extern cli_tx_fpt cli_tx;
+extern uint8_t cli_echo;
+
+void echo_ctrl(char* s);
+int8_t cmd_interface(PGM_VOID_P cmd_desc);
+
+#endif
+
+
+
#endif /*CLI_H_*/
/* debug.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* main-a5_1-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
+#include "cli.h"
-char* cipher_name = "A5_1";
+char* algo_name = "A5_1";
/*****************************************************************************
* additional validation-functions *
nessie_stream_ctx.outsize_b = 8; /* actually unused */
nessie_stream_ctx.keysize_b = 64;
nessie_stream_ctx.ivsize_b = 64;
- nessie_stream_ctx.name = cipher_name;
+ nessie_stream_ctx.name = algo_name;
nessie_stream_ctx.ctx_size_B = sizeof(a5_1_ctx_t);
nessie_stream_ctx.cipher_genctx = (nessie_stream_genctx_fpt)a51_genctx_dummy;
nessie_stream_ctx.cipher_enc = (nessie_stream_genenc_fpt)a5_1_gen;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char testkey_str[] PROGMEM = "testkey";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_a51 },
+/* { performance_str, NULL, testrun_performance_a51}, */
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
-restart:
- while(1){
- if (!getnextwordn(str,20)) {DEBUG_S("DBG: W1\r\n"); goto error;}
- if (strcmp(str, "nessie")) {DEBUG_S("DBG: 1b\r\n"); goto error;}
- testrun_nessie_a51();
- goto restart;
- continue;
- error:
- uart_putstr("ERROR\r\n");
- }
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
+ }
}
/* main-aes-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
+#include <avr/pgmspace.h>
-char* cipher_name = "AES";
+char* algo_name = "AES";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_aes(void){
nessie_bc_ctx.blocksize_B = 16;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(aes128_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)aes128_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)aes128_dec;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char testkey_str[] PROGMEM = "testkey";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_aes },
+ { test_str, NULL, testrun_test_aes},
+ { testkey_str, NULL, testrun_testkey_aes},
+ { performance_str, NULL, testrun_performance_aes},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0testkey\0performance\0");
- void_fpt v[] = {testrun_nessie_aes,
- testrun_test_aes,
- testrun_testkey_aes,
- testrun_performance_aes};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
/* main-arcfour-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
-char* cipher_name = "Arcfour";
+char* algo_name = "Arcfour";
/*****************************************************************************
* additional validation-functions *
nessie_stream_ctx.outsize_b = 8; /* actually unused */
nessie_stream_ctx.keysize_b = 128; /* this is theone we have refrence vectors for */
nessie_stream_ctx.ivsize_b = (uint16_t)-1;
- nessie_stream_ctx.name = cipher_name;
+ nessie_stream_ctx.name = algo_name;
nessie_stream_ctx.ctx_size_B = sizeof(arcfour_ctx_t);
nessie_stream_ctx.cipher_genctx = (nessie_stream_genctx_fpt)arcfour_genctx_dummy;
nessie_stream_ctx.cipher_enc = (nessie_stream_genenc_fpt)arcfour_gen;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_arcfour },
+ { test_str, NULL, testrun_nessie_arcfour},
+ { performance_str, NULL, testrun_performance_arcfour},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_arcfour,
- testrun_nessie_arcfour,
- testrun_performance_arcfour};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ uart_putstr("\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
-
}
/* main-camellia-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include "performance_test.h"
#include "cli.h"
-char* cipher_name = "Camellia";
+char* algo_name = "Camellia";
#include <stdint.h>
void testrun_nessie_camellia(void){
nessie_bc_ctx.blocksize_B = 16;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(camellia128_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)camellia128_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)camellia128_dec;
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
-
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_camellia },
+ { test_str, NULL, testrun_camellia},
+ { performance_str, NULL, test_performance_camellia},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
+int main (void){
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_camellia, testrun_camellia, test_performance_camellia};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
/* main-cast5-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "cast-128 (cast5)";
+char* algo_name = "cast-128 (cast5)";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_cast5(void){
nessie_bc_ctx.blocksize_B = 8;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(cast5_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)cast5_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)cast5_dec;
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
-
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_cast5},
+ { test_str, NULL, testrun_cast5},
+ { performance_str, NULL, testrun_performance_cast5},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
+int main (void){
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_cast5, testrun_cast5, testrun_performance_cast5};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
/* main-des-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "DES";
+char* algo_name = "DES";
/*****************************************************************************
* additional validation-functions *
nessie_bc_init();
nessie_bc_ctx.blocksize_B = 8;
nessie_bc_ctx.keysize_b = 64;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = 8;
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)des_enc_dummy;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)des_dec_dummy;
* main
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_des },
+ { test_str, NULL, testrun_nessie_des },
+ { performance_str, NULL, testrun_performance_des},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_des, testrun_nessie_des, testrun_performance_des};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-entropium-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "Entropium";
+char* algo_name = "Entropium";
/*****************************************************************************
* additional validation-functions *
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_entropium},
+ { test_str, NULL, testrun_entropium},
+ { performance_str, NULL, testrun_performance_entropium},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_entropium, testrun_entropium, testrun_performance_entropium};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-grain-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
-char* cipher_name = "Grain";
+char* algo_name = "Grain";
/*****************************************************************************
* additional validation-functions *
nessie_stream_ctx.outsize_b = 8; /* actually unused */
nessie_stream_ctx.keysize_b = 80; /* this is the one we have refrence vectors for */
nessie_stream_ctx.ivsize_b = 64;
- nessie_stream_ctx.name = cipher_name;
+ nessie_stream_ctx.name = algo_name;
nessie_stream_ctx.ctx_size_B = sizeof(grain_ctx_t);
nessie_stream_ctx.cipher_genctx = (nessie_stream_genctx_fpt)grain_genctx_dummy;
nessie_stream_ctx.cipher_enc = (nessie_stream_genenc_fpt)grain_getbyte_dummy_rev;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_grain },
+ { test_str, NULL, testrun_std_grain},
+ { performance_str, NULL, testrun_performance_grain},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_grain, testrun_std_grain, testrun_performance_grain};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
- }
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
+ }
}
-
-
-
/* main-hmac-sha1-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+/* const char performance_str[] PROGMEM = "performance"; */
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_hmacsha1},
+ { test_str, NULL, testrun_nessie_hmacsha1},
+/* { performance_str, NULL, testrun_performance_hmacsha1}, */
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0");
- void_fpt v[] = {testrun_nessie_hmacsha1, testrun_nessie_hmacsha1};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
-
}
-
/* main-hmac-sha256-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+/* const char performance_str[] PROGMEM = "performance"; */
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_hmacsha256},
+ { test_str, NULL, testrun_nessie_hmacsha256},
+/* { performance_str, NULL, testrun_performance_hmacsha256}, */
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0");
- void_fpt v[] = {testrun_nessie_hmacsha256, testrun_nessie_hmacsha256};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-md5-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
-
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_md5},
+ { test_str, NULL, testrun_md5},
+ { performance_str, NULL, testrun_performance_md5},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
+int main (void){
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr("\r\n\r\nCrypto-VS (MD5)\r\nloaded and running\r\n");
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_md5, testrun_md5, testrun_performance_md5};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
/* main-noekeon-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "Noekeon";
+char* algo_name = "Noekeon";
/*****************************************************************************
* additional validation-functions *
}
void testrun_nessie_noekeon_indirect(void){
- char str[strlen(cipher_name)+10];
- strcpy(str, cipher_name);
+ char str[strlen(algo_name)+10];
+ strcpy(str, algo_name);
strcat(str, "-indirect");
nessie_bc_ctx.blocksize_B = 16;
}
void testrun_nessie_noekeon_direct(void){
- char str[strlen(cipher_name)+10];
- strcpy(str, cipher_name);
+ char str[strlen(algo_name)+10];
+ strcpy(str, algo_name);
strcat(str, "-Direct");
nessie_bc_ctx.blocksize_B = 16;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char direct_str[] PROGMEM = "direct";
+const char indirect_str[] PROGMEM = "indirect";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_noekeon},
+ { test_str, NULL, testrun_stdtest_noekeon},
+ { direct_str, NULL, testrun_nessie_noekeon_direct},
+ { indirect_str, NULL, testrun_nessie_noekeon_indirect},
+ { performance_str, NULL, testrun_performance_noekeon},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0direct\0indirect\0performance\0");
- void_fpt v[] = {testrun_nessie_noekeon,
- testrun_stdtest_noekeon,
- testrun_nessie_noekeon_direct,
- testrun_nessie_noekeon_indirect,
- testrun_performance_noekeon};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-omac-noekeon-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_omac_noekeon },
+ { test_str, NULL, testrun_test_omac_noekeon},
+ { performance_str, NULL, testrun_performance_omac_noekeon},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_omac_noekeon,
- testrun_test_omac_noekeon,
- testrun_performance_omac_noekeon};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-present-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
-char* cipher_name = "Present";
+char* algo_name = "Present";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_present(void){
nessie_bc_ctx.blocksize_B = 8;
nessie_bc_ctx.keysize_b = 80;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(present_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)present_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)present_dec;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_present},
+ { test_str, NULL, testrun_self_present},
+ { performance_str, NULL, testrun_performance_present},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_present, testrun_self_present, testrun_performance_present};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
/* main-rc5-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdlib.h>
#define RC5_ROUNDS 12
-char* cipher_name = "RC5-32/12/16";
+char* algo_name = "RC5-32/12/16";
/*****************************************************************************
* additional validation-functions *
nessie_bc_init();
nessie_bc_ctx.blocksize_B = 8;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(rc5_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)rc5_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)rc5_dec;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_rc5 },
+ { test_str, NULL, testrun_nessie_rc5},
+ { performance_str, NULL, testrun_performance_rc5},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_rc5, testrun_nessie_rc5, testrun_performance_rc5};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-rc6-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
- * rc5 test-suit
+ * rc6 test-suit
*
*/
#include <stdlib.h>
#define RC6_ROUNDS 20
-char* cipher_name = "RC6-32/20/16";
+char* algo_name = "RC6-32/20/16";
/*****************************************************************************
* additional validation-functions *
nessie_bc_init();
nessie_bc_ctx.blocksize_B = 16;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(rc6_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)rc6_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)rc6_dec;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_rc6},
+ { test_str, NULL, testrun_nessie_rc6},
+ { performance_str, NULL, testrun_performance_rc6},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_rc6, testrun_nessie_rc6, testrun_performance_rc6};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-seed-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "Seed";
+char* algo_name = "Seed";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_seed(void){
nessie_bc_ctx.blocksize_B = 16;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(seed_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)seed_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)seed_dec;
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
- DEBUG_INIT();
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_seed},
+ { test_str, NULL, testrun_seed},
+ { performance_str, NULL, testrun_performance_seed},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_seed, testrun_seed, testrun_performance_seed};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+int main (void){
+ DEBUG_INIT();
+ uart_putstr("\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-serpent-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "Serpent";
+char* algo_name = "Serpent";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_serpent(void){
nessie_bc_ctx.blocksize_B = 16;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(serpent_ctx_t);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)serpent_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)serpent_dec;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_serpent},
+ { test_str, NULL, testrun_test_serpent},
+ { performance_str, NULL, testrun_performance_serpent},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_serpent, testrun_test_serpent, testrun_performance_serpent};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-sha1-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_sha1},
+ { test_str, NULL, testrun_sha1},
+ { performance_str, NULL, testrun_performance_sha1},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+int main (void){
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr("\r\n\r\nCrypto-VS (SHA-1)\r\nloaded and running\r\n");
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_sha1, testrun_sha1, testrun_performance_sha1};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
-
/* main-sha256-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_sha256},
+ { test_str, NULL, testrun_nessie_sha256},
+ { performance_str, NULL, testrun_performance_sha256},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_sha256, testrun_nessie_sha256, testrun_performance_sha256};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
/* main-shabea-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "Shabea";
+char* algo_name = "Shabea";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_shabea(void){
nessie_bc_ctx.blocksize_B = 32;
nessie_bc_ctx.keysize_b = 256;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = 32;
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)shabea_enc_dummy;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)shabea_dec_dummy;
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_shabea},
+ { test_str, NULL, testrun_shabea},
+ { performance_str, NULL, testrun_performance_shabea},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+int main (void){
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_shabea, testrun_shabea, testrun_performance_shabea};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-shacal1_enc-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
-char* cipher_name = "Shacal1 encryption only";
+char* algo_name = "Shacal1 encryption only";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_shacal1enc(void){
nessie_bc_ctx.blocksize_B = SHACAL1_BLOCKSIZE_B;
nessie_bc_ctx.keysize_b = SHACAL1_KEYSIZE;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = SHACAL1_KEYSIZE_B;
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)shacal1_enc_dummy;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)NULL;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_shacal1enc},
+ { test_str, NULL, testrun_nessie_shacal1enc},
+ { performance_str, NULL, testrun_performance_shacal1enc},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_shacal1enc,
- testrun_nessie_shacal1enc,
- testrun_performance_shacal1enc};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
/* main-shacal2_enc-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
-char* cipher_name = "Shacal2 encryption only";
+char* algo_name = "Shacal2 encryption only";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_shacal2enc(void){
nessie_bc_ctx.blocksize_B = SHACAL2_BLOCKSIZE_B;
nessie_bc_ctx.keysize_b = SHACAL2_KEYSIZE;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = SHACAL2_KEYSIZE_B;
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)shacal2_enc_dummy;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)NULL;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_shacal2enc},
+ { test_str, NULL, testrun_nessie_shacal2enc},
+ { performance_str, NULL, testrun_performance_shacal2enc},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_shacal2enc,
- testrun_nessie_shacal2enc,
- testrun_performance_shacal2enc};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
/* main-skipjack-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdlib.h>
-char* cipher_name = "Skipjack";
+char* algo_name = "Skipjack";
/*****************************************************************************
* additional validation-functions *
void testrun_nessie_skipjack(void){
nessie_bc_ctx.blocksize_B = 8;
nessie_bc_ctx.keysize_b = 80;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = 10;
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)skipjack_enc;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)skipjack_dec;
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_skipjack},
+ { test_str, NULL, testrun_skipjack},
+ { performance_str, NULL, testrun_performance_skipjack},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+int main (void){
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr("\r\n\r\nCrypto-VS (skipjack)\r\nloaded and running\r\n");
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_skipjack, testrun_skipjack, testrun_performance_skipjack};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-tdes-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <string.h>
#include <stdlib.h>
-char* cipher_name = "TDES";
+char* algo_name = "TDES";
/*****************************************************************************
* additional validation-functions *
nessie_bc_init();
nessie_bc_ctx.blocksize_B = 8;
nessie_bc_ctx.keysize_b = 192;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = sizeof(8*3);
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)tdes_enc_dummy;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)tdes_dec_dummy;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_tdes},
+ { test_str, NULL, testrun_nessie_tdes},
+ { performance_str, NULL, testrun_performance_tdes},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_tdes, testrun_nessie_tdes, testrun_performance_tdes};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
-
}
-
/* main-trivium-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
-char* cipher_name = "Trivium";
+char* algo_name = "Trivium";
/*****************************************************************************
* additional validation-functions *
nessie_stream_ctx.outsize_b = 8; /* actually unused */
nessie_stream_ctx.keysize_b = 80; /* this is the one we have refrence vectors for */
nessie_stream_ctx.ivsize_b = 32;
- nessie_stream_ctx.name = cipher_name;
+ nessie_stream_ctx.name = algo_name;
nessie_stream_ctx.ctx_size_B = sizeof(trivium_ctx_t);
nessie_stream_ctx.cipher_genctx = (nessie_stream_genctx_fpt)trivium_genctx_dummy;
nessie_stream_ctx.cipher_enc = (nessie_stream_genenc_fpt)trivium_getbyte_dummy;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_trivium},
+ { test_str, NULL, testrun_nessie_trivium},
+ { performance_str, NULL, testrun_performance_trivium},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_trivium, testrun_nessie_trivium, testrun_performance_trivium};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
- }
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
+ }
}
/* main-twister224-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
-
- DEBUG_INIT();
- uart_putstr_P(PSTR("\r\n"));
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_twister224},
+ { test_str, NULL, testrun_twister224},
+ { performance_str, NULL, testrun_performance_twister224},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = { testrun_nessie_twister224,
- testrun_twister224,
- testrun_performance_twister224 };
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+int main (void){
+ DEBUG_INIT();
+ uart_putstr("\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
/* main-twister256-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
* main *
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
-
- DEBUG_INIT();
- uart_putstr_P(PSTR("\r\n"));
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_twister256},
+ { test_str, NULL, testrun_twister256},
+ { performance_str, NULL, testrun_performance_twister256},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = { testrun_nessie_twister256,
- testrun_twister256,
- testrun_performance_twister256 };
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+int main (void){
+ DEBUG_INIT();
+ uart_putstr("\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
/* main-twister384-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
*
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
-
- DEBUG_INIT();
- uart_putstr_P(PSTR("\r\n"));
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_twister384},
+ { test_str, NULL, testrun_twister384},
+ { performance_str, NULL, testrun_performance_twister384},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = { testrun_nessie_twister384,
- testrun_twister384,
- testrun_performance_twister384 };
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+int main (void){
+ DEBUG_INIT();
+ uart_putstr("\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
/* main-twister512-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
*
*****************************************************************************/
-int main (void){
- char str[20];
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
-
- DEBUG_INIT();
- uart_putstr_P(PSTR("\r\n"));
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_twister512},
+ { test_str, NULL, testrun_twister512},
+ { performance_str, NULL, testrun_performance_twister512},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(algo_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = { testrun_nessie_twister512,
- testrun_twister512,
- testrun_performance_twister512 };
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+int main (void){
+ DEBUG_INIT();
+ uart_putstr("\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
-
/* main-xtea-test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
#include <stdint.h>
#include <string.h>
-char* cipher_name = "XTEA";
+char* algo_name = "XTEA";
void xtea_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
memcpy(ctx, key, (keysize+7)/8);
void testrun_nessie_xtea(void){
nessie_bc_ctx.blocksize_B = 8;
nessie_bc_ctx.keysize_b = 128;
- nessie_bc_ctx.name = cipher_name;
+ nessie_bc_ctx.name = algo_name;
nessie_bc_ctx.ctx_size_B = 128/8;
nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)xtea_enc_dummy;
nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)xtea_dec_dummy;
* main *
*****************************************************************************/
+const char nessie_str[] PROGMEM = "nessie";
+const char test_str[] PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[] PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+ { nessie_str, NULL, testrun_nessie_xtea},
+ { test_str, NULL, testrun_nessie_xtea},
+ { performance_str, NULL, testrun_performance_xtea},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { NULL, NULL, NULL}
+};
+
int main (void){
- char str[20];
DEBUG_INIT();
uart_putstr("\r\n");
-
- uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
- uart_putstr(cipher_name);
- uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
-
- PGM_P u = PSTR("nessie\0test\0performance\0");
- void_fpt v[] = {testrun_nessie_xtea, testrun_nessie_xtea, testrun_performance_xtea};
-
- while(1){
- if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}
- if(execcommand_d0_P(str, u, v)<0){
- uart_putstr_P(PSTR("\r\nunknown command\r\n"));
- }
- continue;
- error:
- uart_putstr("ERROR\r\n");
+ cli_rx = uart_getc;
+ cli_tx = uart_putc;
+ for(;;){
+ uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+ uart_putstr(algo_name);
+ uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+ cmd_interface(cmdlist);
}
}
/* nessie_bc_test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_bc_test.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_common.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_common.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_hash_test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_hash_test.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_mac_test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_mac_test.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_stream_test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* nessie_stream_test.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* performance_test.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* performance_test.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* serial-tools.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* serial-tools.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
/* uart.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify