From: bg Date: Mon, 3 Jan 2011 19:52:10 +0000 (+0000) Subject: removed warnings and bugs X-Git-Url: https://git.cryptolib.org/?a=commitdiff_plain;h=d1181933dc28db92d787cf5604e2fc96ab0d8f9f;p=avr-crypto-lib.git removed warnings and bugs --- diff --git a/bcal/bcal-nessie.c b/bcal/bcal-nessie.c index 9bc68b8..387a7d7 100644 --- a/bcal/bcal-nessie.c +++ b/bcal/bcal-nessie.c @@ -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 #include +#include #include "blockcipher_descriptor.h" #include "des.h" #include "keysize_descriptor.h" diff --git a/cast5/cast5.c b/cast5/cast5.c index 6d7f42f..5e318cf 100644 --- a/cast5/cast5.c +++ b/cast5/cast5.c @@ -30,8 +30,6 @@ #include #include #include "cast5.h" - #include "config.h" - #include "debug.h" #undef DEBUG diff --git a/cscipher/cscipher_small.c b/cscipher/cscipher_small.c index 9e8b297..220bcc9 100644 --- a/cscipher/cscipher_small.c +++ b/cscipher/cscipher_small.c @@ -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 diff --git a/dsa/dsa.h b/dsa/dsa.h index 6a894f6..0eabffe 100644 --- 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, diff --git a/dsa/dsa_sign.c b/dsa/dsa_sign.c index e9def2b..fab2197 100644 --- a/dsa/dsa_sign.c +++ b/dsa/dsa_sign.c @@ -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]; diff --git a/jh/jh_simple_small_core.c b/jh/jh_simple_small_core.c index 7d457f4..15d8571 100644 --- a/jh/jh_simple_small_core.c +++ b/jh/jh_simple_small_core.c @@ -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){ diff --git a/jh/jh_simple_speed_core.c b/jh/jh_simple_speed_core.c index 6ff0072..47a2938 100644 --- a/jh/jh_simple_speed_core.c +++ b/jh/jh_simple_speed_core.c @@ -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; diff --git a/mkfiles/bigint.mk b/mkfiles/bigint.mk index 076e77d..ede274b 100644 --- a/mkfiles/bigint.mk +++ b/mkfiles/bigint.mk @@ -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/ diff --git a/mkfiles/dsa.mk b/mkfiles/dsa.mk index a689860..e456510 100644 --- a/mkfiles/dsa.mk +++ b/mkfiles/dsa.mk @@ -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 diff --git a/mkfiles/mqq160-sign_c.mk b/mkfiles/mqq160-sign_c.mk index 23b4acd..e187589 100644 --- a/mkfiles/mqq160-sign_c.mk +++ b/mkfiles/mqq160-sign_c.mk @@ -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 diff --git a/mkfiles/rsa.mk b/mkfiles/rsa.mk index aa13459..2bfc57b 100644 --- a/mkfiles/rsa.mk +++ b/mkfiles/rsa.mk @@ -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 diff --git a/mqq-sign/mqq160-sign_P.c b/mqq-sign/mqq160-sign_P.c index 82c90ea..67f3722 100644 --- a/mqq-sign/mqq160-sign_P.c +++ b/mqq-sign/mqq160-sign_P.c @@ -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); diff --git a/test_src/main-aes-test.c b/test_src/main-aes-test.c index 8c41dd2..934d6df 100644 --- a/test_src/main-aes-test.c +++ b/test_src/main-aes-test.c @@ -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 #include @@ -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){ diff --git a/test_src/main-aes128-test.c b/test_src/main-aes128-test.c index 1410d92..2c8e7f3 100644 --- a/test_src/main-aes128-test.c +++ b/test_src/main-aes128-test.c @@ -27,11 +27,11 @@ #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 #include @@ -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){ diff --git a/test_src/main-aes192-test.c b/test_src/main-aes192-test.c index ea92c11..3d50e7d 100644 --- a/test_src/main-aes192-test.c +++ b/test_src/main-aes192-test.c @@ -27,11 +27,11 @@ #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 #include @@ -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){ diff --git a/test_src/main-aes256-test.c b/test_src/main-aes256-test.c index 039a6d2..6025893 100644 --- a/test_src/main-aes256-test.c +++ b/test_src/main-aes256-test.c @@ -27,11 +27,11 @@ #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 #include @@ -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){ diff --git a/test_src/main-bigint-test.c b/test_src/main-bigint-test.c index a1e853a..608c91a 100644 --- a/test_src/main-bigint-test.c +++ b/test_src/main-bigint-test.c @@ -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); diff --git a/test_src/main-camellia-test.c b/test_src/main-camellia-test.c index fb9f881..b3d901d 100644 --- a/test_src/main-camellia-test.c +++ b/test_src/main-camellia-test.c @@ -27,11 +27,11 @@ #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 #include #include @@ -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); } /* diff --git a/test_src/main-cast5-test.c b/test_src/main-cast5-test.c index 3db72a7..26e8274 100644 --- a/test_src/main-cast5-test.c +++ b/test_src/main-cast5-test.c @@ -27,9 +27,9 @@ #include "debug.h" #include -#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); } /***************************************************************************** diff --git a/test_src/main-cast6-test.c b/test_src/main-cast6-test.c index c295b69..78d5b63 100644 --- a/test_src/main-cast6-test.c +++ b/test_src/main-cast6-test.c @@ -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 @@ -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){ diff --git a/test_src/main-des-test.c b/test_src/main-des-test.c index 63d5f00..828593f 100644 --- a/test_src/main-des-test.c +++ b/test_src/main-des-test.c @@ -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" diff --git a/test_src/main-keccak-test.c b/test_src/main-keccak-test.c index 80ed373..c277ce5 100644 --- a/test_src/main-keccak-test.c +++ b/test_src/main-keccak-test.c @@ -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); diff --git a/test_src/main-noekeon-test.c b/test_src/main-noekeon-test.c index ad60d7a..f33f5c1 100644 --- a/test_src/main-noekeon-test.c +++ b/test_src/main-noekeon-test.c @@ -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); } diff --git a/test_src/main-present-test.c b/test_src/main-present-test.c index 96b0ff7..b4e5b49 100644 --- a/test_src/main-present-test.c +++ b/test_src/main-present-test.c @@ -27,10 +27,10 @@ #include "debug.h" #include -#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 @@ -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){ diff --git a/test_src/main-rc5-test.c b/test_src/main-rc5-test.c index 95a3e06..2b21e16 100644 --- a/test_src/main-rc5-test.c +++ b/test_src/main-rc5-test.c @@ -27,10 +27,10 @@ #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 @@ -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); } diff --git a/test_src/main-rc6-test.c b/test_src/main-rc6-test.c index 67513ad..e264d79 100644 --- a/test_src/main-rc6-test.c +++ b/test_src/main-rc6-test.c @@ -27,10 +27,10 @@ #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 @@ -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); } diff --git a/test_src/main-rsa-test.c b/test_src/main-rsa-test.c index 3de5bac..86fb62c 100644 --- a/test_src/main-rsa-test.c +++ b/test_src/main-rsa-test.c @@ -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; diff --git a/test_src/main-seed-test.c b/test_src/main-seed-test.c index 9ff4b3f..39fe0a0 100644 --- a/test_src/main-seed-test.c +++ b/test_src/main-seed-test.c @@ -32,10 +32,10 @@ #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 @@ -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); } diff --git a/test_src/main-serpent-test.c b/test_src/main-serpent-test.c index 51575b9..85610f9 100644 --- a/test_src/main-serpent-test.c +++ b/test_src/main-serpent-test.c @@ -27,10 +27,10 @@ #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 @@ -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){ diff --git a/test_src/main-skipjack-test.c b/test_src/main-skipjack-test.c index 3f1c75f..7c3dd9d 100644 --- a/test_src/main-skipjack-test.c +++ b/test_src/main-skipjack-test.c @@ -31,6 +31,7 @@ #include "cli.h" #include "performance_test.h" #include "bcal-performance.h" +#include "bcal-nessie.h" #include "bcal_skipjack.h" #include @@ -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); } diff --git a/test_src/main-tdes-test.c b/test_src/main-tdes-test.c index 7adc19e..7cad365 100644 --- a/test_src/main-tdes-test.c +++ b/test_src/main-tdes-test.c @@ -27,10 +27,10 @@ #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); } diff --git a/test_src/main-threefish-test.c b/test_src/main-threefish-test.c index 31748e4..799d40f 100644 --- a/test_src/main-threefish-test.c +++ b/test_src/main-threefish-test.c @@ -27,10 +27,10 @@ #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){ diff --git a/test_src/main-xtea-test.c b/test_src/main-xtea-test.c index c40046f..99a8eb7 100644 --- a/test_src/main-xtea-test.c +++ b/test_src/main-xtea-test.c @@ -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){