]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
changing performance measurment of blockciphers to bcal
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Sat, 20 Feb 2010 20:45:42 +0000 (20:45 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Sat, 20 Feb 2010 20:45:42 +0000 (20:45 +0000)
55 files changed:
bcal-eax.c
bcal-performance.c [new file with mode: 0644]
bcal-performance.h [new file with mode: 0644]
bcal_des.c
bcal_threefish1024.c [new file with mode: 0644]
bcal_threefish1024.h [new file with mode: 0644]
bcal_threefish256.c [new file with mode: 0644]
bcal_threefish256.h [new file with mode: 0644]
bcal_threefish512.c [new file with mode: 0644]
bcal_threefish512.h [new file with mode: 0644]
hfal-performance.c
hfal-test.c
host/fix-wiki-size.rb
keysize_descriptor.c
keysize_descriptor.h
mkfiles/001_bcal_std.mk [new file with mode: 0644]
mkfiles/aes.mk
mkfiles/camellia.mk
mkfiles/cast5.mk
mkfiles/cast6.mk
mkfiles/des.mk
mkfiles/noekeon.mk
mkfiles/noekeon_c.mk
mkfiles/present.mk
mkfiles/rc5.mk
mkfiles/rc6.mk
mkfiles/seed.mk
mkfiles/seed_C.mk
mkfiles/serpent-bitslice.mk
mkfiles/serpent_asm_bitslice.mk
mkfiles/serpent_asm_fast.mk
mkfiles/serpent_asm_small.mk
mkfiles/serpent_c.mk
mkfiles/skipjack.mk
mkfiles/tdes.mk
mkfiles/threefish.mk
mkfiles/threefish_C.mk
mkfiles/threefish_small.mk
mkfiles/xtea.mk
mkfiles/xtea_c.mk
test_src/main-aes-test.c
test_src/main-camellia-test.c
test_src/main-cast5-test.c
test_src/main-cast6-test.c
test_src/main-des-test.c
test_src/main-noekeon-test.c
test_src/main-present-test.c
test_src/main-rc5-test.c
test_src/main-rc6-test.c
test_src/main-seed-test.c
test_src/main-serpent-test.c
test_src/main-skipjack-test.c
test_src/main-tdes-test.c
test_src/main-threefish-test.c
test_src/main-xtea-test.c

index 78ddd519c436138661e3d765488c5afe860aa220..9dceccdf6a4448226d07773dfdeb26078be3822b 100644 (file)
@@ -24,6 +24,7 @@
 #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;
diff --git a/bcal-performance.c b/bcal-performance.c
new file mode 100644 (file)
index 0000000..447e4d1
--- /dev/null
@@ -0,0 +1,152 @@
+/* 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);
+       }
+}
diff --git a/bcal-performance.h b/bcal-performance.h
new file mode 100644 (file)
index 0000000..b8c5666
--- /dev/null
@@ -0,0 +1,38 @@
+/* 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_ */
index 601469cae8296f9d08d16569299e8b1902edd104..04ed5e5c61cd45a909d35f9b6d1a06bbbf688605 100644 (file)
@@ -36,12 +36,12 @@ const char des_str[]   PROGMEM = "DES";
 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);
 }
 
