#include "bcal-cmac.h"
#include "bcal-ctr.h"
#include "bcal-eax.h"
+#include "memxor.h"
uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx){
uint8_t r;
--- /dev/null
+/* bcal-performance.c */
+/*
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * \file bcal-performance.c
+ * \author Daniel Otte
+ * \email daniel.otte@rub.de
+ * \date 2010-02-16
+ * \license GPLv3 or later
+ *
+ */
+
+#include "bcal-performance.h"
+#include "keysize_descriptor.h"
+#include "blockcipher_descriptor.h"
+#include "performance_test.h"
+#include "cli.h"
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <avr/pgmspace.h>
+
+
+
+
+static
+void printvalue(unsigned long v){
+ char str[20];
+ int i;
+ ultoa(v, str, 10);
+ for(i=0; i<10-strlen(str); ++i){
+ cli_putc(' ');
+ }
+ cli_putstr(str);
+}
+
+void bcal_performance(const bcdesc_t* bcd){
+ bcdesc_t bc;
+ memcpy_P(&bc, bcd, sizeof(bcdesc_t));
+ uint8_t ctx[bc.ctxsize_B];
+ uint8_t data[(bc.blocksize_b+7)/8];
+ uint16_t keysize = get_keysize(bc.valid_keysize_desc);
+ uint8_t key[(keysize+7)/8];
+ uint64_t t;
+ uint8_t i;
+
+ if(bc.type!=BCDESC_TYPE_BLOCKCIPHER)
+ return;
+ calibrateTimer();
+ print_overhead();
+ cli_putstr_P(PSTR("\r\n\r\n === "));
+ cli_putstr_P(bc.name);
+ cli_putstr_P(PSTR(" performance === "
+ "\r\n type: blockcipher"
+ "\r\n keysize (bits): "));
+ printvalue(keysize);
+
+ cli_putstr_P(PSTR("\r\n ctxsize (bytes): "));
+ printvalue(bc.ctxsize_B);
+
+ cli_putstr_P(PSTR("\r\n blocksize (bits): "));
+ printvalue(bc.blocksize_b);
+
+
+
+ t=0;
+ if(bc.init.init1){
+ if((bc.flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
+ for(i=0; i<32; ++i){
+ startTimer(0);
+ START_TIMER;
+ (bc.init.init1)(key, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ if(i!=31 && bc.free){
+ bc.free(&ctx);
+ }
+ }
+ } else {
+ for(i=0; i<32; ++i){
+ startTimer(0);
+ START_TIMER;
+ (bc.init.init2)(key, keysize, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ if(i!=31 && bc.free){
+ bc.free(&ctx);
+ }
+ }
+ }
+ t>>=5;
+ cli_putstr_P(PSTR("\r\n init (cycles): "));
+ printvalue(t);
+ }
+ t=0;
+ for(i=0; i<32; ++i){
+ startTimer(0);
+ START_TIMER;
+ bc.enc.enc1(data, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ }
+ t>>=5;
+ cli_putstr_P(PSTR("\r\n encrypt (cycles): "));
+ printvalue(t);
+
+ t=0;
+ for(i=0; i<32; ++i){
+ startTimer(0);
+ START_TIMER;
+ bc.dec.dec1(data, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ }
+ t>>=5;
+ cli_putstr_P(PSTR("\r\n decrypt (cycles): "));
+ printvalue(t);
+
+ if(bc.free){
+ bc.free(&ctx);
+ }
+}
+
+
+void bcal_performance_multiple(const bcdesc_t** bcd_list){
+ const bcdesc_t* bcd;
+ for(;;){
+ bcd = (void*)pgm_read_word(bcd_list);
+ if(!bcd){
+ cli_putstr_P(PSTR("\r\n\r\n End of performance figures\r\n"));
+ return;
+ }
+ bcal_performance(bcd);
+ bcd_list = (void*)((uint8_t*)bcd_list + 2);
+ }
+}
--- /dev/null
+/* bcal-performance.h */
+/*
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * \file bcal-performance.h
+ * \author Daniel Otte
+ * \email daniel.otte@rub.de
+ * \date 2010-02-16
+ * \license GPLv3 or later
+ *
+ */
+
+#ifndef BCAL_PERFORMANCE_H_
+#define BCAL_PERFORMANCE_H_
+
+#include "blockcipher_descriptor.h"
+
+void bcal_performance(const bcdesc_t* hd);
+void bcal_performance_multiple(const bcdesc_t** hd_list);
+
+
+#endif /* BCAL_PERFORMANCE_H_ */
const uint8_t des_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(64),
KS_TYPE_TERMINATOR };
static
-void des_dummy_enc(void* block, coid* key){
+void des_dummy_enc(void* block, void* key){
des_enc(block, block, key);
}
static
-void des_dummy_dec(void* block, coid* key){
+void des_dummy_dec(void* block, void* key){
des_dec(block, block, key);
}
--- /dev/null
+/* bcal_threefish1024.c */
+/*
+ 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
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * \file bcal_threefish1024.c
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2010-02-20
+ * \license GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+const char threefish1024_str[] PROGMEM = "Threefish-1024";
+
+const uint8_t threefish1024_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(1024),
+ KS_TYPE_TERMINATOR };
+
+static void threefish1024_dummy_init(void* key, void* ctx){
+ threefish1024_init(key, NULL, ctx);
+}
+
+const bcdesc_t threefish1024_desc PROGMEM = {
+ BCDESC_TYPE_BLOCKCIPHER,
+ BC_INIT_TYPE_1,
+ threefish1024_str,
+ sizeof(threefish1024_ctx_t),
+ 1024,
+ {(void_fpt)threefish1024_dummy_init},
+ {(void_fpt)threefish1024_enc},
+ {(void_fpt)threefish1024_dec},
+ (bc_free_fpt)NULL,
+ threefish1024_keysize_desc
+};
+
+
--- /dev/null
+/* bcal_threefis1024.h */
+/*
+ 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
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * \file bcal_threefish1024.h
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2010-02-20
+ * \license GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t threefish1024_desc;
--- /dev/null
+/* bcal_threefish256.c */
+/*
+ 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
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * \file bcal_threefish256.c
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2010-02-20
+ * \license GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+const char threefish256_str[] PROGMEM = "Threefish-256";
+
+const uint8_t threefish256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(256),
+ KS_TYPE_TERMINATOR };
+
+static void threefish256_dummy_init(void* key, void* ctx){
+ threefish256_init(key, NULL, ctx);
+}
+
+const bcdesc_t threefish256_desc PROGMEM = {
+ BCDESC_TYPE_BLOCKCIPHER,
+ BC_INIT_TYPE_1,
+ threefish256_str,
+ sizeof(threefish256_ctx_t),
+ 256,
+ {(void_fpt)threefish256_dummy_init},
+ {(void_fpt)threefish256_enc},
+ {(void_fpt)threefish256_dec},
+ (bc_free_fpt)NULL,
+ threefish256_keysize_desc
+};
+
+
--- /dev/null
+/* bcal_threefis256.h */
+/*
+ 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
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * \file bcal_threefish256.h
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2010-02-20
+ * \license GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t threefish256_desc;
--- /dev/null
+/* bcal_threefish512.c */
+/*
+ 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
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * \file bcal_threefish512.c
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2010-02-20
+ * \license GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+const char threefish512_str[] PROGMEM = "Threefish-512";
+
+const uint8_t threefish512_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(512),
+ KS_TYPE_TERMINATOR };
+
+static void threefish512_dummy_init(void* key, void* ctx){
+ threefish512_init(key, NULL, ctx);
+}
+
+const bcdesc_t threefish512_desc PROGMEM = {
+ BCDESC_TYPE_BLOCKCIPHER,
+ BC_INIT_TYPE_1,
+ threefish512_str,
+ sizeof(threefish512_ctx_t),
+ 512,
+ {(void_fpt)threefish512_dummy_init},
+ {(void_fpt)threefish512_enc},
+ {(void_fpt)threefish512_dec},
+ (bc_free_fpt)NULL,
+ threefish512_keysize_desc
+};
+
+
--- /dev/null
+/* bcal_threefis512.h */
+/*
+ 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
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * \file bcal_threefish512.h
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2010-02-20
+ * \license GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t threefish512_desc;
hf.init(&ctx);
STOP_TIMER;
t += stopTimer();
+ if(i!=31 && hf.free){
+ hf.free(&ctx)
+ }
}
t>>=5;
cli_putstr_P(PSTR("\r\n init (cycles): "));
t>>=5;
cli_putstr_P(PSTR("\r\n ctx2hash (cycles): "));
printvalue(t);
+
+ if(hf.free){
+ hf.free(&ctx);
+ }
}
*
*/
-#include "nessie_hash_test.h"
#include "hfal-basic.h"
#include "hashfunction_descriptor.h"
#include "cli.h"
along with this program. If not, see <http://www.gnu.org/licenses/>.
=end
+
+require 'rubygems'
+require 'getopt/std'
+
=begin
| Blake-28 || C || C
| 10916<br>
=end
-def fix_file(fin, fout)
+def fix_file(fin, fout, supress)
loop do
return if fin.eof()
comp = Array.new
end until comp[i-1].match(/^\|/)
sum = 0
(i-1).times{ |j| sum += comp[j].match(/[^:]*:[\s]*([\d]*)/)[1].to_i}
- fout.puts(lb1)
- fout.printf("| %d <br>\n", sum)
- comp.each{ |s| fout.puts(s)}
+ fout.print(lb1.chomp)
+ if supress
+ fout.printf(" || %d |%s", sum, comp.last)
+ else
+ fout.printf("\n| %d <br>\n", sum)
+ comp.each{ |s| fout.puts(s)}
+ end
begin
lb1 = fin.readline()
fout.puts(lb1)
fin = STDIN
fout = STDOUT
+opts = Getopt::Std.getopts("s")
fin = File.open(ARGV[0], "r") if ARGV.size > 0
fout = File.open(ARGV[1], "w") if ARGV.size > 1
-fix_file(fin, fout)
+fix_file(fin, fout, opts["s"])
fin.close if ARGV.size > 0
fout.close if ARGV.size > 1
return is_valid_keysize_P((uint8_t*)ks_desc+1, keysize); /* search the next record */
}
+uint16_t get_keysize(PGM_VOID_P ks_desc){
+ uint8_t type;
+ uint16_t keysize;
+ type = pgm_read_byte(ks_desc);
+ if(type==KS_TYPE_LIST)
+ ks_desc = (uint8_t*)ks_desc + 1;
+ ks_desc = (uint8_t*)ks_desc + 1;
+ keysize = pgm_read_word(ks_desc);
+ return keysize;
+}
+
}keysize_desc_arg_range_t;
uint8_t is_valid_keysize_P(PGM_VOID_P ks_desc, uint16_t keysize);
-
+uint16_t get_keysize(PGM_VOID_P ks_desc);
#endif /* KEYSIZE_DESCRIPTOR_H_ */
--- /dev/null
+BCAL_STD = nessie_common.o nessie_bc_test.o performance_test.o \
+ bcal-basic.o bcal-performance.o keysize_descriptor.o
bcal_aes128.o bcal_aes192.o bcal_aes256.o bcal-basic.o bcal-cbc.o \
keysize_descriptor.o dump-asm.o dump-decl.o bcal-cfb_byte.o \
bcal-cfb_bit.o bcal-ofb.o bcal-ctr.o bcal-cmac.o cmacvs.o \
- bcal-eax.o
+ bcal-eax.o bcal-performance.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DIR := camellia/
$(ALGO_NAME)_OBJ := camellia128-stub.o camellia-asm.o
-$(ALGO_NAME)_TEST_BIN := main-camellia-test.o $(CLI_STD) nessie_bc_test.o \
- nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-camellia-test.o $(CLI_STD) $(BCAL_STD) \
+ bcal_camellia128.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := cast5/
$(ALGO_NAME)_OBJ := cast5.o
-$(ALGO_NAME)_TEST_BIN := main-cast5-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-cast5-test.o bcal_cast5.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := cast6/
$(ALGO_NAME)_OBJ := cast6.o
-$(ALGO_NAME)_TEST_BIN := main-cast6-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-cast6-test.o bcal_cast6.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DIR := des/
$(ALGO_NAME)_OBJ := des.o
-$(ALGO_NAME)_TEST_BIN := main-des-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-des-test.o bcal_des.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := noekeon_asm.o
-$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o bcal_noekeon.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := noekeon.o
-$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o bcal_noekeon.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DIR := present/
$(ALGO_NAME)_OBJ := present.o
-$(ALGO_NAME)_TEST_BIN := main-present-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-present-test.o bcal_present.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := rc5/
$(ALGO_NAME)_OBJ := rc5.o
-$(ALGO_NAME)_TEST_BIN := main-rc5-test.o $(CLI_STD) nessie_bc_test.o \
- nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-rc5-test.o bcal_rc5.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DIR := rc6/
$(ALGO_NAME)_OBJ := rc6.o
-$(ALGO_NAME)_TEST_BIN := main-rc6-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-rc6-test.o bcal_rc6.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DIR := seed/
$(ALGO_NAME)_OBJ := seed-asm.o
-$(ALGO_NAME)_TEST_BIN := main-seed-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-seed-test.o bcal_seed.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := seed/
$(ALGO_NAME)_OBJ := seed_C.o
-$(ALGO_NAME)_TEST_BIN := main-seed-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-seed-test.o bcal_seed.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := serpent/
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-bitslice-asm.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o bcal_serpent.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := serpent/
$(ALGO_NAME)_OBJ := serpent-sboxes-bitslice-asm.o serpent-asm.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o bcal_serpent.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := serpent/
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-fast.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o bcal_serpent.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := serpent/
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-small.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o bcal_serpent.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := serpent/
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes_c.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o bcal_serpent.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := skipjack/
$(ALGO_NAME)_OBJ := skipjack.o
-$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o bcal_skipjack.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := des/
$(ALGO_NAME)_OBJ := des.o
-$(ALGO_NAME)_TEST_BIN := main-tdes-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-tdes-test.o bcal_tdes.o bcal_tdes2.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_OBJ := threefish256_enc_asm.o threefish512_enc_asm.o threefish1024_enc_asm.o\
threefish_mix.o threefish_invmix.o \
threefish256_dec_asm.o threefish512_dec_asm.o threefish1024_dec_asm.o
-$(ALGO_NAME)_TEST_BIN := main-threefish-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-threefish-test.o bcal_threefish256.o bcal_threefish512.o bcal_threefish1024.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DIR := skein/
$(ALGO_NAME)_OBJ := threefish256_enc.o threefish512_enc.o threefish1024_enc.o threefish_mix_c.o \
threefish_invmix_c.o threefish256_dec.o threefish512_dec.o threefish1024_dec.o
-$(ALGO_NAME)_TEST_BIN := main-threefish-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-threefish-test.o bcal_threefish256.o bcal_threefish512.o bcal_threefish1024.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_OBJ := threefish256_enc_small.o threefish512_enc.o threefish1024_enc.o\
threefish_mix.o threefish_mix_4c.o threefish_invmix_c.o \
threefish256_dec.o threefish512_dec.o threefish1024_dec.o
-$(ALGO_NAME)_TEST_BIN := main-threefish-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-threefish-test.o bcal_threefish256.o bcal_threefish512.o bcal_threefish1024.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
$(ALGO_NAME)_DIR := xtea/
$(ALGO_NAME)_OBJ := xtea-asm.o
-$(ALGO_NAME)_TEST_BIN := main-xtea-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-xtea-test.o bcal_xtea.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
$(ALGO_NAME)_DIR := xtea/
$(ALGO_NAME)_OBJ := xtea.o
-$(ALGO_NAME)_TEST_BIN := main-xtea-test.o $(CLI_STD) \
- nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-xtea-test.o bcal_xtea.o $(CLI_STD) $(BCAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
#include "bcal-cmac.h"
#include "bcal-eax.h"
#include "cmacvs.h"
+#include "bcal-performance.h"
#include <stdint.h>
#include <string.h>
/*****************************************************************************/
-void testrun_performance_aes128(void){
- uint64_t t;
- char str[16];
- uint8_t key[32], data[16];
- aes128_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 32);
- memset(data, 0, 16);
-
- startTimer(1);
- aes128_init(key, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- aes128_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- aes128_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
-}
-
-
-void testrun_performance_aes192(void){
- uint64_t t;
- char str[16];
- uint8_t key[32], data[16];
- aes192_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 32);
- memset(data, 0, 16);
-
- startTimer(1);
- aes192_init(key, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- aes192_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- aes192_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
-}
-
-
-void testrun_performance_aes256(void){
- uint64_t t;
- char str[16];
- uint8_t key[32], data[16];
- aes256_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 32);
- memset(data, 0, 16);
-
- startTimer(1);
- aes256_init(key, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- aes256_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- aes256_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
-}
-
void testrun_performance_aes(void){
- cli_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n"));
- cli_putstr_P(PSTR("\r\n AES-128\r\n"));
- testrun_performance_aes128();
- cli_putstr_P(PSTR("\r\n AES-192\r\n"));
- testrun_performance_aes192();
- cli_putstr_P(PSTR("\r\n AES-256\r\n"));
- testrun_performance_aes256();
+ bcal_performance_multiple(algolist);
}
+
/*****************************************************************************
* main *
*****************************************************************************/
#include "nessie_bc_test.h"
#include "performance_test.h"
#include "cli.h"
-
-char* algo_name = "Camellia";
-
-
+#include "bcal_camellia128.h"
+#include "bcal-performance.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
+char* algo_name = "Camellia";
+
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&camellia128_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
nessie_bc_run();
}
+/*
+ * P No.001 : 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ */
-void test_performance_camellia(void){
- uint64_t t;
- char str[6];
- uint8_t key[16], data[16];
- camellia128_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 16);
-
- startTimer(1);
- camellia128_init(key, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- camellia128_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- camellia128_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
+uint8_t test_keys[] PROGMEM = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+ 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
+ 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00,
+ 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
+ 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, 0xEF, 0xCD, 0xAB, 0x89, 0x67, 0x45, 0x23, 0x01,
+ 0xEF, 0xCD, 0xAB, 0x89, 0x67, 0x45, 0x23, 0x01, 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE
+};
+
+void hexdump128(void* data){
+ uint8_t i;
+ for(i=0; i<16; ++i){
+ cli_hexdump(data, 1);
+ cli_putc(' ');
+ data = (uint8_t*)data +1;
+ }
+}
+
+void testrun_camellia128(void){
+ uint8_t data[16];
+ uint8_t data2[16];
+ uint8_t key[16];
+ char str[4];
+ uint8_t i,j;
+ str[3]= '\0';
+ for(j=0; j<10; ++j){
+ str[0] = ('0'+(j+1)/100);
+ str[1] = ('0'+((j+1)/10)%10);
+ str[2] = ('0'+(j+1)%10);
+ memcpy_P(key, test_keys+j*16, 16);
+ cli_putstr_P(PSTR("\r\nK No."));
+ cli_putstr(str);
+ cli_putstr_P(PSTR(" : "));
+ hexdump128(key);
+ camellia128_ctx_t ctx;
+ camellia128_init(key, &ctx);
+ for(i=0; i<128; ++i){
+ memset(data, 0x00, 16);
+ data[i/8] = 0x80>>i%8;
+ memcpy(data2, data, 16);
+ str[0] = ('0'+(i+1)/100);
+ str[1] = ('0'+((i+1)/10)%10);
+ str[2] = ('0'+(i+1)%10);
+ cli_putstr_P(PSTR("\r\nP No."));
+ cli_putstr(str);
+ cli_putstr_P(PSTR(" : "));
+ hexdump128(data);
+ camellia128_enc(data, &ctx);
+ cli_putstr_P(PSTR("\r\nC No."));
+ cli_putstr(str);
+ cli_putstr_P(PSTR(" : "));
+ hexdump128(data);
+ camellia128_dec(data, &ctx);
+ if(memcmp(data, data2, 16)){
+ cli_putstr_P(PSTR("\r\n DECRYPTION ERROR !!!"));
+ }
+ }
+ }
}
+void test_performance_camellia(void){
+ bcal_performance_multiple(algolist);
+}
/*****************************************************************************
/*****************************************************************************
- * main *
+ * main *
*****************************************************************************/
const char nessie_str[] PROGMEM = "nessie";
const char test_str[] PROGMEM = "test";
+const char test128_str[] PROGMEM = "test128";
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},
+ { test128_str, NULL, testrun_camellia128},
{ performance_str, NULL, test_performance_camellia},
{ echo_str, (void*)1, (void_fpt)echo_ctrl},
{ NULL, NULL, NULL}
#include <cast5.h>
#include "nessie_bc_test.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_cast5.h"
#include "cli.h"
#include <stdint.h>
char* algo_name = "cast-128 (cast5)";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&cast5_desc,
+ NULL
+};
+
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
}
void testrun_performance_cast5(void){
- uint64_t t;
- char str[6];
- uint8_t key[16], data[16];
- cast5_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 16);
-
- startTimer(1);
- cast5_init(key, 128, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- cast5_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- cast5_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_cast6.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "CAST-256";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&cast6_desc,
+ NULL
+};
+
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
}
void testrun_performance_cast6(void){
- uint64_t t;
- char str[16];
- uint8_t key[16], data[16];
- cast6_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 16);
-
- startTimer(1);
- cast6_init(key, 128, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- cast6_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- cast6_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
+
/*****************************************************************************
* main *
*****************************************************************************/
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_des.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "DES";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&des_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_performance_des(void){
- uint64_t t;
- char str[16];
- uint8_t key[8], data[8];
-
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 8);
- memset(data, 0, 8);
-
- startTimer(1);
- des_enc(data, data, key);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- des_dec(data, data, key);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_noekeon.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "Noekeon";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&noekeon_direct_desc,
+ (bcdesc_t*)&noekeon_indirect_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
}
void testrun_performance_noekeon(void){
- uint64_t t;
- char str[16];
- uint8_t key[16], data[16];
- noekeon_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 16);
-
- startTimer(1);
- noekeon_init(key, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- noekeon_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- noekeon_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_present.h"
#include <stdlib.h>
#include <stdint.h>
char* algo_name = "Present";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&present_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
}
void testrun_performance_present(void){
- uint64_t t;
- uint8_t key[10], data[8];
- present_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 10);
- memset(data, 0, 8);
-
- startTimer(1);
- present_init(key, 80, &ctx);
- t = stopTimer();
- print_time_P(PSTR("\tctx-gen time: "),t);
-
- startTimer(1);
- present_enc(data, &ctx);
- t = stopTimer();
- print_time_P(PSTR("\tencrypt time: "), t);
-
- startTimer(1);
- present_dec(data, &ctx);
- t = stopTimer();
- print_time_P(PSTR("\tdecrypt time: "), t);
-
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_rc5.h"
#include <stdint.h>
#include <string.h>
#define RC5_ROUNDS 12
char* algo_name = "RC5-32/12/16";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&rc5_desc,
+ NULL
+};
+
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_performance_rc5(void){
- uint64_t t;
- char str[16];
- uint8_t key[16], data[16];
- rc5_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 16);
-
- startTimer(1);
- rc5_init(key, 128, RC5_ROUNDS, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- rc5_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- rc5_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- rc5_free(&ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tfree time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_rc6.h"
#include <stdint.h>
#include <string.h>
#define RC6_ROUNDS 20
char* algo_name = "RC6-32/20/16";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&rc6_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_performance_rc6(void){
- uint64_t t;
- char str[16];
- uint8_t key[16], data[16];
- rc6_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 16);
-
- startTimer(1);
- rc6_init(key, 128, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- rc6_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- rc6_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- rc6_free(&ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tfree time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_seed.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "Seed";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&seed_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_performance_seed(void){
- uint64_t t;
- char str[16];
- uint8_t key[16], data[16];
- seed_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 16);
-
- startTimer(1);
- seed_init(key, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- seed_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- seed_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_serpent.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "Serpent";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&serpent_desc,
+ NULL
+};
+
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
}
void testrun_performance_serpent(void){
- uint64_t t;
- char str[16];
- uint8_t key[32], data[16];
- serpent_ctx_t ctx;
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 32);
- memset(data, 0, 16);
-
- startTimer(1);
- serpent_init(key, 0, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- serpent_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- serpent_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_skipjack.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "Skipjack";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&skipjack_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_performance_skipjack(void){
- uint64_t t;
- char str[16];
- uint8_t key[10], data[8];
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 10);
- memset(data, 0, 8);
-
- startTimer(1);
- skipjack_enc(data, key);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
-
- startTimer(1);
- skipjack_dec(data, key);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_tdes.h"
+#include "bcal_tdes2.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "TDES";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&tdes_desc,
+ (bcdesc_t*)&tdes2_desc,
+ NULL
+};
+
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void testrun_performance_tdes(void){
- uint64_t t;
- char str[16];
- uint8_t key[8*3], data[8];
-
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 8*3);
- memset(data, 0, 8);
-
- startTimer(1);
- tdes_enc(data, data, key);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- tdes_dec(data, data, key);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
#include "nessie_bc_test.h"
#include "cli.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_threefish256.h"
+#include "bcal_threefish512.h"
+#include "bcal_threefish1024.h"
#include <stdint.h>
#include <string.h>
char* algo_name = "Threefish";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&threefish256_desc,
+ (bcdesc_t*)&threefish512_desc,
+ (bcdesc_t*)&threefish1024_desc,
+ NULL
+};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
testrun_stdtest_threefish1024();
}
-void testrun_performance_threefish256(void){
- uint64_t t;
- char str[16];
- uint8_t key[THREEFISH256_BLOCKSIZE_B];
- uint8_t data[THREEFISH256_BLOCKSIZE_B];
- uint8_t tweak[16];
- threefish256_ctx_t ctx;
-
- cli_putstr_P(PSTR("\r\nThreefish-256 performance:"));
-
- calibrateTimer();
- print_overhead();
-
-// memset(key, 0, THREEFISH256_BLOCKSIZE_B);
-// memset(tweak, 0, 16);
-
- startTimer(1);
- threefish256_init(key, tweak, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- threefish256_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- threefish256_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
- cli_putstr_P(PSTR("\r\n"));
-}
-
-void testrun_performance_threefish512(void){
- uint64_t t;
- char str[16];
- uint8_t key[THREEFISH512_BLOCKSIZE_B];
- uint8_t data[THREEFISH512_BLOCKSIZE_B];
- uint8_t tweak[16];
- threefish512_ctx_t ctx;
-
- cli_putstr_P(PSTR("\r\nThreefish-512 performance:"));
-
- calibrateTimer();
- print_overhead();
-
-// memset(key, 0, THREEFISH512_BLOCKSIZE_B);
-// memset(tweak, 0, 16);
-
- startTimer(1);
- threefish512_init(key, tweak, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- threefish512_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- threefish512_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
-}
-
-void testrun_performance_threefish1024(void){
- uint64_t t;
- char str[16];
- uint8_t key[THREEFISH1024_BLOCKSIZE_B];
- uint8_t data[THREEFISH1024_BLOCKSIZE_B];
- uint8_t tweak[16];
- threefish1024_ctx_t ctx;
-
- cli_putstr_P(PSTR("\r\nThreefish-1024 performance:"));
-
- calibrateTimer();
- print_overhead();
-
-// memset(key, 0, THREEFISH1024_BLOCKSIZE_B);
-// memset(tweak, 0, 16);
-
- startTimer(1);
- threefish1024_init(key, tweak, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- threefish1024_enc(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tencrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- startTimer(1);
- threefish1024_dec(data, &ctx);
- t = stopTimer();
- cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
- ultoa((unsigned long)t, str, 10);
- cli_putstr(str);
-
- cli_putstr_P(PSTR("\r\n"));
-}
-
void testrun_performance_threefish(void){
- testrun_performance_threefish256();
- testrun_performance_threefish512();
- testrun_performance_threefish1024();
+ bcal_performance_multiple(algolist);
}
void init_test(void){
#include "xtea.h"
#include "nessie_bc_test.h"
#include "performance_test.h"
+#include "bcal-performance.h"
+#include "bcal_xtea.h"
#include "cli.h"
#include <stdint.h>
char* algo_name = "XTEA";
+const bcdesc_t* algolist[] PROGMEM = {
+ (bcdesc_t*)&xtea_desc,
+ NULL
+};
+
+/******************************************************************************/
+
void xtea_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
memcpy(ctx, key, (keysize+7)/8);
}
}
void testrun_performance_xtea(void){
- uint64_t t;
- uint8_t key[16], data[8];
-
- calibrateTimer();
- print_overhead();
-
- memset(key, 0, 16);
- memset(data, 0, 8);
-
- startTimer(1);
- xtea_enc(data, data, key);
- t = stopTimer();
- print_time_P(PSTR("\tencrypt time: "), t);
-
- startTimer(1);
- xtea_dec(data, data, key);
- t = stopTimer();
- print_time_P(PSTR("\tdecrypt time: "), t);
-
- cli_putstr_P(PSTR("\r\n"));
+ bcal_performance_multiple(algolist);
}
/*****************************************************************************