]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
removed warnings and bugs
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Mon, 3 Jan 2011 19:52:10 +0000 (19:52 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Mon, 3 Jan 2011 19:52:10 +0000 (19:52 +0000)
34 files changed:
bcal/bcal-nessie.c
bcal/bcal_tdes2.c
cast5/cast5.c
cscipher/cscipher_small.c
dsa/dsa.h
dsa/dsa_sign.c
jh/jh_simple_small_core.c
jh/jh_simple_speed_core.c
mkfiles/bigint.mk
mkfiles/dsa.mk
mkfiles/mqq160-sign_c.mk
mkfiles/rsa.mk
mqq-sign/mqq160-sign_P.c
test_src/main-aes-test.c
test_src/main-aes128-test.c
test_src/main-aes192-test.c
test_src/main-aes256-test.c
test_src/main-bigint-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-keccak-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-rsa-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 9bc68b8d41eecee003bc904d71264b8de6478231..387a7d7c7feba18598c51aed55363f6d4eb8b6ac 100644 (file)
@@ -58,7 +58,7 @@ void bcal_nessie(const bcdesc_t* bcd){
 
        uint16_t *keysize_list=NULL;
        uint16_t items,i;
-       items = get_keysizes(pgm_read_word(&(bcd->valid_keysize_desc)), &keysize_list);
+       items = get_keysizes((PGM_VOID_P)pgm_read_word(&(bcd->valid_keysize_desc)), &keysize_list);
        if(items){
                for(i=0; i<items; ++i){
                        nessie_bc_ctx.keysize_b   = keysize_list[i];
index d7633665a0c8bc9ba4ff2356a66c9992a0d60feb..a39bafab2f7f24ba1aaf660969294b36ee6624f3 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <avr/pgmspace.h>
 #include <stdlib.h>
+#include <string.h>
 #include "blockcipher_descriptor.h"
 #include "des.h"
 #include "keysize_descriptor.h"
index 6d7f42fff5b3d323cb7950e2ca1af65154baf077..5e318cffc4d49f5348590cc513e7306137362562 100644 (file)
@@ -30,8 +30,6 @@
  #include <stdint.h>
  #include <string.h>
  #include "cast5.h"
- #include "config.h"
- #include "debug.h"
  
  #undef DEBUG
  
index 9e8b297f7598154b7fc778806699b34e20a4dceb..220bcc9247fca9b62f2849b3fa4d79ed9977b722 100644 (file)
@@ -148,7 +148,7 @@ void cscipher_dec(void* buffer, const cscipher_ctx_t* ctx){
 
 void cscipher_init(const void* key, cscipher_ctx_t* ctx){
        uint8_t tmp_key[16], tmp[8];
-       uint8_t i,j,k,t;
+       uint8_t i,j,k,t=0;
        memcpy(tmp_key, key, 16);
        for(i=0; i<9; ++i){
 #if DEBUG
index 6a894f6c8e0d487b164c6d7efb208efa1e971b5b..0eabffe30950d066d7b6700dbc043fed9996528f 100644 (file)
--- a/dsa/dsa.h
+++ b/dsa/dsa.h
@@ -43,6 +43,8 @@ typedef struct{
        dsa_domainparameters_t domain;
 } dsa_ctx_t;
 
+typedef uint8_t(*rand_func_ptr_t)(void);
+
 #define DSA_SIGNATURE_OK 1
 #define DSA_SIGNATURE_FAIL 0
 
@@ -50,7 +52,7 @@ uint8_t dsa_sign_bigint(dsa_signature_t* s, const bigint_t* m,
                                const dsa_ctx_t* ctx, const bigint_t* k);
 uint8_t dsa_sign_message(dsa_signature_t* s, const void* m, uint16_t m_len_b,
                                const hfdesc_t* hash_desc, const dsa_ctx_t* ctx,
-                               const uint8_t(*rand_in)(void));
+                               const rand_func_ptr_t rand_in);
 uint8_t dsa_verify_bigint(const dsa_signature_t* s, const bigint_t* m,
                                  const dsa_ctx_t* ctx);
 uint8_t dsa_verify_message(const dsa_signature_t* s, const void* m, uint16_t m_len_b,
index e9def2bd9c83136e30ebb17bd347a464311ccfd7..fab21976ed4b98038f3d4085940206e778905f4c 100644 (file)
@@ -49,7 +49,7 @@ uint8_t dsa_sign_bigint(dsa_signature_t* s, const bigint_t* m,
 
 uint8_t dsa_sign_message(dsa_signature_t* s, const void* m, uint16_t m_len_b,
                                const hfdesc_t* hash_desc, const dsa_ctx_t* ctx,
-                               const uint8_t(*rand_in)(void)){
+                               const rand_func_ptr_t rand_in){
        bigint_t z, k;
        uint8_t i, n_B = ctx->domain.q.length_B;
        uint8_t hash_value[(n_B>(hfal_hash_getHashsize(hash_desc)+7)/8)?n_B:(hfal_hash_getHashsize(hash_desc)+7)/8];
index 7d457f4dad225580fabc49d538039cb851c7f6f9..15d8571d984e549c32ec6c0753e6489d1161bd65 100644 (file)
@@ -109,7 +109,7 @@ static const uint8_t idx[]={112,80,48,16,96,64,32,0};
 static inline
 void group(uint8_t *a){
        uint8_t b[128];
-       uint8_t i,j,k,x;
+       uint8_t i,j,k,x=0;
        for(i=0; i<128; ++i){
                j=i/8;
                for(k=0;k<8;++k){
@@ -154,7 +154,7 @@ void jh_encrypt(uint8_t* a){
                jh_round(a, rc);
                jh_next_round_const(rc);
        }
-       uint8_t r,x,y;
+       uint8_t r=0,x,y;
 
        for(i=0; i<128; ++i){
                if(i%4==0){
index 6ff0072af7333d12ea246fc30d8d3ac18df77da8..47a2938201db3d099ddfca31c420fde43be1bf60 100644 (file)
@@ -122,7 +122,7 @@ void jh_encrypt(uint8_t* a){
        for(i=0;i<35;++i){
                jh_round(a, i);
        }
-       uint8_t r;
+       uint8_t r=0;
        uint8_t *pr;
 
        pr = jh_round_const + 32*35;
index 076e77d271aae4965868bd6259b51a4d4196a3f5..ede274b59bd2902bc5f72401fb27b986c0745eb0 100644 (file)
@@ -2,7 +2,7 @@
 ALGO_NAME := BIGINT
 
 # comment out the following line for removement of BigInt from the build process
-AUX += $(ALGO_NAME)
+#AUX += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := bigint/
 $(ALGO_NAME)_INCDIR   := memxor/ noekeon/
index a689860cb854932b20c55ac95686e0c426b1aa17..e4565107102419d0dbd19ae4aa2e1a7f4c2d105b 100644 (file)
@@ -6,7 +6,7 @@ SIGNATURE += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := dsa/
 $(ALGO_NAME)_INCDIR   := memxor/ bigint/ sha1/ noekeon/ base64/ hfal/
-$(ALGO_NAME)_OBJ      := bigint.o bigint_io.o bigint_add_u.o sha1-asm.o dsa_sign.o dsa_verify.o dsa_key_blob.o base64_enc.o
+$(ALGO_NAME)_OBJ      := bigint.o bigint_io.o sha1-asm.o dsa_sign.o dsa_verify.o dsa_key_blob.o base64_enc.o
 $(ALGO_NAME)_TEST_BIN := main-dsa-test.o $(CLI_STD) hfal_sha1.o $(HFAL_STD) \
                          noekeon_asm.o noekeon_prng.o memxor.o 
                         
index 23b4acde5fd66449ff8cb9f858458d7686a58c10..e18758944898dd466d0dd25760bdae50b73e181f 100644 (file)
@@ -6,7 +6,7 @@ SIGNATURE += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := mqq-sign/
 $(ALGO_NAME)_INCDIR   := memxor/ 
-$(ALGO_NAME)_OBJ      := mqq160-sign.o mqq160-sign_P.o mqq160-sign_testkey.o memxor.o
+$(ALGO_NAME)_OBJ      := mqq160-sign.o mqq160-sign_P.o mqq160-sign_testkey.o memxor.o memxor_p.o
 $(ALGO_NAME)_TEST_BIN := main-mqq160-sign-test.o performance_test.o stack_measuring.o $(CLI_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test 
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index aa134598b6daed3512e556e436e40db5727b60bc..2bfc57b3ae2e9fc08236083e0df75e545b82174d 100644 (file)
@@ -6,7 +6,7 @@ PK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := rsa/
 $(ALGO_NAME)_INCDIR   := bigint/ noekeon/ memxor/ hfal/
-$(ALGO_NAME)_OBJ      := bigint.o bigint_io.o bigint_add_u.o rsa.o rsa_key_blob.o
+$(ALGO_NAME)_OBJ      := bigint.o bigint_io.o rsa.o rsa_key_blob.o
 $(ALGO_NAME)_TEST_BIN := main-rsa-test.o $(CLI_STD)  \
                          noekeon_asm.o noekeon_prng.o memxor.o 
                         
index 82c90eab0f403ae121b40aa3857df584e4b29353..67f372295c8131ad8bfc642964263e3faeacb055 100644 (file)
@@ -41,14 +41,6 @@ static uint8_t mod20_table[32] PROGMEM = {
                 8,  9, 10, 11, 12, 13, 14, 15,
 };
 
-static void memxor_P(void* dest, const void* src, uint16_t length){
-       while(length--){
-               *((uint8_t*)dest) ^= pgm_read_byte(src);
-               dest = (uint8_t*)dest +1;
-               src  = (uint8_t*)src  +1;
-       }
-}
-
 static void memxor_idx_P(uint8_t* dest, const uint8_t* src, uint16_t length, uint8_t dist){
        while(length--){
                 *((uint8_t*)dest) ^= pgm_read_byte((uint8_t*)src);
index 8c41dd24491f28110a6ae4bc6a331ef84c63c7b9..934d6df5090e1ecf6dec0cbfb4b24bfaee698af2 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "aes.h"
 
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "dump.h"
@@ -45,6 +44,7 @@
 #include "bcal-eax.h"
 #include "cmacvs.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 
 #include <stdint.h>
 #include <string.h>
@@ -65,26 +65,7 @@ const bcdesc_t* algolist[] PROGMEM = {
  *****************************************************************************/
 
 void testrun_nessie_aes(void){
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(aes128_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes128_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes128_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)aes_init;
-       nessie_bc_run();
-
-       nessie_bc_ctx.keysize_b   = 192;
-       nessie_bc_ctx.ctx_size_B  = sizeof(aes192_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes192_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes192_dec;
-       nessie_bc_run();
-
-       nessie_bc_ctx.keysize_b   = 256;
-       nessie_bc_ctx.ctx_size_B  = sizeof(aes256_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes256_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes256_dec;
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_test_aes(void){
index 1410d92749efca0f4d0681fab0ddec11fd1f6adc..2c8e7f379e54c2ff3615fd3b706ba61eaf0f2acf 100644 (file)
 #include "debug.h"
 
 #include "aes.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "blockcipher_descriptor.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_aes128.h"
 #include <stdint.h>
 #include <string.h>
@@ -51,14 +51,7 @@ const bcdesc_t* algolist[] PROGMEM = {
  *****************************************************************************/
 
 void testrun_nessie_aes(void){
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(aes128_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes128_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes128_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)aes_init;
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_test_aes(void){
index ea92c11b035a54ec7b7c8be0885b277c58153dd0..3d50e7d9998461f31c97c3244e1e95727d5e53a1 100644 (file)
 #include "debug.h"
 
 #include "aes.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "blockcipher_descriptor.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_aes192.h"
 #include <stdint.h>
 #include <string.h>
@@ -50,14 +50,7 @@ const bcdesc_t* algolist[] PROGMEM = {
  *****************************************************************************/
 
 void testrun_nessie_aes(void){
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 192;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(aes192_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes192_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes192_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)aes_init;
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_testkey_aes192(void){
index 039a6d284f02391d0a0131d522a67be28734aec9..60258938b4112bb3aebb54cbdddfe701c3ed74ef 100644 (file)
 #include "debug.h"
 
 #include "aes.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "blockcipher_descriptor.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_aes256.h"
 #include <stdint.h>
 #include <string.h>
@@ -49,14 +49,7 @@ const bcdesc_t* algolist[] PROGMEM = {
  *****************************************************************************/
 
 void testrun_nessie_aes(void){
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 256;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(aes256_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)aes256_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)aes256_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)aes_init;
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_testkey_aes256(void){
index a1e853a794ba84b8ba8105ede68d77c030424a57..608c91afe7b4a857685695568a2c3527ee828acd 100644 (file)
@@ -130,7 +130,7 @@ void test_add_scale_bigint(void){
                cli_putstr_P(PSTR(" + "));
                bigint_print_hex(&b);
                cli_putstr_P(PSTR("<<8*"));
-               bigint_print_hex(&scale);
+               cli_hexdump_rev(&scale, 2);
                cli_putstr_P(PSTR(" = "));
                uint8_t *c_b;
                c_b = malloc(((a.length_B>(b.length_B+scale))?a.length_B:(b.length_B+scale))+2);
index fb9f88170389a1f641859bca702b52d35e405a9c..b3d901d37392426293b6bca4551c33ae7cf285ec 100644 (file)
 #include "debug.h"
 
 #include "camellia.h"
-#include "nessie_bc_test.h"
 #include "performance_test.h"
 #include "cli.h"
 #include "bcal_camellia128.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
@@ -47,20 +47,9 @@ const bcdesc_t* algolist[] PROGMEM = {
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
-void camellia128_init_dummy(void* key, uint16_t keysize_b, void* ctx){
-       camellia128_init(key, ctx);
-}
 
 void testrun_nessie_camellia(void){
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(camellia128_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)camellia128_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)camellia128_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)camellia128_init_dummy;
-       
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 /*
index 3db72a7445a24c73c5edd367608fb49b5b37cf1a..26e8274de6326d6312d02561d35b8a8b56fcf1e8 100644 (file)
@@ -27,9 +27,9 @@
 #include "debug.h"
 
 #include <cast5.h>
-#include "nessie_bc_test.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_cast5.h"
 #include "cli.h"
 
@@ -49,15 +49,7 @@ const bcdesc_t* algolist[] PROGMEM = {
  *****************************************************************************/
 
 void testrun_nessie_cast5(void){
-       nessie_bc_ctx.blocksize_B =   8;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(cast5_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)cast5_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)cast5_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)cast5_init;
-       
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 /*****************************************************************************
index c295b699aefb93e4bb9f49b584aaa6b9c681ce0d..78d5b6343df16b109e6ce715fe04f743fd718608 100644 (file)
@@ -9,10 +9,10 @@
 #include "debug.h"
 
 #include "cast6.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_cast6.h"
 
 #include <stdint.h>
@@ -33,22 +33,7 @@ const bcdesc_t* algolist[] PROGMEM = {
 
 
 void testrun_nessie_cast6(void){
-       nessie_bc_init();
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(cast6_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)cast6_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)cast6_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)cast6_init;
-       
-       nessie_bc_run();
-       
-       nessie_bc_ctx.keysize_b   = 192;
-       nessie_bc_run();
-       
-       nessie_bc_ctx.keysize_b   = 256;
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_rfc_cast6(void){
index 63d5f00c892fc8ec34d1862d710b6f70c63a28cc..828593fa82b996758e0a0f3517a684039ac29775 100644 (file)
@@ -27,7 +27,6 @@
 #include "debug.h"
 
 #include "des.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
index 80ed373bbafd5b6dce977a06c85d3e9c5645a803..c277ce5c0a7fe8619c230e13f08542aa1fbf9b0f 100644 (file)
@@ -54,7 +54,6 @@ const hfdesc_t* algolist[] PROGMEM = {
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
 void test_256(void){
-       uint8_t data[] = {0x53, 0x58, 0x7B,  0xC8 };
        uint8_t hash[32];
        uint8_t null[KECCAK256_BLOCKSIZE_B];
        memset(null, 0, KECCAK256_BLOCKSIZE_B);
index ad60d7acc24116a5103aa00cb8a02f5b605e3d43..f33f5c18f0811a69f43ef5d6d65a4cf0b9b6c3a2 100644 (file)
@@ -27,7 +27,6 @@
 #include "debug.h"
 
 #include "noekeon.h"
-#include "nessie_bc_test.h"
 #include "bcal-nessie.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
@@ -50,7 +49,7 @@ const bcdesc_t* algolist[] PROGMEM = {
  *****************************************************************************/
 
 void testrun_nessie_noekeon(void){
-       bcal_nessie_multiple(&algolist);
+       bcal_nessie_multiple(algolist);
 }
 
 
index 96b0ff71117a1a6e5e21fc2ccc89db327af4e88c..b4e5b4967ca6b88f1fc303fdb07c858d0e5868c3 100644 (file)
 #include "debug.h"
 
 #include <present.h>
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_present.h"
 
 #include <stdlib.h>
@@ -51,15 +51,7 @@ void present_genctx_dummy(uint8_t* key, uint16_t keysize_b, present_ctx_t* ctx){
 }
 
 void testrun_nessie_present(void){
-       nessie_bc_ctx.blocksize_B =   8;
-       nessie_bc_ctx.keysize_b   =  80;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(present_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)present_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)present_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)present_genctx_dummy;
-       
-       nessie_bc_run();        
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_selfenc(uint8_t* key, uint8_t* buffer){
index 95a3e06f2786ccb4ce76b011e957fb88fcb3fbac..2b21e16ab6ab50117f658078b4fe44191a20b3e3 100644 (file)
 #include "debug.h"
 
 #include "rc5.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_rc5.h"
 
 #include <stdint.h>
@@ -53,17 +53,7 @@ void rc5_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){
 }
 
 void testrun_nessie_rc5(void){
-       nessie_bc_init();
-       nessie_bc_ctx.blocksize_B =   8;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(rc5_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)rc5_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)rc5_dec;
-       nessie_bc_ctx.cipher_free = (nessie_bc_free_fpt)rc5_free;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)rc5_genctx_dummy;
-       
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 
index 67513adbabdd9c0e8a6caee8ab2085fe2dc3e84b..e264d79001fc5afd02f522bf7ea0fb1b32937dd8 100644 (file)
 #include "debug.h"
 
 #include "rc6.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_rc6.h"
 
 #include <stdint.h>
@@ -52,24 +52,7 @@ void rc6_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){
 }
 
 void testrun_nessie_rc6(void){
-       nessie_bc_init();
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(rc6_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)rc6_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)rc6_dec;
-       nessie_bc_ctx.cipher_free = (nessie_bc_free_fpt)rc6_free;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)rc6_init;
-       
-       nessie_bc_run();
-       
-       nessie_bc_ctx.keysize_b   = 192;
-       nessie_bc_run();
-       
-       nessie_bc_ctx.keysize_b   = 256;
-       nessie_bc_run();
-       
+       bcal_nessie_multiple(algolist);
 }
 
 
index 3de5bac0039c7d9913a2f67324e0546e3b9cb470..86fb62c765083a720d44328347932237b7486155 100644 (file)
@@ -103,7 +103,6 @@ void quick_test(void){
 
        bigint_t m,c,m_;
        uint8_t mw[rsa_ctx.modulus.length_B], cw[rsa_ctx.modulus.length_B], m_w[rsa_ctx.modulus.length_B];
-       uint8_t i;
 
        print_rsa_ctx(&rsa_ctx);
        m.wordv = mw;
index 9ff4b3ff220e593123b839836634b13dfbaccec2..39fe0a0edb6cd673823ba726ec52c9ac1c2fe127 100644 (file)
 #include "debug.h"
 
 #include "seed.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_seed.h"
 
 #include <stdint.h>
@@ -56,16 +56,7 @@ void seed_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
 }
 
 void testrun_nessie_seed(void){
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(seed_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)seed_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)seed_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)seed_genctx_dummy;
-       
-       nessie_bc_run();
-       
+       bcal_nessie_multiple(algolist);
 }
 
 
index 51575b9f6d5cda26c0ab396dcca35ef95cc271b2..85610f9645960d0c353a9103f4c66b747b2b5f51 100644 (file)
 #include "debug.h"
 
 #include "serpent.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_serpent.h"
 
 #include <stdint.h>
@@ -52,21 +52,7 @@ void serpent_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
 }
 
 void testrun_nessie_serpent(void){
-       nessie_bc_ctx.blocksize_B =  16;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(serpent_ctx_t);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)serpent_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)serpent_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)serpent_genctx_dummy;
-       
-       nessie_bc_run();
-       
-       nessie_bc_ctx.keysize_b   = 192;
-       nessie_bc_run();
-       
-       nessie_bc_ctx.keysize_b   = 256;
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_test_serpent(void){
index 3f1c75fd308b420fd8e31532c7be6ed39be695b4..7c3dd9de198d6026ca5646373d25b8c8dd407742 100644 (file)
@@ -31,6 +31,7 @@
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_skipjack.h"
 
 #include <stdint.h>
@@ -52,15 +53,7 @@ void skipjack_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
 }
 
 void testrun_nessie_skipjack(void){
-       nessie_bc_ctx.blocksize_B =   8;
-       nessie_bc_ctx.keysize_b   =  80;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = 10;
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)skipjack_enc;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)skipjack_dec;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)skipjack_genctx_dummy;
-       
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 
index 7adc19e0686179bdd484754e758271b626ab863c..7cad365ade8ea0a99b1f8de799234a12c048fe50 100644 (file)
 #include "debug.h"
 
 #include "des.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_tdes.h"
 #include "bcal_tdes2.h"
 
@@ -49,29 +49,8 @@ const bcdesc_t* algolist[] PROGMEM = {
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
-void tdes_init_dummy(const void* key, uint16_t keysize_b, void* ctx){
-       memcpy(ctx, key, 8*3);
-}
-
-void tdes_enc_dummy(void* buffer, void* ctx){
-       tdes_enc(buffer, buffer, ctx);
-} 
-
-void tdes_dec_dummy(void* buffer, void* ctx){
-       tdes_dec(buffer, buffer, ctx);
-} 
-
 void testrun_nessie_tdes(void){
-       nessie_bc_init();
-       nessie_bc_ctx.blocksize_B =   8;
-       nessie_bc_ctx.keysize_b   = 192;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = sizeof(8*3);
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)tdes_enc_dummy;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)tdes_dec_dummy;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)tdes_init_dummy;
-
-       nessie_bc_run();
+       bcal_nessie_multiple(algolist);
 }
 
 
index 31748e45d78e47993e471c21ff8b517154cf04f1..799d40f7286c97cac12b9f523e8b2d3381988251 100644 (file)
 #include "debug.h"
 
 #include "threefish.h"
-#include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_threefish256.h"
 #include "bcal_threefish512.h"
 #include "bcal_threefish1024.h"
@@ -65,61 +65,8 @@ void threefish256_dump(threefish256_ctx_t* ctx){
        }
 }
 
-void threefish256_dummy_init(const uint8_t* key, uint16_t keysize_b, void* ctx){
-       threefish256_init(key, NULL, ctx);
-}
-
-void testrun_nessie_threefish256(void){
-       nessie_bc_ctx.keysize_b = 256;
-       nessie_bc_ctx.blocksize_B = 32;
-       nessie_bc_ctx.ctx_size_B = sizeof(threefish256_ctx_t);
-       nessie_bc_ctx.name = "Threefish256";
-       nessie_bc_ctx.cipher_genctx = threefish256_dummy_init;
-       nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)threefish256_enc;
-       nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)threefish256_dec;
-       nessie_bc_ctx.cipher_free = NULL;
-       
-       nessie_bc_run();
-}
-
-void threefish512_dummy_init(const uint8_t* key, uint16_t keysize_b, void* ctx){
-       threefish512_init(key, NULL, ctx);
-}
-
-void testrun_nessie_threefish512(void){
-       nessie_bc_ctx.keysize_b = 512;
-       nessie_bc_ctx.blocksize_B = 64;
-       nessie_bc_ctx.ctx_size_B = sizeof(threefish512_ctx_t);
-       nessie_bc_ctx.name = "Threefish512";
-       nessie_bc_ctx.cipher_genctx = threefish512_dummy_init;
-       nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)threefish512_enc;
-       nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)threefish512_dec;
-       nessie_bc_ctx.cipher_free = NULL;
-       
-       nessie_bc_run();
-}
-
-void threefish1024_dummy_init(const uint8_t* key, uint16_t keysize_b, void* ctx){
-       threefish1024_init(key, NULL, ctx);
-}
-
-void testrun_nessie_threefish1024(void){
-       nessie_bc_ctx.keysize_b = 1024;
-       nessie_bc_ctx.blocksize_B = 128;
-       nessie_bc_ctx.ctx_size_B = sizeof(threefish1024_ctx_t);
-       nessie_bc_ctx.name = "Threefish1024";
-       nessie_bc_ctx.cipher_genctx = threefish1024_dummy_init;
-       nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)threefish1024_enc;
-       nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)threefish1024_dec;
-       nessie_bc_ctx.cipher_free = NULL;
-       
-       nessie_bc_run();
-}
-
 void testrun_nessie_threefish(void){
-       testrun_nessie_threefish256();
-       testrun_nessie_threefish512();
-       testrun_nessie_threefish1024();
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_stdtest_threefish256(void){
index c40046f0cdd9cf518c936eefca9ad7183ed542ac..99a8eb72b627cd808b1e7d72672df9dd7d56939e 100644 (file)
@@ -30,6 +30,7 @@
 #include "nessie_bc_test.h"
 #include "performance_test.h"
 #include "bcal-performance.h"
+#include "bcal-nessie.h"
 #include "bcal_xtea.h"
 #include "cli.h"
 
@@ -45,28 +46,8 @@ const bcdesc_t* algolist[] PROGMEM = {
 
 /******************************************************************************/
 
-void xtea_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){
-       memcpy(ctx, key, (keysize+7)/8);
-}
-
-void xtea_enc_dummy(uint8_t* buffer, void* ctx){
-       xtea_enc((uint32_t*)buffer, (uint32_t*)buffer, ctx);
-}
-
-void xtea_dec_dummy(uint8_t* buffer, void* ctx){
-       xtea_dec((uint32_t*)buffer, (uint32_t*)buffer, ctx);
-}
-
 void testrun_nessie_xtea(void){
-       nessie_bc_ctx.blocksize_B =   8;
-       nessie_bc_ctx.keysize_b   = 128;
-       nessie_bc_ctx.name        = algo_name;
-       nessie_bc_ctx.ctx_size_B  = 128/8;
-       nessie_bc_ctx.cipher_enc  = (nessie_bc_enc_fpt)xtea_enc_dummy;
-       nessie_bc_ctx.cipher_dec  = (nessie_bc_dec_fpt)xtea_dec_dummy;
-       nessie_bc_ctx.cipher_genctx  = (nessie_bc_gen_fpt)xtea_genctx_dummy;
-       
-       nessie_bc_run();        
+       bcal_nessie_multiple(algolist);
 }
 
 void testrun_performance_xtea(void){