diff --git a/bcal_threefish1024.c b/bcal_threefish1024.c
new file mode 100644 (file)
index 0000000..8f1a108
--- /dev/null
@@ -0,0 +1,56 @@
+/* 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
+};
+
+
diff --git a/bcal_threefish1024.h b/bcal_threefish1024.h
new file mode 100644 (file)
index 0000000..67c9b3c
--- /dev/null
@@ -0,0 +1,33 @@
+/* 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;
diff --git a/bcal_threefish256.c b/bcal_threefish256.c
new file mode 100644 (file)
index 0000000..f95f1a2
--- /dev/null
@@ -0,0 +1,56 @@
+/* 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
+};
+
+
diff --git a/bcal_threefish256.h b/bcal_threefish256.h
new file mode 100644 (file)
index 0000000..d2819bf
--- /dev/null
@@ -0,0 +1,33 @@
+/* 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;
diff --git a/bcal_threefish512.c b/bcal_threefish512.c
new file mode 100644 (file)
index 0000000..ff61a74
--- /dev/null
@@ -0,0 +1,56 @@
+/* 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
+};
+
+
diff --git a/bcal_threefish512.h b/bcal_threefish512.h
new file mode 100644 (file)
index 0000000..8f87d65
--- /dev/null
@@ -0,0 +1,33 @@
+/* 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;
index 8c5b36db6dc5dac7fd8ff6d443d460333bd28eb7..c64e7e962fbed888c528d8bfb64ad199a6a6b212 100644 (file)
@@ -79,6 +79,9 @@ void hfal_performance(const hfdesc_t* hd){
                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):      "));
@@ -119,6 +122,10 @@ void hfal_performance(const hfdesc_t* hd){
        t>>=5;
        cli_putstr_P(PSTR("\r\n    ctx2hash (cycles):  "));
        printvalue(t);
+
+       if(hf.free){
+               hf.free(&ctx);
+       }
 }
 
 
index 28793311661cafe988ad76504860e23a13a7c0b2..9efce38e3e49e370adc2e9958ca8a278063b51cb 100644 (file)
@@ -25,7 +25,6 @@
  * 
  */
 
-#include "nessie_hash_test.h"
 #include "hfal-basic.h"
 #include "hashfunction_descriptor.h"
 #include "cli.h"
index 2bc08c841c174d33cf4332b44169565b84d9b7e4..53a480efdb4ee007bb948d1aff7698cc951d067e 100644 (file)
     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> 
@@ -32,7 +36,7 @@ memxor: 24
 =end
 
 
-def fix_file(fin, fout)
+def fix_file(fin, fout, supress)
   loop do
     return if fin.eof()
     comp = Array.new
@@ -45,9 +49,13 @@ def fix_file(fin, fout)
     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)
@@ -62,11 +70,12 @@ end
 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
index 5dcdcc05008088c0c109debd5a6d806e1348eba3..045ff65f4c24c2c5188fad812ebbf24886f94095 100644 (file)
@@ -72,4 +72,15 @@ uint8_t is_valid_keysize_P(PGM_VOID_P ks_desc, uint16_t keysize){
        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;
+}
+
 
index e256ddfd1f4af321892802043c45308f95163a05..dd912542915c1b6d7ae8d360c961ab8f7c9e352b 100644 (file)
@@ -55,5 +55,5 @@ typedef struct{ /* keysize is valid if min<=keysize<=max and if keysize mod dist
 }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_ */
diff --git a/mkfiles/001_bcal_std.mk b/mkfiles/001_bcal_std.mk
new file mode 100644 (file)
index 0000000..7045a5f
--- /dev/null
@@ -0,0 +1,2 @@
+BCAL_STD = nessie_common.o nessie_bc_test.o performance_test.o \
+           bcal-basic.o bcal-performance.o keysize_descriptor.o 
index ebe67b6b212b515962b2b4f22d464be5172d08b2..18bf9fab0d5c7023c012f6b2d5138ce9349f04f8 100644 (file)
@@ -12,7 +12,7 @@ $(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD)  \
                          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
 
index 4b0213c4545758d449532e4ad3a71231f051f27c..988b29a725587dff896de57df56533d51363a2ff 100644 (file)
@@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 318a0e57ba76d88911f1bb26ff6aae3d0e896f5b..a2e5fd78280eb7af2afbdb186c48762320bb6090 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index f28800ac8491b6ead4045cef5eff4c24b6b9a2ca..6d035b58803f1dd7613947482475ce663c4ff9d1 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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
 
index 180d9e1ed54cd3f19e4d9ad423497b8cc0208a26..ae283d3966b0707fd886f345403429e535aeb54b 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 086316270b2ec769e17eb67ba3ef6ed72abd6bcb..642747904525a023162a2b09b844dd97101fbd20 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(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
 
index 0f7f0879336927cc13bce93ae65db383c9bb3a28..a106a05efc1defec9070444486a92f737d724a75 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(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
 
index 3c73f82763d99e66c243621e64849c3fdd9009f0..3fd2d91c9a419fe2ba362874edcb1364d5e86976 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index be821751b24e0c7bf83aa9278255813dd680081e..fe006e3af16dbcdc357dbe096914fab3bb9156d8 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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
 
index a58b1383b822f5ddefe5e937e1e11bdc37e786c7..75742c1f1452c058d35869bec6cb2be2066c1618 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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
 
index 07ceb3e71db424f168aef7ebd7c70cd5008936af..7d532d1ef00114e667309bb9147afbc304cc19b0 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 7c776668990858ee11fada235025e78cb7143f8d..2bd38020dfa4455e7b710ac97a8f70a8a977da1c 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 571914320659327f67a5f25dee8796ee46a4d738..500de498bf32837ccbceb10699de70b5258ae724 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index a5956c38c9000b215cf8535b6f3cf5c385f2742e..a36fe02b2917b6fe1afeeebcd1e6e427fe759455 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index d9ff725fe07d2eba9a0f56eea91e5de6e7eeebf4..d0dbc5cd2686665c4bffe3922c54d10630466a03 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 4d6750ebc1a0d17304387249a08f9a8936b70c17..61854eb692bb14b3301fe4792623a1ede28cb48c 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index f52ced4a58d2fd8fd8c3e23377cbe08b4b3e4d27..1f912dc3069a7e9b052f22adcdeec1a979d94131 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index ef859df9ac632210f125ad6657c31d3000551a79..94d019512ac832f2040c0d12a2f83e194269a376 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 09bb96cb3e8b47da21620b963c741be8be4b99b8..c893bfc1d9357f756436d90c1dc4aa0047e48371 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 4e7abc362b329b119c875ffa4569021fe67909cd..f38cad10db2576ef950a186579e9c8a5df12c3f9 100644 (file)
@@ -8,8 +8,7 @@ $(ALGO_NAME)_DIR      := skein/
 $(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
 
index 78bfab24ffe5a25b405dea476e129b0efc987470..8f0ab70016da37920cc79b207ffdce67045817f7 100644 (file)
@@ -7,8 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 $(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
 
index 9899f2131baa4ab9cad94167d888c07d027e62f9..bdb04383f3a1b5b396f7f6f5ec7b08b7d7c5304b 100644 (file)
@@ -8,8 +8,7 @@ $(ALGO_NAME)_DIR      := skein/
 $(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
 
index f2d1169cc66c94d445d5398218d25b01462bd2df..9b61ba80cf258a4394de5df399cef137bd074bfe 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index 5bbd680e88e00499372adcbe533bda05fb6fea99..4f89a4eba49662b33829634b456a9e756f8765e1 100644 (file)
@@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(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"
 
index b17382a4ee853d92fa38a3f9d1823db005095681..9ec7056ee6a4eac658e5c48333cdd8aa32defda4 100644 (file)
@@ -44,6 +44,7 @@
 #include "bcal-cmac.h"
 #include "bcal-eax.h"
 #include "cmacvs.h"
+#include "bcal-performance.h"
 
 #include <stdint.h>
 #include <string.h>
@@ -670,131 +671,10 @@ void testrun_aes128_eax(void){
 
 /*****************************************************************************/
 
-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                                                                                                                                        *
  *****************************************************************************/
index 2cc64390858b0dd4cba03d9c3b222100eee72e23..fb9f88170389a1f641859bca702b52d35e405a9c 100644 (file)
 #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                                                                                     *
@@ -59,45 +63,77 @@ void testrun_nessie_camellia(void){
        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);
+}
 
 
 /*****************************************************************************
@@ -139,17 +175,19 @@ void testrun_camellia(void){
 
 
 /*****************************************************************************
- * 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}
index a8f88900e2ec341e362cb14eba82da359e0aa413..3db72a7445a24c73c5edd367608fb49b5b37cf1a 100644 (file)
@@ -29,6 +29,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -152,41 +159,7 @@ void testrun_cast5(void){
 }
 
 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);
 }
 
 /*****************************************************************************
index 27e047892aa40b8b6c72322b9bdbde75a304ac32..c295b699aefb93e4bb9f49b584aaa6b9c681ce0d 100644 (file)
@@ -12,6 +12,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -104,39 +111,9 @@ void testrun_rfc_cast6(void){
 }
 
 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                                                                                                                                        *
  *****************************************************************************/
index a674d6e56485a5d655c1235cb1d06b7c2c1e4f14..f6d237c7e58e270894049714c21b9a07311a731b 100644 (file)
@@ -30,6 +30,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -67,31 +73,7 @@ void testrun_nessie_des(void){
 
 
 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                                                
index fa0c3238cc035c7d5691b7252121e1fb2d813b61..47f9661521eb954539cb4726566f7f99d012cadb 100644 (file)
@@ -30,6 +30,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -173,39 +180,7 @@ void testrun_stdtest_noekeon(void){
 }
 
 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                                                                                                                                        *
index c7c65d23639179613c9d6463ebd577d0daee6359..96b0ff71117a1a6e5e21fc2ccc89db327af4e88c 100644 (file)
@@ -30,6 +30,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -95,32 +101,7 @@ void testrun_self_present(void){
 }
 
 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);
 }
 
 /*****************************************************************************
index 640c65fc15614d1172e35d9730923d9c4879df5f..95a3e06f2786ccb4ce76b011e957fb88fcb3fbac 100644 (file)
@@ -30,6 +30,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -61,45 +68,7 @@ void testrun_nessie_rc5(void){
 
 
 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                                                                                                                                        *
index c3bb0f029789fb855157c2cd8de6adb460234069..67513adbabdd9c0e8a6caee8ab2085fe2dc3e84b 100644 (file)
@@ -30,6 +30,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -68,45 +74,7 @@ void testrun_nessie_rc6(void){
 
 
 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                                                                                                                                        *
index 4e0655965ef2f581937b8c3151958db29d6e689b..9ff4b3ff220e593123b839836634b13dfbaccec2 100644 (file)
@@ -35,6 +35,8 @@
 #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                                          *
  *****************************************************************************/
@@ -64,41 +70,7 @@ void testrun_nessie_seed(void){
 
 
 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);
 }
 
 /*****************************************************************************
index 896d879b22afac2211a81eb67e869b5e4fe37f43..51575b9f6d5cda26c0ab396dcca35ef95cc271b2 100644 (file)
@@ -30,6 +30,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -77,41 +84,7 @@ void testrun_test_serpent(void){
 }
 
 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                                                                                                                                        *
index c37f2bc16680ee787405f8109a66536a1e15667d..3f1c75fd308b420fd8e31532c7be6ed39be695b4 100644 (file)
@@ -30,6 +30,8 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -59,32 +65,7 @@ void testrun_nessie_skipjack(void){
 
 
 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);
 }
 
 /*****************************************************************************
index ab6cd5e88bbacd9a82c8cc4d493e9e964b5dcb6f..7adc19e0686179bdd484754e758271b626ab863c 100644 (file)
@@ -30,6 +30,9 @@
 #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                                                                                     *
  *****************************************************************************/
@@ -67,31 +76,7 @@ void testrun_nessie_tdes(void){
 
 
 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                                                                                                                                        *
index fd233bd451e94a5f324a924c03848aefd4fd7934..31748e45d78e47993e471c21ff8b517154cf04f1 100644 (file)
 #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                                                                                     *
  *****************************************************************************/
@@ -267,129 +277,8 @@ void testrun_stdtest_threefish(void){
        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){
index aaebdf35d72476d97c0eca03f1fbf461fc07f6d1..c40046f0cdd9cf518c936eefca9ad7183ed542ac 100644 (file)
@@ -29,6 +29,8 @@
 #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);
 }
@@ -61,26 +70,7 @@ void testrun_nessie_xtea(void){
 }
 
 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);
 }
 
 /*****************************************************************************