From 3a9f9d918fb95474996af535c225a7e187d88372 Mon Sep 17 00:00:00 2001 From: bg Date: Sun, 17 Feb 2013 10:44:36 +0100 Subject: [PATCH] global style change (now * is attached to identifier not to type) --- a51/A5_1.c | 4 +-- a51/A5_1.h | 2 +- aes/aes128_dec.c | 2 +- aes/aes128_dec.h | 2 +- aes/aes128_enc.c | 2 +- aes/aes128_enc.h | 2 +- aes/aes192_dec.c | 2 +- aes/aes192_dec.h | 2 +- aes/aes192_enc.c | 2 +- aes/aes192_enc.h | 2 +- aes/aes256_dec.c | 2 +- aes/aes256_dec.h | 2 +- aes/aes256_enc.c | 2 +- aes/aes256_enc.h | 2 +- aes/aes_dec-asm.S | 2 +- aes/aes_dec-asm_faster.S | 2 +- aes/aes_dec.c | 10 +++--- aes/aes_dec.h | 2 +- aes/aes_enc-asm.S | 2 +- aes/aes_enc.c | 8 ++--- aes/aes_enc.h | 2 +- aes/aes_keyschedule-asm.S | 2 +- aes/aes_keyschedule.c | 10 +++--- aes/aes_keyschedule.h | 8 ++--- base64/base64_dec.c | 4 +-- base64/base64_dec.h | 4 +-- base64/base64_enc.c | 2 +- base64/base64_enc.h | 2 +- bcal/bcal-basic.c | 14 ++++---- bcal/bcal-basic.h | 14 ++++---- bcal/bcal-cbc.c | 16 ++++----- bcal/bcal-cbc.h | 16 ++++----- bcal/bcal-cfb_bit.c | 18 +++++----- bcal/bcal-cfb_bit.h | 14 ++++---- bcal/bcal-cfb_byte.c | 14 ++++---- bcal/bcal-cfb_byte.h | 14 ++++---- bcal/bcal-cmac.c | 14 ++++---- bcal/bcal-cmac.h | 12 +++---- bcal/bcal-ctr.c | 16 ++++----- bcal/bcal-ctr.h | 16 ++++----- bcal/bcal-eax.c | 20 +++++------ bcal/bcal-eax.h | 22 ++++++------ bcal/bcal-nessie.c | 10 +++--- bcal/bcal-nessie.h | 4 +-- bcal/bcal-ofb.c | 14 ++++---- bcal/bcal-ofb.h | 14 ++++---- bcal/bcal-performance.c | 8 ++--- bcal/bcal-performance.h | 4 +-- bcal/bcal_des.c | 4 +-- bcal/bcal_rc5.c | 2 +- bcal/bcal_tdes.c | 4 +-- bcal/bcal_tdes2.c | 6 ++-- bcal/bcal_threefish1024.c | 2 +- bcal/bcal_threefish256.c | 2 +- bcal/bcal_threefish512.c | 2 +- bcal/bcal_xtea.c | 4 +-- bigint/bigint-stub.c | 42 +++++++++++----------- bigint/bigint.c | 54 ++++++++++++++--------------- bigint/bigint.h | 50 +++++++++++++------------- bigint/bigint_adjust.S | 4 +-- bigint/bigint_asm.S | 2 +- bigint/bigint_io.c | 4 +-- bigint/bigint_io.h | 4 +-- blake/blake_large.c | 34 +++++++++--------- blake/blake_large.h | 24 ++++++------- blake/blake_small.c | 32 ++++++++--------- blake/blake_small.h | 24 ++++++------- blockcipher_descriptor.h | 2 +- bmw/bmw_224-tinyasm.S | 8 ++--- bmw/bmw_256-tinyasm.S | 8 ++--- bmw/bmw_large.c | 42 +++++++++++----------- bmw/bmw_large.h | 24 ++++++------- bmw/bmw_small-asm.S | 26 +++++++------- bmw/bmw_small-tinyasm.S | 12 +++---- bmw/bmw_small.c | 42 +++++++++++----------- bmw/bmw_small.h | 24 ++++++------- camellia/camellia-asm.S | 6 ++-- camellia/camellia.h | 6 ++-- camellia/camellia128-stub.c | 14 ++++---- camellia/camellia_C.c | 16 ++++----- cast5/cast5.c | 10 +++--- cast5/cast5.h | 18 +++++----- cast6/cast6.c | 20 +++++------ cast6/cast6.h | 6 ++-- cscipher/cscipher.h | 6 ++-- cscipher/cscipher_small.c | 6 ++-- cscipher/cscipher_tiny_asm.S | 4 +-- cubehash/cubehash.c | 26 +++++++------- cubehash/cubehash.h | 24 ++++++------- cubehash/xchg.h | 2 +- des/des.c | 10 +++--- des/des.h | 20 +++++------ dsa/dsa.h | 16 ++++----- dsa/dsa_key_blob.c | 2 +- dsa/dsa_key_blob.h | 2 +- dsa/dsa_sign.c | 8 ++--- dsa/dsa_verify.c | 8 ++--- ecdsa/ecc.h | 16 ++++----- ecdsa/ecc_chudnovsky.c | 16 ++++----- ecdsa/ecdsa.h | 16 ++++----- ecdsa/ecdsa_sign.c | 16 ++++----- ecdsa/ecdsa_sign.h | 16 ++++----- echo/aes_enc_round-asm.S | 2 +- echo/aes_enc_round.h | 2 +- echo/echo.c | 36 +++++++++---------- echo/echo.h | 28 +++++++-------- entropium/entropium.c | 4 +-- entropium/entropium.h | 12 +++---- grain/grain.c | 6 ++-- grain/grain.h | 6 ++-- groestl/groestl_large.c | 28 +++++++-------- groestl/groestl_large.h | 24 ++++++------- groestl/groestl_small.c | 28 +++++++-------- groestl/groestl_small.h | 24 ++++++------- hashfunction_descriptor.h | 2 +- hfal/hfal-basic.c | 26 +++++++------- hfal/hfal-basic.h | 18 +++++----- hfal/hfal-hmac.c | 20 +++++------ hfal/hfal-hmac.h | 18 +++++----- hfal/hfal-nessie.c | 6 ++-- hfal/hfal-nessie.h | 4 +-- hfal/hfal-performance.c | 8 ++--- hfal/hfal-performance.h | 4 +-- hfal/hfal-test.c | 2 +- hfal/hfal-test.h | 2 +- hfal/hfal_skein1024.c | 14 ++++---- hfal/hfal_skein256.c | 12 +++---- hfal/hfal_skein512.c | 14 ++++---- hmac-md5/hmac-md5.c | 10 +++--- hmac-md5/hmac-md5.h | 10 +++--- hmac-sha1/hmac-sha1.c | 10 +++--- hmac-sha1/hmac-sha1.h | 10 +++--- hmac-sha256/hmac-sha256.c | 10 +++--- hmac-sha256/hmac-sha256.h | 10 +++--- host/gf256_table_gen.c | 6 ++-- jh/jh_simple.h | 24 ++++++------- jh/jh_simple_aux.c | 24 ++++++------- jh/jh_simple_small_core.c | 6 ++-- jh/jh_simple_speed_core.c | 4 +-- keccak/keccak-asm.S | 10 +++--- keccak/keccak.c | 28 +++++++-------- keccak/keccak.h | 28 +++++++-------- khazad/khazad.c | 12 +++---- khazad/khazad.h | 6 ++-- md5/md5-asm.S | 8 ++--- md5/md5.c | 12 +++---- md5/md5.h | 8 ++--- memxor/memxor.S | 2 +- memxor/memxor.h | 4 +-- memxor/memxor_c.c | 2 +- memxor/memxor_p.S | 2 +- mgf1/mgf1.c | 4 +-- mgf1/mgf1.h | 4 +-- mickey128/mickey128.c | 18 +++++----- mickey128/mickey128.h | 10 +++--- mqq-sign/mqq160-sign-asm.S | 2 +- mqq-sign/mqq160-sign.c | 8 ++--- mqq-sign/mqq160-sign.h | 2 +- mqq-sign/mqq160-sign_P-asm.S | 2 +- mqq-sign/mqq160-sign_P-stub.c | 8 ++--- mqq-sign/mqq160-sign_P.c | 8 ++--- mqq-sign/mqq160-sign_P.h | 2 +- mqq-sign/mqq160-sign_testkey.c | 2 +- mqq-sign/mqq160-sign_testkey.h | 2 +- mugi/mugi.c | 14 ++++---- mugi/mugi.h | 4 +-- noekeon/noekeon.c | 20 +++++------ noekeon/noekeon.h | 12 +++---- noekeon/noekeon_asm.S | 4 +-- noekeon/noekeon_cbc_enc.S | 2 +- noekeon/noekeon_cbc_enc.h | 2 +- noekeon/noekeon_ctr.S | 2 +- noekeon/noekeon_ctr.h | 2 +- noekeon/noekeon_prng.c | 6 ++-- noekeon/noekeon_prng.h | 6 ++-- noekeon/omac_noekeon.S | 14 ++++---- noekeon/omac_noekeon.h | 16 ++++----- noekeon/omac_noekeon_C.c | 14 ++++---- present/present128.c | 14 ++++---- present/present128.h | 6 ++-- present/present80.c | 14 ++++---- present/present80.h | 6 ++-- present/present_common.c | 6 ++-- present/present_common.h | 6 ++-- present/present_speed.c | 8 ++--- present/present_speed.h | 6 ++-- rabbit/rabbit.h | 10 +++--- rabbit/rabbit_c.c | 22 ++++++------ rc5/rc5.c | 8 ++--- rc5/rc5.h | 8 ++--- rc6/rc6.c | 8 ++--- rc6/rc6.h | 8 ++--- rsa/rsa_basic.c | 10 +++--- rsa/rsa_basic.h | 10 +++--- rsa/rsaes_oaep.c | 22 ++++++------ rsa/rsaes_oaep.h | 26 +++++++------- rsa/rsaes_pkcs1v15.c | 10 +++--- rsa/rsaes_pkcs1v15.h | 10 +++--- salsa20/salsa20.c | 22 ++++++------ salsa20/salsa20.h | 16 ++++----- scal/scal-basic.c | 20 +++++------ scal/scal-basic.h | 20 +++++------ scal/scal-nessie.c | 6 ++-- scal/scal-nessie.h | 2 +- seed/seed-asm.S | 2 +- seed/seed_C.c | 2 +- serpent/serpent-asm.S | 6 ++-- serpent/serpent-sboxes-bitslice.c | 32 ++++++++--------- serpent/serpent-sboxes_c.c | 2 +- serpent/serpent.c | 6 ++-- serpent/serpent.h | 6 ++-- sha1/sha1.c | 6 ++-- sha1/sha1.h | 12 +++---- sha2/sha224.c | 8 ++--- sha2/sha224.h | 16 ++++----- sha2/sha256.c | 8 ++--- sha2/sha256.h | 16 ++++----- sha2/sha2_large_common.c | 4 +-- sha2/sha2_large_common.h | 4 +-- sha2/sha2_small_common.c | 4 +-- sha2/sha2_small_common.h | 4 +-- sha2/sha384.c | 10 +++--- sha2/sha384.h | 8 ++--- sha2/sha512.c | 10 +++--- sha2/sha512.h | 8 ++--- sha256/sha256.c | 6 ++-- sha256/sha256.h | 18 +++++----- shabal/shabal-asm.S | 10 +++--- shabal/shabal.c | 12 +++---- shabal/shabal.h | 36 +++++++++---------- shabal/shabal192-asm.S | 4 +-- shabal/shabal192.c | 6 ++-- shabal/shabal224.c | 6 ++-- shabal/shabal256.c | 6 ++-- shabal/shabal384.c | 6 ++-- shabal/shabal512.c | 6 ++-- shacal1/shacal1_enc.c | 2 +- shacal1/shacal1_enc.h | 2 +- shacal2/shacal2_enc.c | 2 +- shacal2/shacal2_enc.h | 2 +- skein/skein.h | 30 ++++++++-------- skein/skein1024.c | 10 +++--- skein/skein1024_asm.S | 6 ++-- skein/skein256.c | 10 +++--- skein/skein256_asm.S | 6 ++-- skein/skein512.c | 10 +++--- skein/skein512_asm.S | 6 ++-- skein/threefish.h | 22 ++++++------ skein/threefish1024_dec.c | 6 ++-- skein/threefish1024_dec_asm.S | 6 ++-- skein/threefish1024_dec_cstub.c | 6 ++-- skein/threefish1024_enc.c | 8 ++--- skein/threefish1024_enc_asm.S | 8 ++--- skein/threefish256_dec.c | 6 ++-- skein/threefish256_dec_asm.S | 6 ++-- skein/threefish256_dec_cstub.c | 6 ++-- skein/threefish256_enc.c | 8 ++--- skein/threefish256_enc_asm.S | 8 ++--- skein/threefish256_enc_small.S | 8 ++--- skein/threefish512_dec.c | 6 ++-- skein/threefish512_dec_asm.S | 6 ++-- skein/threefish512_dec_cstub.c | 6 ++-- skein/threefish512_enc.c | 10 +++--- skein/threefish512_enc_asm.S | 8 ++--- skein/threefish_invmix.S | 2 +- skein/threefish_invmix_4c.S | 2 +- skein/threefish_invmix_c.c | 2 +- skein/threefish_mix.S | 2 +- skein/threefish_mix_4c.S | 2 +- skein/threefish_mix_c.c | 2 +- skein/ubi.h | 28 +++++++-------- skein/ubi1024.c | 8 ++--- skein/ubi1024_asm.S | 8 ++--- skein/ubi256.c | 8 ++--- skein/ubi256_asm.S | 8 ++--- skein/ubi512.c | 8 ++--- skein/ubi512_asm.S | 8 ++--- skipjack/skipjack.c | 12 +++---- skipjack/skipjack.h | 8 ++--- skipjack/skipjack_nofix.c | 16 ++++----- stack_measuring.h | 4 +-- streamcipher_descriptor.h | 2 +- string-extras.h | 12 +++---- test_src/circularbytebuffer-asm.S | 24 ++++++------- test_src/circularbytebuffer.h | 24 ++++++------- test_src/cli-core.S | 6 ++-- test_src/cli-hexdump.S | 2 +- test_src/cli-stub.c | 12 +++---- test_src/cli.h | 18 +++++----- test_src/cmacvs.c | 14 ++++---- test_src/cmacvs.h | 2 +- test_src/dbz_strings.c | 6 ++-- test_src/dbz_strings.h | 12 +++---- test_src/debug.c | 2 +- test_src/dump-asm.S | 10 +++--- test_src/dump-decl.c | 8 ++--- test_src/dump.h | 2 +- test_src/main-a5_1-test.c | 4 +-- test_src/main-aes-test.c | 4 +-- test_src/main-arcfour-test.c | 4 +-- test_src/main-base64-test.c | 2 +- test_src/main-bigint-test.c | 2 +- test_src/main-blake-test.c | 12 +++---- test_src/main-bmw-test.c | 22 ++++++------ test_src/main-camellia-test.c | 6 ++-- test_src/main-cast5-test.c | 4 +-- test_src/main-cast6-test.c | 4 +-- test_src/main-cscipher-test.c | 6 ++-- test_src/main-cubehash-test.c | 4 +-- test_src/main-des-test.c | 8 ++--- test_src/main-dsa-test.c | 10 +++--- test_src/main-ecdsa-test.c | 6 ++-- test_src/main-echo-test.c | 4 +-- test_src/main-entropium-test.c | 2 +- test_src/main-grain-test.c | 8 ++--- test_src/main-groestl-test.c | 12 +++---- test_src/main-hmac-md5-test.c | 4 +-- test_src/main-hmac-sha1-test.c | 2 +- test_src/main-hmac-sha256-test.c | 2 +- test_src/main-jh-test.c | 4 +-- test_src/main-keccak-test.c | 4 +-- test_src/main-khazad-test.c | 4 +-- test_src/main-md5-test.c | 8 ++--- test_src/main-mickey128-test.c | 2 +- test_src/main-mqq160-sign-test.c | 2 +- test_src/main-mugi-test.c | 2 +- test_src/main-noekeon-test.c | 8 ++--- test_src/main-omac-noekeon-test.c | 12 +++---- test_src/main-present-test.c | 10 +++--- test_src/main-rabbit-test.c | 4 +-- test_src/main-rc5-test.c | 6 ++-- test_src/main-rc6-test.c | 6 ++-- test_src/main-rsaes_oaep-test.c | 10 +++--- test_src/main-rsaes_pkcs1v15-test.c | 12 +++---- test_src/main-salsa20-test.c | 2 +- test_src/main-seed-test.c | 10 +++--- test_src/main-serpent-test.c | 6 ++-- test_src/main-sha1-test.c | 4 +-- test_src/main-sha2-test.c | 4 +-- test_src/main-sha256-test.c | 4 +-- test_src/main-shabal-test.c | 18 +++++----- test_src/main-shabea-test.c | 12 +++---- test_src/main-shacal1_enc-test.c | 6 ++-- test_src/main-shacal2_enc-test.c | 6 ++-- test_src/main-skein-test.c | 6 ++-- test_src/main-skipjack-test.c | 12 +++---- test_src/main-tdes-test.c | 4 +-- test_src/main-test-common.c | 6 ++-- test_src/main-test-common.h | 2 +- test_src/main-threefish-test.c | 6 ++-- test_src/main-trivium-test.c | 2 +- test_src/main-twister-test.c | 16 ++++----- test_src/main-ubi-test.c | 2 +- test_src/main-whirlpool-0-test.c | 4 +-- test_src/main-whirlpool-t-test.c | 4 +-- test_src/main-whirlpool-test.c | 4 +-- test_src/main-xtea-test.c | 4 +-- test_src/nessie_bc_test.c | 6 ++-- test_src/nessie_bc_test.h | 10 +++--- test_src/nessie_common.c | 8 ++--- test_src/nessie_common.h | 8 ++--- test_src/nessie_hash_test.c | 4 +-- test_src/nessie_hash_test.h | 10 +++--- test_src/nessie_mac_test.c | 14 ++++---- test_src/nessie_mac_test.h | 10 +++--- test_src/nessie_stream_test.c | 6 ++-- test_src/nessie_stream_test.h | 6 ++-- test_src/performance_test.c | 2 +- test_src/performance_test.h | 2 +- test_src/shavs.c | 12 +++---- test_src/shavs.h | 2 +- test_src/string-extras-asm.S | 8 ++--- test_src/string-extras.h | 12 +++---- trivium/trivium.c | 8 ++--- trivium/trivium.h | 10 +++--- twister/twister-asm.S | 2 +- twister/twister-large-asm.S | 8 ++--- twister/twister-large.c | 32 ++++++++--------- twister/twister-large.h | 28 +++++++-------- twister/twister-small-asm.S | 4 +-- twister/twister-small-stub.c | 28 +++++++-------- twister/twister-small.c | 28 +++++++-------- twister/twister-small.h | 34 +++++++++--------- twister/twister.c | 6 ++-- twister/twister.h | 6 ++-- twister/twister224.S | 2 +- twister/twister256.S | 2 +- twister/twister384.S | 2 +- twister/twister512.S | 2 +- whirlpool/whirlpool.c | 18 +++++----- whirlpool/whirlpool.h | 8 ++--- xtea/xtea.c | 4 +-- xtea/xtea.h | 4 +-- 393 files changed, 1886 insertions(+), 1886 deletions(-) diff --git a/a51/A5_1.c b/a51/A5_1.c index 64b44f7..a8bbf3d 100644 --- a/a51/A5_1.c +++ b/a51/A5_1.c @@ -39,7 +39,7 @@ uint8_t a5_1_clock_core(a5_1_ctx_t *c, uint8_t clockoverride); * length is length of key in bits! */ -void a5_1_init(a5_1_ctx_t *c, void* key, uint8_t keylength_b, void* iv, uint8_t ivlength_b){ +void a5_1_init(a5_1_ctx_t *c, void *key, uint8_t keylength_b, void *iv, uint8_t ivlength_b){ uint8_t i,t; memset(c->r1, 0, 3); memset(c->r2, 0, 3); @@ -65,7 +65,7 @@ void a5_1_init(a5_1_ctx_t *c, void* key, uint8_t keylength_b, void* iv, uint8_t } static -void shiftreg(uint8_t* d){ +void shiftreg(uint8_t *d){ uint8_t c, c2; c=d[0]>>7; d[0] <<= 1; diff --git a/a51/A5_1.h b/a51/A5_1.h index fab0171..4e3e667 100644 --- a/a51/A5_1.h +++ b/a51/A5_1.h @@ -58,7 +58,7 @@ typedef struct { } a5_1_ctx_t; -void a5_1_init(a5_1_ctx_t *c, void* key, uint8_t keylength_b, void* iv, uint8_t ivlength_b); +void a5_1_init(a5_1_ctx_t *c, void *key, uint8_t keylength_b, void *iv, uint8_t ivlength_b); uint8_t a5_1_clock(a5_1_ctx_t *c); uint8_t a5_1_gen(a5_1_ctx_t *c); diff --git a/aes/aes128_dec.c b/aes/aes128_dec.c index f3746a7..083aa9a 100644 --- a/aes/aes128_dec.c +++ b/aes/aes128_dec.c @@ -28,7 +28,7 @@ #include "aes.h" #include "aes_dec.h" -void aes128_dec(void* buffer, aes128_ctx_t* ctx){ +void aes128_dec(void *buffer, aes128_ctx_t *ctx){ aes_decrypt_core(buffer, (aes_genctx_t*)ctx, 10); } diff --git a/aes/aes128_dec.h b/aes/aes128_dec.h index b5df9df..1f4e7f8 100644 --- a/aes/aes128_dec.h +++ b/aes/aes128_dec.h @@ -39,7 +39,7 @@ * \param buffer pointer to the block to decrypt * \param ctx pointer to the key schedule */ -void aes128_dec(void* buffer, aes128_ctx_t* ctx); +void aes128_dec(void *buffer, aes128_ctx_t *ctx); diff --git a/aes/aes128_enc.c b/aes/aes128_enc.c index 3790854..b629c75 100644 --- a/aes/aes128_enc.c +++ b/aes/aes128_enc.c @@ -28,7 +28,7 @@ #include "aes.h" #include "aes_enc.h" -void aes128_enc(void* buffer, aes128_ctx_t* ctx){ +void aes128_enc(void *buffer, aes128_ctx_t *ctx){ aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 10); } diff --git a/aes/aes128_enc.h b/aes/aes128_enc.h index 98a8cc2..0ac7b0a 100644 --- a/aes/aes128_enc.h +++ b/aes/aes128_enc.h @@ -40,7 +40,7 @@ * \param buffer pointer to the block to encrypt * \param ctx pointer to the key schedule */ -void aes128_enc(void* buffer, aes128_ctx_t* ctx); +void aes128_enc(void *buffer, aes128_ctx_t *ctx); diff --git a/aes/aes192_dec.c b/aes/aes192_dec.c index 99cc1b1..ce762d0 100644 --- a/aes/aes192_dec.c +++ b/aes/aes192_dec.c @@ -28,7 +28,7 @@ #include "aes.h" #include "aes_dec.h" -void aes192_dec(void* buffer, aes192_ctx_t* ctx){ +void aes192_dec(void *buffer, aes192_ctx_t *ctx){ aes_decrypt_core(buffer, (aes_genctx_t*)ctx, 12); } diff --git a/aes/aes192_dec.h b/aes/aes192_dec.h index 577ab44..05ff664 100644 --- a/aes/aes192_dec.h +++ b/aes/aes192_dec.h @@ -39,7 +39,7 @@ * \param buffer pointer to the block to decrypt * \param ctx pointer to the key schedule */ -void aes192_dec(void* buffer, aes192_ctx_t* ctx); +void aes192_dec(void *buffer, aes192_ctx_t *ctx); diff --git a/aes/aes192_enc.c b/aes/aes192_enc.c index 05cb71b..6fc7fa3 100644 --- a/aes/aes192_enc.c +++ b/aes/aes192_enc.c @@ -28,7 +28,7 @@ #include "aes.h" #include "aes_enc.h" -void aes192_enc(void* buffer, aes192_ctx_t* ctx){ +void aes192_enc(void *buffer, aes192_ctx_t *ctx){ aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 12); } diff --git a/aes/aes192_enc.h b/aes/aes192_enc.h index 1c39aa0..a1ad1e9 100644 --- a/aes/aes192_enc.h +++ b/aes/aes192_enc.h @@ -40,7 +40,7 @@ * \param buffer pointer to the block to encrypt * \param ctx pointer to the key schedule */ -void aes192_enc(void* buffer, aes192_ctx_t* ctx); +void aes192_enc(void *buffer, aes192_ctx_t *ctx); diff --git a/aes/aes256_dec.c b/aes/aes256_dec.c index 9bbb016..6425eb2 100644 --- a/aes/aes256_dec.c +++ b/aes/aes256_dec.c @@ -28,7 +28,7 @@ #include "aes.h" #include "aes_dec.h" -void aes256_dec(void* buffer, aes256_ctx_t* ctx){ +void aes256_dec(void *buffer, aes256_ctx_t *ctx){ aes_decrypt_core(buffer, (aes_genctx_t*)ctx, 14); } diff --git a/aes/aes256_dec.h b/aes/aes256_dec.h index 14b8a0a..0b354db 100644 --- a/aes/aes256_dec.h +++ b/aes/aes256_dec.h @@ -39,7 +39,7 @@ * \param buffer pointer to the block to decrypt * \param ctx pointer to the key schedule */ -void aes256_dec(void* buffer, aes256_ctx_t* ctx); +void aes256_dec(void *buffer, aes256_ctx_t *ctx); diff --git a/aes/aes256_enc.c b/aes/aes256_enc.c index cb2f3ff..3e3e379 100644 --- a/aes/aes256_enc.c +++ b/aes/aes256_enc.c @@ -28,7 +28,7 @@ #include "aes.h" #include "aes_enc.h" -void aes256_enc(void* buffer, aes256_ctx_t* ctx){ +void aes256_enc(void *buffer, aes256_ctx_t *ctx){ aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 14); } diff --git a/aes/aes256_enc.h b/aes/aes256_enc.h index a890cd3..bcda6c3 100644 --- a/aes/aes256_enc.h +++ b/aes/aes256_enc.h @@ -40,7 +40,7 @@ * \param buffer pointer to the block to encrypt * \param ctx pointer to the key schedule */ -void aes256_enc(void* buffer, aes256_ctx_t* ctx); +void aes256_enc(void *buffer, aes256_ctx_t *ctx); diff --git a/aes/aes_dec-asm.S b/aes/aes_dec-asm.S index 78dffad..4edbb63 100644 --- a/aes/aes_dec-asm.S +++ b/aes/aes_dec-asm.S @@ -65,7 +65,7 @@ aes128_dec: /* - void aes_decrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds) + void aes_decrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds) */ T0= 2 T1= 3 diff --git a/aes/aes_dec-asm_faster.S b/aes/aes_dec-asm_faster.S index e743678..4796f4e 100644 --- a/aes/aes_dec-asm_faster.S +++ b/aes/aes_dec-asm_faster.S @@ -47,7 +47,7 @@ aes128_dec: /* - void aes_decrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds) + void aes_decrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds) */ T0= 2 T1= 3 diff --git a/aes/aes_dec.c b/aes/aes_dec.c index 8c476de..5db465b 100644 --- a/aes/aes_dec.c +++ b/aes/aes_dec.c @@ -25,7 +25,7 @@ #include "aes_dec.h" #include -void aes_invshiftrow(void* data, uint8_t shift){ +void aes_invshiftrow(void *data, uint8_t shift){ uint8_t tmp[4]; tmp[0] = ((uint8_t*)data)[(4+0-shift)&3]; tmp[1] = ((uint8_t*)data)[(4+1-shift)&3]; @@ -34,7 +34,7 @@ void aes_invshiftrow(void* data, uint8_t shift){ memcpy(data, tmp, 4); } -void aes_invshiftcol(void* data, uint8_t shift){ +void aes_invshiftcol(void *data, uint8_t shift){ uint8_t tmp[4]; tmp[0] = ((uint8_t*)data)[ 0]; tmp[1] = ((uint8_t*)data)[ 4]; @@ -46,7 +46,7 @@ void aes_invshiftcol(void* data, uint8_t shift){ ((uint8_t*)data)[12] = tmp[(4-shift+3)&3]; } static -void aes_dec_round(aes_cipher_state_t* state, const aes_roundkey_t* k){ +void aes_dec_round(aes_cipher_state_t *state, const aes_roundkey_t *k){ uint8_t tmp[16]; uint8_t i; uint8_t t,u,v,w; @@ -102,7 +102,7 @@ void aes_dec_round(aes_cipher_state_t* state, const aes_roundkey_t* k){ static -void aes_dec_firstround(aes_cipher_state_t* state, const aes_roundkey_t* k){ +void aes_dec_firstround(aes_cipher_state_t *state, const aes_roundkey_t *k){ uint8_t i; /* keyAdd */ for(i=0; i<16; ++i){ @@ -118,7 +118,7 @@ void aes_dec_firstround(aes_cipher_state_t* state, const aes_roundkey_t* k){ } } -void aes_decrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds){ +void aes_decrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds){ uint8_t i; aes_dec_firstround(state, &(ks->key[i=rounds])); for(;rounds>1;--rounds){ diff --git a/aes/aes_dec.h b/aes/aes_dec.h index 0517bd9..e267170 100644 --- a/aes/aes_dec.h +++ b/aes/aes_dec.h @@ -30,7 +30,7 @@ #include -void aes_decrypt_core(aes_cipher_state_t* state,const aes_genctx_t* ks, uint8_t rounds); +void aes_decrypt_core(aes_cipher_state_t *state,const aes_genctx_t *ks, uint8_t rounds); #endif diff --git a/aes/aes_enc-asm.S b/aes/aes_enc-asm.S index 77c3336..83c6d55 100644 --- a/aes/aes_enc-asm.S +++ b/aes/aes_enc-asm.S @@ -54,7 +54,7 @@ aes128_enc: /* - void aes_encrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds) + void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds) */ T0= 2 T1= 3 diff --git a/aes/aes_enc.c b/aes/aes_enc.c index dadf9f4..6b6804c 100644 --- a/aes/aes_enc.c +++ b/aes/aes_enc.c @@ -33,7 +33,7 @@ #include "aes_enc.h" #include -void aes_shiftcol(void* data, uint8_t shift){ +void aes_shiftcol(void *data, uint8_t shift){ uint8_t tmp[4]; tmp[0] = ((uint8_t*)data)[ 0]; tmp[1] = ((uint8_t*)data)[ 4]; @@ -50,7 +50,7 @@ void aes_shiftcol(void* data, uint8_t shift){ #define GF256MUL_3(a) (gf256mul(3, (a), 0x1b)) static -void aes_enc_round(aes_cipher_state_t* state, const aes_roundkey_t* k){ +void aes_enc_round(aes_cipher_state_t *state, const aes_roundkey_t *k){ uint8_t tmp[16], t; uint8_t i; /* subBytes */ @@ -90,7 +90,7 @@ void aes_enc_round(aes_cipher_state_t* state, const aes_roundkey_t* k){ static -void aes_enc_lastround(aes_cipher_state_t* state,const aes_roundkey_t* k){ +void aes_enc_lastround(aes_cipher_state_t *state,const aes_roundkey_t *k){ uint8_t i; /* subBytes */ for(i=0; i<16; ++i){ @@ -106,7 +106,7 @@ void aes_enc_lastround(aes_cipher_state_t* state,const aes_roundkey_t* k){ } } -void aes_encrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds){ +void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds){ uint8_t i; for(i=0; i<16; ++i){ state->s[i] ^= ks->key[0].ks[i]; diff --git a/aes/aes_enc.h b/aes/aes_enc.h index fb25764..1dc519e 100644 --- a/aes/aes_enc.h +++ b/aes/aes_enc.h @@ -30,7 +30,7 @@ #include -void aes_encrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds); +void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds); #endif diff --git a/aes/aes_keyschedule-asm.S b/aes/aes_keyschedule-asm.S index c5d69ea..74595d9 100644 --- a/aes/aes_keyschedule-asm.S +++ b/aes/aes_keyschedule-asm.S @@ -48,7 +48,7 @@ aes128_init: ldi r22, 128 /* -void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx){ +void aes_init(const void *key, uint16_t keysize_b, aes_genctx_t *ctx){ uint8_t hi,i,nk, next_nk; uint8_t rc=1; uint8_t tmp[4]; diff --git a/aes/aes_keyschedule.c b/aes/aes_keyschedule.c index fff0700..94182b4 100644 --- a/aes/aes_keyschedule.c +++ b/aes/aes_keyschedule.c @@ -33,7 +33,7 @@ #include static -void aes_rotword(void* a){ +void aes_rotword(void *a){ uint8_t t; t=((uint8_t*)a)[0]; ((uint8_t*)a)[0] = ((uint8_t*)a)[1]; @@ -46,7 +46,7 @@ const uint8_t rc_tab[] PROGMEM = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 }; -void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx){ +void aes_init(const void *key, uint16_t keysize_b, aes_genctx_t *ctx){ uint8_t hi,i,nk, next_nk; uint8_t rc=0; union { @@ -81,14 +81,14 @@ void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx){ } } -void aes128_init(const void* key, aes128_ctx_t* ctx){ +void aes128_init(const void *key, aes128_ctx_t *ctx){ aes_init(key, 128, (aes_genctx_t*)ctx); } -void aes192_init(const void* key, aes192_ctx_t* ctx){ +void aes192_init(const void *key, aes192_ctx_t *ctx){ aes_init(key, 192, (aes_genctx_t*)ctx); } -void aes256_init(const void* key, aes256_ctx_t* ctx){ +void aes256_init(const void *key, aes256_ctx_t *ctx){ aes_init(key, 256, (aes_genctx_t*)ctx); } diff --git a/aes/aes_keyschedule.h b/aes/aes_keyschedule.h index ab5786a..7c3e46e 100644 --- a/aes/aes_keyschedule.h +++ b/aes/aes_keyschedule.h @@ -39,7 +39,7 @@ * \param keysize_b length of the key in bits (valid are 128, 192 and 256) * \param ctx pointer to the context where the keyschedule should be stored */ -void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx); +void aes_init(const void *key, uint16_t keysize_b, aes_genctx_t *ctx); /** * \brief initialize the keyschedule for 128 bit key @@ -49,7 +49,7 @@ void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx); * \param key pointer to the key material * \param ctx pointer to the context where the keyschedule should be stored */ -void aes128_init(const void* key, aes128_ctx_t* ctx); +void aes128_init(const void *key, aes128_ctx_t *ctx); /** * \brief initialize the keyschedule for 192 bit key @@ -59,7 +59,7 @@ void aes128_init(const void* key, aes128_ctx_t* ctx); * \param key pointer to the key material * \param ctx pointer to the context where the keyschedule should be stored */ -void aes192_init(const void* key, aes192_ctx_t* ctx); +void aes192_init(const void *key, aes192_ctx_t *ctx); /** * \brief initialize the keyschedule for 256 bit key @@ -69,7 +69,7 @@ void aes192_init(const void* key, aes192_ctx_t* ctx); * \param key pointer to the key material * \param ctx pointer to the context where the keyschedule should be stored */ -void aes256_init(const void* key, aes256_ctx_t* ctx); +void aes256_init(const void *key, aes256_ctx_t *ctx); #endif /* AES_KEYSCHEDULE_H_ */ diff --git a/base64/base64_dec.c b/base64/base64_dec.c index 5a0dcca..2a6e941 100644 --- a/base64/base64_dec.c +++ b/base64/base64_dec.c @@ -131,7 +131,7 @@ uint8_t ascii2bit6(uint8_t a){ #endif -int base64_binlength(char* str, uint8_t strict){ +int base64_binlength(char *str, uint8_t strict){ int l=0; uint8_t term=0; for(;;){ @@ -187,7 +187,7 @@ int base64_binlength(char* str, uint8_t strict){ */ -int base64dec(void* dest, const char* b64str, uint8_t strict){ +int base64dec(void *dest, const char *b64str, uint8_t strict){ uint8_t buffer[4]; uint8_t idx=0; uint8_t term=0; diff --git a/base64/base64_dec.h b/base64/base64_dec.h index 1c9f1d9..0f9cb96 100644 --- a/base64/base64_dec.h +++ b/base64/base64_dec.h @@ -23,7 +23,7 @@ #include -int base64_binlength(char* str, uint8_t strict); -int base64dec(void* dest, const char* b64str, uint8_t strict); +int base64_binlength(char *str, uint8_t strict); +int base64dec(void *dest, const char *b64str, uint8_t strict); #endif /*BASE64_DEC_H_*/ diff --git a/base64/base64_enc.c b/base64/base64_enc.c index ae06127..57ae7f3 100644 --- a/base64/base64_enc.c +++ b/base64/base64_enc.c @@ -75,7 +75,7 @@ char bit6toAscii(uint8_t a){ #endif -void base64enc(char* dest,const void* src, uint16_t length){ +void base64enc(char *dest,const void *src, uint16_t length){ uint16_t i,j; uint8_t a[4]; for(i=0; i -void base64enc(char* dest, const void* src, uint16_t length); +void base64enc(char *dest, const void *src, uint16_t length); #endif /*BASE64_ENC_H_*/ diff --git a/bcal/bcal-basic.c b/bcal/bcal-basic.c index 3d7a65c..2dec6cf 100644 --- a/bcal/bcal-basic.c +++ b/bcal/bcal-basic.c @@ -24,8 +24,8 @@ #include "blockcipher_descriptor.h" #include "keysize_descriptor.h" -uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor, - const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx){ +uint8_t bcal_cipher_init(const bcdesc_t *cipher_descriptor, + const void *key, uint16_t keysize_b, bcgen_ctx_t *ctx){ if(!is_valid_keysize_P((PGM_VOID_P)pgm_read_word(&(cipher_descriptor->valid_keysize_desc)), keysize_b)){ return 1; @@ -52,7 +52,7 @@ uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor, return 0; } -void bcal_cipher_free(bcgen_ctx_t* ctx){ +void bcal_cipher_free(bcgen_ctx_t *ctx){ if(!ctx) return; bc_free_fpt free_fpt; @@ -62,7 +62,7 @@ void bcal_cipher_free(bcgen_ctx_t* ctx){ free(ctx->ctx); } -void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx){ +void bcal_cipher_enc(void *block, const bcgen_ctx_t *ctx){ bc_enc_fpt enc_fpt; enc_fpt.encvoid = (void_fpt)pgm_read_word(&(ctx->desc_ptr->enc.encvoid)); if(!enc_fpt.encvoid){ @@ -73,7 +73,7 @@ void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx){ } -void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx){ +void bcal_cipher_dec(void *block, const bcgen_ctx_t *ctx){ bc_dec_fpt dec_fpt; dec_fpt.decvoid = (void_fpt)pgm_read_word(&(ctx->desc_ptr->dec.decvoid)); if(!dec_fpt.decvoid){ @@ -83,11 +83,11 @@ void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx){ dec_fpt.dec1(block, (ctx->ctx)); } -uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc){ +uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t *desc){ return pgm_read_word(&(desc->blocksize_b)); } -PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t* desc){ +PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t *desc){ return (PGM_VOID_P)pgm_read_word(&(desc->valid_keysize_desc)); } diff --git a/bcal/bcal-basic.h b/bcal/bcal-basic.h index e45b9b8..3f8260a 100644 --- a/bcal/bcal-basic.h +++ b/bcal/bcal-basic.h @@ -26,11 +26,11 @@ #include "keysize_descriptor.h" #include -uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor, - const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx); -void bcal_cipher_free(bcgen_ctx_t* ctx); -void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx); -void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx); -uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc); -PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t* desc); +uint8_t bcal_cipher_init(const bcdesc_t *cipher_descriptor, + const void *key, uint16_t keysize_b, bcgen_ctx_t *ctx); +void bcal_cipher_free(bcgen_ctx_t *ctx); +void bcal_cipher_enc(void *block, const bcgen_ctx_t *ctx); +void bcal_cipher_dec(void *block, const bcgen_ctx_t *ctx); +uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t *desc); +PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t *desc); #endif /* BCAL_BASIC_H_ */ diff --git a/bcal/bcal-cbc.c b/bcal/bcal-cbc.c index c5ff9d6..7188387 100644 --- a/bcal/bcal-cbc.c +++ b/bcal/bcal-cbc.c @@ -23,7 +23,7 @@ #include "bcal-basic.h" #include "memxor.h" -uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx){ +uint8_t bcal_cbc_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cbc_ctx_t *ctx){ ctx->desc = (bcdesc_t*)desc; ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8; ctx->prev_block = malloc(ctx->blocksize_B); @@ -34,37 +34,37 @@ uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx)); } -void bcal_cbc_free(bcal_cbc_ctx_t* ctx){ +void bcal_cbc_free(bcal_cbc_ctx_t *ctx){ bcal_cipher_free(&(ctx->cctx)); free(ctx->prev_block); } -void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx){ +void bcal_cbc_loadIV(const void *iv, bcal_cbc_ctx_t *ctx){ if(iv){ memcpy(ctx->prev_block, iv, ctx->blocksize_B); } } -void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx){ +void bcal_cbc_encNext(void *block, bcal_cbc_ctx_t *ctx){ memxor(block, ctx->prev_block, ctx->blocksize_B); bcal_cipher_enc(block, &(ctx->cctx)); memcpy(ctx->prev_block, block, ctx->blocksize_B); } -void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx){ +void bcal_cbc_decNext(void *block, bcal_cbc_ctx_t *ctx){ uint8_t tmp[ctx->blocksize_B]; memcpy(tmp, block, ctx->blocksize_B); bcal_cipher_dec(block, &(ctx->cctx)); memxor(block, ctx->prev_block, ctx->blocksize_B); memcpy(ctx->prev_block, tmp, ctx->blocksize_B); } -void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx){ +void bcal_cbc_decRand(void *block, const void *prev_block, bcal_cbc_ctx_t *ctx){ bcal_cipher_dec(block, &(ctx->cctx)); memxor(block, prev_block, ctx->blocksize_B); } -void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){ +void bcal_cbc_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx){ bcal_cbc_loadIV(iv, ctx); while(msg_blocks--){ bcal_cbc_encNext(msg, ctx); @@ -72,7 +72,7 @@ void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ct } } -void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){ +void bcal_cbc_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx){ msg=(uint8_t*)msg + (msg_blocks-1)*ctx->blocksize_B; while(msg_blocks > 1){ bcal_cbc_decRand(msg, (uint8_t*)msg-ctx->blocksize_B, ctx); diff --git a/bcal/bcal-cbc.h b/bcal/bcal-cbc.h index ba20186..3f2c49f 100644 --- a/bcal/bcal-cbc.h +++ b/bcal/bcal-cbc.h @@ -31,14 +31,14 @@ typedef struct{ uint8_t blocksize_B; } bcal_cbc_ctx_t; -uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx); -void bcal_cbc_free(bcal_cbc_ctx_t* ctx); -void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx); -void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx); -void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx); -void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx); -void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx); -void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx); +uint8_t bcal_cbc_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cbc_ctx_t *ctx); +void bcal_cbc_free(bcal_cbc_ctx_t *ctx); +void bcal_cbc_loadIV(const void *iv, bcal_cbc_ctx_t *ctx); +void bcal_cbc_encNext(void *block, bcal_cbc_ctx_t *ctx); +void bcal_cbc_decNext(void *block, bcal_cbc_ctx_t *ctx); +void bcal_cbc_decRand(void *block, const void *prev_block, bcal_cbc_ctx_t *ctx); +void bcal_cbc_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx); +void bcal_cbc_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx); #endif /* BCALCBC_H_ */ diff --git a/bcal/bcal-cfb_bit.c b/bcal/bcal-cfb_bit.c index 2611b65..33e4abf 100644 --- a/bcal/bcal-cfb_bit.c +++ b/bcal/bcal-cfb_bit.c @@ -23,14 +23,14 @@ #include "bcal-cfb_bit.h" #include "bcal-basic.h" -static uint8_t read_bit(void* block, uint32_t index){ +static uint8_t read_bit(void *block, uint32_t index){ uint8_t r; r=((uint8_t*)block)[index/8]; r=(r&(0x80>>(index&7)))?0xff:0x00; return r; } -static void write_bit(void* block, uint32_t index, uint8_t value){ +static void write_bit(void *block, uint32_t index, uint8_t value){ if(value){ /* set bit */ ((uint8_t*)block)[index/8] |= 0x80>>(index&7); @@ -40,7 +40,7 @@ static void write_bit(void* block, uint32_t index, uint8_t value){ } } -uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx){ +uint8_t bcal_cfb_b_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t *ctx){ ctx->desc = (bcdesc_t*)desc; ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8; ctx->in_block=malloc(ctx->blocksize_B); @@ -54,18 +54,18 @@ uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_ return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx)); } -void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx){ +void bcal_cfb_b_free(bcal_cfb_b_ctx_t *ctx){ free(ctx->in_block); bcal_cipher_free(&(ctx->cctx)); } -void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx){ +void bcal_cfb_b_loadIV(const void *iv, bcal_cfb_b_ctx_t *ctx){ if(iv){ memcpy(ctx->in_block, iv, ctx->blocksize_B); } } -void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){ +void bcal_cfb_b_encNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx){ uint8_t tmp[ctx->blocksize_B]; offset &= 7; memcpy(tmp, ctx->in_block, ctx->blocksize_B); @@ -83,7 +83,7 @@ void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){ } } -void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){ +void bcal_cfb_b_decNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx){ uint8_t tmp[ctx->blocksize_B]; offset &= 7; memcpy(tmp, ctx->in_block, ctx->blocksize_B); @@ -103,7 +103,7 @@ void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){ } } -void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){ +void bcal_cfb_b_encMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx){ bcal_cfb_b_loadIV(iv, ctx); uint32_t addr; addr = ((uint16_t)msg)*8+offset; @@ -115,7 +115,7 @@ void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_b } } -void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){ +void bcal_cfb_b_decMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx){ bcal_cfb_b_loadIV(iv, ctx); uint32_t addr; addr = ((uint16_t)msg)*8+offset; diff --git a/bcal/bcal-cfb_bit.h b/bcal/bcal-cfb_bit.h index df62e17..3f56f58 100644 --- a/bcal/bcal-cfb_bit.h +++ b/bcal/bcal-cfb_bit.h @@ -35,13 +35,13 @@ typedef struct{ } bcal_cfb_b_ctx_t; -uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx); -void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx); -void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx); -void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx); -void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx); -void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx); -void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx); +uint8_t bcal_cfb_b_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t *ctx); +void bcal_cfb_b_free(bcal_cfb_b_ctx_t *ctx); +void bcal_cfb_b_loadIV(const void *iv, bcal_cfb_b_ctx_t *ctx); +void bcal_cfb_b_encNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx); +void bcal_cfb_b_decNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx); +void bcal_cfb_b_encMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx); +void bcal_cfb_b_decMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx); #endif /* BCALCFB_BIT_H_ */ diff --git a/bcal/bcal-cfb_byte.c b/bcal/bcal-cfb_byte.c index e0e5d22..00f072a 100644 --- a/bcal/bcal-cfb_byte.c +++ b/bcal/bcal-cfb_byte.c @@ -25,7 +25,7 @@ #include "memxor.h" -uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx){ +uint8_t bcal_cfb_B_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t *ctx){ ctx->desc = (bcdesc_t*)desc; ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8; ctx->in_block=malloc(ctx->blocksize_B); @@ -39,18 +39,18 @@ uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_ return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx)); } -void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx){ +void bcal_cfb_B_free(bcal_cfb_B_ctx_t *ctx){ free(ctx->in_block); bcal_cipher_free(&(ctx->cctx)); } -void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx){ +void bcal_cfb_B_loadIV(const void *iv, bcal_cfb_B_ctx_t *ctx){ if(iv){ memcpy(ctx->in_block, iv, ctx->blocksize_B); } } -void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx){ +void bcal_cfb_B_encNext(void *block, bcal_cfb_B_ctx_t *ctx){ uint8_t tmp[ctx->blocksize_B]; memcpy(tmp, ctx->in_block, ctx->blocksize_B); bcal_cipher_enc(tmp, &(ctx->cctx)); @@ -59,7 +59,7 @@ void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx){ memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, block, ctx->size_B); } -void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx){ +void bcal_cfb_B_decNext(void *block, bcal_cfb_B_ctx_t *ctx){ uint8_t tmp[ctx->blocksize_B]; uint8_t xblock[ctx->size_B]; memcpy(xblock, block, ctx->size_B); @@ -70,7 +70,7 @@ void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx){ memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, xblock, ctx->size_B); } -void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){ +void bcal_cfb_B_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx){ bcal_cfb_B_loadIV(iv, ctx); while(msg_blocks--){ bcal_cfb_B_encNext(msg, ctx); @@ -78,7 +78,7 @@ void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_ } } -void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){ +void bcal_cfb_B_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx){ bcal_cfb_B_loadIV(iv, ctx); while(msg_blocks--){ bcal_cfb_B_decNext(msg, ctx); diff --git a/bcal/bcal-cfb_byte.h b/bcal/bcal-cfb_byte.h index 276a904..4787620 100644 --- a/bcal/bcal-cfb_byte.h +++ b/bcal/bcal-cfb_byte.h @@ -34,13 +34,13 @@ typedef struct{ } bcal_cfb_B_ctx_t; -uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx); -void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx); -void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx); -void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx); -void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx); -void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx); -void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx); +uint8_t bcal_cfb_B_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t *ctx); +void bcal_cfb_B_free(bcal_cfb_B_ctx_t *ctx); +void bcal_cfb_B_loadIV(const void *iv, bcal_cfb_B_ctx_t *ctx); +void bcal_cfb_B_encNext(void *block, bcal_cfb_B_ctx_t *ctx); +void bcal_cfb_B_decNext(void *block, bcal_cfb_B_ctx_t *ctx); +void bcal_cfb_B_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx); +void bcal_cfb_B_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx); #endif /* BCALCFB_BYTE_H_ */ diff --git a/bcal/bcal-cmac.c b/bcal/bcal-cmac.c index abc9dfa..5cf319a 100644 --- a/bcal/bcal-cmac.c +++ b/bcal/bcal-cmac.c @@ -25,7 +25,7 @@ #include "memxor.h" -static uint8_t left_shift_be_block(void* block, uint8_t blocksize_B){ +static uint8_t left_shift_be_block(void *block, uint8_t blocksize_B){ uint8_t c1=0, c2; do{ --blocksize_B; @@ -40,7 +40,7 @@ static uint8_t left_shift_be_block(void* block, uint8_t blocksize_B){ static const uint8_t const_128 = 0x87; static const uint8_t const_64 = 0x1b; -uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx){ +uint8_t bcal_cmac_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cmac_ctx_t *ctx){ uint8_t r; ctx->desc = (bcdesc_t*)desc; ctx->blocksize_B = bcal_cipher_getBlocksize_b(desc)/8; @@ -87,14 +87,14 @@ uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b return 0; } -void bcal_cmac_free(bcal_cmac_ctx_t* ctx){ +void bcal_cmac_free(bcal_cmac_ctx_t *ctx){ free(ctx->accu); free(ctx->k1); free(ctx->k2); bcal_cipher_free(&(ctx->cctx)); } -void bcal_cmac_nextBlock (bcal_cmac_ctx_t* ctx, const void* block){ +void bcal_cmac_nextBlock (bcal_cmac_ctx_t *ctx, const void *block){ if(ctx->last_set){ memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B); bcal_cipher_enc(ctx->accu, &(ctx->cctx)); @@ -104,7 +104,7 @@ void bcal_cmac_nextBlock (bcal_cmac_ctx_t* ctx, const void* block){ } -void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b){ +void bcal_cmac_lastBlock(bcal_cmac_ctx_t *ctx, const void *block, uint16_t length_b){ uint16_t blocksize_b; blocksize_b = ctx->blocksize_B*8; while(length_b>=blocksize_b){ @@ -131,7 +131,7 @@ void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t lengt bcal_cipher_enc(ctx->accu, &(ctx->cctx)); } -void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx){ +void bcal_cmac_ctx2mac(void *dest, uint16_t length_b, const bcal_cmac_ctx_t *ctx){ memcpy(dest, ctx->accu, length_b/8); if(length_b&7){ ((uint8_t*)dest)[length_b/8] &= 0xff>>(length_b&7); @@ -139,7 +139,7 @@ void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx } } -void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx){ +void bcal_cmac(void *dest, uint16_t out_length_b, const void *block, uint32_t length_b, bcal_cmac_ctx_t *ctx){ uint16_t blocksize_b; blocksize_b = ctx->blocksize_B*8; while(length_b>blocksize_b){ diff --git a/bcal/bcal-cmac.h b/bcal/bcal-cmac.h index be699b6..868c616 100644 --- a/bcal/bcal-cmac.h +++ b/bcal/bcal-cmac.h @@ -35,11 +35,11 @@ typedef struct{ uint8_t blocksize_B; } bcal_cmac_ctx_t; -uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx); -void bcal_cmac_free(bcal_cmac_ctx_t* ctx); -void bcal_cmac_nextBlock(bcal_cmac_ctx_t* ctx, const void* block); -void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b); -void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx); -void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx); +uint8_t bcal_cmac_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cmac_ctx_t *ctx); +void bcal_cmac_free(bcal_cmac_ctx_t *ctx); +void bcal_cmac_nextBlock(bcal_cmac_ctx_t *ctx, const void *block); +void bcal_cmac_lastBlock(bcal_cmac_ctx_t *ctx, const void *block, uint16_t length_b); +void bcal_cmac_ctx2mac(void *dest, uint16_t length_b, const bcal_cmac_ctx_t *ctx); +void bcal_cmac(void *dest, uint16_t out_length_b, const void *block, uint32_t length_b, bcal_cmac_ctx_t *ctx); #endif /* BCALCMAC_H_ */ diff --git a/bcal/bcal-ctr.c b/bcal/bcal-ctr.c index 694cedd..c0d7d77 100644 --- a/bcal/bcal-ctr.c +++ b/bcal/bcal-ctr.c @@ -24,7 +24,7 @@ #include "bcal-ctr.h" #include "memxor.h" -static void increment_be(void* block, uint8_t size_B){ +static void increment_be(void *block, uint8_t size_B){ uint16_t c=1; do{ --size_B; @@ -34,7 +34,7 @@ static void increment_be(void* block, uint8_t size_B){ }while(size_B); } -uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx){ +uint8_t bcal_ctr_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t *ctx){ ctx->desc = (bcdesc_t*)desc; if(inc_func){ ctx->inc_func = inc_func; @@ -49,18 +49,18 @@ uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx)); } -void bcal_ctr_free(bcal_ctr_ctx_t* ctx){ +void bcal_ctr_free(bcal_ctr_ctx_t *ctx){ free(ctx->in_block); bcal_cipher_free(&(ctx->cctx)); } -void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx){ +void bcal_ctr_loadIV(const void *iv, bcal_ctr_ctx_t *ctx){ if(iv){ memcpy(ctx->in_block, iv, ctx->blocksize_B); } } -void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx){ +void bcal_ctr_encNext(void *block, bcal_ctr_ctx_t *ctx){ uint8_t tmp[ctx->blocksize_B]; memcpy(tmp, ctx->in_block, ctx->blocksize_B); bcal_cipher_enc(tmp, &(ctx->cctx)); @@ -68,11 +68,11 @@ void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx){ ctx->inc_func(ctx->in_block, ctx->blocksize_B); } -void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx){ +void bcal_ctr_decNext(void *block, bcal_ctr_ctx_t *ctx){ bcal_ctr_encNext(block, ctx); } -void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){ +void bcal_ctr_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx){ bcal_ctr_loadIV(iv, ctx); uint16_t blocksize_b; blocksize_b = ctx->blocksize_B*8; @@ -89,7 +89,7 @@ void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx memxor(msg, tmp, (msg_len_b+7)/8); } -void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){ +void bcal_ctr_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx){ bcal_ctr_encMsg(iv, msg, msg_len_b, ctx); } diff --git a/bcal/bcal-ctr.h b/bcal/bcal-ctr.h index 55de485..8cad997 100644 --- a/bcal/bcal-ctr.h +++ b/bcal/bcal-ctr.h @@ -24,7 +24,7 @@ #include "bcal-basic.h" #include "blockcipher_descriptor.h" -typedef void(*inc_fp_t)(void* block, uint8_t size_B); +typedef void(*inc_fp_t)(void *block, uint8_t size_B); typedef struct{ bcdesc_t* desc; @@ -34,12 +34,12 @@ typedef struct{ uint8_t blocksize_B; } bcal_ctr_ctx_t; -uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx); -void bcal_ctr_free(bcal_ctr_ctx_t* ctx); -void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx); -void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx); -void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx); -void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx); -void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx); +uint8_t bcal_ctr_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t *ctx); +void bcal_ctr_free(bcal_ctr_ctx_t *ctx); +void bcal_ctr_loadIV(const void *iv, bcal_ctr_ctx_t *ctx); +void bcal_ctr_encNext(void *block, bcal_ctr_ctx_t *ctx); +void bcal_ctr_decNext(void *block, bcal_ctr_ctx_t *ctx); +void bcal_ctr_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx); +void bcal_ctr_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx); #endif /* BCALCTR_H_ */ diff --git a/bcal/bcal-eax.c b/bcal/bcal-eax.c index 9dceccd..15c80a0 100644 --- a/bcal/bcal-eax.c +++ b/bcal/bcal-eax.c @@ -26,7 +26,7 @@ #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 bcal_eax_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_eax_ctx_t *ctx){ uint8_t r; ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8; ctx->nonce = malloc(ctx->blocksize_B); @@ -60,7 +60,7 @@ uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, return 0; } -void bcal_eax_free(bcal_eax_ctx_t* ctx){ +void bcal_eax_free(bcal_eax_ctx_t *ctx){ bcal_ctr_free(&(ctx->cipher)); bcal_cmac_free(&(ctx->ctag)); bcal_cmac_free(&(ctx->htag)); @@ -68,42 +68,42 @@ void bcal_eax_free(bcal_eax_ctx_t* ctx){ free(ctx->nonce); } -void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx){ +void bcal_eax_loadNonce(const void *nonce, uint16_t length_b, bcal_eax_ctx_t *ctx){ bcal_cmac_lastBlock(&(ctx->ntag), nonce, length_b); bcal_cmac_ctx2mac(ctx->nonce, ctx->blocksize_B*8, &(ctx->ntag)); bcal_ctr_loadIV(ctx->nonce, &(ctx->cipher)); } -void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx){ +void bcal_eax_addNextHeader(const void *header, bcal_eax_ctx_t *ctx){ bcal_cmac_nextBlock(&(ctx->htag), header); } -void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx){ +void bcal_eax_addLastHeader(const void *header, uint16_t length_b, bcal_eax_ctx_t *ctx){ bcal_cmac_lastBlock(&(ctx->htag), header, length_b); ctx->header_set = 1; } -void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx){ +void bcal_eax_encNextBlock(void *block, bcal_eax_ctx_t *ctx){ bcal_ctr_encNext(block, &(ctx->cipher)); bcal_cmac_nextBlock(&(ctx->ctag), block); } -void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){ +void bcal_eax_encLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx){ bcal_ctr_encMsg(NULL, block, length_b, &(ctx->cipher)); bcal_cmac_lastBlock(&(ctx->ctag), block, length_b); } -void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx){ +void bcal_eax_decNextBlock(void *block, bcal_eax_ctx_t *ctx){ bcal_cmac_nextBlock(&(ctx->ctag), block); bcal_ctr_decNext(block, &(ctx->cipher)); } -void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){ +void bcal_eax_decLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx){ bcal_cmac_lastBlock(&(ctx->ctag), block, length_b); bcal_ctr_decMsg(NULL, block, length_b, &(ctx->cipher)); } -void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx){ +void bcal_eax_ctx2tag(void *dest, uint16_t length_b, bcal_eax_ctx_t *ctx){ uint8_t tmp[ctx->blocksize_B]; if(ctx->header_set==0){ bcal_cmac_lastBlock(&(ctx->htag), NULL, 0); diff --git a/bcal/bcal-eax.h b/bcal/bcal-eax.h index 190eee9..08dbe85 100644 --- a/bcal/bcal-eax.h +++ b/bcal/bcal-eax.h @@ -37,17 +37,17 @@ typedef struct{ uint8_t header_set; } bcal_eax_ctx_t; -uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx); -void bcal_eax_free(bcal_eax_ctx_t* ctx); -void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx); -void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx); -void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx); -void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx); -void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx); -void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx); -void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx); -void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx); -//void bcal_eax(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_eax_ctx_t* ctx); +uint8_t bcal_eax_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_eax_ctx_t *ctx); +void bcal_eax_free(bcal_eax_ctx_t *ctx); +void bcal_eax_loadNonce(const void *nonce, uint16_t length_b, bcal_eax_ctx_t *ctx); +void bcal_eax_addNextHeader(const void *header, bcal_eax_ctx_t *ctx); +void bcal_eax_addLastHeader(const void *header, uint16_t length_b, bcal_eax_ctx_t *ctx); +void bcal_eax_encNextBlock(void *block, bcal_eax_ctx_t *ctx); +void bcal_eax_encLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx); +void bcal_eax_decNextBlock(void *block, bcal_eax_ctx_t *ctx); +void bcal_eax_decLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx); +void bcal_eax_ctx2tag(void *dest, uint16_t length_b, bcal_eax_ctx_t *ctx); +//void bcal_eax(void *dest, uint16_t out_length_b, const void *block, uint32_t length_b, bcal_eax_ctx_t *ctx); #endif /* BCALEAX_H_ */ diff --git a/bcal/bcal-nessie.c b/bcal/bcal-nessie.c index 00121f0..f9748a3 100644 --- a/bcal/bcal-nessie.c +++ b/bcal/bcal-nessie.c @@ -26,9 +26,9 @@ #include -void(*bcal_nessie_dummy_init_fpt)(const void* key, void* ctx)=NULL; +void(*bcal_nessie_dummy_init_fpt)(const void *key, void *ctx)=NULL; -void bcal_nessie_dummy_init(const void* key, uint16_t keysize, void* ctx){ +void bcal_nessie_dummy_init(const void *key, uint16_t keysize, void *ctx){ if(bcal_nessie_dummy_init_fpt){ bcal_nessie_dummy_init_fpt(key, ctx); }else{ @@ -36,7 +36,7 @@ void bcal_nessie_dummy_init(const void* key, uint16_t keysize, void* ctx){ } } -void bcal_nessie(const bcdesc_t* bcd){ +void bcal_nessie(const bcdesc_t *bcd){ if(pgm_read_byte(&(bcd->type))!=BCDESC_TYPE_BLOCKCIPHER) return; char name[1+strlen_P((void*)pgm_read_word(&(bcd->name)))]; @@ -69,8 +69,8 @@ void bcal_nessie(const bcdesc_t* bcd){ } -void bcal_nessie_multiple(const bcdesc_t* const* bcd_list){ - const bcdesc_t* bcd; +void bcal_nessie_multiple(const bcdesc_t *const *bcd_list){ + const bcdesc_t *bcd; for(;;){ bcd = (void*)pgm_read_word(bcd_list); if(!bcd) diff --git a/bcal/bcal-nessie.h b/bcal/bcal-nessie.h index 0120961..73cff46 100644 --- a/bcal/bcal-nessie.h +++ b/bcal/bcal-nessie.h @@ -30,8 +30,8 @@ #include "blockcipher_descriptor.h" -void bcal_nessie(const bcdesc_t* bcd); -void bcal_nessie_multiple(const bcdesc_t* const* bcd_list); +void bcal_nessie(const bcdesc_t *bcd); +void bcal_nessie_multiple(const bcdesc_t *const *bcd_list); #endif /* BCALNESSIE_H_ */ diff --git a/bcal/bcal-ofb.c b/bcal/bcal-ofb.c index d7ae757..34dbc8a 100644 --- a/bcal/bcal-ofb.c +++ b/bcal/bcal-ofb.c @@ -24,7 +24,7 @@ #include "memxor.h" -uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx){ +uint8_t bcal_ofb_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_ofb_ctx_t *ctx){ ctx->desc = (bcdesc_t*)desc; ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8; ctx->in_block=malloc(ctx->blocksize_B); @@ -34,29 +34,29 @@ uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx)); } -void bcal_ofb_free(bcal_ofb_ctx_t* ctx){ +void bcal_ofb_free(bcal_ofb_ctx_t *ctx){ free(ctx->in_block); bcal_cipher_free(&(ctx->cctx)); } -void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx){ +void bcal_ofb_loadIV(const void *iv, bcal_ofb_ctx_t *ctx){ if(iv){ memcpy(ctx->in_block, iv, ctx->blocksize_B); } } -void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx){ +void bcal_ofb_encNext(void *block, bcal_ofb_ctx_t *ctx){ bcal_cipher_enc(ctx->in_block , &(ctx->cctx)); memxor(block, ctx->in_block, ctx->blocksize_B); } -void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx){ +void bcal_ofb_decNext(void *block, bcal_ofb_ctx_t *ctx){ bcal_cipher_enc(ctx->in_block , &(ctx->cctx)); memxor(block, ctx->in_block, ctx->blocksize_B); } -void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){ +void bcal_ofb_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx){ uint16_t block_len_b; block_len_b = ctx->blocksize_B*8; bcal_ofb_loadIV(iv, ctx); @@ -70,7 +70,7 @@ void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx memxor(msg, ctx->in_block, (msg_len_b+7)/8); } -void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){ +void bcal_ofb_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx){ bcal_ofb_encMsg(iv, msg, msg_len_b, ctx); } diff --git a/bcal/bcal-ofb.h b/bcal/bcal-ofb.h index aa69c05..e005fa0 100644 --- a/bcal/bcal-ofb.h +++ b/bcal/bcal-ofb.h @@ -34,13 +34,13 @@ typedef struct{ } bcal_ofb_ctx_t; -uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx); -void bcal_ofb_free(bcal_ofb_ctx_t* ctx); -void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx); -void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx); -void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx); -void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx); -void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx); +uint8_t bcal_ofb_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_ofb_ctx_t *ctx); +void bcal_ofb_free(bcal_ofb_ctx_t *ctx); +void bcal_ofb_loadIV(const void *iv, bcal_ofb_ctx_t *ctx); +void bcal_ofb_encNext(void *block, bcal_ofb_ctx_t *ctx); +void bcal_ofb_decNext(void *block, bcal_ofb_ctx_t *ctx); +void bcal_ofb_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx); +void bcal_ofb_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx); #endif /* BCALOFB_H_ */ diff --git a/bcal/bcal-performance.c b/bcal/bcal-performance.c index 267ec1c..b5b2db3 100644 --- a/bcal/bcal-performance.c +++ b/bcal/bcal-performance.c @@ -55,7 +55,7 @@ void printvalue(unsigned long v){ } */ -void bcal_performance(const bcdesc_t* bcd){ +void bcal_performance(const bcdesc_t *bcd){ bcdesc_t bc; memcpy_P(&bc, bcd, sizeof(bcdesc_t)); uint8_t ctx[bc.ctxsize_B]; @@ -136,7 +136,7 @@ void bcal_performance(const bcdesc_t* bcd){ } } -void bcal_stacksize(const bcdesc_t* bcd){ +void bcal_stacksize(const bcdesc_t *bcd){ bcdesc_t bc; stack_measuring_ctx_t smctx; memcpy_P(&bc, bcd, sizeof(bcdesc_t)); @@ -205,8 +205,8 @@ void bcal_stacksize(const bcdesc_t* bcd){ } } -void bcal_performance_multiple(const bcdesc_t* const* bcd_list){ - const bcdesc_t* bcd; +void bcal_performance_multiple(const bcdesc_t *const *bcd_list){ + const bcdesc_t *bcd; for(;;){ bcd = (void*)pgm_read_word(bcd_list); if(!bcd){ diff --git a/bcal/bcal-performance.h b/bcal/bcal-performance.h index 19207ea..7258854 100644 --- a/bcal/bcal-performance.h +++ b/bcal/bcal-performance.h @@ -31,8 +31,8 @@ #include "blockcipher_descriptor.h" -void bcal_performance(const bcdesc_t* hd); -void bcal_performance_multiple(const bcdesc_t* const* hd_list); +void bcal_performance(const bcdesc_t *hd); +void bcal_performance_multiple(const bcdesc_t *const *hd_list); #endif /* BCAL_PERFORMANCE_H_ */ diff --git a/bcal/bcal_des.c b/bcal/bcal_des.c index 0e8068b..1483660 100644 --- a/bcal/bcal_des.c +++ b/bcal/bcal_des.c @@ -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, void* key){ +void des_dummy_enc(void *block, void *key){ des_enc(block, block, key); } static -void des_dummy_dec(void* block, void* key){ +void des_dummy_dec(void *block, void *key){ des_dec(block, block, key); } diff --git a/bcal/bcal_rc5.c b/bcal/bcal_rc5.c index 9702168..b6e18f1 100644 --- a/bcal/bcal_rc5.c +++ b/bcal/bcal_rc5.c @@ -39,7 +39,7 @@ const uint8_t rc5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(20 KS_TYPE_TERMINATOR }; static -void rc5_dummy_init(void* key, uint16_t keysize_b, void* ctx){ +void rc5_dummy_init(void *key, uint16_t keysize_b, void *ctx){ rc5_init(key, keysize_b, RC5_ROUNDS, ctx); } diff --git a/bcal/bcal_tdes.c b/bcal/bcal_tdes.c index 6a6f49d..4ee3e85 100644 --- a/bcal/bcal_tdes.c +++ b/bcal/bcal_tdes.c @@ -37,12 +37,12 @@ const uint8_t tdes_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192), KS_TYPE_TERMINATOR }; static -void tdes_dummy_enc(void* block, void* key){ +void tdes_dummy_enc(void *block, void *key){ tdes_enc(block, block, key); } static -void tdes_dummy_dec(void* block, void* key){ +void tdes_dummy_dec(void *block, void *key){ tdes_dec(block, block, key); } diff --git a/bcal/bcal_tdes2.c b/bcal/bcal_tdes2.c index a39bafa..19cb85a 100644 --- a/bcal/bcal_tdes2.c +++ b/bcal/bcal_tdes2.c @@ -38,17 +38,17 @@ const uint8_t tdes2_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128), KS_TYPE_TERMINATOR }; static -void tdes_dummy_enc(void* block, void* key){ +void tdes_dummy_enc(void *block, void *key){ tdes_enc(block, block, key); } static -void tdes_dummy_dec(void* block, void* key){ +void tdes_dummy_dec(void *block, void *key){ tdes_dec(block, block, key); } static -void tdes2_init(void* key, void* ctx){ +void tdes2_init(void *key, void *ctx){ memcpy(ctx, key, 16); memcpy((uint8_t*)ctx+16, key, 8); } diff --git a/bcal/bcal_threefish1024.c b/bcal/bcal_threefish1024.c index 8f1a108..167cbf9 100644 --- a/bcal/bcal_threefish1024.c +++ b/bcal/bcal_threefish1024.c @@ -36,7 +36,7 @@ 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){ +static void threefish1024_dummy_init(void *key, void *ctx){ threefish1024_init(key, NULL, ctx); } diff --git a/bcal/bcal_threefish256.c b/bcal/bcal_threefish256.c index f95f1a2..817edbf 100644 --- a/bcal/bcal_threefish256.c +++ b/bcal/bcal_threefish256.c @@ -36,7 +36,7 @@ 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){ +static void threefish256_dummy_init(void *key, void *ctx){ threefish256_init(key, NULL, ctx); } diff --git a/bcal/bcal_threefish512.c b/bcal/bcal_threefish512.c index ff61a74..9f7f1bc 100644 --- a/bcal/bcal_threefish512.c +++ b/bcal/bcal_threefish512.c @@ -36,7 +36,7 @@ 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){ +static void threefish512_dummy_init(void *key, void *ctx){ threefish512_init(key, NULL, ctx); } diff --git a/bcal/bcal_xtea.c b/bcal/bcal_xtea.c index bd6263b..210c398 100644 --- a/bcal/bcal_xtea.c +++ b/bcal/bcal_xtea.c @@ -37,12 +37,12 @@ const uint8_t xtea_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128), KS_TYPE_TERMINATOR }; static -void xtea_dummy_enc(void* block, void* key){ +void xtea_dummy_enc(void *block, void *key){ xtea_enc(block, block, key); } static -void xtea_dummy_dec(void* block, void* key){ +void xtea_dummy_dec(void *block, void *key){ xtea_dec(block, block, key); } diff --git a/bigint/bigint-stub.c b/bigint/bigint-stub.c index a5dc765..13c01f0 100644 --- a/bigint/bigint-stub.c +++ b/bigint/bigint-stub.c @@ -58,7 +58,7 @@ /******************************************************************************/ /* -void bigint_copy(bigint_t* dest, const bigint_t* src){ +void bigint_copy(bigint_t *dest, const bigint_t *src){ memcpy(dest->wordv, src->wordv, src->length_W); dest->length_W = src->length_W; dest->info = src->info; @@ -68,7 +68,7 @@ void bigint_copy(bigint_t* dest, const bigint_t* src){ /* this should be implemented in assembly */ /* -void bigint_add_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_add_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint16_t t=0, i; if(a->length_W < b->length_W){ XCHG_PTR(a,b); @@ -92,7 +92,7 @@ void bigint_add_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /* this should be implemented in assembly */ /* -void bigint_add_scale_u(bigint_t* dest, const bigint_t* a, uint16_t scale){ +void bigint_add_scale_u(bigint_t *dest, const bigint_t *a, uint16_t scale){ uint16_t i,j=0; uint16_t t=0; if(scale>dest->length_W) @@ -122,7 +122,7 @@ void bigint_add_scale_u(bigint_t* dest, const bigint_t* a, uint16_t scale){ /******************************************************************************/ /* this should be implemented in assembly */ -void bigint_sub_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_sub_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){ int8_t borrow=0; int8_t r; int16_t t; @@ -183,7 +183,7 @@ void bigint_sub_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -int8_t bigint_cmp_u(const bigint_t* a, const bigint_t* b){ +int8_t bigint_cmp_u(const bigint_t *a, const bigint_t *b){ if(a->length_W > b->length_W){ return 1; } @@ -209,7 +209,7 @@ int8_t bigint_cmp_u(const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_add_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_add_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint8_t s; s = GET_SIGN(a)?2:0; s |= GET_SIGN(b)?1:0; @@ -235,7 +235,7 @@ void bigint_add_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_sub_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_sub_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint8_t s; s = GET_SIGN(a)?2:0; s |= GET_SIGN(b)?1:0; @@ -262,7 +262,7 @@ void bigint_sub_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -int8_t bigint_cmp_s(const bigint_t* a, const bigint_t* b){ +int8_t bigint_cmp_s(const bigint_t *a, const bigint_t *b){ uint8_t s; if(a->length_W==0 && b->length_W==0){ return 0; @@ -290,7 +290,7 @@ int8_t bigint_cmp_s(const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_shiftleft(bigint_t* a, uint16_t shift){ +void bigint_shiftleft(bigint_t *a, uint16_t shift){ uint16_t byteshift; uint16_t i; uint8_t bitshift; @@ -324,7 +324,7 @@ void bigint_shiftleft(bigint_t* a, uint16_t shift){ /******************************************************************************/ -void bigint_shiftright(bigint_t* a, uint16_t shift){ +void bigint_shiftright(bigint_t *a, uint16_t shift){ uint16_t byteshift; uint16_t i; uint8_t bitshift; @@ -359,7 +359,7 @@ void bigint_shiftright(bigint_t* a, uint16_t shift){ /******************************************************************************/ -void bigint_xor(bigint_t* dest, const bigint_t* a){ +void bigint_xor(bigint_t *dest, const bigint_t *a){ uint16_t i; for(i=0; ilength_W; ++i){ dest->wordv[i] ^= a->wordv[i]; @@ -369,7 +369,7 @@ void bigint_xor(bigint_t* dest, const bigint_t* a){ /******************************************************************************/ -void bigint_set_zero(bigint_t* a){ +void bigint_set_zero(bigint_t *a){ a->length_W=0; } @@ -377,7 +377,7 @@ void bigint_set_zero(bigint_t* a){ /* using the Karatsuba-Algorithm */ /* x*y = (xh*yh)*b**2n + ((xh+xl)*(yh+yl) - xh*yh - xl*yl)*b**n + yh*yl */ -void bigint_mul_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_mul_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){ if(a->length_W==0 || b->length_W==0){ bigint_set_zero(dest); return; @@ -470,7 +470,7 @@ void bigint_mul_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_mul_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_mul_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint8_t s; s = GET_SIGN(a)?2:0; s |= GET_SIGN(b)?1:0; @@ -500,7 +500,7 @@ void bigint_mul_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /* square */ /* (xh*b^n+xl)^2 = xh^2*b^2n + 2*xh*xl*b^n + xl^2 */ -void bigint_square(bigint_t* dest, const bigint_t* a){ +void bigint_square(bigint_t *dest, const bigint_t *a){ if(a->length_W<=4){ uint64_t r=0; memcpy(&r, a->wordv, a->length_W); @@ -538,7 +538,7 @@ void bigint_square(bigint_t* dest, const bigint_t* a){ /******************************************************************************/ -void bigint_sub_u_bitscale(bigint_t* a, const bigint_t* b, uint16_t bitscale){ +void bigint_sub_u_bitscale(bigint_t *a, const bigint_t *b, uint16_t bitscale){ bigint_t tmp; uint8_t tmp_b[b->length_W+1]; uint16_t i,j,byteshift=bitscale/8; @@ -579,7 +579,7 @@ void bigint_sub_u_bitscale(bigint_t* a, const bigint_t* b, uint16_t bitscale){ /******************************************************************************/ -void bigint_reduce(bigint_t* a, const bigint_t* r){ +void bigint_reduce(bigint_t *a, const bigint_t *r){ // bigint_adjust(r); uint8_t rfbs = GET_FBS(r); @@ -602,7 +602,7 @@ void bigint_reduce(bigint_t* a, const bigint_t* r){ /* calculate dest = a**exp % r */ /* using square&multiply */ -void bigint_expmod_u(bigint_t* dest, const bigint_t* a, const bigint_t* exp, const bigint_t* r){ +void bigint_expmod_u(bigint_t *dest, const bigint_t *a, const bigint_t *exp, const bigint_t *r){ if(a->length_W==0 || r->length_W==0){ return; } @@ -647,7 +647,7 @@ void bigint_expmod_u(bigint_t* dest, const bigint_t* a, const bigint_t* exp, con /******************************************************************************/ /* gcd <-- gcd(x,y) a*x+b*y=gcd */ -void bigint_gcdext(bigint_t* gcd, bigint_t* a, bigint_t* b, const bigint_t* x, const bigint_t* y){ +void bigint_gcdext(bigint_t *gcd, bigint_t *a, bigint_t *b, const bigint_t *x, const bigint_t *y){ bigint_t g, x_, y_, u, v, a_, b_, c_, d_; volatile uint16_t i=0; if(x->length_W==0 || y->length_W==0){ @@ -744,7 +744,7 @@ void bigint_gcdext(bigint_t* gcd, bigint_t* a, bigint_t* b, const bigint_t* x, c /******************************************************************************/ -void bigint_inverse(bigint_t* dest, const bigint_t* a, const bigint_t* m){ +void bigint_inverse(bigint_t *dest, const bigint_t *a, const bigint_t *m){ bigint_gcdext(NULL, dest, NULL, a, m); while(dest->info&BIGINT_NEG_MASK){ bigint_add_s(dest, dest, m); @@ -753,7 +753,7 @@ void bigint_inverse(bigint_t* dest, const bigint_t* a, const bigint_t* m){ /******************************************************************************/ -void bigint_changeendianess(bigint_t* a){ +void bigint_changeendianess(bigint_t *a){ uint8_t t, *p, *q; p = a->wordv; q = p+a->length_W-1; diff --git a/bigint/bigint.c b/bigint/bigint.c index 7ba80b3..bf854cc 100644 --- a/bigint/bigint.c +++ b/bigint/bigint.c @@ -61,7 +61,7 @@ #define GET_SIGN(a) ((a)->info&BIGINT_NEG_MASK) /******************************************************************************/ -void bigint_adjust(bigint_t* a){ +void bigint_adjust(bigint_t *a){ while(a->length_W!=0 && a->wordv[a->length_W-1]==0){ a->length_W--; } @@ -81,7 +81,7 @@ void bigint_adjust(bigint_t* a){ /******************************************************************************/ -uint16_t bigint_length_b(const bigint_t* a){ +uint16_t bigint_length_b(const bigint_t *a){ if(!a->length_W || a->length_W==0){ return 0; } @@ -90,13 +90,13 @@ uint16_t bigint_length_b(const bigint_t* a){ /******************************************************************************/ -uint16_t bigint_length_B(const bigint_t* a){ +uint16_t bigint_length_B(const bigint_t *a){ return a->length_W * sizeof(bigint_word_t); } /******************************************************************************/ -uint32_t bigint_get_first_set_bit(const bigint_t* a){ +uint32_t bigint_get_first_set_bit(const bigint_t *a){ if(a->length_W==0){ return (uint32_t)(-1); } @@ -106,7 +106,7 @@ uint32_t bigint_get_first_set_bit(const bigint_t* a){ /******************************************************************************/ -uint32_t bigint_get_last_set_bit(const bigint_t* a){ +uint32_t bigint_get_last_set_bit(const bigint_t *a){ uint32_t r=0; uint8_t b=0; bigint_word_t x=1; @@ -128,7 +128,7 @@ uint32_t bigint_get_last_set_bit(const bigint_t* a){ /******************************************************************************/ -void bigint_copy(bigint_t* dest, const bigint_t* src){ +void bigint_copy(bigint_t *dest, const bigint_t *src){ if(dest->wordv != src->wordv){ memcpy(dest->wordv, src->wordv, src->length_W * sizeof(bigint_word_t)); } @@ -139,7 +139,7 @@ void bigint_copy(bigint_t* dest, const bigint_t* src){ /******************************************************************************/ /* this should be implemented in assembly */ -void bigint_add_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_add_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint16_t i; bigint_wordplus_t t = 0LL; if(a->length_W < b->length_W){ @@ -167,7 +167,7 @@ void bigint_add_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ /* this should be implemented in assembly */ -void bigint_add_scale_u(bigint_t* dest, const bigint_t* a, uint16_t scale){ +void bigint_add_scale_u(bigint_t *dest, const bigint_t *a, uint16_t scale){ if(a->length_W == 0){ return; } @@ -218,7 +218,7 @@ void bigint_add_scale_u(bigint_t* dest, const bigint_t* a, uint16_t scale){ /******************************************************************************/ /* this should be implemented in assembly */ -void bigint_sub_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_sub_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){ int8_t borrow=0; int8_t r; bigint_wordplus_signed_t t=0LL; @@ -263,7 +263,7 @@ void bigint_sub_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -int8_t bigint_cmp_u(const bigint_t* a, const bigint_t* b){ +int8_t bigint_cmp_u(const bigint_t *a, const bigint_t *b){ if(a->length_W > b->length_W){ return 1; } @@ -289,7 +289,7 @@ int8_t bigint_cmp_u(const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_add_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_add_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint8_t s; s = GET_SIGN(a)?2:0; s |= GET_SIGN(b)?1:0; @@ -315,7 +315,7 @@ void bigint_add_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_sub_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_sub_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint8_t s; s = GET_SIGN(a)?2:0; s |= GET_SIGN(b)?1:0; @@ -342,7 +342,7 @@ void bigint_sub_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -int8_t bigint_cmp_s(const bigint_t* a, const bigint_t* b){ +int8_t bigint_cmp_s(const bigint_t *a, const bigint_t *b){ uint8_t s; if(a->length_W==0 && b->length_W==0){ return 0; @@ -370,7 +370,7 @@ int8_t bigint_cmp_s(const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_shiftleft(bigint_t* a, uint16_t shift){ +void bigint_shiftleft(bigint_t *a, uint16_t shift){ uint16_t byteshift, words_to_shift; int16_t i; uint8_t bitshift; @@ -408,7 +408,7 @@ void bigint_shiftleft(bigint_t* a, uint16_t shift){ /******************************************************************************/ -void bigint_shiftright(bigint_t* a, uint16_t shift){ +void bigint_shiftright(bigint_t *a, uint16_t shift){ uint16_t byteshift; uint16_t i; uint8_t bitshift; @@ -445,7 +445,7 @@ void bigint_shiftright(bigint_t* a, uint16_t shift){ /******************************************************************************/ -void bigint_xor(bigint_t* dest, const bigint_t* a){ +void bigint_xor(bigint_t *dest, const bigint_t *a){ uint16_t i; for(i=0; ilength_W; ++i){ dest->wordv[i] ^= a->wordv[i]; @@ -455,7 +455,7 @@ void bigint_xor(bigint_t* dest, const bigint_t* a){ /******************************************************************************/ -void bigint_set_zero(bigint_t* a){ +void bigint_set_zero(bigint_t *a){ a->length_W=0; } @@ -463,7 +463,7 @@ void bigint_set_zero(bigint_t* a){ /* using the Karatsuba-Algorithm */ /* x*y = (xh*yh)*b**2n + ((xh+xl)*(yh+yl) - xh*yh - xl*yl)*b**n + yh*yl */ -void bigint_mul_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_mul_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){ if(a->length_W == 0 || b->length_W == 0){ bigint_set_zero(dest); return; @@ -564,7 +564,7 @@ void bigint_mul_u(bigint_t* dest, const bigint_t* a, const bigint_t* b){ /******************************************************************************/ -void bigint_mul_s(bigint_t* dest, const bigint_t* a, const bigint_t* b){ +void bigint_mul_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){ uint8_t s; s = GET_SIGN(a)?2:0; s |= GET_SIGN(b)?1:0; @@ -599,7 +599,7 @@ unsigned square_depth = 0; /* square */ /* (xh*b^n+xl)^2 = xh^2*b^2n + 2*xh*xl*b^n + xl^2 */ -void bigint_square(bigint_t* dest, const bigint_t* a){ +void bigint_square(bigint_t *dest, const bigint_t *a){ if(a->length_W * sizeof(bigint_word_t) <= 4){ uint64_t r = 0; memcpy(&r, a->wordv, a->length_W * sizeof(bigint_word_t)); @@ -684,7 +684,7 @@ void bigint_square(bigint_t* dest, const bigint_t* a){ /******************************************************************************/ -void bigint_sub_u_bitscale(bigint_t* a, const bigint_t* b, uint16_t bitscale){ +void bigint_sub_u_bitscale(bigint_t *a, const bigint_t *b, uint16_t bitscale){ bigint_t tmp, x; bigint_word_t tmp_b[b->length_W + 1]; const uint16_t word_shift = bitscale / BIGINT_WORD_SIZE; @@ -711,7 +711,7 @@ void bigint_sub_u_bitscale(bigint_t* a, const bigint_t* b, uint16_t bitscale){ /******************************************************************************/ -void bigint_reduce(bigint_t* a, const bigint_t* r){ +void bigint_reduce(bigint_t *a, const bigint_t *r){ // bigint_adjust((bigint_t*)r); uint8_t rfbs = GET_FBS(r); #if DEBUG @@ -772,7 +772,7 @@ void bigint_reduce(bigint_t* a, const bigint_t* r){ /* calculate dest = a**exp % r */ /* using square&multiply */ -void bigint_expmod_u_sam(bigint_t* dest, const bigint_t* a, const bigint_t* exp, const bigint_t* r){ +void bigint_expmod_u_sam(bigint_t *dest, const bigint_t *a, const bigint_t *exp, const bigint_t *r){ if(a->length_W==0 || r->length_W==0){ return; } @@ -835,7 +835,7 @@ void bigint_expmod_u_sam(bigint_t* dest, const bigint_t* a, const bigint_t* exp, #define printf_P(...) #endif /* gcd <-- gcd(x,y) a*x+b*y=gcd */ -void bigint_gcdext(bigint_t* gcd, bigint_t* a, bigint_t* b, const bigint_t* x, const bigint_t* y){ +void bigint_gcdext(bigint_t *gcd, bigint_t *a, bigint_t *b, const bigint_t *x, const bigint_t *y){ uint16_t i = 0; printf_P(PSTR("\nDBG: gcdext( ")); bigint_print_hex(x); @@ -1009,7 +1009,7 @@ void bigint_gcdext(bigint_t* gcd, bigint_t* a, bigint_t* b, const bigint_t* x, c /******************************************************************************/ -void bigint_inverse(bigint_t* dest, const bigint_t* a, const bigint_t* m){ +void bigint_inverse(bigint_t *dest, const bigint_t *a, const bigint_t *m){ bigint_gcdext(NULL, dest, NULL, a, m); while(dest->info&BIGINT_NEG_MASK){ bigint_add_s(dest, dest, m); @@ -1018,7 +1018,7 @@ void bigint_inverse(bigint_t* dest, const bigint_t* a, const bigint_t* m){ /******************************************************************************/ -void bigint_changeendianess(bigint_t* a){ +void bigint_changeendianess(bigint_t *a){ uint8_t t, *p, *q; p = (uint8_t*)(a->wordv); q = p + a->length_W * sizeof(bigint_word_t) - 1; @@ -1037,7 +1037,7 @@ void bigint_changeendianess(bigint_t* a){ /******************************************************************************/ -void bigint_expmod_u(bigint_t* dest, const bigint_t* a, const bigint_t* exp, const bigint_t* r){ +void bigint_expmod_u(bigint_t *dest, const bigint_t *a, const bigint_t *exp, const bigint_t *r){ bigint_expmod_u_sam(dest, a, exp, r); } diff --git a/bigint/bigint.h b/bigint/bigint.h index 0966f97..59dcc35 100644 --- a/bigint/bigint.h +++ b/bigint/bigint.h @@ -47,32 +47,32 @@ typedef struct{ /******************************************************************************/ -void bigint_adjust(bigint_t* a); -uint32_t bigint_get_first_set_bit(const bigint_t* a); -uint32_t bigint_get_last_set_bit(const bigint_t* a); -uint16_t bigint_length_b(const bigint_t* a); -uint16_t bigint_length_B(const bigint_t* a); -void bigint_copy(bigint_t* dest, const bigint_t* src); -void bigint_add_u(bigint_t* dest, const bigint_t* a, const bigint_t* b); -void bigint_add_scale_u(bigint_t* dest, const bigint_t* a, uint16_t scale); -void bigint_sub_u(bigint_t* dest, const bigint_t* a, const bigint_t* b); +void bigint_adjust(bigint_t *a); +uint32_t bigint_get_first_set_bit(const bigint_t *a); +uint32_t bigint_get_last_set_bit(const bigint_t *a); +uint16_t bigint_length_b(const bigint_t *a); +uint16_t bigint_length_B(const bigint_t *a); +void bigint_copy(bigint_t *dest, const bigint_t *src); +void bigint_add_u(bigint_t *dest, const bigint_t *a, const bigint_t *b); +void bigint_add_scale_u(bigint_t *dest, const bigint_t *a, uint16_t scale); +void bigint_sub_u(bigint_t *dest, const bigint_t *a, const bigint_t *b); int8_t bigint_cmp_u(const bigint_t * a, const bigint_t * b); -void bigint_add_s(bigint_t* dest, const bigint_t* a, const bigint_t* b); -void bigint_sub_s(bigint_t* dest, const bigint_t* a, const bigint_t* b); -int8_t bigint_cmp_s(const bigint_t* a, const bigint_t* b); -void bigint_shiftleft(bigint_t* a, uint16_t shift); -void bigint_shiftright(bigint_t* a, uint16_t shift); -void bigint_xor(bigint_t* dest, const bigint_t* a); -void bigint_set_zero(bigint_t* a); -void bigint_mul_u(bigint_t* dest, const bigint_t* a, const bigint_t* b); -void bigint_mul_s(bigint_t* dest, const bigint_t* a, const bigint_t* b); -void bigint_square(bigint_t* dest, const bigint_t* a); -void bigint_sub_u_bitscale(bigint_t* a, const bigint_t* b, uint16_t bitscale); -void bigint_reduce(bigint_t* a, const bigint_t* r); -void bigint_expmod_u(bigint_t* dest, const bigint_t* a, const bigint_t* exp, const bigint_t* r); -void bigint_gcdext(bigint_t* gcd, bigint_t* a, bigint_t* b, const bigint_t* x, const bigint_t* y); -void bigint_inverse(bigint_t* dest, const bigint_t* a, const bigint_t* m); -void bigint_changeendianess(bigint_t* a); +void bigint_add_s(bigint_t *dest, const bigint_t *a, const bigint_t *b); +void bigint_sub_s(bigint_t *dest, const bigint_t *a, const bigint_t *b); +int8_t bigint_cmp_s(const bigint_t *a, const bigint_t *b); +void bigint_shiftleft(bigint_t *a, uint16_t shift); +void bigint_shiftright(bigint_t *a, uint16_t shift); +void bigint_xor(bigint_t *dest, const bigint_t *a); +void bigint_set_zero(bigint_t *a); +void bigint_mul_u(bigint_t *dest, const bigint_t *a, const bigint_t *b); +void bigint_mul_s(bigint_t *dest, const bigint_t *a, const bigint_t *b); +void bigint_square(bigint_t *dest, const bigint_t *a); +void bigint_sub_u_bitscale(bigint_t *a, const bigint_t *b, uint16_t bitscale); +void bigint_reduce(bigint_t *a, const bigint_t *r); +void bigint_expmod_u(bigint_t *dest, const bigint_t *a, const bigint_t *exp, const bigint_t *r); +void bigint_gcdext(bigint_t *gcd, bigint_t *a, bigint_t *b, const bigint_t *x, const bigint_t *y); +void bigint_inverse(bigint_t *dest, const bigint_t *a, const bigint_t *m); +void bigint_changeendianess(bigint_t *a); /******************************************************************************/ #endif /*BIGINT_H_*/ diff --git a/bigint/bigint_adjust.S b/bigint/bigint_adjust.S index 56ff2a1..5bdfcca 100644 --- a/bigint/bigint_adjust.S +++ b/bigint/bigint_adjust.S @@ -18,7 +18,7 @@ */ /* -void bigint_adjust(bigint_t* a){ +void bigint_adjust(bigint_t *a){ while(a->length_B!=0 && a->wordv[a->length_B-1]==0){ a->length_B--; } @@ -76,7 +76,7 @@ bigint_adjust_ret: ret /* -void bigint_copy(bigint_t* dest, const bigint_t* src){ +void bigint_copy(bigint_t *dest, const bigint_t *src){ memcpy(dest->wordv, src->wordv, src->length_B); dest->length_B = src->length_B; dest->info = src->info; diff --git a/bigint/bigint_asm.S b/bigint/bigint_asm.S index 1942fa3..1fe05cb 100644 --- a/bigint/bigint_asm.S +++ b/bigint/bigint_asm.S @@ -24,7 +24,7 @@ /******************************************************************************/ /* -void bigint_add_scale_u(bigint_t* dest, const bigint_t* a, uint16_t scale){ +void bigint_add_scale_u(bigint_t *dest, const bigint_t *a, uint16_t scale){ uint16_t i,j=0; uint16_t t=0; if(scale>dest->length_B) diff --git a/bigint/bigint_io.c b/bigint/bigint_io.c index 9b942ea..4ba078e 100644 --- a/bigint/bigint_io.c +++ b/bigint/bigint_io.c @@ -23,7 +23,7 @@ #include #include -void bigint_print_hex(const bigint_t* a){ +void bigint_print_hex(const bigint_t *a){ if(a->length_W==0){ cli_putc('0'); return; @@ -94,7 +94,7 @@ static uint16_t read_byte(void){ return (t1<<4)|t2; } -uint8_t bigint_read_hex_echo(bigint_t* a){ +uint8_t bigint_read_hex_echo(bigint_t *a){ uint16_t allocated=0; uint8_t shift4=0; uint16_t t, idx = 0; diff --git a/bigint/bigint_io.h b/bigint/bigint_io.h index e82247e..2187ffe 100644 --- a/bigint/bigint_io.h +++ b/bigint/bigint_io.h @@ -22,7 +22,7 @@ #include "bigint.h" -void bigint_print_hex(const bigint_t* a); -uint8_t bigint_read_hex_echo(bigint_t* a); +void bigint_print_hex(const bigint_t *a); +uint8_t bigint_read_hex_echo(bigint_t *a); #endif /* BIGINT_IO_H_ */ diff --git a/blake/blake_large.c b/blake/blake_large.c index 9dc118b..916970e 100644 --- a/blake/blake_large.c +++ b/blake/blake_large.c @@ -33,7 +33,7 @@ #include "blake_common.h" static -uint64_t pgm_read_qword(const void* p){ +uint64_t pgm_read_qword(const void *p){ union{ uint64_t v64; uint32_t v32[2]; @@ -65,7 +65,7 @@ const uint64_t blake_c[] PROGMEM = { (a)>>24 ) static -void blake_large_expand(uint64_t* v, const blake_large_ctx_t* ctx){ +void blake_large_expand(uint64_t *v, const blake_large_ctx_t *ctx){ uint8_t i; memcpy(v, ctx->h, 8*8); for(i=0; i<8; ++i){ @@ -76,7 +76,7 @@ void blake_large_expand(uint64_t* v, const blake_large_ctx_t* ctx){ } static -void blake_large_changeendian(void* dest, const void* src){ +void blake_large_changeendian(void *dest, const void *src){ uint8_t i; uint32_t tmp; for(i=0; i<32; i+=2){ @@ -87,7 +87,7 @@ void blake_large_changeendian(void* dest, const void* src){ } static -void blake_large_compress(uint64_t* v,const void* m){ +void blake_large_compress(uint64_t *v,const void *m){ uint8_t r,i; uint8_t a,b,c,d, s0, s1, sigma_idx=0; for(r=0; r<16; ++r){ @@ -116,14 +116,14 @@ void blake_large_compress(uint64_t* v,const void* m){ } static -void blake_large_collapse(blake_large_ctx_t* ctx, uint64_t* v){ +void blake_large_collapse(blake_large_ctx_t *ctx, uint64_t *v){ uint8_t i; for(i=0; i<8; ++i){ ctx->h[i] ^= ctx->s[i%4] ^ v[i] ^ v[8+i]; } } -void blake_large_nextBlock(blake_large_ctx_t* ctx, const void* msg){ +void blake_large_nextBlock(blake_large_ctx_t *ctx, const void *msg){ uint64_t v[16]; uint64_t m[16]; union { @@ -140,7 +140,7 @@ void blake_large_nextBlock(blake_large_ctx_t* ctx, const void* msg){ blake_large_collapse(ctx, v); } -void blake_large_lastBlock(blake_large_ctx_t* ctx, const void* msg, uint16_t length_b){ +void blake_large_lastBlock(blake_large_ctx_t *ctx, const void *msg, uint16_t length_b){ while(length_b>=BLAKE_LARGE_BLOCKSIZE){ blake_large_nextBlock(ctx, msg); msg = (uint8_t*)msg + BLAKE_LARGE_BLOCKSIZE_B; @@ -186,7 +186,7 @@ const uint64_t blake512_iv[] PROGMEM = { 0x1F83D9ABFB41BD6BLL, 0x5BE0CD19137E2179LL }; -void blake512_init(blake512_ctx_t* ctx){ +void blake512_init(blake512_ctx_t *ctx){ uint8_t i; for(i=0; i<8; ++i){ ctx->h[i] = pgm_read_qword(&(blake512_iv[i])); @@ -203,7 +203,7 @@ const uint64_t blake384_iv[] PROGMEM = { 0xDB0C2E0D64F98FA7LL, 0x47B5481DBEFA4FA4LL }; -void blake384_init(blake384_ctx_t* ctx){ +void blake384_init(blake384_ctx_t *ctx){ uint8_t i; for(i=0; i<8; ++i){ ctx->h[i] = pgm_read_qword(&(blake384_iv[i])); @@ -213,7 +213,7 @@ void blake384_init(blake384_ctx_t* ctx){ ctx->appendone = 0; } -void blake512_ctx2hash(void* dest, const blake512_ctx_t* ctx){ +void blake512_ctx2hash(void *dest, const blake512_ctx_t *ctx){ uint8_t i; for(i=0; i<8; ++i){ ((uint32_t*)dest)[2*i+0] = CHANGE_ENDIAN32((ctx->h[i])>>32); @@ -221,7 +221,7 @@ void blake512_ctx2hash(void* dest, const blake512_ctx_t* ctx){ } } -void blake384_ctx2hash(void* dest, const blake384_ctx_t* ctx){ +void blake384_ctx2hash(void *dest, const blake384_ctx_t *ctx){ uint8_t i; for(i=0; i<6; ++i){ ((uint32_t*)dest)[2*i+0] = CHANGE_ENDIAN32((ctx->h[i])>>32); @@ -229,23 +229,23 @@ void blake384_ctx2hash(void* dest, const blake384_ctx_t* ctx){ } } -void blake512_nextBlock(blake512_ctx_t* ctx, const void* block){ +void blake512_nextBlock(blake512_ctx_t *ctx, const void *block){ blake_large_nextBlock(ctx, block); } -void blake384_nextBlock(blake384_ctx_t* ctx, const void* block){ +void blake384_nextBlock(blake384_ctx_t *ctx, const void *block){ blake_large_nextBlock(ctx, block); } -void blake512_lastBlock(blake512_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake512_lastBlock(blake512_ctx_t *ctx, const void *block, uint16_t length_b){ blake_large_lastBlock(ctx, block, length_b); } -void blake384_lastBlock(blake384_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake384_lastBlock(blake384_ctx_t *ctx, const void *block, uint16_t length_b){ blake_large_lastBlock(ctx, block, length_b); } -void blake512(void* dest, const void* msg, uint32_t length_b){ +void blake512(void *dest, const void *msg, uint32_t length_b){ blake_large_ctx_t ctx; blake512_init(&ctx); while(length_b>=BLAKE_LARGE_BLOCKSIZE){ @@ -257,7 +257,7 @@ void blake512(void* dest, const void* msg, uint32_t length_b){ blake512_ctx2hash(dest, &ctx); } -void blake384(void* dest, const void* msg, uint32_t length_b){ +void blake384(void *dest, const void *msg, uint32_t length_b){ blake_large_ctx_t ctx; blake384_init(&ctx); while(length_b>=BLAKE_LARGE_BLOCKSIZE){ diff --git a/blake/blake_large.h b/blake/blake_large.h index 0ad66ea..472e164 100644 --- a/blake/blake_large.h +++ b/blake/blake_large.h @@ -46,22 +46,22 @@ typedef struct { typedef blake_large_ctx_t blake384_ctx_t; typedef blake_large_ctx_t blake512_ctx_t; -void blake384_init(blake384_ctx_t* ctx); -void blake512_init(blake512_ctx_t* ctx); +void blake384_init(blake384_ctx_t *ctx); +void blake512_init(blake512_ctx_t *ctx); -void blake_large_nextBlock(blake_large_ctx_t* ctx, const void* block); -void blake_large_lastBlock(blake_large_ctx_t* ctx, const void* block, uint16_t length_b); +void blake_large_nextBlock(blake_large_ctx_t *ctx, const void *block); +void blake_large_lastBlock(blake_large_ctx_t *ctx, const void *block, uint16_t length_b); -void blake384_nextBlock(blake384_ctx_t* ctx, const void* block); -void blake384_lastBlock(blake384_ctx_t* ctx, const void* block, uint16_t length_b); +void blake384_nextBlock(blake384_ctx_t *ctx, const void *block); +void blake384_lastBlock(blake384_ctx_t *ctx, const void *block, uint16_t length_b); -void blake512_nextBlock(blake512_ctx_t* ctx, const void* block); -void blake512_lastBlock(blake512_ctx_t* ctx, const void* block, uint16_t length_b); +void blake512_nextBlock(blake512_ctx_t *ctx, const void *block); +void blake512_lastBlock(blake512_ctx_t *ctx, const void *block, uint16_t length_b); -void blake384_ctx2hash(void* dest, const blake384_ctx_t* ctx); -void blake512_ctx2hash(void* dest, const blake512_ctx_t* ctx); +void blake384_ctx2hash(void *dest, const blake384_ctx_t *ctx); +void blake512_ctx2hash(void *dest, const blake512_ctx_t *ctx); -void blake384(void* dest, const void* msg, uint32_t length_b); -void blake512(void* dest, const void* msg, uint32_t length_b); +void blake384(void *dest, const void *msg, uint32_t length_b); +void blake512(void *dest, const void *msg, uint32_t length_b); #endif /* BLAKE_LARGE_H_ */ diff --git a/blake/blake_small.c b/blake/blake_small.c index fafea39..9467b04 100644 --- a/blake/blake_small.c +++ b/blake/blake_small.c @@ -51,7 +51,7 @@ const uint32_t blake_c[] PROGMEM = { ((0x00ff0000&(a))>>8)| \ (a)>>24 ) static -void blake_small_expand(uint32_t* v, const blake_small_ctx_t* ctx){ +void blake_small_expand(uint32_t *v, const blake_small_ctx_t *ctx){ uint8_t i; memcpy(v, ctx->h, 8*4); for(i=0; i<8; ++i){ @@ -62,7 +62,7 @@ void blake_small_expand(uint32_t* v, const blake_small_ctx_t* ctx){ } static -void blake_small_changeendian(void* dest, const void* src){ +void blake_small_changeendian(void *dest, const void *src){ uint8_t i; for(i=0; i<16; ++i){ ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(((uint32_t*)src)[i]); @@ -70,7 +70,7 @@ void blake_small_changeendian(void* dest, const void* src){ } static -void blake_small_compress(uint32_t* v,const void* m){ +void blake_small_compress(uint32_t *v,const void *m){ uint8_t r,i; uint8_t a,b,c,d, s0, s1, sigma_idx=0; uint32_t lv[4]; @@ -109,14 +109,14 @@ void blake_small_compress(uint32_t* v,const void* m){ } static -void blake_small_collapse(blake_small_ctx_t* ctx, uint32_t* v){ +void blake_small_collapse(blake_small_ctx_t *ctx, uint32_t *v){ uint8_t i; for(i=0; i<8; ++i){ ctx->h[i] ^= ctx->s[i%4] ^ v[i] ^ v[8+i]; } } -void blake_small_nextBlock(blake_small_ctx_t* ctx, const void* msg){ +void blake_small_nextBlock(blake_small_ctx_t *ctx, const void *msg){ uint32_t v[16]; uint32_t m[16]; union { @@ -135,7 +135,7 @@ void blake_small_nextBlock(blake_small_ctx_t* ctx, const void* msg){ blake_small_collapse(ctx, v); } -void blake_small_lastBlock(blake_small_ctx_t* ctx, const void* msg, uint16_t length_b){ +void blake_small_lastBlock(blake_small_ctx_t *ctx, const void *msg, uint16_t length_b){ while(length_b>=BLAKE_SMALL_BLOCKSIZE){ blake_small_nextBlock(ctx, msg); msg = (uint8_t*)msg + BLAKE_SMALL_BLOCKSIZE_B; @@ -189,7 +189,7 @@ const uint32_t blake256_iv[] PROGMEM = { 0x1F83D9ABL, 0x5BE0CD19 }; -void blake256_init(blake256_ctx_t* ctx){ +void blake256_init(blake256_ctx_t *ctx){ uint8_t i; for(i=0; i<8; ++i){ ctx->h[i] = pgm_read_dword(&(blake256_iv[i])); @@ -206,7 +206,7 @@ const uint32_t blake224_iv[] PROGMEM = { 0x64F98FA7, 0xBEFA4FA4 }; -void blake224_init(blake224_ctx_t* ctx){ +void blake224_init(blake224_ctx_t *ctx){ uint8_t i; for(i=0; i<8; ++i){ ctx->h[i] = pgm_read_dword(&(blake224_iv[i])); @@ -216,37 +216,37 @@ void blake224_init(blake224_ctx_t* ctx){ ctx->appendone = 0; } -void blake256_ctx2hash(void* dest, const blake256_ctx_t* ctx){ +void blake256_ctx2hash(void *dest, const blake256_ctx_t *ctx){ uint8_t i; for(i=0; i<8; ++i){ ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(ctx->h[i]); } } -void blake224_ctx2hash(void* dest, const blake224_ctx_t* ctx){ +void blake224_ctx2hash(void *dest, const blake224_ctx_t *ctx){ uint8_t i; for(i=0; i<7; ++i){ ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(ctx->h[i]); } } -void blake256_nextBlock(blake256_ctx_t* ctx, const void* block){ +void blake256_nextBlock(blake256_ctx_t *ctx, const void *block){ blake_small_nextBlock(ctx, block); } -void blake224_nextBlock(blake224_ctx_t* ctx, const void* block){ +void blake224_nextBlock(blake224_ctx_t *ctx, const void *block){ blake_small_nextBlock(ctx, block); } -void blake256_lastBlock(blake256_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake256_lastBlock(blake256_ctx_t *ctx, const void *block, uint16_t length_b){ blake_small_lastBlock(ctx, block, length_b); } -void blake224_lastBlock(blake224_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake224_lastBlock(blake224_ctx_t *ctx, const void *block, uint16_t length_b){ blake_small_lastBlock(ctx, block, length_b); } -void blake256(void* dest, const void* msg, uint32_t length_b){ +void blake256(void *dest, const void *msg, uint32_t length_b){ blake_small_ctx_t ctx; blake256_init(&ctx); while(length_b>=BLAKE_SMALL_BLOCKSIZE){ @@ -258,7 +258,7 @@ void blake256(void* dest, const void* msg, uint32_t length_b){ blake256_ctx2hash(dest, &ctx); } -void blake224(void* dest, const void* msg, uint32_t length_b){ +void blake224(void *dest, const void *msg, uint32_t length_b){ blake_small_ctx_t ctx; blake224_init(&ctx); while(length_b>=BLAKE_SMALL_BLOCKSIZE){ diff --git a/blake/blake_small.h b/blake/blake_small.h index 3d96cf7..2fa49b1 100644 --- a/blake/blake_small.h +++ b/blake/blake_small.h @@ -46,22 +46,22 @@ typedef struct { typedef blake_small_ctx_t blake224_ctx_t; typedef blake_small_ctx_t blake256_ctx_t; -void blake224_init(blake224_ctx_t* ctx); -void blake256_init(blake256_ctx_t* ctx); +void blake224_init(blake224_ctx_t *ctx); +void blake256_init(blake256_ctx_t *ctx); -void blake_small_nextBlock(blake_small_ctx_t* ctx, const void* block); -void blake_small_lastBlock(blake_small_ctx_t* ctx, const void* block, uint16_t length_b); +void blake_small_nextBlock(blake_small_ctx_t *ctx, const void *block); +void blake_small_lastBlock(blake_small_ctx_t *ctx, const void *block, uint16_t length_b); -void blake224_nextBlock(blake224_ctx_t* ctx, const void* block); -void blake224_lastBlock(blake224_ctx_t* ctx, const void* block, uint16_t length_b); +void blake224_nextBlock(blake224_ctx_t *ctx, const void *block); +void blake224_lastBlock(blake224_ctx_t *ctx, const void *block, uint16_t length_b); -void blake256_nextBlock(blake256_ctx_t* ctx, const void* block); -void blake256_lastBlock(blake256_ctx_t* ctx, const void* block, uint16_t length_b); +void blake256_nextBlock(blake256_ctx_t *ctx, const void *block); +void blake256_lastBlock(blake256_ctx_t *ctx, const void *block, uint16_t length_b); -void blake224_ctx2hash(void* dest, const blake224_ctx_t* ctx); -void blake256_ctx2hash(void* dest, const blake256_ctx_t* ctx); +void blake224_ctx2hash(void *dest, const blake224_ctx_t *ctx); +void blake256_ctx2hash(void *dest, const blake256_ctx_t *ctx); -void blake224(void* dest, const void* msg, uint32_t length_b); -void blake256(void* dest, const void* msg, uint32_t length_b); +void blake224(void *dest, const void *msg, uint32_t length_b); +void blake256(void *dest, const void *msg, uint32_t length_b); #endif /* BLAKE_SMALL_H_ */ diff --git a/blockcipher_descriptor.h b/blockcipher_descriptor.h index 1fbeab8..33a9ba3 100644 --- a/blockcipher_descriptor.h +++ b/blockcipher_descriptor.h @@ -90,7 +90,7 @@ typedef struct { } bcdesc_t; /* blockcipher descriptor type */ typedef struct{ - bcdesc_t* desc_ptr; + bcdesc_t *desc_ptr; uint16_t keysize; void* ctx; } bcgen_ctx_t; diff --git a/bmw/bmw_224-tinyasm.S b/bmw/bmw_224-tinyasm.S index 5b3c657..8f4c1f6 100644 --- a/bmw/bmw_224-tinyasm.S +++ b/bmw/bmw_224-tinyasm.S @@ -279,7 +279,7 @@ f0_hacktable: /******************************************************************************* -* uint32_t addelment(uint8_t j, const uint32_t* m, const uint32_t* h){ +* uint32_t addelment(uint8_t j, const uint32_t *m, const uint32_t *h){ * uint32_t r; * r = pgm_read_dword(k_lut+j); * r += rotl_addel(((uint32_t*)m)[j&0xf], j+0); @@ -1017,7 +1017,7 @@ bmw256_lastBlock: /******************************************************************************* -* void bmw224_ctx2hash(void* dest, const bmw224_ctx_t* ctx){ +* void bmw224_ctx2hash(void *dest, const bmw224_ctx_t *ctx){ * memcpy(dest, &(ctx->h[9]), 224/8); * } * @@ -1038,7 +1038,7 @@ bmw224_ctx2hash: /******************************************************************************* -* void bmw224(void* dest, const void* msg, uint32_t length_b){ +* void bmw224(void *dest, const void *msg, uint32_t length_b){ * bmw_small_ctx_t ctx; * bmw224_init(&ctx); * while(length_b>=BMW_SMALL_BLOCKSIZE){ @@ -1102,7 +1102,7 @@ bmw224: rjmp pop9 /******************************************************************************* -* void bmw224_init(bmw224_ctx_t* ctx){ +* void bmw224_init(bmw224_ctx_t *ctx){ * uint8_t i; * ctx->h[0] = 0x00010203; * for(i=1; i<16; ++i){ diff --git a/bmw/bmw_256-tinyasm.S b/bmw/bmw_256-tinyasm.S index ef23de2..fbef469 100644 --- a/bmw/bmw_256-tinyasm.S +++ b/bmw/bmw_256-tinyasm.S @@ -279,7 +279,7 @@ f0_hacktable: /******************************************************************************* -* uint32_t addelment(uint8_t j, const uint32_t* m, const uint32_t* h){ +* uint32_t addelment(uint8_t j, const uint32_t *m, const uint32_t *h){ * uint32_t r; * r = pgm_read_dword(k_lut+j); * r += rotl_addel(((uint32_t*)m)[j&0xf], j+0); @@ -1019,7 +1019,7 @@ bmw256_lastBlock: /******************************************************************************* -* void bmw256_ctx2hash(void* dest, const bmw256_ctx_t* ctx){ +* void bmw256_ctx2hash(void *dest, const bmw256_ctx_t *ctx){ * memcpy(dest, &(ctx->h[8]), 256/8); * } * @@ -1039,7 +1039,7 @@ bmw256_ctx2hash: ret /******************************************************************************* -* void bmw256(void* dest, const void* msg, uint32_t length_b){ +* void bmw256(void *dest, const void *msg, uint32_t length_b){ * bmw_small_ctx_t ctx; * bmw256_init(&ctx); * while(length_b>=BMW_SMALL_BLOCKSIZE){ @@ -1068,7 +1068,7 @@ dst1 = 11 /******************************************************************************* -* void bmw224(void* dest, const void* msg, uint32_t length_b){ +* void bmw224(void *dest, const void *msg, uint32_t length_b){ * bmw_small_ctx_t ctx; * bmw224_init(&ctx); * while(length_b>=BMW_SMALL_BLOCKSIZE){ diff --git a/bmw/bmw_large.c b/bmw/bmw_large.c index 45a449f..d247273 100644 --- a/bmw/bmw_large.c +++ b/bmw/bmw_large.c @@ -43,7 +43,7 @@ #if DEBUG #include "cli.h" - void ctx_dump(const bmw_large_ctx_t* ctx){ + void ctx_dump(const bmw_large_ctx_t *ctx){ uint8_t i; cli_putstr_P(PSTR("\r\n==== ctx dump ====")); for(i=0; i<16;++i){ @@ -56,7 +56,7 @@ cli_hexdump(&(ctx->counter), 4); } - void dump_x(const uint64_t* q, uint8_t elements, char x){ + void dump_x(const uint64_t *q, uint8_t elements, char x){ uint8_t i; cli_putstr_P(PSTR("\r\n==== ")); cli_putc(x); @@ -220,7 +220,7 @@ const uint64_t k_lut[] PROGMEM = { 0xa55555555555554bLL }; static -uint64_t bmw_large_expand1(uint8_t j, const uint64_t* q, const void* m, const void* h){ +uint64_t bmw_large_expand1(uint8_t j, const uint64_t *q, const void *m, const void *h){ uint64_t(*s[])(uint64_t) = {bmw_large_s1, bmw_large_s2, bmw_large_s3, bmw_large_s0}; uint64_t a = 0; union{ @@ -250,7 +250,7 @@ uint64_t bmw_large_expand1(uint8_t j, const uint64_t* q, const void* m, const vo } static -uint64_t bmw_large_expand2(uint8_t j, const uint64_t* q, const void* m, const void* h){ +uint64_t bmw_large_expand2(uint8_t j, const uint64_t *q, const void *m, const void *h){ uint64_t(*rf[])(uint64_t) = {bmw_large_r1, bmw_large_r2, bmw_large_r3, bmw_large_r4, bmw_large_r5, bmw_large_r6, bmw_large_r7}; @@ -313,7 +313,7 @@ static const uint8_t offset_table[5] PROGMEM = { 4+16, 6+16, 9+16, 12+16, 13+16 static -void bmw_large_f0(uint64_t* q, const uint64_t* h, const void* m){ +void bmw_large_f0(uint64_t *q, const uint64_t *h, const void *m){ uint16_t hack_reg; uint8_t i,j,c; uint64_t(*s[])(uint64_t)={ bmw_large_s0, bmw_large_s1, bmw_large_s2, @@ -375,7 +375,7 @@ const uint8_t f0_lut[] PROGMEM ={ }; static -void bmw_large_f0(uint64_t* q, const uint64_t* h, const void* m){ +void bmw_large_f0(uint64_t *q, const uint64_t *h, const void *m){ uint8_t i,j=-1,v,sign,l=0; uint64_t(*s[])(uint64_t)={ bmw_large_s0, bmw_large_s1, bmw_large_s2, bmw_large_s3, bmw_large_s4 }; @@ -417,7 +417,7 @@ void bmw_large_f0(uint64_t* q, const uint64_t* h, const void* m){ #if F0_HACK==0 static -void bmw_large_f0(uint64_t* q, const uint64_t* h, const void* m){ +void bmw_large_f0(uint64_t *q, const uint64_t *h, const void *m){ uint8_t i; uint64_t(*s[])(uint64_t)={ bmw_large_s0, bmw_large_s1, bmw_large_s2, bmw_large_s3, bmw_large_s4 }; @@ -458,7 +458,7 @@ void bmw_large_f0(uint64_t* q, const uint64_t* h, const void* m){ #endif /* F0_HACK==0 */ static -void bmw_large_f1(uint64_t* q, const void* m, const uint64_t* h){ +void bmw_large_f1(uint64_t *q, const void *m, const uint64_t *h){ uint8_t i; q[16] = bmw_large_expand1(0, q, m, h); q[17] = bmw_large_expand1(1, q, m, h); @@ -468,7 +468,7 @@ void bmw_large_f1(uint64_t* q, const void* m, const uint64_t* h){ } static -void bmw_large_f2(uint64_t* h, const uint64_t* q, const void* m){ +void bmw_large_f2(uint64_t *h, const uint64_t *q, const void *m){ uint64_t xl=0, xh; uint8_t i; for(i=16;i<24;++i){ @@ -510,7 +510,7 @@ void bmw_large_f2(uint64_t* h, const uint64_t* q, const void* m){ h[15] += SHR64(xl, 2) ^ q[22] ^ q[15]; } -void bmw_large_nextBlock(bmw_large_ctx_t* ctx, const void* block){ +void bmw_large_nextBlock(bmw_large_ctx_t *ctx, const void *block){ uint64_t q[32]; dump_x(block, 16, 'M'); bmw_large_f0(q, ctx->h, block); @@ -522,7 +522,7 @@ void bmw_large_nextBlock(bmw_large_ctx_t* ctx, const void* block){ ctx_dump(ctx); } -void bmw_large_lastBlock(bmw_large_ctx_t* ctx, const void* block, uint16_t length_b){ +void bmw_large_lastBlock(bmw_large_ctx_t *ctx, const void *block, uint16_t length_b){ union { uint8_t v8[128]; uint64_t v64[ 16]; @@ -556,7 +556,7 @@ void bmw_large_lastBlock(bmw_large_ctx_t* ctx, const void* block, uint16_t lengt #endif } -void bmw384_init(bmw384_ctx_t* ctx){ +void bmw384_init(bmw384_ctx_t *ctx){ uint8_t i; ctx->h[0] = 0x0001020304050607LL; for(i=1; i<16; ++i){ @@ -569,7 +569,7 @@ void bmw384_init(bmw384_ctx_t* ctx){ ctx_dump(ctx); } -void bmw512_init(bmw512_ctx_t* ctx){ +void bmw512_init(bmw512_ctx_t *ctx){ uint8_t i; ctx->h[0] = 0x8081828384858687LL; for(i=1; i<16; ++i){ @@ -579,31 +579,31 @@ void bmw512_init(bmw512_ctx_t* ctx){ ctx_dump(ctx); } -void bmw384_nextBlock(bmw384_ctx_t* ctx, const void* block){ +void bmw384_nextBlock(bmw384_ctx_t *ctx, const void *block){ bmw_large_nextBlock(ctx, block); } -void bmw512_nextBlock(bmw512_ctx_t* ctx, const void* block){ +void bmw512_nextBlock(bmw512_ctx_t *ctx, const void *block){ bmw_large_nextBlock(ctx, block); } -void bmw384_lastBlock(bmw384_ctx_t* ctx, const void* block, uint16_t length_b){ +void bmw384_lastBlock(bmw384_ctx_t *ctx, const void *block, uint16_t length_b){ bmw_large_lastBlock(ctx, block, length_b); } -void bmw512_lastBlock(bmw512_ctx_t* ctx, const void* block, uint16_t length_b){ +void bmw512_lastBlock(bmw512_ctx_t *ctx, const void *block, uint16_t length_b){ bmw_large_lastBlock(ctx, block, length_b); } -void bmw384_ctx2hash(void* dest, const bmw384_ctx_t* ctx){ +void bmw384_ctx2hash(void *dest, const bmw384_ctx_t *ctx){ memcpy(dest, &(ctx->h[10]), 384/8); } -void bmw512_ctx2hash(void* dest, const bmw512_ctx_t* ctx){ +void bmw512_ctx2hash(void *dest, const bmw512_ctx_t *ctx){ memcpy(dest, &(ctx->h[8]), 512/8); } -void bmw384(void* dest, const void* msg, uint32_t length_b){ +void bmw384(void *dest, const void *msg, uint32_t length_b){ bmw_large_ctx_t ctx; bmw384_init(&ctx); while(length_b>=BMW_LARGE_BLOCKSIZE){ @@ -615,7 +615,7 @@ void bmw384(void* dest, const void* msg, uint32_t length_b){ bmw384_ctx2hash(dest, &ctx); } -void bmw512(void* dest, const void* msg, uint32_t length_b){ +void bmw512(void *dest, const void *msg, uint32_t length_b){ bmw_large_ctx_t ctx; bmw512_init(&ctx); while(length_b>=BMW_LARGE_BLOCKSIZE){ diff --git a/bmw/bmw_large.h b/bmw/bmw_large.h index fba01fb..a810b18 100644 --- a/bmw/bmw_large.h +++ b/bmw/bmw_large.h @@ -44,22 +44,22 @@ typedef struct { typedef bmw_large_ctx_t bmw384_ctx_t; typedef bmw_large_ctx_t bmw512_ctx_t; -void bmw384_init(bmw384_ctx_t* ctx); -void bmw512_init(bmw512_ctx_t* ctx); +void bmw384_init(bmw384_ctx_t *ctx); +void bmw512_init(bmw512_ctx_t *ctx); -void bmw_large_nextBlock(bmw_large_ctx_t* ctx, const void* block); -void bmw_large_lastBlock(bmw_large_ctx_t* ctx, const void* block, uint16_t length_b); +void bmw_large_nextBlock(bmw_large_ctx_t *ctx, const void *block); +void bmw_large_lastBlock(bmw_large_ctx_t *ctx, const void *block, uint16_t length_b); -void bmw384_nextBlock(bmw384_ctx_t* ctx, const void* block); -void bmw384_lastBlock(bmw384_ctx_t* ctx, const void* block, uint16_t length_b); +void bmw384_nextBlock(bmw384_ctx_t *ctx, const void *block); +void bmw384_lastBlock(bmw384_ctx_t *ctx, const void *block, uint16_t length_b); -void bmw512_nextBlock(bmw512_ctx_t* ctx, const void* block); -void bmw512_lastBlock(bmw512_ctx_t* ctx, const void* block, uint16_t length_b); +void bmw512_nextBlock(bmw512_ctx_t *ctx, const void *block); +void bmw512_lastBlock(bmw512_ctx_t *ctx, const void *block, uint16_t length_b); -void bmw384_ctx2hash(void* dest, const bmw384_ctx_t* ctx); -void bmw512_ctx2hash(void* dest, const bmw512_ctx_t* ctx); +void bmw384_ctx2hash(void *dest, const bmw384_ctx_t *ctx); +void bmw512_ctx2hash(void *dest, const bmw512_ctx_t *ctx); -void bmw384(void* dest, const void* msg, uint32_t length_b); -void bmw512(void* dest, const void* msg, uint32_t length_b); +void bmw384(void *dest, const void *msg, uint32_t length_b); +void bmw512(void *dest, const void *msg, uint32_t length_b); #endif /* BMW_LARGE_H_ */ diff --git a/bmw/bmw_small-asm.S b/bmw/bmw_small-asm.S index ce8518d..e8902e1 100644 --- a/bmw/bmw_small-asm.S +++ b/bmw/bmw_small-asm.S @@ -510,7 +510,7 @@ const_lut: .long 0x9555554c, 0x9aaaaaa1, 0x9ffffff6, 0xa555554b /******************************************************************************* -* uint32_t addelment(uint8_t j, const uint32_t* m, const uint32_t* h){ +* uint32_t addelment(uint8_t j, const uint32_t *m, const uint32_t *h){ * uint32_t r; * r = pgm_read_dword(k_lut+j); * r += rotl_addel(((uint32_t*)m)[j&0xf], j+0); @@ -625,7 +625,7 @@ addelement: ret /******************************************************************************* -* uint32_t bmw_small_expand1(uint8_t j, const void* m, const void* h, const uint32_t* q){ +* uint32_t bmw_small_expand1(uint8_t j, const void *m, const void *h, const uint32_t *q){ * uint32_t(*s[])(uint32_t) = {bmw_small_s1, bmw_small_s2, bmw_small_s3, bmw_small_s0}; * uint32_t r; * uint8_t i; @@ -708,7 +708,7 @@ expand1_exit: ret /******************************************************************************* -* uint32_t bmw_small_expand2(uint8_t j, const void* m, const void* h, const uint32_t* q){ +* uint32_t bmw_small_expand2(uint8_t j, const void *m, const void *h, const uint32_t *q){ * uint32_t(*rf[])(uint32_t) = {bmw_small_r1, bmw_small_r2, bmw_small_r3, * bmw_small_r4, bmw_small_r5, bmw_small_r6, * bmw_small_r7}; @@ -781,7 +781,7 @@ bmw_small_expand2: rjmp expand1_exit /******************************************************************************* -* void bmw_small_f1(uint32_t* q, const void* m, const void* h){ +* void bmw_small_f1(uint32_t *q, const void *m, const void *h){ * uint8_t i; * q[16] = bmw_small_expand1(0, m, h, q); * q[17] = bmw_small_expand1(1, m, h, q); @@ -849,7 +849,7 @@ bmw_small_f1: * uint16_t hack_table[5] PROGMEM = { 0x0311, 0xDDB3, 0x2A79, 0x07AA, 0x51C2 }; * uint8_t offset_table[5] PROGMEM = { 4+16, 6+16, 9+16, 12+16, 13+16 }; * -* void bmw_small_f0(uint32_t* h, const void* m, uint32_t* q){ +* void bmw_small_f0(uint32_t *h, const void *m, uint32_t *q){ * uint16_t hack_reg; * uint8_t c,i,j; * uint32_t(*s[])(uint32_t)={ bmw_small_s0, bmw_small_s1, bmw_small_s2, @@ -1109,7 +1109,7 @@ bmw_small_f0: ret /******************************************************************************* -* void bmw_small_f2(uint32_t* h, const uint32_t* q, const void* m){ +* void bmw_small_f2(uint32_t *h, const uint32_t *q, const void *m){ * uint32_t xl=0, xh; * uint8_t i; * for(i=16;i<24;++i){ @@ -1699,7 +1699,7 @@ cli_putchar: #endif /******************************************************************************* -* void bmw_small_nextBlock(bmw_small_ctx_t* ctx, const void* block){ +* void bmw_small_nextBlock(bmw_small_ctx_t *ctx, const void *block){ * uint32_t q[32]; * dump_x(block, 16, 'M'); * bmw_small_f0(ctx->h, block, q); @@ -1769,7 +1769,7 @@ bmw256_nextBlock: /******************************************************************************* -* void bmw224_init(bmw224_ctx_t* ctx){ +* void bmw224_init(bmw224_ctx_t *ctx){ * uint8_t i; * ctx->h[0] = 0x00010203; * for(i=1; i<16; ++i){ @@ -1821,7 +1821,7 @@ bmw256_init: rjmp bmw_small_init /******************************************************************************* -* void bmw_small_lastBlock(bmw_small_ctx_t* ctx, const void* block, uint16_t length_b){ +* void bmw_small_lastBlock(bmw_small_ctx_t *ctx, const void *block, uint16_t length_b){ * struct { * uint8_t buffer[64]; * uint32_t ctr; @@ -2041,7 +2041,7 @@ bmw256_lastBlock: ret /******************************************************************************* -* void bmw224_ctx2hash(void* dest, const bmw224_ctx_t* ctx){ +* void bmw224_ctx2hash(void *dest, const bmw224_ctx_t *ctx){ * memcpy(dest, &(ctx->h[9]), 224/8); * } * @@ -2057,7 +2057,7 @@ bmw224_ctx2hash: rjmp 1f /******************************************************************************* -* void bmw256_ctx2hash(void* dest, const bmw256_ctx_t* ctx){ +* void bmw256_ctx2hash(void *dest, const bmw256_ctx_t *ctx){ * memcpy(dest, &(ctx->h[8]), 256/8); * } * @@ -2078,7 +2078,7 @@ bmw256_ctx2hash: ret /******************************************************************************* -* void bmw256(void* dest, const void* msg, uint32_t length_b){ +* void bmw256(void *dest, const void *msg, uint32_t length_b){ * bmw_small_ctx_t ctx; * bmw256_init(&ctx); * while(length_b>=BMW_SMALL_BLOCKSIZE){ @@ -2111,7 +2111,7 @@ bmw256: rjmp bmw_small_all /******************************************************************************* -* void bmw224(void* dest, const void* msg, uint32_t length_b){ +* void bmw224(void *dest, const void *msg, uint32_t length_b){ * bmw_small_ctx_t ctx; * bmw224_init(&ctx); * while(length_b>=BMW_SMALL_BLOCKSIZE){ diff --git a/bmw/bmw_small-tinyasm.S b/bmw/bmw_small-tinyasm.S index fec6bb0..ad4ee95 100644 --- a/bmw/bmw_small-tinyasm.S +++ b/bmw/bmw_small-tinyasm.S @@ -279,7 +279,7 @@ f0_hacktable: /******************************************************************************* -* uint32_t addelment(uint8_t j, const uint32_t* m, const uint32_t* h){ +* uint32_t addelment(uint8_t j, const uint32_t *m, const uint32_t *h){ * uint32_t r; * r = pgm_read_dword(k_lut+j); * r += rotl_addel(((uint32_t*)m)[j&0xf], j+0); @@ -1021,7 +1021,7 @@ bmw256_lastBlock: /******************************************************************************* -* void bmw224_ctx2hash(void* dest, const bmw224_ctx_t* ctx){ +* void bmw224_ctx2hash(void *dest, const bmw224_ctx_t *ctx){ * memcpy(dest, &(ctx->h[9]), 224/8); * } * @@ -1036,7 +1036,7 @@ bmw224_ctx2hash: rjmp 1f /******************************************************************************* -* void bmw256_ctx2hash(void* dest, const bmw256_ctx_t* ctx){ +* void bmw256_ctx2hash(void *dest, const bmw256_ctx_t *ctx){ * memcpy(dest, &(ctx->h[8]), 256/8); * } * @@ -1056,7 +1056,7 @@ bmw256_ctx2hash: ret /******************************************************************************* -* void bmw256(void* dest, const void* msg, uint32_t length_b){ +* void bmw256(void *dest, const void *msg, uint32_t length_b){ * bmw_small_ctx_t ctx; * bmw256_init(&ctx); * while(length_b>=BMW_SMALL_BLOCKSIZE){ @@ -1089,7 +1089,7 @@ bmw256: /******************************************************************************* -* void bmw224(void* dest, const void* msg, uint32_t length_b){ +* void bmw224(void *dest, const void *msg, uint32_t length_b){ * bmw_small_ctx_t ctx; * bmw224_init(&ctx); * while(length_b>=BMW_SMALL_BLOCKSIZE){ @@ -1177,7 +1177,7 @@ c2h_lut: rjmp bmw256_ctx2hash /******************************************************************************* -* void bmw224_init(bmw224_ctx_t* ctx){ +* void bmw224_init(bmw224_ctx_t *ctx){ * uint8_t i; * ctx->h[0] = 0x00010203; * for(i=1; i<16; ++i){ diff --git a/bmw/bmw_small.c b/bmw/bmw_small.c index b41e923..b807e15 100644 --- a/bmw/bmw_small.c +++ b/bmw/bmw_small.c @@ -56,7 +56,7 @@ #if DEBUG #include "cli.h" - void ctx_dump(const bmw_small_ctx_t* ctx){ + void ctx_dump(const bmw_small_ctx_t *ctx){ uint8_t i; cli_putstr_P(PSTR("\r\n==== ctx dump ====")); for(i=0; i<16;++i){ @@ -69,7 +69,7 @@ cli_hexdump(&(ctx->counter), 4); } - void dump_x(const uint32_t* q, uint8_t elements, char x){ + void dump_x(const uint32_t *q, uint8_t elements, char x){ uint8_t i; cli_putstr_P(PSTR("\r\n==== ")); cli_putc(x); @@ -212,7 +212,7 @@ const uint32_t k_lut[] PROGMEM = { 0xa555554bL }; static -uint32_t bmw_small_expand1(uint8_t j, const uint32_t* q, const void* m, const void* h){ +uint32_t bmw_small_expand1(uint8_t j, const uint32_t *q, const void *m, const void *h){ uint32_t(*s[])(uint32_t) = {bmw_small_s1, bmw_small_s2, bmw_small_s3, bmw_small_s0}; uint32_t r; uint8_t i; @@ -237,7 +237,7 @@ uint32_t bmw_small_expand1(uint8_t j, const uint32_t* q, const void* m, const vo } static -uint32_t bmw_small_expand2(uint8_t j, const uint32_t* q, const void* m, const void* h){ +uint32_t bmw_small_expand2(uint8_t j, const uint32_t *q, const void *m, const void *h){ uint32_t(*rf[])(uint32_t) = {bmw_small_r1, bmw_small_r2, bmw_small_r3, bmw_small_r4, bmw_small_r5, bmw_small_r6, bmw_small_r7}; @@ -277,7 +277,7 @@ static const uint16_t hack_table[5] PROGMEM = { 0x0311, 0xDDB3, 0x2A79, 0x07AA, static const uint8_t offset_table[5] PROGMEM = { 4+16, 6+16, 9+16, 12+16, 13+16 }; static -void bmw_small_f0(uint32_t* q, uint32_t* h, const void* m){ +void bmw_small_f0(uint32_t *q, uint32_t *h, const void *m){ uint16_t hack_reg; uint8_t c,i,j; uint32_t(*s[])(uint32_t)={ bmw_small_s0, bmw_small_s1, bmw_small_s2, @@ -339,7 +339,7 @@ const uint8_t f0_lut[] PROGMEM = { }; static -void bmw_small_f0(uint32_t* q, uint32_t* h, const void* m){ +void bmw_small_f0(uint32_t *q, uint32_t *h, const void *m){ uint8_t i,j=-1,v,sign,l=0; uint32_t(*s[])(uint32_t)={ bmw_small_s0, bmw_small_s1, bmw_small_s2, bmw_small_s3, bmw_small_s4 }; @@ -381,7 +381,7 @@ void bmw_small_f0(uint32_t* q, uint32_t* h, const void* m){ #if F0_HACK==0 static -void bmw_small_f0(uint32_t* q, uint32_t* h, const void* m){ +void bmw_small_f0(uint32_t *q, uint32_t *h, const void *m){ uint8_t i; uint32_t(*s[])(uint32_t)={ bmw_small_s0, bmw_small_s1, bmw_small_s2, bmw_small_s3, bmw_small_s4 }; @@ -421,7 +421,7 @@ void bmw_small_f0(uint32_t* q, uint32_t* h, const void* m){ #endif /* F0_HACK==0 */ static -void bmw_small_f1(uint32_t* q, const void* m, const void* h){ +void bmw_small_f1(uint32_t *q, const void *m, const void *h){ uint8_t i; q[16] = bmw_small_expand1(0, q, m, h); q[17] = bmw_small_expand1(1, q, m, h); @@ -431,7 +431,7 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){ } static -void bmw_small_f2(uint32_t* h, uint32_t* q, const void* m){ +void bmw_small_f2(uint32_t *h, uint32_t *q, const void *m){ uint32_t xl=0, xh; uint8_t i; for(i=16;i<24;++i){ @@ -486,7 +486,7 @@ void bmw_small_f2(uint32_t* h, uint32_t* q, const void* m){ } -void bmw_small_nextBlock(bmw_small_ctx_t* ctx, const void* block){ +void bmw_small_nextBlock(bmw_small_ctx_t *ctx, const void *block){ uint32_t q[32]; dump_x(block, 16, 'M'); bmw_small_f0(q, ctx->h, block); @@ -498,7 +498,7 @@ void bmw_small_nextBlock(bmw_small_ctx_t* ctx, const void* block){ ctx_dump(ctx); } -void bmw_small_lastBlock(bmw_small_ctx_t* ctx, const void* block, uint16_t length_b){ +void bmw_small_lastBlock(bmw_small_ctx_t *ctx, const void *block, uint16_t length_b){ union { uint8_t v8[64]; uint32_t v32[16]; @@ -538,7 +538,7 @@ void bmw_small_lastBlock(bmw_small_ctx_t* ctx, const void* block, uint16_t lengt #endif } -void bmw224_init(bmw224_ctx_t* ctx){ +void bmw224_init(bmw224_ctx_t *ctx){ uint8_t i; ctx->h[0] = 0x00010203; for(i=1; i<16; ++i){ @@ -551,7 +551,7 @@ void bmw224_init(bmw224_ctx_t* ctx){ ctx_dump(ctx); } -void bmw256_init(bmw256_ctx_t* ctx){ +void bmw256_init(bmw256_ctx_t *ctx){ uint8_t i; ctx->h[0] = 0x40414243; for(i=1; i<16; ++i){ @@ -561,31 +561,31 @@ void bmw256_init(bmw256_ctx_t* ctx){ ctx_dump(ctx); } -void bmw224_nextBlock(bmw224_ctx_t* ctx, const void* block){ +void bmw224_nextBlock(bmw224_ctx_t *ctx, const void *block){ bmw_small_nextBlock(ctx, block); } -void bmw256_nextBlock(bmw256_ctx_t* ctx, const void* block){ +void bmw256_nextBlock(bmw256_ctx_t *ctx, const void *block){ bmw_small_nextBlock(ctx, block); } -void bmw224_lastBlock(bmw224_ctx_t* ctx, const void* block, uint16_t length_b){ +void bmw224_lastBlock(bmw224_ctx_t *ctx, const void *block, uint16_t length_b){ bmw_small_lastBlock(ctx, block, length_b); } -void bmw256_lastBlock(bmw256_ctx_t* ctx, const void* block, uint16_t length_b){ +void bmw256_lastBlock(bmw256_ctx_t *ctx, const void *block, uint16_t length_b){ bmw_small_lastBlock(ctx, block, length_b); } -void bmw224_ctx2hash(void* dest, const bmw224_ctx_t* ctx){ +void bmw224_ctx2hash(void *dest, const bmw224_ctx_t *ctx){ memcpy(dest, &(ctx->h[9]), 224/8); } -void bmw256_ctx2hash(void* dest, const bmw256_ctx_t* ctx){ +void bmw256_ctx2hash(void *dest, const bmw256_ctx_t *ctx){ memcpy(dest, &(ctx->h[8]), 256/8); } -void bmw224(void* dest, const void* msg, uint32_t length_b){ +void bmw224(void *dest, const void *msg, uint32_t length_b){ bmw_small_ctx_t ctx; bmw224_init(&ctx); while(length_b>=BMW_SMALL_BLOCKSIZE){ @@ -597,7 +597,7 @@ void bmw224(void* dest, const void* msg, uint32_t length_b){ bmw224_ctx2hash(dest, &ctx); } -void bmw256(void* dest, const void* msg, uint32_t length_b){ +void bmw256(void *dest, const void *msg, uint32_t length_b){ bmw_small_ctx_t ctx; bmw256_init(&ctx); while(length_b>=BMW_SMALL_BLOCKSIZE){ diff --git a/bmw/bmw_small.h b/bmw/bmw_small.h index f314712..4f87508 100644 --- a/bmw/bmw_small.h +++ b/bmw/bmw_small.h @@ -44,22 +44,22 @@ typedef struct { typedef bmw_small_ctx_t bmw224_ctx_t; typedef bmw_small_ctx_t bmw256_ctx_t; -void bmw224_init(bmw224_ctx_t* ctx); -void bmw256_init(bmw256_ctx_t* ctx); +void bmw224_init(bmw224_ctx_t *ctx); +void bmw256_init(bmw256_ctx_t *ctx); -void bmw_small_nextBlock(bmw_small_ctx_t* ctx, const void* block); -void bmw_small_lastBlock(bmw_small_ctx_t* ctx, const void* block, uint16_t length_b); +void bmw_small_nextBlock(bmw_small_ctx_t *ctx, const void *block); +void bmw_small_lastBlock(bmw_small_ctx_t *ctx, const void *block, uint16_t length_b); -void bmw224_nextBlock(bmw224_ctx_t* ctx, const void* block); -void bmw224_lastBlock(bmw224_ctx_t* ctx, const void* block, uint16_t length_b); +void bmw224_nextBlock(bmw224_ctx_t *ctx, const void *block); +void bmw224_lastBlock(bmw224_ctx_t *ctx, const void *block, uint16_t length_b); -void bmw256_nextBlock(bmw256_ctx_t* ctx, const void* block); -void bmw256_lastBlock(bmw256_ctx_t* ctx, const void* block, uint16_t length_b); +void bmw256_nextBlock(bmw256_ctx_t *ctx, const void *block); +void bmw256_lastBlock(bmw256_ctx_t *ctx, const void *block, uint16_t length_b); -void bmw224_ctx2hash(void* dest, const bmw224_ctx_t* ctx); -void bmw256_ctx2hash(void* dest, const bmw256_ctx_t* ctx); +void bmw224_ctx2hash(void *dest, const bmw224_ctx_t *ctx); +void bmw256_ctx2hash(void *dest, const bmw256_ctx_t *ctx); -void bmw224(void* dest, const void* msg, uint32_t length_b); -void bmw256(void* dest, const void* msg, uint32_t length_b); +void bmw224(void *dest, const void *msg, uint32_t length_b); +void bmw256(void *dest, const void *msg, uint32_t length_b); #endif /* BMW_SMALL_H_ */ diff --git a/camellia/camellia-asm.S b/camellia/camellia-asm.S index c743997..621bd7e 100644 --- a/camellia/camellia-asm.S +++ b/camellia/camellia-asm.S @@ -646,9 +646,9 @@ change_endian: #define KEY_ROL17 0x08 #define KEY_ROL15 0x00 /* -void camellia_6rounds(camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, uint8_t roundop, uint8_t keychoice){ +void camellia_6rounds(camellia128_ctx_t *s, uint64_t *bl, uint64_t *br, uint8_t roundop, uint8_t keychoice){ uint8_t i; - uint64_t* k[4]; + uint64_t *k[4]; k[0] = &(s->kll); k[1] = &(s->klr); k[2] = &(s->kal); @@ -827,7 +827,7 @@ main_loop: ;############################################################################## /* -void camellia128_init(camellia128_ctx_t* s, uint8_t* key){ +void camellia128_init(camellia128_ctx_t *s, uint8_t *key){ uint8_t i; s->kll = 0; //((uint64_t*)key)[0]; diff --git a/camellia/camellia.h b/camellia/camellia.h index 7609613..b591fe2 100644 --- a/camellia/camellia.h +++ b/camellia/camellia.h @@ -29,9 +29,9 @@ typedef struct camellia128_ctx_s{ }camellia128_ctx_t; -void camellia128_init(const void* key, camellia128_ctx_t* s); -void camellia128_enc(void* block, const camellia128_ctx_t* s); -void camellia128_dec(void* block, const camellia128_ctx_t* s); +void camellia128_init(const void *key, camellia128_ctx_t *s); +void camellia128_enc(void *block, const camellia128_ctx_t *s); +void camellia128_dec(void *block, const camellia128_ctx_t *s); #endif /*CAMELLIA_H_*/ diff --git a/camellia/camellia128-stub.c b/camellia/camellia128-stub.c index 57ed483..5de2a60 100644 --- a/camellia/camellia128-stub.c +++ b/camellia/camellia128-stub.c @@ -39,7 +39,7 @@ uint64_t camellia_fl(uint64_t x, uint64_t k); /*****************************************************************************/ uint64_t camellia_fl_inv(uint64_t y, uint64_t k); /*****************************************************************************/ -void change_endian(void* data, uint8_t length); +void change_endian(void *data, uint8_t length); /* uint64_t PROGMEM camellia_sigma[6]={ / * 64 byte table * / 0xA09E667F3BCC908BLL, @@ -83,7 +83,7 @@ void camellia128_ctx_dump(camellia128_ctx_t *s){ /*****************************************************************************/ /* extern uint64_t camellia_sigma[6]; */ -void camellia128_init(const void* key, camellia128_ctx_t* s){ +void camellia128_init(const void *key, camellia128_ctx_t *s){ uint8_t i; s->kll = 0; /* ((uint64_t*)key)[0]; */ @@ -113,9 +113,9 @@ void camellia128_init(const void* key, camellia128_ctx_t* s){ } /*****************************************************************************/ -void camellia128_keyop(camellia128_ctx_t* s, int8_t q); +void camellia128_keyop(camellia128_ctx_t *s, int8_t q); /*****************************************************************************/ -void camellia128_keyop_inv(camellia128_ctx_t* s, int8_t q); +void camellia128_keyop_inv(camellia128_ctx_t *s, int8_t q); /*****************************************************************************/ #define SEL_KA 1 @@ -133,12 +133,12 @@ void camellia128_keyop_inv(camellia128_ctx_t* s, int8_t q); #define KEY_ROL17 0x08 #define KEY_ROL15 0x00 -void camellia_6rounds(const camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, +void camellia_6rounds(const camellia128_ctx_t *s, uint64_t *bl, uint64_t *br, uint8_t roundop, uint8_t keychoice); /*****************************************************************************/ -void camellia128_enc(void* block, const camellia128_ctx_t* s){ +void camellia128_enc(void *block, const camellia128_ctx_t *s){ #define BL (((uint64_t*)block)[0]) #define BR (((uint64_t*)block)[1]) @@ -192,7 +192,7 @@ void camellia128_enc(void* block, const camellia128_ctx_t* s){ /*****************************************************************************/ -void camellia128_dec(void* block, const camellia128_ctx_t* s){ +void camellia128_dec(void *block, const camellia128_ctx_t *s){ #define BL (((uint64_t*)block)[1]) #define BR (((uint64_t*)block)[0]) diff --git a/camellia/camellia_C.c b/camellia/camellia_C.c index 2f30934..5e09701 100644 --- a/camellia/camellia_C.c +++ b/camellia/camellia_C.c @@ -272,7 +272,7 @@ uint64_t camellia_sigma(uint8_t idx){ } /*****************************************************************************/ -void camellia128_init(const void* key, camellia128_ctx_t* s){ +void camellia128_init(const void *key, camellia128_ctx_t *s){ uint8_t i; s->kll = 0; //((uint64_t*)key)[0]; @@ -306,7 +306,7 @@ void camellia128_init(const void* key, camellia128_ctx_t* s){ /*****************************************************************************/ static -void camellia128_keyop(camellia128_ctx_t* s, int8_t q){ +void camellia128_keyop(camellia128_ctx_t *s, int8_t q){ /* first we do 16 bit left-rols for kl and ka (128bit each) */ uint32_t temp; @@ -323,7 +323,7 @@ void camellia128_keyop(camellia128_ctx_t* s, int8_t q){ /*****************************************************************************/ static -void camellia128_keyop_inv(camellia128_ctx_t* s, int8_t q){ +void camellia128_keyop_inv(camellia128_ctx_t *s, int8_t q){ /* first we do 16 bit right-rols for kl and ka (128bit each) */ uint32_t temp; @@ -355,9 +355,9 @@ void camellia128_keyop_inv(camellia128_ctx_t* s, int8_t q){ #define KEY_ROL15 0x00 static -void camellia_6rounds(const camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, uint8_t roundop, uint8_t keychoice){ +void camellia_6rounds(const camellia128_ctx_t *s, uint64_t *bl, uint64_t *br, uint8_t roundop, uint8_t keychoice){ uint8_t i; - uint64_t* k[4]; + uint64_t *k[4]; k[0] = &(((camellia128_ctx_t*)s)->kll); k[1] = &(((camellia128_ctx_t*)s)->klr); k[2] = &(((camellia128_ctx_t*)s)->kal); @@ -384,7 +384,7 @@ void camellia_6rounds(const camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, ui /*****************************************************************************/ static -void change_endian(void* data, uint8_t length){ +void change_endian(void *data, uint8_t length){ uint8_t i,a; for(i=0; ikeys[8], 8); } -void cscipher_dec(void* buffer, const cscipher_ctx_t* ctx){ +void cscipher_dec(void *buffer, const cscipher_ctx_t *ctx){ uint8_t i=7,j,k; uint8_t tmp[8]; memxor(buffer, ctx->keys[8], 8); @@ -146,7 +146,7 @@ void cscipher_dec(void* buffer, const cscipher_ctx_t* ctx){ }while(i--); } -void cscipher_init(const void* key, 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=0; memcpy(tmp_key, key, 16); diff --git a/cscipher/cscipher_tiny_asm.S b/cscipher/cscipher_tiny_asm.S index bba78f9..2a4b1b1 100644 --- a/cscipher/cscipher_tiny_asm.S +++ b/cscipher/cscipher_tiny_asm.S @@ -164,7 +164,7 @@ round_const: .byte 0xbf, 0x71, 0x58, 0x80, 0x9c, 0xf4, 0xf3, 0xc7 /* -void cscipher_enc(void* buffer, const cscipher_ctx_t* ctx){ +void cscipher_enc(void *buffer, const cscipher_ctx_t *ctx){ uint8_t i,j,k; uint8_t tmp[8]; for(i=0; i<8; ++i){ @@ -288,7 +288,7 @@ cscipher_enc: rjmp memxor /* -void cscipher_dec(void* buffer, const cscipher_ctx_t* ctx){ +void cscipher_dec(void *buffer, const cscipher_ctx_t *ctx){ uint8_t i=7,j,k; uint8_t tmp[8]; memxor(buffer, ctx->keys[8], 8); diff --git a/cubehash/cubehash.c b/cubehash/cubehash.c index 0cc62b0..f5b3077 100644 --- a/cubehash/cubehash.c +++ b/cubehash/cubehash.c @@ -46,7 +46,7 @@ • Swap x_1jkl0 with x_1jkl1 , for each (j, k, l). */ -static void cubehash_round(cubehash_ctx_t* ctx){ +static void cubehash_round(cubehash_ctx_t *ctx){ uint8_t i; uint32_t t, t2; for(i=0; i<16; ++i){ @@ -79,7 +79,7 @@ static void cubehash_round(cubehash_ctx_t* ctx){ } } -void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t* ctx){ +void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t *ctx){ memset(ctx->a, 0, 32*4); ctx->a[0] = h/8; ctx->a[1] = b; @@ -91,7 +91,7 @@ void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t* ctx){ } } -void cubehash_nextBlock(cubehash_ctx_t* ctx, void* block){ +void cubehash_nextBlock(cubehash_ctx_t *ctx, void *block){ uint8_t i; memxor(ctx->a, block, ctx->blocksize_B); for(i=0; irounds; ++i){ @@ -99,7 +99,7 @@ void cubehash_nextBlock(cubehash_ctx_t* ctx, void* block){ } } -void cubehash_lastBlock(cubehash_ctx_t* ctx, void* block, uint16_t length_b){ +void cubehash_lastBlock(cubehash_ctx_t *ctx, void *block, uint16_t length_b){ while(length_b>=ctx->blocksize_B*8){ cubehash_nextBlock(ctx, block); block = (uint8_t*)block + ctx->blocksize_B; @@ -117,46 +117,46 @@ void cubehash_lastBlock(cubehash_ctx_t* ctx, void* block, uint16_t length_b){ } } -void cubehash_ctx2hash(void* dest, uint16_t length_b, cubehash_ctx_t* ctx){ +void cubehash_ctx2hash(void *dest, uint16_t length_b, cubehash_ctx_t *ctx){ memcpy(dest, ctx->a, (length_b+7)/8); } /******************************************************************************/ -void cubehash224_init(cubehash_ctx_t* ctx){ +void cubehash224_init(cubehash_ctx_t *ctx){ cubehash_init(16, 32, 224, ctx); } -void cubehash224_ctx2hash(void* dest, cubehash_ctx_t* ctx){ +void cubehash224_ctx2hash(void *dest, cubehash_ctx_t *ctx){ cubehash_ctx2hash(dest, 224, ctx); } /******************************************************************************/ -void cubehash256_init(cubehash_ctx_t* ctx){ +void cubehash256_init(cubehash_ctx_t *ctx){ cubehash_init(16, 32, 256, ctx); } -void cubehash256_ctx2hash(void* dest, cubehash_ctx_t* ctx){ +void cubehash256_ctx2hash(void *dest, cubehash_ctx_t *ctx){ cubehash_ctx2hash(dest, 256, ctx); } /******************************************************************************/ -void cubehash384_init(cubehash_ctx_t* ctx){ +void cubehash384_init(cubehash_ctx_t *ctx){ cubehash_init(16, 32, 384, ctx); } -void cubehash384_ctx2hash(void* dest, cubehash_ctx_t* ctx){ +void cubehash384_ctx2hash(void *dest, cubehash_ctx_t *ctx){ cubehash_ctx2hash(dest, 384, ctx); } /******************************************************************************/ -void cubehash512_init(cubehash_ctx_t* ctx){ +void cubehash512_init(cubehash_ctx_t *ctx){ cubehash_init(16, 32, 512, ctx); } -void cubehash512_ctx2hash(void* dest, cubehash_ctx_t* ctx){ +void cubehash512_ctx2hash(void *dest, cubehash_ctx_t *ctx){ cubehash_ctx2hash(dest, 512, ctx); } diff --git a/cubehash/cubehash.h b/cubehash/cubehash.h index 1f7b13a..03c4992 100644 --- a/cubehash/cubehash.h +++ b/cubehash/cubehash.h @@ -37,21 +37,21 @@ typedef struct { uint8_t blocksize_B; } cubehash_ctx_t; -void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t* ctx); -void cubehash_nextBlock(cubehash_ctx_t* ctx, void* block); -void cubehash_lastBlock(cubehash_ctx_t* ctx, void* block, uint16_t length_b); -void cubehash_ctx2hash(void* dest, uint16_t length_b, cubehash_ctx_t* ctx); +void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t *ctx); +void cubehash_nextBlock(cubehash_ctx_t *ctx, void *block); +void cubehash_lastBlock(cubehash_ctx_t *ctx, void *block, uint16_t length_b); +void cubehash_ctx2hash(void *dest, uint16_t length_b, cubehash_ctx_t *ctx); -void cubehash224_init(cubehash_ctx_t* ctx); -void cubehash224_ctx2hash(void* dest, cubehash_ctx_t* ctx); +void cubehash224_init(cubehash_ctx_t *ctx); +void cubehash224_ctx2hash(void *dest, cubehash_ctx_t *ctx); -void cubehash256_init(cubehash_ctx_t* ctx); -void cubehash256_ctx2hash(void* dest, cubehash_ctx_t* ctx); +void cubehash256_init(cubehash_ctx_t *ctx); +void cubehash256_ctx2hash(void *dest, cubehash_ctx_t *ctx); -void cubehash384_init(cubehash_ctx_t* ctx); -void cubehash384_ctx2hash(void* dest, cubehash_ctx_t* ctx); +void cubehash384_init(cubehash_ctx_t *ctx); +void cubehash384_ctx2hash(void *dest, cubehash_ctx_t *ctx); -void cubehash512_init(cubehash_ctx_t* ctx); -void cubehash512_ctx2hash(void* dest, cubehash_ctx_t* ctx); +void cubehash512_init(cubehash_ctx_t *ctx); +void cubehash512_ctx2hash(void *dest, cubehash_ctx_t *ctx); #endif /* CUBEHASH_H_ */ diff --git a/cubehash/xchg.h b/cubehash/xchg.h index c8c6565..1c4d9e4 100644 --- a/cubehash/xchg.h +++ b/cubehash/xchg.h @@ -22,6 +22,6 @@ #include -void xchg32_array(void* a, void* b, uint8_t n); +void xchg32_array(void *a, void *b, uint8_t n); #endif /* XCHG_H_ */ diff --git a/des/des.c b/des/des.c index 2b30b01..9aedd29 100644 --- a/des/des.c +++ b/des/des.c @@ -269,7 +269,7 @@ uint8_t substitute(uint8_t a, uint8_t * sbp){ /******************************************************************************/ -uint32_t des_f(uint32_t r, uint8_t* kr){ +uint32_t des_f(uint32_t r, uint8_t *kr){ uint8_t i; uint32_t t=0,ret; uint64_t data; @@ -297,7 +297,7 @@ uint32_t des_f(uint32_t r, uint8_t* kr){ /******************************************************************************/ -void des_enc(void* out, const void* in, const void* key){ +void des_enc(void *out, const void *in, const void *key){ #define R (data.v32[1]) #define L (data.v32[0]) @@ -333,7 +333,7 @@ void des_enc(void* out, const void* in, const void* key){ /******************************************************************************/ -void des_dec(void* out, const void* in, const uint8_t* key){ +void des_dec(void *out, const void *in, const uint8_t *key){ uint8_t kr[6],k[7]; union { uint8_t v8[8]; @@ -368,7 +368,7 @@ void des_dec(void* out, const void* in, const uint8_t* key){ /******************************************************************************/ -void tdes_enc(void* out, void* in, const void* key){ +void tdes_enc(void *out, void *in, const void *key){ des_enc(out, in, (uint8_t*)key + 0); des_dec(out, out, (uint8_t*)key + 8); des_enc(out, out, (uint8_t*)key +16); @@ -376,7 +376,7 @@ void tdes_enc(void* out, void* in, const void* key){ /******************************************************************************/ -void tdes_dec(void* out, void* in, const uint8_t* key){ +void tdes_dec(void *out, void *in, const uint8_t *key){ des_dec(out, in, (uint8_t*)key +16); des_enc(out, out, (uint8_t*)key + 8); des_dec(out, out, (uint8_t*)key + 0); diff --git a/des/des.h b/des/des.h index 53de98a..469e493 100644 --- a/des/des.h +++ b/des/des.h @@ -31,17 +31,17 @@ * Also we only implement the three key mode */ /** \def tdea_enc - * \brief defining an alias for void tdes_enc(void* out, const void* in, const void* key) + * \brief defining an alias for void tdes_enc(void *out, const void *in, const void *key) */ /** \def tdea_dec - * \brief defining an alias for void tdes_dec(void* out, const void* in, const void* key) + * \brief defining an alias for void tdes_dec(void *out, const void *in, const void *key) */ #define tdea_enc tdes_enc #define tdea_dec tdes_dec -/** \fn void des_enc(void* out, const void* in, const void* key) +/** \fn void des_enc(void *out, const void *in, const void *key) * \brief encrypt a block with DES * * This function encrypts a block of 64 bits (8 bytes) with the DES algorithm. @@ -53,9 +53,9 @@ * \param in pointer to the block (64 bit = 8 byte) where the plaintext is read from * \param key pointer to the key (64 bit = 8 byte) */ -void des_enc(void* out, const void* in, const void* key); +void des_enc(void *out, const void *in, const void *key); -/** \fn void des_dec(void* out, const void* in, const void* key) +/** \fn void des_dec(void *out, const void *in, const void *key) * \brief decrypt a block with DES * * This function decrypts a block of 64 bits (8 bytes) with the DES algorithm. @@ -67,9 +67,9 @@ void des_enc(void* out, const void* in, const void* key); * \param in pointer to the block (64 bit = 8 byte) where the ciphertext is read from * \param key pointer to the key (64 bit = 8 byte) */ -void des_dec(void* out, const void* in, const void* key); +void des_dec(void *out, const void *in, const void *key); -/** \fn void tdes_enc(void* out, const void* in, const void* key) +/** \fn void tdes_enc(void *out, const void *in, const void *key) * \brief encrypt a block with Tripple-DES * * This function encrypts a block of 64 bits (8 bytes) with the Tripple-DES (EDE) @@ -81,9 +81,9 @@ void des_dec(void* out, const void* in, const void* key); * \param in pointer to the block (64 bit = 8 byte) where the plaintext is read from * \param key pointer to the key (192 bit = 24 byte) */ -void tdes_enc(void* out, const void* in, const void* key); +void tdes_enc(void *out, const void *in, const void *key); -/** \fn void tdes_dec(void* out, const void* in, const void* key) +/** \fn void tdes_dec(void *out, const void *in, const void *key) * \brief decrypt a block with Tripple-DES * * This function decrypts a block of 64 bits (8 bytes) with the Tripple-DES (EDE) @@ -95,6 +95,6 @@ void tdes_enc(void* out, const void* in, const void* key); * \param in pointer to the block (64 bit = 8 byte) where the ciphertext is read from * \param key pointer to the key (192 bit = 24 byte) */ - void tdes_dec(void* out, const void* in, const void* key); + void tdes_dec(void *out, const void *in, const void *key); #endif /*DES_H_*/ diff --git a/dsa/dsa.h b/dsa/dsa.h index b7dacc3..69fa32d 100644 --- a/dsa/dsa.h +++ b/dsa/dsa.h @@ -49,14 +49,14 @@ typedef uint8_t(*rand_func_ptr_t)(void); #define DSA_SIGNATURE_OK 1 #define DSA_SIGNATURE_FAIL 0 -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, +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 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, - const hfdesc_t* hash_desc, const dsa_ctx_t* ctx); +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, + const hfdesc_t *hash_desc, const dsa_ctx_t *ctx); #endif /* DSA_H_ */ diff --git a/dsa/dsa_key_blob.c b/dsa/dsa_key_blob.c index f6e761c..f7c7916 100644 --- a/dsa/dsa_key_blob.c +++ b/dsa/dsa_key_blob.c @@ -270,7 +270,7 @@ static const uint8_t dsa_key_blob[] PROGMEM = { }; #endif -void load_dsa_key_blob(dsa_ctx_t* ctx){ +void load_dsa_key_blob(dsa_ctx_t *ctx){ if(ctx->priv.wordv){ free(ctx->priv.wordv); } diff --git a/dsa/dsa_key_blob.h b/dsa/dsa_key_blob.h index 8099a1e..95d295c 100644 --- a/dsa/dsa_key_blob.h +++ b/dsa/dsa_key_blob.h @@ -20,6 +20,6 @@ #ifndef DSA_KEY_BLOB_H_ #define DSA_KEY_BLOB_H_ -void load_dsa_key_blob(dsa_ctx_t* ctx); +void load_dsa_key_blob(dsa_ctx_t *ctx); #endif /* DSA_KEY_BLOB_H_ */ diff --git a/dsa/dsa_sign.c b/dsa/dsa_sign.c index 7bd57e6..b13ec45 100644 --- a/dsa/dsa_sign.c +++ b/dsa/dsa_sign.c @@ -24,8 +24,8 @@ #include "hashfunction_descriptor.h" #include "hfal-basic.h" -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_bigint(dsa_signature_t *s, const bigint_t *m, + const dsa_ctx_t *ctx, const bigint_t *k){ bigint_t tmp, tmp2; uint8_t tmp_b[ctx->domain.p.length_W+5], tmp2_b[ctx->domain.q.length_W+5]; tmp.wordv= tmp_b; @@ -47,8 +47,8 @@ uint8_t dsa_sign_bigint(dsa_signature_t* s, const bigint_t* m, return 0; } -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, +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 rand_func_ptr_t rand_in){ bigint_t z, k; uint8_t i, n_B = ctx->domain.q.length_W; diff --git a/dsa/dsa_verify.c b/dsa/dsa_verify.c index d0eb4d7..3941a2b 100644 --- a/dsa/dsa_verify.c +++ b/dsa/dsa_verify.c @@ -22,8 +22,8 @@ #include "dsa.h" #include "hfal-basic.h" -uint8_t dsa_verify_bigint(const dsa_signature_t* s, const bigint_t* m, - const dsa_ctx_t* ctx){ +uint8_t dsa_verify_bigint(const dsa_signature_t *s, const bigint_t *m, + const dsa_ctx_t *ctx){ if(s->r.length_W==0 || s->s.length_W==0){ return DSA_SIGNATURE_FAIL; } @@ -54,8 +54,8 @@ uint8_t dsa_verify_bigint(const dsa_signature_t* s, const bigint_t* m, return DSA_SIGNATURE_FAIL; } -uint8_t dsa_verify_message(const dsa_signature_t* s, const void* m, uint16_t m_len_b, - const hfdesc_t* hash_desc, const dsa_ctx_t* ctx){ +uint8_t dsa_verify_message(const dsa_signature_t *s, const void *m, uint16_t m_len_b, + const hfdesc_t *hash_desc, const dsa_ctx_t *ctx){ bigint_t z; uint8_t n_B = ctx->domain.q.length_W; uint8_t hash_value[(hfal_hash_getHashsize(hash_desc)+7)/8]; diff --git a/ecdsa/ecc.h b/ecdsa/ecc.h index 225b31b..a38f32d 100644 --- a/ecdsa/ecc.h +++ b/ecdsa/ecc.h @@ -41,15 +41,15 @@ typedef union __attribute__((packed)){ } ecc_combi_point_t; typedef struct { - bigint_t* p; - bigint_t* b; + bigint_t *p; + bigint_t *b; int (*reduce_p)(bigint_t*); } ecc_curve_sp_t; -uint8_t ecc_chudnovsky_point_alloc(ecc_chudnovsky_point_t* p, size_t length_B); +uint8_t ecc_chudnovsky_point_alloc(ecc_chudnovsky_point_t *p, size_t length_B); -void ecc_chudnovsky_point_free(ecc_chudnovsky_point_t* p); +void ecc_chudnovsky_point_free(ecc_chudnovsky_point_t *p); void ecc_chudnovsky_point_print(const ecc_chudnovsky_point_t *p); @@ -71,15 +71,15 @@ uint8_t ecc_chudnovsky_point_add_sp(ecc_chudnovsky_point_t *dest, uint8_t ecc_chudnovsky_double_and_add(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve); -uint8_t bigint_to_naf(uint8_t* dest, uint16_t *length, const bigint_t *src); + const ecc_curve_sp_t *curve); +uint8_t bigint_to_naf(uint8_t *dest, uint16_t *length, const bigint_t *src); uint8_t ecc_chudnovsky_naf_multiplication(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve); + const ecc_curve_sp_t *curve); uint8_t ecc_chudnovsky_multiplication(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve); + const ecc_curve_sp_t *curve); #endif /* ECC_H_ */ diff --git a/ecdsa/ecc_chudnovsky.c b/ecdsa/ecc_chudnovsky.c index dd3433a..894125b 100644 --- a/ecdsa/ecc_chudnovsky.c +++ b/ecdsa/ecc_chudnovsky.c @@ -38,7 +38,7 @@ #define putchar(a) #endif -uint8_t ecc_chudnovsky_point_alloc(ecc_chudnovsky_point_t* p, size_t length_B){ +uint8_t ecc_chudnovsky_point_alloc(ecc_chudnovsky_point_t *p, size_t length_B){ if(!(p->x.wordv = malloc(length_B))){ printf_P(PSTR("DBG: XXX <%S %s %d>\n"), PSTR(__FILE__), __func__, __LINE__); return 1; @@ -77,7 +77,7 @@ uint8_t ecc_chudnovsky_point_alloc(ecc_chudnovsky_point_t* p, size_t length_B){ return 0; } -void ecc_chudnovsky_point_free(ecc_chudnovsky_point_t* p){ +void ecc_chudnovsky_point_free(ecc_chudnovsky_point_t *p){ free(p->x.wordv); free(p->y.wordv); free(p->z1.wordv); @@ -378,7 +378,7 @@ uint8_t ecc_chudnovsky_point_add_sp(ecc_chudnovsky_point_t *dest, uint8_t ecc_chudnovsky_double_and_add(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve){ + const ecc_curve_sp_t *curve){ uint16_t i; uint8_t s = 0; bigint_word_t v, t; @@ -404,7 +404,7 @@ uint8_t ecc_chudnovsky_double_and_add(ecc_chudnovsky_point_t *dest, return 0; } -uint8_t bigint_to_naf(uint8_t* dest, uint16_t *length, const bigint_t *src){ +uint8_t bigint_to_naf(uint8_t *dest, uint16_t *length, const bigint_t *src){ if(src->length_W == 0){ *dest = 0; *length = 2; @@ -443,7 +443,7 @@ uint8_t bigint_to_naf(uint8_t* dest, uint16_t *length, const bigint_t *src){ return 0; } -void print_naf(uint8_t* naf, uint16_t length){ +void print_naf(uint8_t *naf, uint16_t length){ if(!length){ return; } @@ -466,7 +466,7 @@ void print_naf(uint8_t* naf, uint16_t length){ uint8_t ecc_chudnovsky_naf_multiplication(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve){ + const ecc_curve_sp_t *curve){ if(k->length_W == 0 || p->y.length_W == 0){ bigint_set_zero(&dest->y); return 0; @@ -515,7 +515,7 @@ uint8_t ecc_chudnovsky_naf_multiplication(ecc_chudnovsky_point_t *dest, uint8_t ecc_chudnovsky_multiplication(ecc_chudnovsky_point_t *dest, const bigint_t *k, const ecc_chudnovsky_point_t *p, - const ecc_curve_sp_t* curve){ + const ecc_curve_sp_t *curve){ return ecc_chudnovsky_naf_multiplication(dest, k, p, curve); } @@ -526,6 +526,6 @@ uint8_t ecc_chudnovsky_multipy_and_sum(ecc_chudnovsky_point_t *dest, const ecc_chudnovsky_point_t *p, const bigint_t *l, const ecc_chudnovsky_point_t *q, - const ecc_curve_sp_t* curve){ + const ecc_curve_sp_t *curve){ return ecc_chudnovsky_naf_multiplication(dest, k, p, curve); } diff --git a/ecdsa/ecdsa.h b/ecdsa/ecdsa.h index 9559417..4f56711 100644 --- a/ecdsa/ecdsa.h +++ b/ecdsa/ecdsa.h @@ -43,15 +43,15 @@ typedef uint8_t(*rand_func_ptr_t)(void); #define ECDSA_SIGNATURE_OK 1 #define ECDSA_SIGNATURE_FAIL 0 -uint8_t ecdsa_sign_bigint(ecdsa_signature_t* s, const bigint_t* m, - const ecdsa_ctx_t* ctx, const bigint_t* k); -uint8_t ecdsa_sign_message(ecdsa_signature_t* s, const void* m, uint16_t m_len_b, - const hfdesc_t* hash_desc, const ecdsa_ctx_t* ctx, +uint8_t ecdsa_sign_bigint(ecdsa_signature_t *s, const bigint_t *m, + const ecdsa_ctx_t *ctx, const bigint_t *k); +uint8_t ecdsa_sign_message(ecdsa_signature_t *s, const void *m, uint16_t m_len_b, + const hfdesc_t *hash_desc, const ecdsa_ctx_t *ctx, const void *rand_in); -uint8_t ecdsa_verify_bigint(const ecdsa_signature_t* s, const bigint_t* m, - const ecdsa_ctx_t* ctx); -uint8_t ecdsa_verify_message(const ecdsa_signature_t* s, const void* m, uint16_t m_len_b, - const hfdesc_t* hash_desc, const ecdsa_ctx_t* ctx); +uint8_t ecdsa_verify_bigint(const ecdsa_signature_t *s, const bigint_t *m, + const ecdsa_ctx_t *ctx); +uint8_t ecdsa_verify_message(const ecdsa_signature_t *s, const void *m, uint16_t m_len_b, + const hfdesc_t *hash_desc, const ecdsa_ctx_t *ctx); #endif /* ECDSA_H_ */ diff --git a/ecdsa/ecdsa_sign.c b/ecdsa/ecdsa_sign.c index 8bcf4f4..e6fe11b 100644 --- a/ecdsa/ecdsa_sign.c +++ b/ecdsa/ecdsa_sign.c @@ -31,7 +31,7 @@ #include "bigint_io.h" -uint8_t ecdsa_signature_alloc(ecdsa_signature_t* s, size_t length_B){ +uint8_t ecdsa_signature_alloc(ecdsa_signature_t *s, size_t length_B){ if(!(s->r.wordv = malloc(length_B))){ printf_P(PSTR("DBG: XXX <%S %s %d>\n"), PSTR(__FILE__), __func__, __LINE__); return 1; @@ -46,13 +46,13 @@ uint8_t ecdsa_signature_alloc(ecdsa_signature_t* s, size_t length_B){ return 0; } -void ecdsa_signature_free(ecdsa_signature_t* s){ +void ecdsa_signature_free(ecdsa_signature_t *s){ free(s->r.wordv); free(s->s.wordv); } -uint8_t ecdsa_sign_bigint(ecdsa_signature_t* s, const bigint_t* m, - const ecdsa_ctx_t* ctx, const bigint_t* k){ +uint8_t ecdsa_sign_bigint(ecdsa_signature_t *s, const bigint_t *m, + const ecdsa_ctx_t *ctx, const bigint_t *k){ bigint_t t; ecc_combi_point_t q; @@ -111,8 +111,8 @@ uint8_t ecdsa_sign_bigint(ecdsa_signature_t* s, const bigint_t* m, return 0; } -uint8_t ecdsa_sign_hash(ecdsa_signature_t* s, const void* hash, - size_t hash_len_B, const ecdsa_ctx_t* ctx, +uint8_t ecdsa_sign_hash(ecdsa_signature_t *s, const void *hash, + size_t hash_len_B, const ecdsa_ctx_t *ctx, const void *rand_in){ bigint_t m_int; bigint_t r_int; @@ -169,8 +169,8 @@ uint8_t ecdsa_sign_hash(ecdsa_signature_t* s, const void* hash, return r; } -uint8_t ecdsa_sign_message(ecdsa_signature_t* s, const void* m, uint16_t m_len_b, - const hfdesc_t* hash_desc, const ecdsa_ctx_t* ctx, +uint8_t ecdsa_sign_message(ecdsa_signature_t *s, const void *m, uint16_t m_len_b, + const hfdesc_t *hash_desc, const ecdsa_ctx_t *ctx, const void *rand_in){ uint8_t *hash; diff --git a/ecdsa/ecdsa_sign.h b/ecdsa/ecdsa_sign.h index 578461b..099d48f 100644 --- a/ecdsa/ecdsa_sign.h +++ b/ecdsa/ecdsa_sign.h @@ -25,19 +25,19 @@ #include "ecdsa.h" #include "hfal-basic.h" -uint8_t ecdsa_signature_alloc(ecdsa_signature_t* s, size_t length_B); +uint8_t ecdsa_signature_alloc(ecdsa_signature_t *s, size_t length_B); -void ecdsa_signature_free(ecdsa_signature_t* s); +void ecdsa_signature_free(ecdsa_signature_t *s); -uint8_t ecdsa_sign_bigint(ecdsa_signature_t* s, const bigint_t* m, - const ecdsa_ctx_t* ctx, const bigint_t* k); +uint8_t ecdsa_sign_bigint(ecdsa_signature_t *s, const bigint_t *m, + const ecdsa_ctx_t *ctx, const bigint_t *k); -uint8_t ecdsa_sign_hash(ecdsa_signature_t* s, const void* hash, - size_t hash_len_B, const ecdsa_ctx_t* ctx, +uint8_t ecdsa_sign_hash(ecdsa_signature_t *s, const void *hash, + size_t hash_len_B, const ecdsa_ctx_t *ctx, const void *rand_in); -uint8_t ecdsa_sign_message(ecdsa_signature_t* s, const void* m, uint16_t m_len_b, - const hfdesc_t* hash_desc, const ecdsa_ctx_t* ctx, +uint8_t ecdsa_sign_message(ecdsa_signature_t *s, const void *m, uint16_t m_len_b, + const hfdesc_t *hash_desc, const ecdsa_ctx_t *ctx, const void *rand_in); #endif /* ECDSA_SIGN_H_ */ diff --git a/echo/aes_enc_round-asm.S b/echo/aes_enc_round-asm.S index 2db1dc4..2069419 100644 --- a/echo/aes_enc_round-asm.S +++ b/echo/aes_enc_round-asm.S @@ -40,7 +40,7 @@ xREDUCER = 25 /* - void aes_encrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds) + void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds) */ T0= 2 T1= 3 diff --git a/echo/aes_enc_round.h b/echo/aes_enc_round.h index 18ffd9b..ccbf04e 100644 --- a/echo/aes_enc_round.h +++ b/echo/aes_enc_round.h @@ -28,7 +28,7 @@ typedef struct{ uint8_t ks[16]; } aes_roundkey_t; -void aes_enc_round(aes_cipher_state_t* state, const aes_roundkey_t* k); +void aes_enc_round(aes_cipher_state_t *state, const aes_roundkey_t *k); #endif /* AES_ENC_ROUND_H_ */ diff --git a/echo/echo.c b/echo/echo.c index 6fbbbd8..43703d7 100644 --- a/echo/echo.c +++ b/echo/echo.c @@ -43,7 +43,7 @@ #define GF256MUL_2(a) (gf256mul(2, (a), 0x1b)) #define GF256MUL_3(a) (gf256mul(3, (a), 0x1b)) -static void mixcol(uint8_t* s){ +static void mixcol(uint8_t *s){ uint8_t t, tmp[4]; tmp[0] = *(s+16*0); tmp[1] = *(s+16*1); @@ -70,7 +70,7 @@ static void mixcol(uint8_t* s){ } #if DEBUG -static void dump_state(void* s){ +static void dump_state(void *s){ uint8_t row, col; for(col=0; col<4; col++){ for(row=0; row<4; row++){ @@ -91,7 +91,7 @@ static void dump_state(void* s){ } #endif -static void echo_compress(uint8_t* s, uint8_t iterations, uint64_t* c, void* salt){ +static void echo_compress(uint8_t *s, uint8_t iterations, uint64_t *c, void *salt){ uint8_t i, j; union { uint8_t v8[16]; @@ -169,7 +169,7 @@ static void echo_compress(uint8_t* s, uint8_t iterations, uint64_t* c, void* sal /******************************************************************************/ -static void compress512(void* v, void* m, uint64_t* c, void* salt){ +static void compress512(void *v, void *m, uint64_t *c, void *salt){ uint8_t s[16*16]; uint8_t i; memcpy(s, v, 16*4); /* load v into state */ @@ -186,7 +186,7 @@ static void compress512(void* v, void* m, uint64_t* c, void* salt){ } } -static void compress1024(void* v, void* m, uint64_t* c, void* salt){ +static void compress1024(void *v, void *m, uint64_t *c, void *salt){ uint8_t s[16*16]; memcpy(s, v, 16*8); /* load v into state */ memcpy(s+16*8, m, 16*8); /* load m into state */ @@ -201,12 +201,12 @@ static void compress1024(void* v, void* m, uint64_t* c, void* salt){ /******************************************************************************/ -void echo_small_nextBlock(echo_small_ctx_t* ctx, void* block){ +void echo_small_nextBlock(echo_small_ctx_t *ctx, void *block){ ctx->counter += ECHO_SMALL_BLOCKSIZE; compress512(ctx->v, block, &(ctx->counter), ctx->salt); } -void echo_small_lastBlock(echo_small_ctx_t* ctx, void* block, uint16_t length_b){ +void echo_small_lastBlock(echo_small_ctx_t *ctx, void *block, uint16_t length_b){ while(length_b>=ECHO_SMALL_BLOCKSIZE){ echo_small_nextBlock(ctx, block); block = (uint8_t*)block + ECHO_SMALL_BLOCKSIZE_B; @@ -233,12 +233,12 @@ void echo_small_lastBlock(echo_small_ctx_t* ctx, void* block, uint16_t length_b) /******************************************************************************/ -void echo_large_nextBlock(echo_large_ctx_t* ctx, void* block){ +void echo_large_nextBlock(echo_large_ctx_t *ctx, void *block){ ctx->counter += ECHO_LARGE_BLOCKSIZE; compress1024(ctx->v, block, &(ctx->counter), ctx->salt); } -void echo_large_lastBlock(echo_large_ctx_t* ctx, void* block, uint16_t length_b){ +void echo_large_lastBlock(echo_large_ctx_t *ctx, void *block, uint16_t length_b){ while(length_b>=ECHO_LARGE_BLOCKSIZE){ echo_large_nextBlock(ctx, block); block = (uint8_t*)block + ECHO_LARGE_BLOCKSIZE_B; @@ -264,31 +264,31 @@ void echo_large_lastBlock(echo_large_ctx_t* ctx, void* block, uint16_t length_b) } /******************************************************************************/ -void echo_ctx2hash(void* dest, uint16_t length_b, echo_small_ctx_t* ctx){ +void echo_ctx2hash(void *dest, uint16_t length_b, echo_small_ctx_t *ctx){ memcpy(dest, ctx->v, (length_b+7)/8); } -void echo224_ctx2hash(void* dest, echo_small_ctx_t* ctx){ +void echo224_ctx2hash(void *dest, echo_small_ctx_t *ctx){ memcpy(dest, ctx->v, 224/8); } -void echo256_ctx2hash(void* dest, echo_small_ctx_t* ctx){ +void echo256_ctx2hash(void *dest, echo_small_ctx_t *ctx){ memcpy(dest, ctx->v, 256/8); } /******************************************************************************/ -void echo384_ctx2hash(void* dest, echo_large_ctx_t* ctx){ +void echo384_ctx2hash(void *dest, echo_large_ctx_t *ctx){ memcpy(dest, ctx->v, 384/8); } -void echo512_ctx2hash(void* dest, echo_large_ctx_t* ctx){ +void echo512_ctx2hash(void *dest, echo_large_ctx_t *ctx){ memcpy(dest, ctx->v, 512/8); } /******************************************************************************/ -void echo224_init(echo_small_ctx_t* ctx){ +void echo224_init(echo_small_ctx_t *ctx){ memset(ctx->v, 0, 4*16); ctx->counter = 0; memset(ctx->salt, 0, 16); @@ -299,7 +299,7 @@ void echo224_init(echo_small_ctx_t* ctx){ ctx->v[0+16*3] = 0xE0; } -void echo256_init(echo_small_ctx_t* ctx){ +void echo256_init(echo_small_ctx_t *ctx){ memset(ctx->v, 0, 4*16); ctx->counter = 0; memset(ctx->salt, 0, 16); @@ -312,7 +312,7 @@ void echo256_init(echo_small_ctx_t* ctx){ /******************************************************************************/ -void echo384_init(echo_large_ctx_t* ctx){ +void echo384_init(echo_large_ctx_t *ctx){ uint8_t i; memset(ctx->v, 0, 8*16); ctx->counter = 0; @@ -324,7 +324,7 @@ void echo384_init(echo_large_ctx_t* ctx){ } } -void echo512_init(echo_large_ctx_t* ctx){ +void echo512_init(echo_large_ctx_t *ctx){ uint8_t i; memset(ctx->v, 0, 8*16); ctx->counter = 0; diff --git a/echo/echo.h b/echo/echo.h index e930b3b..179564f 100644 --- a/echo/echo.h +++ b/echo/echo.h @@ -50,20 +50,20 @@ typedef struct{ uint16_t id; }echo_large_ctx_t; -void echo_small_nextBlock(echo_small_ctx_t* ctx, void* block); -void echo_small_lastBlock(echo_small_ctx_t* ctx, void* block, uint16_t length_b); -void echo_small_ctx2hash(void* dest, uint16_t length_b, echo_small_ctx_t* ctx); -void echo224_ctx2hash(void* dest, echo_small_ctx_t* ctx); -void echo256_ctx2hash(void* dest, echo_small_ctx_t* ctx); -void echo224_init(echo_small_ctx_t* ctx); -void echo256_init(echo_small_ctx_t* ctx); +void echo_small_nextBlock(echo_small_ctx_t *ctx, void *block); +void echo_small_lastBlock(echo_small_ctx_t *ctx, void *block, uint16_t length_b); +void echo_small_ctx2hash(void *dest, uint16_t length_b, echo_small_ctx_t *ctx); +void echo224_ctx2hash(void *dest, echo_small_ctx_t *ctx); +void echo256_ctx2hash(void *dest, echo_small_ctx_t *ctx); +void echo224_init(echo_small_ctx_t *ctx); +void echo256_init(echo_small_ctx_t *ctx); -void echo_large_nextBlock(echo_large_ctx_t* ctx, void* block); -void echo_large_lastBlock(echo_large_ctx_t* ctx, void* block, uint16_t length_b); -void echo_large_ctx2hash(void* dest, uint16_t length_b, echo_large_ctx_t* ctx); -void echo384_ctx2hash(void* dest, echo_large_ctx_t* ctx); -void echo512_ctx2hash(void* dest, echo_large_ctx_t* ctx); -void echo384_init(echo_large_ctx_t* ctx); -void echo512_init(echo_large_ctx_t* ctx); +void echo_large_nextBlock(echo_large_ctx_t *ctx, void *block); +void echo_large_lastBlock(echo_large_ctx_t *ctx, void *block, uint16_t length_b); +void echo_large_ctx2hash(void *dest, uint16_t length_b, echo_large_ctx_t *ctx); +void echo384_ctx2hash(void *dest, echo_large_ctx_t *ctx); +void echo512_ctx2hash(void *dest, echo_large_ctx_t *ctx); +void echo384_init(echo_large_ctx_t *ctx); +void echo512_init(echo_large_ctx_t *ctx); #endif /* ECHO_H_ */ diff --git a/entropium/entropium.c b/entropium/entropium.c index 0cc3603..182cd2f 100644 --- a/entropium/entropium.c +++ b/entropium/entropium.c @@ -65,7 +65,7 @@ uint32_t rndCore[16]; * * we simply first "hash" rndCore, then entropy. */ -void entropium_addEntropy(unsigned length_b, const void* data){ +void entropium_addEntropy(unsigned length_b, const void *data){ sha256_ctx_t s; static uint8_t offset=0; /* selects if higher or lower half gets updated */ sha256_init(&s); @@ -116,7 +116,7 @@ uint8_t entropium_getRandomByte(void){ return block[i++]; } -void entropium_fillBlockRandom(void* block, unsigned length_B){ +void entropium_fillBlockRandom(void *block, unsigned length_B){ while(length_B>ENTROPIUM_RANDOMBLOCK_SIZE){ entropium_getRandomBlock(block); block = (uint8_t*)block + ENTROPIUM_RANDOMBLOCK_SIZE; diff --git a/entropium/entropium.h b/entropium/entropium.h index 303619d..ef78ce6 100644 --- a/entropium/entropium.h +++ b/entropium/entropium.h @@ -43,23 +43,23 @@ */ #define ENTROPIUM_RANDOMBLOCK_SIZE 32 /* bytes */ -/** \fn void entropium_addEntropy(unsigned length_b, const void* data) +/** \fn void entropium_addEntropy(unsigned length_b, const void *data) * \brief add entropy to the prng * * This function adds data to the internal entropy pool * \param length_b length of the data block in bits * \param data pointer to the data */ -void entropium_addEntropy(unsigned length_b, const void* data); +void entropium_addEntropy(unsigned length_b, const void *data); -/** \fn void entropium_getRandomBlock(void* b) +/** \fn void entropium_getRandomBlock(void *b) * \brief generate a fixed size block of random data * * This function writes 32 bytes of random extracted from the entropy pool * in the supplied buffer. * \param b buffer where the random data gets written */ -void entropium_getRandomBlock(void* b); +void entropium_getRandomBlock(void *b); /** \fn uint8_t entropium_getRandomByte(void) * \brief get a single byte of random data @@ -70,7 +70,7 @@ void entropium_getRandomBlock(void* b); */ uint8_t entropium_getRandomByte(void); -/** \fn void entropium_fillBlockRandom(void* block, unsigned length_B) +/** \fn void entropium_fillBlockRandom(void *block, unsigned length_B) * \brief get a block of random data * * This function writes random data extracted from the entropy pool in the @@ -79,6 +79,6 @@ uint8_t entropium_getRandomByte(void); * \param block pointer to the buffer where the random data goes * \param length_B number of bytes to be written to the buffer */ -void entropium_fillBlockRandom(void* block, unsigned length_B); +void entropium_fillBlockRandom(void *block, unsigned length_B); #endif /*PRNG_H_*/ diff --git a/grain/grain.c b/grain/grain.c index ff6b97d..fc8c7f7 100644 --- a/grain/grain.c +++ b/grain/grain.c @@ -54,7 +54,7 @@ const uint8_t g_lut[128] PROGMEM = { 0xF3, 0x2E, 0xF3, 0x2E, 0x0C, 0xD1, 0x0C, 0x2E, 0xAC, 0x71, 0xAC, 0x71, 0x53, 0x71, 0xA3, 0xD4 }; #endif -uint8_t grain_enc(grain_ctx_t* ctx){ +uint8_t grain_enc(grain_ctx_t *ctx){ uint8_t s80, s0, c1, c2; uint8_t i; /* clock the LFSR */ @@ -137,7 +137,7 @@ uint8_t grain_enc(grain_ctx_t* ctx){ return (h&1); } -uint8_t grain_getbyte(grain_ctx_t* ctx){ +uint8_t grain_getbyte(grain_ctx_t *ctx){ uint8_t i=0; uint8_t r=0; do{ @@ -166,7 +166,7 @@ uint8_t reverse_bits(uint8_t a){ #endif -void grain_init(const void* key, const void* iv, grain_ctx_t* ctx){ +void grain_init(const void *key, const void *iv, grain_ctx_t *ctx){ uint8_t i,t; /* load the 80bit key */ diff --git a/grain/grain.h b/grain/grain.h index 06e8c78..a8b73f9 100644 --- a/grain/grain.h +++ b/grain/grain.h @@ -35,8 +35,8 @@ typedef struct gain_ctx_st{ uint8_t nfsr[10]; } grain_ctx_t; -uint8_t grain_getbyte(grain_ctx_t* ctx); -uint8_t grain_enc(grain_ctx_t* ctx); -void grain_init(const void* key, const void* iv, grain_ctx_t* ctx); +uint8_t grain_getbyte(grain_ctx_t *ctx); +uint8_t grain_enc(grain_ctx_t *ctx); +void grain_init(const void *key, const void *iv, grain_ctx_t *ctx); #endif /*GRAIN_H_*/ diff --git a/groestl/groestl_large.c b/groestl/groestl_large.c index f7f5eea..972a956 100644 --- a/groestl/groestl_large.c +++ b/groestl/groestl_large.c @@ -40,7 +40,7 @@ #if DEBUG #include "cli.h" - void dump_m(const uint8_t* m){ + void dump_m(const uint8_t *m){ uint8_t i,j; for(i=0; i<16; ++i){ cli_putstr_P(PSTR("\r\n")); @@ -152,20 +152,20 @@ void groestl_large_rounds(uint8_t *m, uint8_t q){ } } -void groestl384_init(groestl384_ctx_t* ctx){ +void groestl384_init(groestl384_ctx_t *ctx){ memset(ctx->h, 0, 16*8); ctx->h[8*16-1] = (uint8_t)384; ctx->h[8*16-2] = (uint8_t)(384>>8); ctx->counter = 0; } -void groestl512_init(groestl512_ctx_t* ctx){ +void groestl512_init(groestl512_ctx_t *ctx){ memset(ctx->h, 0, 16*8); ctx->h[8*16-2] = 2; ctx->counter = 0; } -void groestl_large_nextBlock(groestl_large_ctx_t* ctx, const void* block){ +void groestl_large_nextBlock(groestl_large_ctx_t *ctx, const void *block){ uint8_t tmp1[128], tmp2[128]; /* for(i=0; i<8; ++i){ @@ -184,7 +184,7 @@ void groestl_large_nextBlock(groestl_large_ctx_t* ctx, const void* block){ ctx->counter++; } -void groestl_large_lastBlock(groestl_large_ctx_t* ctx, const void* block, uint16_t length_b){ +void groestl_large_lastBlock(groestl_large_ctx_t *ctx, const void *block, uint16_t length_b){ uint8_t buffer[128]; while(length_b>=GROESTL_LARGE_BLOCKSIZE){ groestl_large_nextBlock(ctx, block); @@ -206,7 +206,7 @@ void groestl_large_lastBlock(groestl_large_ctx_t* ctx, const void* block, uint16 groestl_large_nextBlock(ctx, buffer); } -void groestl_large_ctx2hash(void* dest, const groestl_large_ctx_t* ctx, uint16_t outlength_b){ +void groestl_large_ctx2hash(void *dest, const groestl_large_ctx_t *ctx, uint16_t outlength_b){ uint8_t tmp[128]; memcpy(tmp, ctx->h, 128); groestl_large_rounds(tmp, 0); @@ -218,31 +218,31 @@ void groestl_large_ctx2hash(void* dest, const groestl_large_ctx_t* ctx, uint16_t memcpy(dest, tmp+128-outlength_b/8, outlength_b/8); } -void groestl384_ctx2hash(void* dest, const groestl384_ctx_t* ctx){ +void groestl384_ctx2hash(void *dest, const groestl384_ctx_t *ctx){ groestl_large_ctx2hash(dest, ctx, 384); } -void groestl512_ctx2hash(void* dest, const groestl512_ctx_t* ctx){ +void groestl512_ctx2hash(void *dest, const groestl512_ctx_t *ctx){ groestl_large_ctx2hash(dest, ctx, 512); } -void groestl384_nextBlock(groestl384_ctx_t* ctx, const void* block){ +void groestl384_nextBlock(groestl384_ctx_t *ctx, const void *block){ groestl_large_nextBlock(ctx, block); } -void groestl512_nextBlock(groestl512_ctx_t* ctx, const void* block){ +void groestl512_nextBlock(groestl512_ctx_t *ctx, const void *block){ groestl_large_nextBlock(ctx, block); } -void groestl384_lastBlock(groestl384_ctx_t* ctx, const void* block, uint16_t length_b){ +void groestl384_lastBlock(groestl384_ctx_t *ctx, const void *block, uint16_t length_b){ groestl_large_lastBlock(ctx, block, length_b); } -void groestl512_lastBlock(groestl512_ctx_t* ctx, const void* block, uint16_t length_b){ +void groestl512_lastBlock(groestl512_ctx_t *ctx, const void *block, uint16_t length_b){ groestl_large_lastBlock(ctx, block, length_b); } -void groestl384(void* dest, const void* msg, uint32_t length_b){ +void groestl384(void *dest, const void *msg, uint32_t length_b){ groestl_large_ctx_t ctx; groestl384_init(&ctx); while(length_b>=GROESTL_LARGE_BLOCKSIZE){ @@ -254,7 +254,7 @@ void groestl384(void* dest, const void* msg, uint32_t length_b){ groestl_large_ctx2hash(dest, &ctx, 384); } -void groestl512(void* dest, const void* msg, uint32_t length_b){ +void groestl512(void *dest, const void *msg, uint32_t length_b){ groestl_large_ctx_t ctx; groestl512_init(&ctx); while(length_b>=GROESTL_LARGE_BLOCKSIZE){ diff --git a/groestl/groestl_large.h b/groestl/groestl_large.h index c932fb7..cedc280 100644 --- a/groestl/groestl_large.h +++ b/groestl/groestl_large.h @@ -44,22 +44,22 @@ typedef struct { typedef groestl_large_ctx_t groestl384_ctx_t; typedef groestl_large_ctx_t groestl512_ctx_t; -void groestl384_init(groestl384_ctx_t* ctx); -void groestl512_init(groestl512_ctx_t* ctx); +void groestl384_init(groestl384_ctx_t *ctx); +void groestl512_init(groestl512_ctx_t *ctx); -void groestl_large_nextBlock(groestl_large_ctx_t* ctx, const void* block); -void groestl_large_lastBlock(groestl_large_ctx_t* ctx, const void* block, uint16_t length_b); +void groestl_large_nextBlock(groestl_large_ctx_t *ctx, const void *block); +void groestl_large_lastBlock(groestl_large_ctx_t *ctx, const void *block, uint16_t length_b); -void groestl384_nextBlock(groestl384_ctx_t* ctx, const void* block); -void groestl384_lastBlock(groestl384_ctx_t* ctx, const void* block, uint16_t length_b); +void groestl384_nextBlock(groestl384_ctx_t *ctx, const void *block); +void groestl384_lastBlock(groestl384_ctx_t *ctx, const void *block, uint16_t length_b); -void groestl512_nextBlock(groestl512_ctx_t* ctx, const void* block); -void groestl512_lastBlock(groestl512_ctx_t* ctx, const void* block, uint16_t length_b); +void groestl512_nextBlock(groestl512_ctx_t *ctx, const void *block); +void groestl512_lastBlock(groestl512_ctx_t *ctx, const void *block, uint16_t length_b); -void groestl384_ctx2hash(void* dest, const groestl384_ctx_t* ctx); -void groestl512_ctx2hash(void* dest, const groestl512_ctx_t* ctx); +void groestl384_ctx2hash(void *dest, const groestl384_ctx_t *ctx); +void groestl512_ctx2hash(void *dest, const groestl512_ctx_t *ctx); -void groestl384(void* dest, const void* msg, uint32_t length_b); -void groestl512(void* dest, const void* msg, uint32_t length_b); +void groestl384(void *dest, const void *msg, uint32_t length_b); +void groestl512(void *dest, const void *msg, uint32_t length_b); #endif /* GROESTL_GROESTL_H_ */ diff --git a/groestl/groestl_small.c b/groestl/groestl_small.c index 243bc99..0b66505 100644 --- a/groestl/groestl_small.c +++ b/groestl/groestl_small.c @@ -40,7 +40,7 @@ #if DEBUG #include "cli.h" - void dump_m(const uint8_t* m){ + void dump_m(const uint8_t *m){ uint8_t i,j; for(i=0; i<8; ++i){ cli_putstr_P(PSTR("\r\n")); @@ -160,19 +160,19 @@ void groestl_small_rounds(uint8_t *m, uint8_t q){ } } -void groestl224_init(groestl224_ctx_t* ctx){ +void groestl224_init(groestl224_ctx_t *ctx){ memset(ctx->h, 0, 8*8); ctx->h[8*8-1] = 224; ctx->counter = 1; } -void groestl256_init(groestl256_ctx_t* ctx){ +void groestl256_init(groestl256_ctx_t *ctx){ memset(ctx->h, 0, 8*8); ctx->h[8*8-2] = 1; ctx->counter = 1; } -void groestl_small_nextBlock(groestl_small_ctx_t* ctx, const void* block){ +void groestl_small_nextBlock(groestl_small_ctx_t *ctx, const void *block){ uint8_t tmp1[64], tmp2[64]; /* for(i=0; i<8; ++i){ for(j=0; j<8; ++j){ @@ -190,7 +190,7 @@ void groestl_small_nextBlock(groestl_small_ctx_t* ctx, const void* block){ ctx->counter++; } -void groestl_small_lastBlock(groestl_small_ctx_t* ctx, const void* block, uint16_t length_b){ +void groestl_small_lastBlock(groestl_small_ctx_t *ctx, const void *block, uint16_t length_b){ uint8_t buffer[64]; while(length_b>=GROESTL_SMALL_BLOCKSIZE){ groestl_small_nextBlock(ctx, block); @@ -212,7 +212,7 @@ void groestl_small_lastBlock(groestl_small_ctx_t* ctx, const void* block, uint16 groestl_small_nextBlock(ctx, buffer); } -void groestl_small_ctx2hash(void* dest, const groestl_small_ctx_t* ctx, uint16_t outlength_b){ +void groestl_small_ctx2hash(void *dest, const groestl_small_ctx_t *ctx, uint16_t outlength_b){ uint8_t tmp[64]; memcpy(tmp, ctx->h, 64); groestl_small_rounds(tmp, 0); @@ -224,31 +224,31 @@ void groestl_small_ctx2hash(void* dest, const groestl_small_ctx_t* ctx, uint16_t memcpy(dest, tmp+64-outlength_b/8, outlength_b/8); } -void groestl224_ctx2hash(void* dest, const groestl224_ctx_t* ctx){ +void groestl224_ctx2hash(void *dest, const groestl224_ctx_t *ctx){ groestl_small_ctx2hash(dest, ctx, 224); } -void groestl256_ctx2hash(void* dest, const groestl256_ctx_t* ctx){ +void groestl256_ctx2hash(void *dest, const groestl256_ctx_t *ctx){ groestl_small_ctx2hash(dest, ctx, 256); } -void groestl224_nextBlock(groestl224_ctx_t* ctx, const void* block){ +void groestl224_nextBlock(groestl224_ctx_t *ctx, const void *block){ groestl_small_nextBlock(ctx, block); } -void groestl256_nextBlock(groestl256_ctx_t* ctx, const void* block){ +void groestl256_nextBlock(groestl256_ctx_t *ctx, const void *block){ groestl_small_nextBlock(ctx, block); } -void groestl224_lastBlock(groestl224_ctx_t* ctx, const void* block, uint16_t length_b){ +void groestl224_lastBlock(groestl224_ctx_t *ctx, const void *block, uint16_t length_b){ groestl_small_lastBlock(ctx, block, length_b); } -void groestl256_lastBlock(groestl256_ctx_t* ctx, const void* block, uint16_t length_b){ +void groestl256_lastBlock(groestl256_ctx_t *ctx, const void *block, uint16_t length_b){ groestl_small_lastBlock(ctx, block, length_b); } -void groestl224(void* dest, const void* msg, uint32_t length_b){ +void groestl224(void *dest, const void *msg, uint32_t length_b){ groestl_small_ctx_t ctx; groestl224_init(&ctx); while(length_b>=GROESTL_SMALL_BLOCKSIZE){ @@ -260,7 +260,7 @@ void groestl224(void* dest, const void* msg, uint32_t length_b){ groestl_small_ctx2hash(dest, &ctx, 224); } -void groestl256(void* dest, const void* msg, uint32_t length_b){ +void groestl256(void *dest, const void *msg, uint32_t length_b){ groestl_small_ctx_t ctx; groestl256_init(&ctx); while(length_b>=GROESTL_SMALL_BLOCKSIZE){ diff --git a/groestl/groestl_small.h b/groestl/groestl_small.h index 819cc4c..652684a 100644 --- a/groestl/groestl_small.h +++ b/groestl/groestl_small.h @@ -44,22 +44,22 @@ typedef struct { typedef groestl_small_ctx_t groestl224_ctx_t; typedef groestl_small_ctx_t groestl256_ctx_t; -void groestl224_init(groestl224_ctx_t* ctx); -void groestl256_init(groestl256_ctx_t* ctx); +void groestl224_init(groestl224_ctx_t *ctx); +void groestl256_init(groestl256_ctx_t *ctx); -void groestl_small_nextBlock(groestl_small_ctx_t* ctx, const void* block); -void groestl_small_lastBlock(groestl_small_ctx_t* ctx, const void* block, uint16_t length_b); +void groestl_small_nextBlock(groestl_small_ctx_t *ctx, const void *block); +void groestl_small_lastBlock(groestl_small_ctx_t *ctx, const void *block, uint16_t length_b); -void groestl224_nextBlock(groestl224_ctx_t* ctx, const void* block); -void groestl224_lastBlock(groestl224_ctx_t* ctx, const void* block, uint16_t length_b); +void groestl224_nextBlock(groestl224_ctx_t *ctx, const void *block); +void groestl224_lastBlock(groestl224_ctx_t *ctx, const void *block, uint16_t length_b); -void groestl256_nextBlock(groestl256_ctx_t* ctx, const void* block); -void groestl256_lastBlock(groestl256_ctx_t* ctx, const void* block, uint16_t length_b); +void groestl256_nextBlock(groestl256_ctx_t *ctx, const void *block); +void groestl256_lastBlock(groestl256_ctx_t *ctx, const void *block, uint16_t length_b); -void groestl224_ctx2hash(void* dest, const groestl224_ctx_t* ctx); -void groestl256_ctx2hash(void* dest, const groestl256_ctx_t* ctx); +void groestl224_ctx2hash(void *dest, const groestl224_ctx_t *ctx); +void groestl256_ctx2hash(void *dest, const groestl256_ctx_t *ctx); -void groestl224(void* dest, const void* msg, uint32_t length_b); -void groestl256(void* dest, const void* msg, uint32_t length_b); +void groestl224(void *dest, const void *msg, uint32_t length_b); +void groestl256(void *dest, const void *msg, uint32_t length_b); #endif /* GROESTL_GROESTL_H_ */ diff --git a/hashfunction_descriptor.h b/hashfunction_descriptor.h index 8eb12c1..7532862 100644 --- a/hashfunction_descriptor.h +++ b/hashfunction_descriptor.h @@ -50,7 +50,7 @@ typedef struct { } hfdesc_t; /* hashfunction descriptor type */ typedef struct{ - hfdesc_t* desc_ptr; + hfdesc_t *desc_ptr; void* ctx; } hfgen_ctx_t; diff --git a/hfal/hfal-basic.c b/hfal/hfal-basic.c index f8f63f8..5741df1 100644 --- a/hfal/hfal-basic.c +++ b/hfal/hfal-basic.c @@ -22,7 +22,7 @@ #include "hfal-basic.h" #include -uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx){ +uint8_t hfal_hash_init(const hfdesc_t *hash_descriptor, hfgen_ctx_t *ctx){ hf_init_fpt f; uint16_t tmp; ctx->desc_ptr = (hfdesc_t*)hash_descriptor; @@ -34,37 +34,37 @@ uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx){ return 0; } -void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block){ +void hfal_hash_nextBlock(hfgen_ctx_t *ctx, const void *block){ hf_nextBlock_fpt f; - hfdesc_t* x=(ctx->desc_ptr); + hfdesc_t *x=(ctx->desc_ptr); f =(hf_nextBlock_fpt)pgm_read_word(&(x->nextBlock)); f(ctx->ctx, block); } -void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b){ +void hfal_hash_lastBlock(hfgen_ctx_t *ctx, const void *block, uint16_t length_b){ hf_lastBlock_fpt f; - hfdesc_t* x=ctx->desc_ptr; + hfdesc_t *x=ctx->desc_ptr; f =(hf_lastBlock_fpt)pgm_read_word(&(x->lastBlock)); f(ctx->ctx, block, length_b); } -void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx){ +void hfal_hash_ctx2hash(void *dest, hfgen_ctx_t *ctx){ hf_ctx2hash_fpt f; - hfdesc_t* x=ctx->desc_ptr; + hfdesc_t *x=ctx->desc_ptr; f =(hf_ctx2hash_fpt)pgm_read_word(&(x->ctx2hash)); f(dest, ctx->ctx); } -void hfal_hash_free(hfgen_ctx_t* ctx){ +void hfal_hash_free(hfgen_ctx_t *ctx){ hf_free_fpt f; - hfdesc_t* x=ctx->desc_ptr; + hfdesc_t *x=ctx->desc_ptr; f =(hf_free_fpt)pgm_read_word(&(x->free)); if(f) f(ctx->ctx); free(ctx->ctx); } -void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b){ +void hfal_hash_mem(const hfdesc_t *hash_descriptor, void *dest, const void *msg, uint32_t length_b){ void_fpt f; f = (void_fpt)pgm_read_word(&(hash_descriptor->mem)); if(f){ @@ -89,19 +89,19 @@ void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, } } -uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor){ +uint16_t hfal_hash_getBlocksize(const hfdesc_t *hash_descriptor){ uint16_t ret; ret = pgm_read_word(&(hash_descriptor->blocksize_b)); return ret; } -uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor){ +uint16_t hfal_hash_getHashsize(const hfdesc_t *hash_descriptor){ uint16_t ret; ret = pgm_read_word(&(hash_descriptor->hashsize_b)); return ret; } -uint16_t hfal_hash_getCtxsize_B(const hfdesc_t* hash_descriptor){ +uint16_t hfal_hash_getCtxsize_B(const hfdesc_t *hash_descriptor){ uint16_t ret; ret = pgm_read_word(&(hash_descriptor->ctxsize_B)); return ret; diff --git a/hfal/hfal-basic.h b/hfal/hfal-basic.h index 43a2fc1..e1651f8 100644 --- a/hfal/hfal-basic.h +++ b/hfal/hfal-basic.h @@ -23,14 +23,14 @@ #include #include "hashfunction_descriptor.h" -uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx); -void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block); -void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b); -void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx); -void hfal_hash_free(hfgen_ctx_t* ctx); -void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b); -uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor); -uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor); -uint16_t hfal_hash_getCtxsize_B(const hfdesc_t* hash_descriptor); +uint8_t hfal_hash_init(const hfdesc_t *hash_descriptor, hfgen_ctx_t *ctx); +void hfal_hash_nextBlock(hfgen_ctx_t *ctx, const void *block); +void hfal_hash_lastBlock(hfgen_ctx_t *ctx, const void *block, uint16_t length_b); +void hfal_hash_ctx2hash(void *dest, hfgen_ctx_t *ctx); +void hfal_hash_free(hfgen_ctx_t *ctx); +void hfal_hash_mem(const hfdesc_t *hash_descriptor, void *dest, const void *msg, uint32_t length_b); +uint16_t hfal_hash_getBlocksize(const hfdesc_t *hash_descriptor); +uint16_t hfal_hash_getHashsize(const hfdesc_t *hash_descriptor); +uint16_t hfal_hash_getCtxsize_B(const hfdesc_t *hash_descriptor); #endif /* HFAL_BASIC_H_ */ diff --git a/hfal/hfal-hmac.c b/hfal/hfal-hmac.c index dbc5608..2bc7942 100644 --- a/hfal/hfal-hmac.c +++ b/hfal/hfal-hmac.c @@ -25,9 +25,9 @@ #define IPAD 0x36 #define OPAD 0x5C -uint8_t hfal_hmac_init(const hfdesc_t* hash_descriptor, - hfhmacgen_ctx_t* ctx, - const void* key, uint16_t keylength_b){ +uint8_t hfal_hmac_init(const hfdesc_t *hash_descriptor, + hfhmacgen_ctx_t *ctx, + const void *key, uint16_t keylength_b){ uint16_t bs = hfal_hash_getBlocksize(); uint8_t buffer[bs/8]; uint8_t i; @@ -67,13 +67,13 @@ uint8_t hfal_hmac_init(const hfdesc_t* hash_descriptor, memset(buffer, 0, bs/8); } -void hfal_hmac_nextBlock(hfhmacgen_ctx_t* ctx, const void* block){ +void hfal_hmac_nextBlock(hfhmacgen_ctx_t *ctx, const void *block){ hf_nextBlock_fpt nextBlock; nextBlock = pgm_read_word(&(hash_descriptor->nextBlock)); nextBlock(ctx->ctx, block); } -void hfal_hmac_lastBlock(hfhmacgen_ctx_t* ctx, const void* block, uint16_t length_b){ +void hfal_hmac_lastBlock(hfhmacgen_ctx_t *ctx, const void *block, uint16_t length_b){ hf_lastBlock_fpt lastBlock; hf_ctx2hash_fpt ctx2hash; uint16_t hs = pgm_read_word(&(hash_descriptor->hashsize_b)); @@ -85,13 +85,13 @@ void hfal_hmac_lastBlock(hfhmacgen_ctx_t* ctx, const void* block, uint16_t lengt lastBlock(ctx->finctx, buffer, hs); } -void hfal_hmac_ctx2mac(void* dest, hfhmacgen_ctx_t* ctx){ +void hfal_hmac_ctx2mac(void *dest, hfhmacgen_ctx_t *ctx){ hf_ctx2hash_fpt ctx2hash; ctx2hash = pgm_read_word(&(hash_descriptor->ctx2hash)); ctx2hash(dest, ctx->finctx); } -void hfal_hmac_free(hfhmacgen_ctx_t* ctx){ +void hfal_hmac_free(hfhmacgen_ctx_t *ctx){ hf_free_fpt free_fpt; free_fpt = pgm_read_word(&(hash_descriptor->free)); if(free_fpt){ @@ -102,7 +102,7 @@ void hfal_hmac_free(hfhmacgen_ctx_t* ctx){ free(ctx->finctx) } -void hfal_hmac_mem(const hfdesc_t* hash_descriptor, const void* key, uint16_t keylength_b, void* dest, const void* msg, uint32_t length_b){ +void hfal_hmac_mem(const hfdesc_t *hash_descriptor, const void *key, uint16_t keylength_b, void *dest, const void *msg, uint32_t length_b){ hfhmacgen_ctx_t ctx; uint16_t bs = hfal_hash_getBlocksize(); hfal_hmac_init(hash_descriptor, &ctx, key, keylength_b); @@ -116,11 +116,11 @@ void hfal_hmac_mem(const hfdesc_t* hash_descriptor, const void* key, uint16_t ke hfal_free(&ctx); } -uint16_t hfal_hmac_getBlocksize(const hfdesc_t* hash_descriptor){ +uint16_t hfal_hmac_getBlocksize(const hfdesc_t *hash_descriptor){ return hfal_hash_getBlocksize(hash_descriptor); } -uint16_t hfal_hmac_getMACsize(const hfdesc_t* hash_descriptor){ +uint16_t hfal_hmac_getMACsize(const hfdesc_t *hash_descriptor){ return hfal_hash_getHashsize(hash_descriptor); } diff --git a/hfal/hfal-hmac.h b/hfal/hfal-hmac.h index 8c9b899..4b70b99 100644 --- a/hfal/hfal-hmac.h +++ b/hfal/hfal-hmac.h @@ -24,18 +24,18 @@ #include "hashfunction_descriptor.h" typedef struct { - hfdesc_t* desc; + hfdesc_t *desc; void* ctx; void* finctx; } hfhmacgen_ctx_t; -uint8_t hfal_hmac_init(const hfdesc_t* hash_descriptor, hfhmacgen_ctx_t* ctx, const void* key, uint16_t keylength_b); -void hfal_hmac_nextBlock(hfhmacgen_ctx_t* ctx, const void* block); -void hfal_hmac_lastBlock(hfhmacgen_ctx_t* ctx, const void* block, uint16_t length_b); -void hfal_hmac_ctx2mac(void* dest, hfhmacgen_ctx_t* ctx); -void hfal_hmac_free(hfhmacgen_ctx_t* ctx); -void hfal_hmac_mem(const hfdesc_t* hash_descriptor, const void* key, uint16_t keylength_b, void* dest, const void* msg, uint32_t length_b); -uint16_t hfal_hmac_getBlocksize(const hfdesc_t* hash_descriptor); -uint16_t hfal_hmac_getMACsize(const hfdesc_t* hash_descriptor); +uint8_t hfal_hmac_init(const hfdesc_t *hash_descriptor, hfhmacgen_ctx_t *ctx, const void *key, uint16_t keylength_b); +void hfal_hmac_nextBlock(hfhmacgen_ctx_t *ctx, const void *block); +void hfal_hmac_lastBlock(hfhmacgen_ctx_t *ctx, const void *block, uint16_t length_b); +void hfal_hmac_ctx2mac(void *dest, hfhmacgen_ctx_t *ctx); +void hfal_hmac_free(hfhmacgen_ctx_t *ctx); +void hfal_hmac_mem(const hfdesc_t *hash_descriptor, const void *key, uint16_t keylength_b, void *dest, const void *msg, uint32_t length_b); +uint16_t hfal_hmac_getBlocksize(const hfdesc_t *hash_descriptor); +uint16_t hfal_hmac_getMACsize(const hfdesc_t *hash_descriptor); #endif /* HFAL_HMAC_H_ */ diff --git a/hfal/hfal-nessie.c b/hfal/hfal-nessie.c index be21078..3e0c023 100644 --- a/hfal/hfal-nessie.c +++ b/hfal/hfal-nessie.c @@ -30,7 +30,7 @@ #include #include -void hfal_nessie(const hfdesc_t* hd){ +void hfal_nessie(const hfdesc_t *hd){ if(pgm_read_byte(&(hd->type))!=HFDESC_TYPE_HASHFUNCTION) return; char name[1+strlen_P((void*)pgm_read_word(&(hd->name)))]; @@ -48,8 +48,8 @@ void hfal_nessie(const hfdesc_t* hd){ nessie_hash_run(); } -void hfal_nessie_multiple(const hfdesc_t* const* hd_list){ - const hfdesc_t* hd; +void hfal_nessie_multiple(const hfdesc_t *const *hd_list){ + const hfdesc_t *hd; for(;;){ hd = (void*)pgm_read_word(hd_list); if(!hd) diff --git a/hfal/hfal-nessie.h b/hfal/hfal-nessie.h index c06db33..1807dc9 100644 --- a/hfal/hfal-nessie.h +++ b/hfal/hfal-nessie.h @@ -30,7 +30,7 @@ #include "hashfunction_descriptor.h" -void hfal_nessie(const hfdesc_t* hd); -void hfal_nessie_multiple(const hfdesc_t* const* hd_list); +void hfal_nessie(const hfdesc_t *hd); +void hfal_nessie_multiple(const hfdesc_t *const *hd_list); #endif /* HFAL_NESSIE_H_ */ diff --git a/hfal/hfal-performance.c b/hfal/hfal-performance.c index a0fd1fd..192d602 100644 --- a/hfal/hfal-performance.c +++ b/hfal/hfal-performance.c @@ -49,7 +49,7 @@ void printvalue(unsigned long v){ cli_putstr(str); } -void hfal_performance(const hfdesc_t* hd){ +void hfal_performance(const hfdesc_t *hd){ hfdesc_t hf; memcpy_P(&hf, hd, sizeof(hfdesc_t)); uint8_t ctx[hf.ctxsize_B]; @@ -131,7 +131,7 @@ void hfal_performance(const hfdesc_t* hd){ } } -void hfal_stacksize(const hfdesc_t* hd){ +void hfal_stacksize(const hfdesc_t *hd){ hfdesc_t hf; stack_measuring_ctx_t smctx; memcpy_P(&hf, hd, sizeof(hfdesc_t)); @@ -203,8 +203,8 @@ void hfal_stacksize(const hfdesc_t* hd){ } } -void hfal_performance_multiple(const hfdesc_t* const* hd_list){ - const hfdesc_t* hd; +void hfal_performance_multiple(const hfdesc_t *const *hd_list){ + const hfdesc_t *hd; for(;;){ hd = (void*)pgm_read_word(hd_list); if(!hd){ diff --git a/hfal/hfal-performance.h b/hfal/hfal-performance.h index b8de940..b65f6ee 100644 --- a/hfal/hfal-performance.h +++ b/hfal/hfal-performance.h @@ -30,6 +30,6 @@ #include "hashfunction_descriptor.h" -void hfal_performance(const hfdesc_t* hd); -void hfal_performance_multiple(const hfdesc_t* const* hd_list); +void hfal_performance(const hfdesc_t *hd); +void hfal_performance_multiple(const hfdesc_t *const *hd_list); #endif /* HFAL_PERFORMANCE_H_ */ diff --git a/hfal/hfal-test.c b/hfal/hfal-test.c index 9efce38..c71a7a3 100644 --- a/hfal/hfal-test.c +++ b/hfal/hfal-test.c @@ -31,7 +31,7 @@ #include #include -void hfal_test(const hfdesc_t* hd, void* msg, uint32_t length_b){ +void hfal_test(const hfdesc_t *hd, void *msg, uint32_t length_b){ if(pgm_read_byte(&(hd->type))!=HFDESC_TYPE_HASHFUNCTION) return; uint16_t dlen = (pgm_read_word(&(hd->hashsize_b))+7)/8; diff --git a/hfal/hfal-test.h b/hfal/hfal-test.h index ac43338..95a63f3 100644 --- a/hfal/hfal-test.h +++ b/hfal/hfal-test.h @@ -31,6 +31,6 @@ #include "hashfunction_descriptor.h" #include -void hfal_test(const hfdesc_t* hd, void* msg, uint32_t length_b); +void hfal_test(const hfdesc_t *hd, void *msg, uint32_t length_b); #endif /* HFAL_TEST_H_ */ diff --git a/hfal/hfal_skein1024.c b/hfal/hfal_skein1024.c index 485bed5..93d79b2 100644 --- a/hfal/hfal_skein1024.c +++ b/hfal/hfal_skein1024.c @@ -39,25 +39,25 @@ static const char skein1024_384_str[] PROGMEM = "Skein-1024-384"; static const char skein1024_512_str[] PROGMEM = "Skein-1024-512"; static const char skein1024_1024_str[] PROGMEM = "Skein-1024-1024"; -void skein1024_128_init(skein1024_ctx_t* ctx){ +void skein1024_128_init(skein1024_ctx_t *ctx){ skein1024_init(ctx, 128); } -void skein1024_160_init(skein1024_ctx_t* ctx){ +void skein1024_160_init(skein1024_ctx_t *ctx){ skein1024_init(ctx, 160); } -void skein1024_224_init(skein1024_ctx_t* ctx){ +void skein1024_224_init(skein1024_ctx_t *ctx){ skein1024_init(ctx, 224); } -void skein1024_256_init(skein1024_ctx_t* ctx){ +void skein1024_256_init(skein1024_ctx_t *ctx){ skein1024_init(ctx, 256); } -void skein1024_384_init(skein1024_ctx_t* ctx){ +void skein1024_384_init(skein1024_ctx_t *ctx){ skein1024_init(ctx, 384); } -void skein1024_512_init(skein1024_ctx_t* ctx){ +void skein1024_512_init(skein1024_ctx_t *ctx){ skein1024_init(ctx, 512); } -void skein1024_1024_init(skein1024_ctx_t* ctx){ +void skein1024_1024_init(skein1024_ctx_t *ctx){ skein1024_init(ctx, 1024); } diff --git a/hfal/hfal_skein256.c b/hfal/hfal_skein256.c index c647e1e..5855108 100644 --- a/hfal/hfal_skein256.c +++ b/hfal/hfal_skein256.c @@ -38,22 +38,22 @@ static const char skein256_256_str[] PROGMEM = "Skein-256-256"; static const char skein256_384_str[] PROGMEM = "Skein-256-384"; static const char skein256_512_str[] PROGMEM = "Skein-256-512"; -void skein256_128_init(skein256_ctx_t* ctx){ +void skein256_128_init(skein256_ctx_t *ctx){ skein256_init(ctx, 128); } -void skein256_160_init(skein256_ctx_t* ctx){ +void skein256_160_init(skein256_ctx_t *ctx){ skein256_init(ctx, 160); } -void skein256_224_init(skein256_ctx_t* ctx){ +void skein256_224_init(skein256_ctx_t *ctx){ skein256_init(ctx, 224); } -void skein256_256_init(skein256_ctx_t* ctx){ +void skein256_256_init(skein256_ctx_t *ctx){ skein256_init(ctx, 256); } -void skein256_384_init(skein256_ctx_t* ctx){ +void skein256_384_init(skein256_ctx_t *ctx){ skein256_init(ctx, 384); } -void skein256_512_init(skein256_ctx_t* ctx){ +void skein256_512_init(skein256_ctx_t *ctx){ skein256_init(ctx, 512); } diff --git a/hfal/hfal_skein512.c b/hfal/hfal_skein512.c index f78bc6f..6ed405e 100644 --- a/hfal/hfal_skein512.c +++ b/hfal/hfal_skein512.c @@ -39,25 +39,25 @@ static const char skein512_384_str[] PROGMEM = "Skein-512-384"; static const char skein512_512_str[] PROGMEM = "Skein-512-512"; static const char skein512_1024_str[] PROGMEM = "Skein-512-1024"; -void skein512_128_init(skein512_ctx_t* ctx){ +void skein512_128_init(skein512_ctx_t *ctx){ skein512_init(ctx, 128); } -void skein512_160_init(skein512_ctx_t* ctx){ +void skein512_160_init(skein512_ctx_t *ctx){ skein512_init(ctx, 160); } -void skein512_224_init(skein512_ctx_t* ctx){ +void skein512_224_init(skein512_ctx_t *ctx){ skein512_init(ctx, 224); } -void skein512_256_init(skein512_ctx_t* ctx){ +void skein512_256_init(skein512_ctx_t *ctx){ skein512_init(ctx, 256); } -void skein512_384_init(skein512_ctx_t* ctx){ +void skein512_384_init(skein512_ctx_t *ctx){ skein512_init(ctx, 384); } -void skein512_512_init(skein512_ctx_t* ctx){ +void skein512_512_init(skein512_ctx_t *ctx){ skein512_init(ctx, 512); } -void skein512_1024_init(skein512_ctx_t* ctx){ +void skein512_1024_init(skein512_ctx_t *ctx){ skein512_init(ctx, 1024); } diff --git a/hmac-md5/hmac-md5.c b/hmac-md5/hmac-md5.c index d72dca9..a7add23 100644 --- a/hmac-md5/hmac-md5.c +++ b/hmac-md5/hmac-md5.c @@ -39,7 +39,7 @@ #ifndef HMAC_SHORTONLY -void hmac_md5_init(hmac_md5_ctx_t *s, void* key, uint16_t keylength_b){ +void hmac_md5_init(hmac_md5_ctx_t *s, void *key, uint16_t keylength_b){ uint8_t buffer[MD5_BLOCK_BYTES]; uint8_t i; @@ -67,15 +67,15 @@ void hmac_md5_init(hmac_md5_ctx_t *s, void* key, uint16_t keylength_b){ #endif } -void hmac_md5_nextBlock(hmac_md5_ctx_t *s, const void* block){ +void hmac_md5_nextBlock(hmac_md5_ctx_t *s, const void *block){ md5_nextBlock(&(s->a), block); } -void hmac_md5_lastBlock(hmac_md5_ctx_t *s, const void* block, uint16_t length_b){ +void hmac_md5_lastBlock(hmac_md5_ctx_t *s, const void *block, uint16_t length_b){ md5_lastBlock(&(s->a), block, length_b); } -void hmac_md5_final(void* dest, hmac_md5_ctx_t *s){ +void hmac_md5_final(void *dest, hmac_md5_ctx_t *s){ md5_ctx2hash((md5_hash_t*)dest, &(s->a)); md5_lastBlock(&(s->b), dest, MD5_HASH_BITS); md5_ctx2hash((md5_hash_t*)dest, &(s->b)); @@ -92,7 +92,7 @@ void hmac_md5_lastBlock() * keylength in bits! * message length in bits! */ -void hmac_md5(void* dest, void* key, uint16_t keylength_b, void* msg, uint32_t msglength_b){ /* a one-shot*/ +void hmac_md5(void *dest, void *key, uint16_t keylength_b, void *msg, uint32_t msglength_b){ /* a one-shot*/ md5_ctx_t s; uint8_t i; uint8_t buffer[MD5_BLOCK_BYTES]; diff --git a/hmac-md5/hmac-md5.h b/hmac-md5/hmac-md5.h index 5bbaeb9..d608983 100644 --- a/hmac-md5/hmac-md5.h +++ b/hmac-md5/hmac-md5.h @@ -31,12 +31,12 @@ typedef struct{ } hmac_md5_ctx_t; -void hmac_md5_init(hmac_md5_ctx_t *s, void* key, uint16_t keylength_b); -void hmac_md5_nextBlock(hmac_md5_ctx_t *s, const void* block); -void hmac_md5_lastBlock(hmac_md5_ctx_t *s, const void* block, uint16_t length_b); -void hmac_md5_final(void* dest, hmac_md5_ctx_t *s); +void hmac_md5_init(hmac_md5_ctx_t *s, void *key, uint16_t keylength_b); +void hmac_md5_nextBlock(hmac_md5_ctx_t *s, const void *block); +void hmac_md5_lastBlock(hmac_md5_ctx_t *s, const void *block, uint16_t length_b); +void hmac_md5_final(void *dest, hmac_md5_ctx_t *s); -void hmac_md5(void* dest, void* key, uint16_t keylength_b, void* msg, uint32_t msglength_b); +void hmac_md5(void *dest, void *key, uint16_t keylength_b, void *msg, uint32_t msglength_b); #endif /*HMACMD5_H_*/ diff --git a/hmac-sha1/hmac-sha1.c b/hmac-sha1/hmac-sha1.c index 3ac8872..9f22590 100644 --- a/hmac-sha1/hmac-sha1.c +++ b/hmac-sha1/hmac-sha1.c @@ -40,7 +40,7 @@ #ifndef HMAC_SHORTONLY -void hmac_sha1_init(hmac_sha1_ctx_t *s, const void* key, uint16_t keylength_b){ +void hmac_sha1_init(hmac_sha1_ctx_t *s, const void *key, uint16_t keylength_b){ uint8_t buffer[SHA1_BLOCK_BYTES]; uint8_t i; @@ -69,10 +69,10 @@ void hmac_sha1_init(hmac_sha1_ctx_t *s, const void* key, uint16_t keylength_b){ #endif } -void hmac_sha1_nextBlock(hmac_sha1_ctx_t *s, const void* block){ +void hmac_sha1_nextBlock(hmac_sha1_ctx_t *s, const void *block){ sha1_nextBlock(&(s->a), block); } -void hmac_sha1_lastBlock(hmac_sha1_ctx_t *s, const void* block, uint16_t length_b){ +void hmac_sha1_lastBlock(hmac_sha1_ctx_t *s, const void *block, uint16_t length_b){ while(length_b>=SHA1_BLOCK_BITS){ sha1_nextBlock(&s->a, block); block = (uint8_t*)block + SHA1_BLOCK_BYTES; @@ -81,7 +81,7 @@ void hmac_sha1_lastBlock(hmac_sha1_ctx_t *s, const void* block, uint16_t length_ sha1_lastBlock(&s->a, block, length_b); } -void hmac_sha1_final(void* dest, hmac_sha1_ctx_t *s){ +void hmac_sha1_final(void *dest, hmac_sha1_ctx_t *s){ sha1_ctx2hash(dest, &s->a); sha1_lastBlock(&s->b, dest, SHA1_HASH_BITS); sha1_ctx2hash(dest, &(s->b)); @@ -93,7 +93,7 @@ void hmac_sha1_final(void* dest, hmac_sha1_ctx_t *s){ * keylength in bits! * message length in bits! */ -void hmac_sha1(void* dest, const void* key, uint16_t keylength_b, const void* msg, uint32_t msglength_b){ /* a one-shot*/ +void hmac_sha1(void *dest, const void *key, uint16_t keylength_b, const void *msg, uint32_t msglength_b){ /* a one-shot*/ sha1_ctx_t s; uint8_t i; uint8_t buffer[SHA1_BLOCK_BYTES]; diff --git a/hmac-sha1/hmac-sha1.h b/hmac-sha1/hmac-sha1.h index d0be029..fccd5ed 100644 --- a/hmac-sha1/hmac-sha1.h +++ b/hmac-sha1/hmac-sha1.h @@ -31,11 +31,11 @@ typedef struct{ } hmac_sha1_ctx_t; -void hmac_sha1_init(hmac_sha1_ctx_t *s, const void* key, uint16_t keylength_b); -void hmac_sha1_nextBlock(hmac_sha1_ctx_t *s, const void* block); -void hmac_sha1_lastBlock(hmac_sha1_ctx_t *s, const void* block, uint16_t length_b); -void hmac_sha1_final(void* dest, hmac_sha1_ctx_t *s); +void hmac_sha1_init(hmac_sha1_ctx_t *s, const void *key, uint16_t keylength_b); +void hmac_sha1_nextBlock(hmac_sha1_ctx_t *s, const void *block); +void hmac_sha1_lastBlock(hmac_sha1_ctx_t *s, const void *block, uint16_t length_b); +void hmac_sha1_final(void *dest, hmac_sha1_ctx_t *s); -void hmac_sha1(void* dest, const void* key, uint16_t keylength_b, const void* msg, uint32_t msglength_b); +void hmac_sha1(void *dest, const void *key, uint16_t keylength_b, const void *msg, uint32_t msglength_b); #endif /*HMACSHA1_H_*/ diff --git a/hmac-sha256/hmac-sha256.c b/hmac-sha256/hmac-sha256.c index 6a57189..f675e03 100644 --- a/hmac-sha256/hmac-sha256.c +++ b/hmac-sha256/hmac-sha256.c @@ -39,7 +39,7 @@ #ifndef HMAC_SHA256_SHORTONLY -void hmac_sha256_init(hmac_sha256_ctx_t *s, const void* key, uint16_t keylength_b){ +void hmac_sha256_init(hmac_sha256_ctx_t *s, const void *key, uint16_t keylength_b){ uint8_t buffer[HMAC_SHA256_BLOCK_BYTES]; uint8_t i; @@ -68,11 +68,11 @@ void hmac_sha256_init(hmac_sha256_ctx_t *s, const void* key, uint16_t keylength_ #endif } -void hmac_sha256_nextBlock(hmac_sha256_ctx_t *s, const void* block){ +void hmac_sha256_nextBlock(hmac_sha256_ctx_t *s, const void *block){ sha256_nextBlock(&(s->a), block); } -void hmac_sha256_lastBlock(hmac_sha256_ctx_t *s, const void* block, uint16_t length_b){ +void hmac_sha256_lastBlock(hmac_sha256_ctx_t *s, const void *block, uint16_t length_b){ /* while(length_b>=SHA256_BLOCK_BITS){ sha256_nextBlock(&(s->a), block); block = (uint8_t*)block + SHA256_BLOCK_BYTES; @@ -81,7 +81,7 @@ void hmac_sha256_lastBlock(hmac_sha256_ctx_t *s, const void* block, uint16_t len */ sha256_lastBlock(&(s->a), block, length_b); } -void hmac_sha256_final(void* dest, hmac_sha256_ctx_t *s){ +void hmac_sha256_final(void *dest, hmac_sha256_ctx_t *s){ sha256_ctx2hash((sha256_hash_t*)dest, &(s->a)); sha256_lastBlock(&(s->b), dest, SHA256_HASH_BITS); sha256_ctx2hash((sha256_hash_t*)dest, &(s->b)); @@ -93,7 +93,7 @@ void hmac_sha256_final(void* dest, hmac_sha256_ctx_t *s){ * keylength in bits! * message length in bits! */ -void hmac_sha256(void* dest, const void* key, uint16_t keylength_b, const void* msg, uint32_t msglength_b){ /* a one-shot*/ +void hmac_sha256(void *dest, const void *key, uint16_t keylength_b, const void *msg, uint32_t msglength_b){ /* a one-shot*/ sha256_ctx_t s; uint8_t i; uint8_t buffer[HMAC_SHA256_BLOCK_BYTES]; diff --git a/hmac-sha256/hmac-sha256.h b/hmac-sha256/hmac-sha256.h index 4df6af5..ecc0a14 100644 --- a/hmac-sha256/hmac-sha256.h +++ b/hmac-sha256/hmac-sha256.h @@ -32,12 +32,12 @@ typedef struct { } hmac_sha256_ctx_t; -void hmac_sha256_init(hmac_sha256_ctx_t *s, const void* key, uint16_t keylength_b); -void hmac_sha256_nextBlock(hmac_sha256_ctx_t *s, const void* block); -void hmac_sha256_lastBlock(hmac_sha256_ctx_t *s, const void* block, uint16_t length_b); -void hmac_sha256_final(void* dest, hmac_sha256_ctx_t *s); +void hmac_sha256_init(hmac_sha256_ctx_t *s, const void *key, uint16_t keylength_b); +void hmac_sha256_nextBlock(hmac_sha256_ctx_t *s, const void *block); +void hmac_sha256_lastBlock(hmac_sha256_ctx_t *s, const void *block, uint16_t length_b); +void hmac_sha256_final(void *dest, hmac_sha256_ctx_t *s); -void hmac_sha256(void* dest, const void* key, uint16_t keylength_b, const void* msg, uint32_t msglength_b); +void hmac_sha256(void *dest, const void *key, uint16_t keylength_b, const void *msg, uint32_t msglength_b); #endif /*HMACSHA256_H_*/ diff --git a/host/gf256_table_gen.c b/host/gf256_table_gen.c index b359411..b30f688 100644 --- a/host/gf256_table_gen.c +++ b/host/gf256_table_gen.c @@ -36,7 +36,7 @@ int print_header = 1, print_align = 1, print_prefix = 1; -char* fmt_strings[]={"%d", "%3d", +char *fmt_strings[]={"%d", "%3d", "%X", "%2.2X", "%o", "%3o", "%d", "%3d", @@ -65,7 +65,7 @@ int main(int argc, char** argv){ int i,j; int c; int option_index=0; - char* fmt=NULL; + char *fmt=NULL; static struct option long_options[] = { /* These options set a flag. */ @@ -98,7 +98,7 @@ int main(int argc, char** argv){ unsigned long ul_reducer=0x00, max=0xff, min=0x00; uint8_t reducer, a; char** eptr; - FILE* of = stdout; + FILE *of = stdout; while(c!=-1){ c = getopt_long(argc, argv,"cCbBdh8aApPr:l:u:f:", long_options, &option_index); diff --git a/jh/jh_simple.h b/jh/jh_simple.h index b97d7f1..6788acb 100644 --- a/jh/jh_simple.h +++ b/jh/jh_simple.h @@ -37,22 +37,22 @@ typedef struct { } jh_ctx_t; -void jh_init(uint16_t hashlen_b, jh_ctx_t* ctx); -void jh_nextBlock(jh_ctx_t* ctx, void* block); -void jh_lastBlock(jh_ctx_t* ctx, void* block, uint16_t length_b); -void jh_ctx2hash(void* dest, uint16_t length_b, jh_ctx_t* ctx); +void jh_init(uint16_t hashlen_b, jh_ctx_t *ctx); +void jh_nextBlock(jh_ctx_t *ctx, void *block); +void jh_lastBlock(jh_ctx_t *ctx, void *block, uint16_t length_b); +void jh_ctx2hash(void *dest, uint16_t length_b, jh_ctx_t *ctx); -void jh224_init(jh_ctx_t* ctx); -void jh224_ctx2hash(void* dest, jh_ctx_t* ctx); +void jh224_init(jh_ctx_t *ctx); +void jh224_ctx2hash(void *dest, jh_ctx_t *ctx); -void jh256_init(jh_ctx_t* ctx); -void jh256_ctx2hash(void* dest, jh_ctx_t* ctx); +void jh256_init(jh_ctx_t *ctx); +void jh256_ctx2hash(void *dest, jh_ctx_t *ctx); -void jh384_init(jh_ctx_t* ctx); -void jh384_ctx2hash(void* dest, jh_ctx_t* ctx); +void jh384_init(jh_ctx_t *ctx); +void jh384_ctx2hash(void *dest, jh_ctx_t *ctx); -void jh512_init(jh_ctx_t* ctx); -void jh512_ctx2hash(void* dest, jh_ctx_t* ctx); +void jh512_init(jh_ctx_t *ctx); +void jh512_ctx2hash(void *dest, jh_ctx_t *ctx); #endif /* JH_SIMPLE_H_ */ diff --git a/jh/jh_simple_aux.c b/jh/jh_simple_aux.c index 65c991c..b4ca6fd 100644 --- a/jh/jh_simple_aux.c +++ b/jh/jh_simple_aux.c @@ -32,7 +32,7 @@ void jh_encrypt(uint8_t *a); -void jh_init(uint16_t hashlen_b, jh_ctx_t* ctx){ +void jh_init(uint16_t hashlen_b, jh_ctx_t *ctx){ memset(ctx->a, 0, 128); ctx->a[0] = hashlen_b>>8; ctx->a[1] = hashlen_b&0xff; @@ -40,14 +40,14 @@ void jh_init(uint16_t hashlen_b, jh_ctx_t* ctx){ ctx->block_hashed=0; } -void jh_nextBlock(jh_ctx_t* ctx, void* block){ +void jh_nextBlock(jh_ctx_t *ctx, void *block){ memxor(ctx->a, block, 64); jh_encrypt(ctx->a); memxor(ctx->a+64, block, 64); ctx->block_hashed++; } -void jh_lastBlock(jh_ctx_t* ctx, void* block, uint16_t length_b){ +void jh_lastBlock(jh_ctx_t *ctx, void *block, uint16_t length_b){ while(length_b>=64*8){ jh_nextBlock(ctx, block); block = (uint8_t*)block + 64; @@ -77,39 +77,39 @@ void jh_lastBlock(jh_ctx_t* ctx, void* block, uint16_t length_b){ jh_nextBlock(ctx, buffer); } -void jh_ctx2hash(void* dest, uint16_t length_b, jh_ctx_t* ctx){ +void jh_ctx2hash(void *dest, uint16_t length_b, jh_ctx_t *ctx){ memcpy(dest, ctx->a+128-(length_b+7)/8, (length_b+7)/8); } -void jh224_init(jh_ctx_t* ctx){ +void jh224_init(jh_ctx_t *ctx){ jh_init(224, ctx); } -void jh224_ctx2hash(void* dest, jh_ctx_t* ctx){ +void jh224_ctx2hash(void *dest, jh_ctx_t *ctx){ jh_ctx2hash(dest, 224, ctx); } -void jh256_init(jh_ctx_t* ctx){ +void jh256_init(jh_ctx_t *ctx){ jh_init(256, ctx); } -void jh256_ctx2hash(void* dest, jh_ctx_t* ctx){ +void jh256_ctx2hash(void *dest, jh_ctx_t *ctx){ jh_ctx2hash(dest, 256, ctx); } -void jh384_init(jh_ctx_t* ctx){ +void jh384_init(jh_ctx_t *ctx){ jh_init(384, ctx); } -void jh384_ctx2hash(void* dest, jh_ctx_t* ctx){ +void jh384_ctx2hash(void *dest, jh_ctx_t *ctx){ jh_ctx2hash(dest, 384, ctx); } -void jh512_init(jh_ctx_t* ctx){ +void jh512_init(jh_ctx_t *ctx){ jh_init(512, ctx); } -void jh512_ctx2hash(void* dest, jh_ctx_t* ctx){ +void jh512_ctx2hash(void *dest, jh_ctx_t *ctx){ jh_ctx2hash(dest, 512, ctx); } diff --git a/jh/jh_simple_small_core.c b/jh/jh_simple_small_core.c index 5e5fe4f..d8d9ad9 100644 --- a/jh/jh_simple_small_core.c +++ b/jh/jh_simple_small_core.c @@ -50,7 +50,7 @@ uint8_t jh_l(uint8_t v, uint8_t w){ } static -void jh_round(uint8_t* a, const uint8_t* rc){ +void jh_round(uint8_t *a, const uint8_t *rc){ uint8_t b[128]; uint8_t i,r=0,x,y; for(i=0; i<128; ++i){ @@ -79,7 +79,7 @@ void jh_round(uint8_t* a, const uint8_t* rc){ } static -void jh_next_round_const(uint8_t* a){ +void jh_next_round_const(uint8_t *a){ uint8_t b[32]; uint8_t i,x,y; for(i=0; i<32; ++i){ @@ -138,7 +138,7 @@ void degroup(uint8_t *a){ memcpy(a,b,128); } -void jh_encrypt(uint8_t* a){ +void jh_encrypt(uint8_t *a){ uint8_t i; uint8_t rc[32]; /* grouping */ diff --git a/jh/jh_simple_speed_core.c b/jh/jh_simple_speed_core.c index 55fbeff..46a2bfa 100644 --- a/jh/jh_simple_speed_core.c +++ b/jh/jh_simple_speed_core.c @@ -32,7 +32,7 @@ #endif static -void jh_round(uint8_t* a, uint8_t roundno){ +void jh_round(uint8_t *a, uint8_t roundno){ uint8_t b[128]; uint8_t i,r=0,u,v,x,y; uint8_t *pr; @@ -113,7 +113,7 @@ void degroup(uint8_t *a){ memcpy(a,b,128); } -void jh_encrypt(uint8_t* a){ +void jh_encrypt(uint8_t *a){ uint8_t i; /* grouping */ #if DEBUG diff --git a/keccak/keccak-asm.S b/keccak/keccak-asm.S index a827ea6..030c7a6 100644 --- a/keccak/keccak-asm.S +++ b/keccak/keccak-asm.S @@ -440,8 +440,8 @@ keccak_f1600: -- or -- - const uint8_t* rot_code = (const uint8_t*)keccak_rotate_codes; - const uint8_t* idx_idx = (const uint8_t*)rho_pi_idx_table; + const uint8_t *rot_code = (const uint8_t*)keccak_rotate_codes; + const uint8_t *idx_idx = (const uint8_t*)rho_pi_idx_table; uint64_t *a_tmp = (uint64_t*)a; for(i = 0; i < 25; ++i){ *((uint64_t*)(((uint8_t*)b) + pgm_read_byte(idx_idx++))) = @@ -657,7 +657,7 @@ keccak256_ctx2hash: .endfunc /* -void keccak_ctx2hash(void* dest, uint16_t length_b, keccak_ctx_t* ctx){ +void keccak_ctx2hash(void *dest, uint16_t length_b, keccak_ctx_t *ctx){ while(length_b>=ctx->r){ memcpy(dest, ctx->a, ctx->bs); dest = (uint8_t*)dest + ctx->bs; @@ -758,7 +758,7 @@ keccak256_init: ldi r25, hi8(1088) .endfunc /* -void keccak_init(uint16_t r, keccak_ctx_t* ctx){ +void keccak_init(uint16_t r, keccak_ctx_t *ctx){ memset(ctx->a, 0x00, 5 * 5 * 8); ctx->r = r; ctx->bs = (uint8_t)(r / 8); @@ -787,7 +787,7 @@ keccak_init_1: .endfunc /* -void keccak_lastBlock(keccak_ctx_t* ctx, const void* block, uint16_t length_b){ +void keccak_lastBlock(keccak_ctx_t *ctx, const void *block, uint16_t length_b){ uint8_t length_B; uint8_t t; while(length_b >= ctx->r){ diff --git a/keccak/keccak.c b/keccak/keccak.c index 501ca77..59c845a 100644 --- a/keccak/keccak.c +++ b/keccak/keccak.c @@ -47,7 +47,7 @@ void keccak_dump_state(uint64_t a[5][5]){ } } -void keccak_dump_ctx(keccak_ctx_t* ctx){ +void keccak_dump_ctx(keccak_ctx_t *ctx){ keccak_dump_state(ctx->a); cli_putstr_P(PSTR("\r\nDBG: r: ")); cli_hexdump_rev(&(ctx->r), 2); @@ -160,7 +160,7 @@ void keccak_round(uint64_t *a, uint8_t rci){ #endif } -void keccak_f1600(void* a){ +void keccak_f1600(void *a){ uint8_t i = 0; do { #if DEBUG @@ -172,12 +172,12 @@ void keccak_f1600(void* a){ } while (++i < 24); } -void keccak_nextBlock(keccak_ctx_t* ctx, const void* block){ +void keccak_nextBlock(keccak_ctx_t *ctx, const void *block){ memxor(ctx->a, block, ctx->bs); keccak_f1600(ctx->a); } -void keccak_lastBlock(keccak_ctx_t* ctx, const void* block, uint16_t length_b){ +void keccak_lastBlock(keccak_ctx_t *ctx, const void *block, uint16_t length_b){ uint8_t length_B; uint8_t t; while(length_b >= ctx->r){ @@ -203,7 +203,7 @@ void keccak_lastBlock(keccak_ctx_t* ctx, const void* block, uint16_t length_b){ keccak_f1600(ctx->a); } -void keccak_ctx2hash(void* dest, uint16_t length_b, keccak_ctx_t* ctx){ +void keccak_ctx2hash(void *dest, uint16_t length_b, keccak_ctx_t *ctx){ while(length_b >= ctx->r){ memcpy(dest, ctx->a, ctx->bs); dest = (uint8_t*)dest + ctx->bs; @@ -213,19 +213,19 @@ void keccak_ctx2hash(void* dest, uint16_t length_b, keccak_ctx_t* ctx){ memcpy(dest, ctx->a, (length_b+7)/8); } -void keccak224_ctx2hash(void* dest, keccak_ctx_t* ctx){ +void keccak224_ctx2hash(void *dest, keccak_ctx_t *ctx){ keccak_ctx2hash(dest, 224, ctx); } -void keccak256_ctx2hash(void* dest, keccak_ctx_t* ctx){ +void keccak256_ctx2hash(void *dest, keccak_ctx_t *ctx){ keccak_ctx2hash(dest, 256, ctx); } -void keccak384_ctx2hash(void* dest, keccak_ctx_t* ctx){ +void keccak384_ctx2hash(void *dest, keccak_ctx_t *ctx){ keccak_ctx2hash(dest, 384, ctx); } -void keccak512_ctx2hash(void* dest, keccak_ctx_t* ctx){ +void keccak512_ctx2hash(void *dest, keccak_ctx_t *ctx){ keccak_ctx2hash(dest, 512, ctx); } @@ -235,24 +235,24 @@ void keccak512_ctx2hash(void* dest, keccak_ctx_t* ctx){ 3. SHA3-384: ⌊Keccak[r = 832, c = 768, d = 48]⌋384 4. SHA3-512: ⌊Keccak[r = 576, c = 1024, d = 64]⌋512 */ -void keccak_init(uint16_t r, keccak_ctx_t* ctx){ +void keccak_init(uint16_t r, keccak_ctx_t *ctx){ memset(ctx->a, 0x00, 5 * 5 * 8); ctx->r = r; ctx->bs = (uint8_t)(r / 8); } -void keccak224_init(keccak_ctx_t* ctx){ +void keccak224_init(keccak_ctx_t *ctx){ keccak_init(1152, ctx); } -void keccak256_init(keccak_ctx_t* ctx){ +void keccak256_init(keccak_ctx_t *ctx){ keccak_init(1088, ctx); } -void keccak384_init(keccak_ctx_t* ctx){ +void keccak384_init(keccak_ctx_t *ctx){ keccak_init( 832, ctx); } -void keccak512_init(keccak_ctx_t* ctx){ +void keccak512_init(keccak_ctx_t *ctx){ keccak_init( 576, ctx); } diff --git a/keccak/keccak.h b/keccak/keccak.h index edc8d81..b374ce5 100644 --- a/keccak/keccak.h +++ b/keccak/keccak.h @@ -38,19 +38,19 @@ typedef struct{ } keccak_ctx_t; -void keccak_init(uint16_t r, keccak_ctx_t* ctx); -void keccak224_init(keccak_ctx_t* ctx); -void keccak256_init(keccak_ctx_t* ctx); -void keccak384_init(keccak_ctx_t* ctx); -void keccak512_init(keccak_ctx_t* ctx); - -void keccak_nextBlock(keccak_ctx_t* ctx, const void* block); -void keccak_lastBlock(keccak_ctx_t* ctx, const void* block, uint16_t length_b); - -void keccak_ctx2hash(void* dest, uint16_t length_b, keccak_ctx_t* ctx); -void keccak224_ctx2hash(void* dest, keccak_ctx_t* ctx); -void keccak256_ctx2hash(void* dest, keccak_ctx_t* ctx); -void keccak384_ctx2hash(void* dest, keccak_ctx_t* ctx); -void keccak512_ctx2hash(void* dest, keccak_ctx_t* ctx); +void keccak_init(uint16_t r, keccak_ctx_t *ctx); +void keccak224_init(keccak_ctx_t *ctx); +void keccak256_init(keccak_ctx_t *ctx); +void keccak384_init(keccak_ctx_t *ctx); +void keccak512_init(keccak_ctx_t *ctx); + +void keccak_nextBlock(keccak_ctx_t *ctx, const void *block); +void keccak_lastBlock(keccak_ctx_t *ctx, const void *block, uint16_t length_b); + +void keccak_ctx2hash(void *dest, uint16_t length_b, keccak_ctx_t *ctx); +void keccak224_ctx2hash(void *dest, keccak_ctx_t *ctx); +void keccak256_ctx2hash(void *dest, keccak_ctx_t *ctx); +void keccak384_ctx2hash(void *dest, keccak_ctx_t *ctx); +void keccak512_ctx2hash(void *dest, keccak_ctx_t *ctx); #endif /* KECCAK_H_ */ diff --git a/khazad/khazad.c b/khazad/khazad.c index 9da7dea..a5681b5 100644 --- a/khazad/khazad.c +++ b/khazad/khazad.c @@ -92,7 +92,7 @@ uint8_t khazad_sbox(uint8_t a){ return b|c; } -static void gamma_1(uint8_t* a){ +static void gamma_1(uint8_t *a){ uint8_t i; for(i=0; i<8; ++i){ *a = khazad_sbox(*a); @@ -126,7 +126,7 @@ static const uint8_t h[8][4] PROGMEM = { { 0x7B, 0x86, 0x54, 0x31 } }; -static void theta(uint8_t* a){ +static void theta(uint8_t *a){ uint8_t i,j,x,accu; uint8_t c[8]; uint8_t *hp; @@ -146,7 +146,7 @@ static void theta(uint8_t* a){ /******************************************************************************/ -static void khazad_round(uint8_t* a, const uint8_t* k){ +static void khazad_round(uint8_t *a, const uint8_t *k){ gamma_1(a); theta(a); memxor(a, k, 8); @@ -154,7 +154,7 @@ static void khazad_round(uint8_t* a, const uint8_t* k){ /******************************************************************************/ -void khazad_init(const void* key, khazad_ctx_t* ctx){ +void khazad_init(const void *key, khazad_ctx_t *ctx){ uint8_t c[8]; uint8_t i,r=0; for(i=0; i<8; ++i){ @@ -182,7 +182,7 @@ void khazad_init(const void* key, khazad_ctx_t* ctx){ /******************************************************************************/ -void khazad_enc(void* buffer, const khazad_ctx_t* ctx){ +void khazad_enc(void *buffer, const khazad_ctx_t *ctx){ uint8_t r; memxor(buffer, ctx->k[0], 8); for(r=1; r<8; ++r){ @@ -194,7 +194,7 @@ void khazad_enc(void* buffer, const khazad_ctx_t* ctx){ /******************************************************************************/ -void khazad_dec(void* buffer, const khazad_ctx_t* ctx){ +void khazad_dec(void *buffer, const khazad_ctx_t *ctx){ uint8_t r=7; memxor(buffer, ctx->k[8], 8); gamma_1(buffer); diff --git a/khazad/khazad.h b/khazad/khazad.h index 1f1c335..819cfaa 100644 --- a/khazad/khazad.h +++ b/khazad/khazad.h @@ -26,9 +26,9 @@ typedef struct { uint8_t k[9][8]; }khazad_ctx_t; -void khazad_enc(void* buffer, const khazad_ctx_t* ctx); -void khazad_dec(void* buffer, const khazad_ctx_t* ctx); -void khazad_init(const void* key, khazad_ctx_t* ctx); +void khazad_enc(void *buffer, const khazad_ctx_t *ctx); +void khazad_dec(void *buffer, const khazad_ctx_t *ctx); +void khazad_init(const void *key, khazad_ctx_t *ctx); uint8_t khazad_sbox(uint8_t); #endif /* KHAZAD_H_ */ diff --git a/md5/md5-asm.S b/md5/md5-asm.S index de3b170..9710c4e 100644 --- a/md5/md5-asm.S +++ b/md5/md5-asm.S @@ -247,9 +247,9 @@ md5_core: mov r18, r14 ; rjmp md5_core_asm /* -void md5_core(uint32_t* a, void* block, uint8_t as, uint8_t s, uint8_t i, uint8_t fi){ +void md5_core(uint32_t *a, void *block, uint8_t as, uint8_t s, uint8_t i, uint8_t fi){ uint32_t t; - md5_func_t* funcs[]={md5_F, md5_G, md5_H, md5_I}; + md5_func_t *funcs[]={md5_F, md5_G, md5_H, md5_I}; as &= 0x3; / * a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). * / t = a[as] + funcs[fi](a[(as+1)&3], a[(as+2)&3], a[(as+3)&3]) + *((uint32_t*)block) + md5_T[i] ; @@ -452,7 +452,7 @@ md5_core_exit: ;################################################################### /* -void md5_nextBlock(md5_ctx_t *state, void* block){ +void md5_nextBlock(md5_ctx_t *state, void *block){ uint32_t a[4]; uint8_t m,n,i=0; @@ -743,7 +743,7 @@ md5_nextBlock: ;############################################################################### /* -void md5_lastBlock(md5_ctx_t *state, const void* block, uint16_t length_b){ +void md5_lastBlock(md5_ctx_t *state, const void *block, uint16_t length_b){ uint16_t l; uint8_t b[64]; while (length_b >= 512){ diff --git a/md5/md5.c b/md5/md5.c index 3feddd6..f84edf8 100644 --- a/md5/md5.c +++ b/md5/md5.c @@ -66,9 +66,9 @@ typedef uint32_t md5_func_t(uint32_t, uint32_t, uint32_t); #define ROTL32(x,n) (((x)<<(n)) | ((x)>>(32-(n)))) static -void md5_core(uint32_t* a, void* block, uint8_t as, uint8_t s, uint8_t i, uint8_t fi){ +void md5_core(uint32_t *a, void *block, uint8_t as, uint8_t s, uint8_t i, uint8_t fi){ uint32_t t; - md5_func_t* funcs[]={md5_F, md5_G, md5_H, md5_I}; + md5_func_t *funcs[]={md5_F, md5_G, md5_H, md5_I}; as &= 0x3; /* a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ #ifdef DEBUG @@ -85,7 +85,7 @@ void md5_core(uint32_t* a, void* block, uint8_t as, uint8_t s, uint8_t i, uint8_ a[as]=a[(as+1)&3] + ROTL32(t, s); } -void md5_nextBlock(md5_ctx_t *state, const void* block){ +void md5_nextBlock(md5_ctx_t *state, const void *block){ uint32_t a[4]; uint8_t m,n,i=0; /* this requires other mixed sboxes */ @@ -137,7 +137,7 @@ void md5_nextBlock(md5_ctx_t *state, const void* block){ state->counter++; } -void md5_lastBlock(md5_ctx_t *state, const void* block, uint16_t length_b){ +void md5_lastBlock(md5_ctx_t *state, const void *block, uint16_t length_b){ uint16_t l; union { uint8_t v8[64]; @@ -170,11 +170,11 @@ void md5_lastBlock(md5_ctx_t *state, const void* block, uint16_t length_b){ md5_nextBlock(state, buffer.v8); } -void md5_ctx2hash(md5_hash_t* dest, const md5_ctx_t* state){ +void md5_ctx2hash(md5_hash_t *dest, const md5_ctx_t *state){ memcpy(dest, state->a, MD5_HASH_BYTES); } -void md5(md5_hash_t* dest, const void* msg, uint32_t length_b){ +void md5(md5_hash_t *dest, const void *msg, uint32_t length_b){ md5_ctx_t ctx; md5_init(&ctx); while(length_b>=MD5_BLOCK_BITS){ diff --git a/md5/md5.h b/md5/md5.h index 6b65c4a..140b583 100644 --- a/md5/md5.h +++ b/md5/md5.h @@ -47,9 +47,9 @@ typedef uint8_t md5_hash_t[MD5_HASH_BYTES]; void md5_init(md5_ctx_t *s); -void md5_nextBlock(md5_ctx_t *state, const void* block); -void md5_lastBlock(md5_ctx_t *state, const void* block, uint16_t length); -void md5_ctx2hash(md5_hash_t* dest, const md5_ctx_t* state); -void md5(md5_hash_t* dest, const void* msg, uint32_t length_b); +void md5_nextBlock(md5_ctx_t *state, const void *block); +void md5_lastBlock(md5_ctx_t *state, const void *block, uint16_t length); +void md5_ctx2hash(md5_hash_t *dest, const md5_ctx_t *state); +void md5(md5_hash_t *dest, const void *msg, uint32_t length_b); #endif /*MD5_H_*/ diff --git a/memxor/memxor.S b/memxor/memxor.S index a32058b..d72a1d8 100644 --- a/memxor/memxor.S +++ b/memxor/memxor.S @@ -27,7 +27,7 @@ */ /* - * void memxor(void* dest, const void* src, uint16_t n); + * void memxor(void *dest, const void *src, uint16_t n); */ /* * param dest is passed in r24:r25 diff --git a/memxor/memxor.h b/memxor/memxor.h index 4c0cc3d..3644c25 100644 --- a/memxor/memxor.h +++ b/memxor/memxor.h @@ -2,8 +2,8 @@ #define MEMXOR_H_ #include -void memxor(void* dest, const void* src, uint16_t n); -void memxor_P(void* dest, const void* src, uint16_t n); +void memxor(void *dest, const void *src, uint16_t n); +void memxor_P(void *dest, const void *src, uint16_t n); #endif diff --git a/memxor/memxor_c.c b/memxor/memxor_c.c index 7485b3e..a2c3fe1 100644 --- a/memxor/memxor_c.c +++ b/memxor/memxor_c.c @@ -2,7 +2,7 @@ #include "memxor.h" -void memxor(void* dest, const void* src, uint16_t n){ +void memxor(void *dest, const void *src, uint16_t n){ while(n--){ *((uint8_t*)dest) ^= *((uint8_t*)src); dest = (uint8_t*)dest +1; diff --git a/memxor/memxor_p.S b/memxor/memxor_p.S index 4f152ea..590f001 100644 --- a/memxor/memxor_p.S +++ b/memxor/memxor_p.S @@ -27,7 +27,7 @@ */ /* - * void memxor(void* dest, const void* src, uint16_t n); + * void memxor(void *dest, const void *src, uint16_t n); */ /* * param dest is passed in r24:r25 diff --git a/mgf1/mgf1.c b/mgf1/mgf1.c index bdbf1ea..fa436f5 100644 --- a/mgf1/mgf1.c +++ b/mgf1/mgf1.c @@ -27,7 +27,7 @@ */ -void mgf1_short_seed(void* dest, const void* seed, uint8_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t* p){ +void mgf1_short_seed(void *dest, const void *seed, uint8_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t *p){ uint8_t buffer[seed_len_B+4]; uint32_t counter=1; uint8_t hv_len = hfal_hash_getHashsize(p->hashfunction)/8; @@ -50,6 +50,6 @@ void mgf1_short_seed(void* dest, const void* seed, uint8_t seed_len_B, uint16_t } } -void mgf1(void* dest, const void* seed, uint16_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t* p){ +void mgf1(void *dest, const void *seed, uint16_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t *p){ mgf1_short_seed(dest, seed, seed_len_B, out_length_B, p); } diff --git a/mgf1/mgf1.h b/mgf1/mgf1.h index 76c3b8d..f7dac24 100644 --- a/mgf1/mgf1.h +++ b/mgf1/mgf1.h @@ -24,13 +24,13 @@ #include "hfal-basic.h" typedef struct { - const hfdesc_t* hashfunction; + const hfdesc_t *hashfunction; } mgf1_parameter_t; /* * MGF1 as defined in PKCS #1 v2.1 B.2.1 */ -void mgf1(void* dest, const void* seed, uint16_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t* p); +void mgf1(void *dest, const void *seed, uint16_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t *p); #endif /* MGF1_H_ */ diff --git a/mickey128/mickey128.c b/mickey128/mickey128.c index acf3cf8..30a6217 100644 --- a/mickey128/mickey128.c +++ b/mickey128/mickey128.c @@ -45,7 +45,7 @@ const uint8_t rtaps[] PROGMEM = { }; static -void memxor_P(void* d, PGM_VOID_P s, uint8_t length_B){ +void memxor_P(void *d, PGM_VOID_P s, uint8_t length_B){ while(length_B--){ *((uint8_t*)d) ^= pgm_read_byte(s); d = (uint8_t*)d +1; @@ -60,7 +60,7 @@ void memxor_P(void* d, PGM_VOID_P s, uint8_t length_B){ #define SHLX1(a) c0=((a)>>7); (a)^=(((a)<<1)|c1) static -void clock_r(uint8_t* r, uint8_t ibit, uint8_t cbit){ +void clock_r(uint8_t *r, uint8_t ibit, uint8_t cbit){ uint8_t i,c0=0,c1=0; /* carry */ ibit ^= ((r[159/8])>>(159%8))&1; /* ibit is now the same as feedback_bit */ if(cbit){ @@ -204,7 +204,7 @@ const uint8_t fb1[] PROGMEM = { }; static -void clock_s(uint8_t* s, uint8_t ibit, uint8_t cbit){ +void clock_s(uint8_t *s, uint8_t ibit, uint8_t cbit){ uint8_t s0[20], s1[20]; uint8_t i,c=0, c2=0; ibit ^= (s[19])>>7; @@ -228,7 +228,7 @@ void clock_s(uint8_t* s, uint8_t ibit, uint8_t cbit){ } static -void clock_kg(uint8_t* r, uint8_t* s, uint8_t mixing, uint8_t input){ +void clock_kg(uint8_t *r, uint8_t *s, uint8_t mixing, uint8_t input){ uint8_t rb, sb; rb = ((s[ 54/8])>>(( 54%8))) ^ ((r[106/8])>>(((106%8)))); sb = ((s[106/8])>>((106%8))) ^ ((r[ 53/8])>>((( 53%8)))); @@ -239,9 +239,9 @@ void clock_kg(uint8_t* r, uint8_t* s, uint8_t mixing, uint8_t input){ clock_s(s, input, sb); } -void mickey128_init(void* key, uint16_t keysize_b, - void* iv, uint16_t ivsize_b, - mickey128_ctx_t* ctx){ +void mickey128_init(void *key, uint16_t keysize_b, + void *iv, uint16_t ivsize_b, + mickey128_ctx_t *ctx){ uint16_t i; memset(ctx->r, 0, 20); memset(ctx->s, 0, 20); @@ -256,14 +256,14 @@ void mickey128_init(void* key, uint16_t keysize_b, } } -uint8_t mickey128_getbit(mickey128_ctx_t* ctx){ +uint8_t mickey128_getbit(mickey128_ctx_t *ctx){ uint8_t ret; ret = 1&(*(ctx->r) ^ *(ctx->s)); clock_kg(ctx->r, ctx->s, 0, 0); return ret; } -uint8_t mickey128_getbyte(mickey128_ctx_t* ctx){ +uint8_t mickey128_getbyte(mickey128_ctx_t *ctx){ uint8_t i,ret=0; for(i=0; i<8; ++i){ ret<<=1; diff --git a/mickey128/mickey128.h b/mickey128/mickey128.h index 9a125f4..e9e0dea 100644 --- a/mickey128/mickey128.h +++ b/mickey128/mickey128.h @@ -10,10 +10,10 @@ typedef struct mickey128_ctx_st{ void debug_clock_r(void); void debug_clock_s(void); -void mickey128_init(void* key, uint16_t keysize_b, - void* iv, uint16_t ivsize_b, - mickey128_ctx_t* ctx); -uint8_t mickey128_getbit(mickey128_ctx_t* ctx); -uint8_t mickey128_getbyte(mickey128_ctx_t* ctx); +void mickey128_init(void *key, uint16_t keysize_b, + void *iv, uint16_t ivsize_b, + mickey128_ctx_t *ctx); +uint8_t mickey128_getbit(mickey128_ctx_t *ctx); +uint8_t mickey128_getbyte(mickey128_ctx_t *ctx); #endif /*MICKEY128_H_*/ diff --git a/mqq-sign/mqq160-sign-asm.S b/mqq-sign/mqq160-sign-asm.S index c2f494f..2373307 100644 --- a/mqq-sign/mqq160-sign-asm.S +++ b/mqq-sign/mqq160-sign-asm.S @@ -28,7 +28,7 @@ #include "avr-asm-macros.S" #if 0 -static void mqq_inv_affine_transformation(uint8_t* input_bytes, uint8_t* result, const mqq160_sign_key_t* key){ +static void mqq_inv_affine_transformation(uint8_t *input_bytes, uint8_t *result, const mqq160_sign_key_t *key){ /* The matrix SInv is given as two permutations of 160 elements. */ uint8_t j, byteindex, bitindex, bitindex_d, byteindex_d, rp1, rp5; uint8_t *r1_ptr, *r5_ptr; diff --git a/mqq-sign/mqq160-sign.c b/mqq-sign/mqq160-sign.c index 99c4db8..82d29ef 100644 --- a/mqq-sign/mqq160-sign.c +++ b/mqq-sign/mqq160-sign.c @@ -30,7 +30,7 @@ static const uint8_t mod20_table[32] PROGMEM = { 8, 9, 10, 11, 12, 13, 14, 15, }; -static void memxor_idx(void* dest, const void* src, uint16_t length, uint8_t dist){ +static void memxor_idx(void *dest, const void *src, uint16_t length, uint8_t dist){ while(length--){ *((uint8_t*)dest) ^= *((uint8_t*)src); dest = (uint8_t*)dest + 1; @@ -43,7 +43,7 @@ It should be programmed in a more flexible way in the MQQ160-SIGN C Library. */ -static void mqq_inv_affine_transformation(const uint8_t* input_bytes, uint8_t* result, const mqq160_sign_key_t* key){ +static void mqq_inv_affine_transformation(const uint8_t *input_bytes, uint8_t *result, const mqq160_sign_key_t *key){ /* The matrix SInv is given as two permutations of 160 elements. */ uint8_t j, byteindex, bitindex, bitindex_d, byteindex_d, rp1, rp5; const uint8_t *rp1_ptr, *rp5_ptr; @@ -94,7 +94,7 @@ static void mqq_inv_affine_transformation(const uint8_t* input_bytes, uint8_t* r static uint16_t MaskShort[8] = {0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100}; -static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t* key){ +static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t *key){ uint8_t e[9]; uint16_t a[8]; uint8_t result, column, row, k; @@ -178,7 +178,7 @@ static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t* return(result); } -void mqq160_sign(void* dest, const void* hash, const mqq160_sign_key_t* key){ +void mqq160_sign(void *dest, const void *hash, const mqq160_sign_key_t *key){ uint8_t i, r1[20], byteindex; mqq_inv_affine_transformation((uint8_t*)hash, (uint8_t*)dest, key); r1[0]=((uint8_t*)dest)[0]; diff --git a/mqq-sign/mqq160-sign.h b/mqq-sign/mqq160-sign.h index 6a1d43b..3271dfd 100644 --- a/mqq-sign/mqq160-sign.h +++ b/mqq-sign/mqq160-sign.h @@ -28,6 +28,6 @@ typedef struct{ const uint8_t *rp5; } mqq160_sign_key_t; -void mqq160_sign(void* dest, const void* hash, const mqq160_sign_key_t* key); +void mqq160_sign(void *dest, const void *hash, const mqq160_sign_key_t *key); #endif /* MQQ160SIGN_H_ */ diff --git a/mqq-sign/mqq160-sign_P-asm.S b/mqq-sign/mqq160-sign_P-asm.S index 1123455..60ac137 100644 --- a/mqq-sign/mqq160-sign_P-asm.S +++ b/mqq-sign/mqq160-sign_P-asm.S @@ -28,7 +28,7 @@ #include "avr-asm-macros.S" #if 0 -static void mqq_inv_affine_transformation(uint8_t* input_bytes, uint8_t* result, const mqq160_sign_key_t* key){ +static void mqq_inv_affine_transformation(uint8_t *input_bytes, uint8_t *result, const mqq160_sign_key_t *key){ /* The matrix SInv is given as two permutations of 160 elements. */ uint8_t j, byteindex, bitindex, bitindex_d, byteindex_d, rp1, rp5; uint8_t *r1_ptr, *r5_ptr; diff --git a/mqq-sign/mqq160-sign_P-stub.c b/mqq-sign/mqq160-sign_P-stub.c index d8c889f..d484308 100644 --- a/mqq-sign/mqq160-sign_P-stub.c +++ b/mqq-sign/mqq160-sign_P-stub.c @@ -41,14 +41,14 @@ in the MQQ160-SIGN C Library. */ -void mqq_inv_affine_transformation(uint8_t* input_bytes, uint8_t* result, const mqq160_sign_key_t* key); -uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t* key); +void mqq_inv_affine_transformation(uint8_t *input_bytes, uint8_t *result, const mqq160_sign_key_t *key); +uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t *key); #if 0 static uint16_t MaskShort[8] = {0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100}; -static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t* key){ +static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t *key){ uint8_t e[9]; uint16_t a[8]; uint8_t result, column, row, k; @@ -133,7 +133,7 @@ static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t* #endif -void mqq160_sign_P(void* dest, const void* hash, const mqq160_sign_key_t* key_P){ +void mqq160_sign_P(void *dest, const void *hash, const mqq160_sign_key_t *key_P){ uint8_t i, r1[20], byteindex; mqq160_sign_key_t key; diff --git a/mqq-sign/mqq160-sign_P.c b/mqq-sign/mqq160-sign_P.c index 90f11d2..73aaf42 100644 --- a/mqq-sign/mqq160-sign_P.c +++ b/mqq-sign/mqq160-sign_P.c @@ -41,7 +41,7 @@ static const uint8_t mod20_table[32] PROGMEM = { 8, 9, 10, 11, 12, 13, 14, 15, }; -static void memxor_idx_P(uint8_t* dest, const uint8_t* src, uint16_t length, uint8_t dist){ +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); dest = (uint8_t*)dest + 1; @@ -54,7 +54,7 @@ It should be programmed in a more flexible way in the MQQ160-SIGN C Library. */ -static void mqq_inv_affine_transformation(uint8_t* input_bytes, uint8_t* result, const mqq160_sign_key_t* key){ +static void mqq_inv_affine_transformation(uint8_t *input_bytes, uint8_t *result, const mqq160_sign_key_t *key){ /* The matrix SInv is given as two permutations of 160 elements. */ uint8_t j, byteindex, bitindex, bitindex_d, byteindex_d, rp1, rp5; const uint8_t *r1_ptr, *r5_ptr; @@ -103,7 +103,7 @@ static void mqq_inv_affine_transformation(uint8_t* input_bytes, uint8_t* result, static uint16_t MaskShort[8] = {0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100}; -static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t* key){ +static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t *key){ uint8_t e[9]; uint16_t a[8]; uint8_t result, column, row, k; @@ -186,7 +186,7 @@ static uint8_t mqq_q(uint8_t i, uint8_t b1, uint8_t b2, const mqq160_sign_key_t* return(result); } -void mqq160_sign_P(void* dest, const void* hash, const mqq160_sign_key_t* key_P){ +void mqq160_sign_P(void *dest, const void *hash, const mqq160_sign_key_t *key_P){ uint8_t i, r1[20], byteindex; mqq160_sign_key_t key; memcpy_P(&key, key_P, sizeof(mqq160_sign_key_t)); diff --git a/mqq-sign/mqq160-sign_P.h b/mqq-sign/mqq160-sign_P.h index 19208a2..4cd64b3 100644 --- a/mqq-sign/mqq160-sign_P.h +++ b/mqq-sign/mqq160-sign_P.h @@ -22,6 +22,6 @@ #include "mqq160-sign.h" -void mqq160_sign_P(void* dest, const void* hash, const mqq160_sign_key_t* key_P); +void mqq160_sign_P(void *dest, const void *hash, const mqq160_sign_key_t *key_P); #endif /* MQQ160SIGN_P_H_ */ diff --git a/mqq-sign/mqq160-sign_testkey.c b/mqq-sign/mqq160-sign_testkey.c index f7fc011..c893466 100644 --- a/mqq-sign/mqq160-sign_testkey.c +++ b/mqq-sign/mqq160-sign_testkey.c @@ -85,7 +85,7 @@ const uint8_t rp5[160] PROGMEM = { const mqq160_sign_key_t testkey_P PROGMEM = {a, cc1, cc2, rp1, rp5 }; -void mqq_load_pgm_key(void* buffer, mqq160_sign_key_t* key, const mqq160_sign_key_t* key_P){ +void mqq_load_pgm_key(void *buffer, mqq160_sign_key_t *key, const mqq160_sign_key_t *key_P){ uint8_t *buf_ptr; buf_ptr = buffer; memcpy_P(key, key_P, sizeof(mqq160_sign_key_t)); diff --git a/mqq-sign/mqq160-sign_testkey.h b/mqq-sign/mqq160-sign_testkey.h index e10e5b5..e53f117 100644 --- a/mqq-sign/mqq160-sign_testkey.h +++ b/mqq-sign/mqq160-sign_testkey.h @@ -37,6 +37,6 @@ RP1[] and RP5[] of 160 uint8_ts. */ extern const mqq160_sign_key_t testkey_P; -void mqq_load_pgm_key(void* buffer, mqq160_sign_key_t* key, const mqq160_sign_key_t* key_P); +void mqq_load_pgm_key(void *buffer, mqq160_sign_key_t *key, const mqq160_sign_key_t *key_P); #endif /* MQQ160SIGN_TESTKEY_H_ */ diff --git a/mugi/mugi.c b/mugi/mugi.c index c90b1a1..e316416 100644 --- a/mugi/mugi.c +++ b/mugi/mugi.c @@ -36,7 +36,7 @@ /* #include "cli.h" / * only for debugging * / -void dump_mugi_ctx(mugi_ctx_t* ctx){ +void dump_mugi_ctx(mugi_ctx_t *ctx){ uint8_t i; cli_putstr_P(PSTR("\r\n== MUGI CTX DUMP==\r\n a:")); cli_hexdump(&(ctx->a[0]), 8); @@ -101,7 +101,7 @@ uint64_t rotr64(uint64_t a, uint8_t i){ #define T(x) (((uint8_t*)&t)[(x)]) #define D(y) (((uint8_t*)dest)[(y)]) -static void mugi_f(uint64_t* dest, uint64_t* a, uint64_t* b){ +static void mugi_f(uint64_t *dest, uint64_t *a, uint64_t *b){ uint64_t t; uint8_t i,x; t = (*a); @@ -147,7 +147,7 @@ static void mugi_f(uint64_t* dest, uint64_t* a, uint64_t* b){ } static -void mugi_rho(mugi_ctx_t* ctx){ +void mugi_rho(mugi_ctx_t *ctx){ uint64_t t,bx; t = ctx->a[1]; ctx->a[1] = ctx->a[2]; @@ -161,7 +161,7 @@ void mugi_rho(mugi_ctx_t* ctx){ } static -void mugi_rho_init(uint64_t* a){ +void mugi_rho_init(uint64_t *a){ uint64_t t; t = a[1]; a[1] = a[2]; @@ -174,7 +174,7 @@ void mugi_rho_init(uint64_t* a){ } static -void mugi_lambda(uint64_t* b, uint64_t *a){ +void mugi_lambda(uint64_t *b, uint64_t *a){ uint8_t i; uint64_t t; t=b[15]; @@ -186,7 +186,7 @@ void mugi_lambda(uint64_t* b, uint64_t *a){ b[10] ^= rotl64(b[14], 32); } -void mugi_init(const void* key, const void* iv, mugi_ctx_t* ctx){ +void mugi_init(const void *key, const void *iv, mugi_ctx_t *ctx){ uint8_t i; uint64_t a0; memcpy(ctx->a, key, 128/8); @@ -209,7 +209,7 @@ void mugi_init(const void* key, const void* iv, mugi_ctx_t* ctx){ a0=0x00; } -uint64_t mugi_gen(mugi_ctx_t* ctx){ +uint64_t mugi_gen(mugi_ctx_t *ctx){ uint64_t r; r=ctx->a[0]; mugi_rho(ctx); diff --git a/mugi/mugi.h b/mugi/mugi.h index 809b9fd..07ee808 100644 --- a/mugi/mugi.h +++ b/mugi/mugi.h @@ -34,8 +34,8 @@ typedef struct{ uint64_t b[16]; }mugi_ctx_t; /* 152 bytes in total */ -void mugi_init(const void* key, const void* iv, mugi_ctx_t* ctx); -uint64_t mugi_gen(mugi_ctx_t* ctx); +void mugi_init(const void *key, const void *iv, mugi_ctx_t *ctx); +uint64_t mugi_gen(mugi_ctx_t *ctx); #endif /* MUGI_H_ */ diff --git a/noekeon/noekeon.c b/noekeon/noekeon.c index 0fbdcf9..2dae591 100644 --- a/noekeon/noekeon.c +++ b/noekeon/noekeon.c @@ -39,7 +39,7 @@ #define RC_POS 0 static -void gamma_1(uint32_t* a){ +void gamma_1(uint32_t *a){ uint32_t tmp; a[1] ^= ~((a[3]) | (a[2])); @@ -56,21 +56,21 @@ void gamma_1(uint32_t* a){ #define ROTR32(a,n) (((a)>>n)|((a)<<(32-n))) static -void pi1(uint32_t* a){ +void pi1(uint32_t *a){ a[1] = ROTL32(a[1], 1); a[2] = ROTL32(a[2], 5); a[3] = ROTL32(a[3], 2); } static -void pi2(uint32_t* a){ +void pi2(uint32_t *a){ a[1] = ROTR32(a[1], 1); a[2] = ROTR32(a[2], 5); a[3] = ROTR32(a[3], 2); } static -void theta(const uint32_t* k, uint32_t* a){ +void theta(const uint32_t *k, uint32_t *a){ uint32_t temp; temp = a[0] ^ a[2]; temp ^= ROTR32(temp, 8) ^ ROTL32(temp, 8); @@ -89,7 +89,7 @@ void theta(const uint32_t* k, uint32_t* a){ } static -void noekeon_round(uint32_t* key, uint32_t* state, uint8_t const1, uint8_t const2){ +void noekeon_round(uint32_t *key, uint32_t *state, uint8_t const1, uint8_t const2){ ((uint8_t*)state)[RC_POS] ^= const1; theta(key, state); ((uint8_t*)state)[RC_POS] ^= const2; @@ -114,7 +114,7 @@ const uint8_t rc_tab[] */ static -void changendian32(void* a){ +void changendian32(void *a){ ((uint8_t*)a)[0] ^= ((uint8_t*)a)[3]; ((uint8_t*)a)[3] ^= ((uint8_t*)a)[0]; ((uint8_t*)a)[0] ^= ((uint8_t*)a)[3]; @@ -125,7 +125,7 @@ void changendian32(void* a){ } static -void changendian(void* a){ +void changendian(void *a){ changendian32((uint32_t*)(&(((uint32_t*)a)[0]))); changendian32((uint32_t*)(&(((uint32_t*)a)[1]))); changendian32((uint32_t*)(&(((uint32_t*)a)[2]))); @@ -134,7 +134,7 @@ void changendian(void* a){ /******************************************************************************/ -void noekeon_enc(void* buffer, const void* key){ +void noekeon_enc(void *buffer, const void *key){ uint8_t rc=0x80; uint8_t keyb[16]; int8_t i; @@ -158,7 +158,7 @@ void noekeon_enc(void* buffer, const void* key){ } -void noekeon_dec(void* buffer, const void* key){ +void noekeon_dec(void *buffer, const void *key){ uint8_t rc; int8_t i; uint8_t nullv[16]; @@ -189,7 +189,7 @@ void noekeon_dec(void* buffer, const void* key){ changendian(buffer); } -void noekeon_init(const void* key, noekeon_ctx_t* ctx){ +void noekeon_init(const void *key, noekeon_ctx_t *ctx){ uint8_t nullv[16]; memset(nullv, 0, 16); diff --git a/noekeon/noekeon.h b/noekeon/noekeon.h index 9c046f3..744c834 100644 --- a/noekeon/noekeon.h +++ b/noekeon/noekeon.h @@ -42,7 +42,7 @@ */ typedef uint8_t noekeon_ctx_t[16]; -/** \fn void noekeon_enc(void* buffer, const void* key) +/** \fn void noekeon_enc(void *buffer, const void *key) * \brief noekeon encrytion funtion * * This function encrypts a block (64 bit = 8 byte) with the noekeon encrytion @@ -53,9 +53,9 @@ typedef uint8_t noekeon_ctx_t[16]; * \param key pointer to either the key (128 bit = 16 byte; direct mode) or * to the context (indirect mode) */ -void noekeon_enc(void* buffer, const void* key); +void noekeon_enc(void *buffer, const void *key); -/** \fn void noekeon_dec(void* buffer, const void* key) +/** \fn void noekeon_dec(void *buffer, const void *key) * \brief noekeon encrytion funtion * * This function decrypts a block (64 bit = 8 byte) encrypted with the noekeon @@ -67,10 +67,10 @@ void noekeon_enc(void* buffer, const void* key); * \param key pointer to either the key (128 bit = 16 byte; direct mode) or * to the context (indirect mode) */ -void noekeon_dec(void* buffer, const void* key); +void noekeon_dec(void *buffer, const void *key); -/** \fn void noekeon_init(const void* key, noekeon_ctx_t* ctx) +/** \fn void noekeon_init(const void *key, noekeon_ctx_t *ctx) * \brief noekeon context generation function for indirect mode * * This function generates a context from the supplied key for using @@ -80,6 +80,6 @@ void noekeon_dec(void* buffer, const void* key); * \param ctx pointer to the context to fill with key material * to the context (indirect mode) */ -void noekeon_init(const void* key, noekeon_ctx_t* ctx); +void noekeon_init(const void *key, noekeon_ctx_t *ctx); #endif /*NOEKEON_H_*/ diff --git a/noekeon/noekeon_asm.S b/noekeon/noekeon_asm.S index b0a2a16..76458fb 100644 --- a/noekeon/noekeon_asm.S +++ b/noekeon/noekeon_asm.S @@ -166,7 +166,7 @@ bigendian_rotr32_exit: /******************************************************************************/ /* -void theta(uint32_t* k, uint32_t* a){ +void theta(uint32_t *k, uint32_t *a){ uint32_t temp; temp = a[0] ^ a[2]; temp ^= ROTR32(temp, 8) ^ ROTL32(temp, 8); a[1] ^= temp; @@ -583,7 +583,7 @@ pi: /******************************************************************************/ /* -void noekeon_init(void* key, noekeon_ctx_t* ctx){ +void noekeon_init(void *key, noekeon_ctx_t *ctx){ uint8_t nullv[16]; memset(nullv, 0, 16); diff --git a/noekeon/noekeon_cbc_enc.S b/noekeon/noekeon_cbc_enc.S index 0c0b89a..9da291c 100644 --- a/noekeon/noekeon_cbc_enc.S +++ b/noekeon/noekeon_cbc_enc.S @@ -43,7 +43,7 @@ .extern noekeon_enc /* - * void noekeon_cbc_enc(void* buffer, uint8_t block_cnt, const void* key) + * void noekeon_cbc_enc(void *buffer, uint8_t block_cnt, const void *key) */ /* param buffer is passed in r24:r25 diff --git a/noekeon/noekeon_cbc_enc.h b/noekeon/noekeon_cbc_enc.h index e9ced11..e6cb14a 100644 --- a/noekeon/noekeon_cbc_enc.h +++ b/noekeon/noekeon_cbc_enc.h @@ -4,6 +4,6 @@ #include #include "noekeon.h" -void noekeon_cbc_enc(void* buffer, uint8_t block_cnt, const void* key); +void noekeon_cbc_enc(void *buffer, uint8_t block_cnt, const void *key); #endif /*NOEKEON_CBC_ENC_H_*/ diff --git a/noekeon/noekeon_ctr.S b/noekeon/noekeon_ctr.S index bf366ba..683bee5 100644 --- a/noekeon/noekeon_ctr.S +++ b/noekeon/noekeon_ctr.S @@ -29,7 +29,7 @@ .extern noekeon_enc /* - * void noekeon_ctr_next(void* buffer, const noekeon_ctr_ctx_t* ctx); + * void noekeon_ctr_next(void *buffer, const noekeon_ctr_ctx_t *ctx); */ .global noekeon_ctr_next /* diff --git a/noekeon/noekeon_ctr.h b/noekeon/noekeon_ctr.h index d7a601f..7327886 100644 --- a/noekeon/noekeon_ctr.h +++ b/noekeon/noekeon_ctr.h @@ -37,6 +37,6 @@ typedef struct{ uint8_t key[16]; }noekeon_ctr_ctx_t; -void noekeon_ctr_next(void* buffer, const noekeon_ctr_ctx_t* ctx); +void noekeon_ctr_next(void *buffer, const noekeon_ctr_ctx_t *ctx); #endif /*NOEKEON_CTR_H_*/ diff --git a/noekeon/noekeon_prng.c b/noekeon/noekeon_prng.c index 4e73c7c..a329b75 100644 --- a/noekeon/noekeon_prng.c +++ b/noekeon/noekeon_prng.c @@ -46,7 +46,7 @@ uint8_t random8(void){ return sr[i]; } -void random_block(void* dest){ +void random_block(void *dest){ i=0; noekeon_enc(random_state, random_key); memcpy(dest, random_state, 16); @@ -56,11 +56,11 @@ void srandom32(uint32_t seed){ memcpy(random_key, &seed, 4); } -void random_seed(const void* buffer){ +void random_seed(const void *buffer){ memcpy(random_key, buffer, 16); } -void random_add(const void* buffer){ +void random_add(const void *buffer){ memxor(random_key, buffer, 16); } diff --git a/noekeon/noekeon_prng.h b/noekeon/noekeon_prng.h index ff9ca03..dba7295 100644 --- a/noekeon/noekeon_prng.h +++ b/noekeon/noekeon_prng.h @@ -30,10 +30,10 @@ #include uint8_t random8(void); -void random_block(void* dest); +void random_block(void *dest); void srandom32(uint32_t seed); -void random_seed(const void* buffer); -void random_add(const void* buffer); +void random_seed(const void *buffer); +void random_add(const void *buffer); #endif /* PRNG_H_*/ diff --git a/noekeon/omac_noekeon.S b/noekeon/omac_noekeon.S index 598280b..b4000cd 100644 --- a/noekeon/omac_noekeon.S +++ b/noekeon/omac_noekeon.S @@ -35,7 +35,7 @@ /******************************************************************************/ /* - * void noekeon_omac_init(noekeon_omac_ctx_t* ctx){ + * void noekeon_omac_init(noekeon_omac_ctx_t *ctx){ * memset(ctx, 0, 16); * } */ @@ -56,7 +56,7 @@ omac_noekeon_init: /******************************************************************************/ /* - * void omac_noekeon_tweak(uint8_t t, const void* key, noekeon_omac_ctx_t* ctx){ + * void omac_noekeon_tweak(uint8_t t, const void *key, noekeon_omac_ctx_t *ctx){ * *ctx[15] = t; * noekeon_enc(ctx, key); * } @@ -76,7 +76,7 @@ omac_noekeon_tweak: /******************************************************************************/ /* - * void noekeon_omac_next(const void* buffer, const void* key, noekeon_omac_ctx_t* ctx){ + * void noekeon_omac_next(const void *buffer, const void *key, noekeon_omac_ctx_t *ctx){ * memxor(ctx, buffer, 16); * noekeon_enc(ctx, key); * } @@ -104,7 +104,7 @@ omac_noekeon_next: /******************************************************************************/ /* - * void omac_noekeon_comppad(uint8_t* pad, const void* key, uint8_t length_b){ + * void omac_noekeon_comppad(uint8_t *pad, const void *key, uint8_t length_b){ * uint8_t c1,c2,r,j; * memset(pad, 0, 16); * noekeon_enc(pad, key); @@ -194,7 +194,7 @@ omac_noekeon_comppad: /******************************************************************************/ /* - * void omac_noekeon_last(const void* buffer, uint8_t length_b, const void* key, noekeon_omac_ctx_t* ctx){ + * void omac_noekeon_last(const void *buffer, uint8_t length_b, const void *key, noekeon_omac_ctx_t *ctx){ * while(length_b>128){ * omac_noekeon_next(buffer, key, ctx); * buffer = (uint8_t*)buffer +16; @@ -263,8 +263,8 @@ omac_noekeon_last: /******************************************************************************/ /* - *void omac_noekeon(void* dest, const void* msg, uint16_t msglength_b, - * const void* key, uint8_t t){ + *void omac_noekeon(void *dest, const void *msg, uint16_t msglength_b, + * const void *key, uint8_t t){ * omac_noekeon_init(dest); * if(t!=0xff) * omac_noekeon_tweak(t,key,dest); diff --git a/noekeon/omac_noekeon.h b/noekeon/omac_noekeon.h index a4db052..6ed1a37 100644 --- a/noekeon/omac_noekeon.h +++ b/noekeon/omac_noekeon.h @@ -32,13 +32,13 @@ typedef uint8_t omac_noekeon_ctx_t[16]; -void omac_noekeon_init(omac_noekeon_ctx_t* ctx); -void omac_noekeon_tweak(uint8_t t, const void* key, omac_noekeon_ctx_t* ctx); -void omac_noekeon_next(const void* buffer, const void* key, - omac_noekeon_ctx_t* ctx); -void omac_noekeon_last(const void* buffer, uint8_t length_b, const void* key, - omac_noekeon_ctx_t* ctx); -void omac_noekeon(void* dest, const void* msg, uint16_t msglength_b, - const void* key, uint8_t t); +void omac_noekeon_init(omac_noekeon_ctx_t *ctx); +void omac_noekeon_tweak(uint8_t t, const void *key, omac_noekeon_ctx_t *ctx); +void omac_noekeon_next(const void *buffer, const void *key, + omac_noekeon_ctx_t *ctx); +void omac_noekeon_last(const void *buffer, uint8_t length_b, const void *key, + omac_noekeon_ctx_t *ctx); +void omac_noekeon(void *dest, const void *msg, uint16_t msglength_b, + const void *key, uint8_t t); #endif /*NOEKEON_OMAC_H_*/ diff --git a/noekeon/omac_noekeon_C.c b/noekeon/omac_noekeon_C.c index 3046ede..146892d 100644 --- a/noekeon/omac_noekeon_C.c +++ b/noekeon/omac_noekeon_C.c @@ -5,23 +5,23 @@ #include -void omac_noekeon_init(omac_noekeon_ctx_t* ctx){ +void omac_noekeon_init(omac_noekeon_ctx_t *ctx){ memset(ctx, 0, 16); } -void omac_noekeon_tweak(uint8_t t, const void* key, omac_noekeon_ctx_t* ctx){ +void omac_noekeon_tweak(uint8_t t, const void *key, omac_noekeon_ctx_t *ctx){ *ctx[15] = t; noekeon_enc(ctx, key); } -void omac_noekeon_next(const void* buffer, const void* key, omac_noekeon_ctx_t* ctx){ +void omac_noekeon_next(const void *buffer, const void *key, omac_noekeon_ctx_t *ctx){ memxor(ctx, buffer, 16); noekeon_enc(ctx, key); } static -void omac_noekeon_comppad(uint8_t* pad, const void* key, uint8_t length_b){ +void omac_noekeon_comppad(uint8_t *pad, const void *key, uint8_t length_b){ uint8_t c1,c2,r,j; memset(pad, 0, 16); noekeon_enc(pad, key); @@ -42,7 +42,7 @@ void omac_noekeon_comppad(uint8_t* pad, const void* key, uint8_t length_b){ } } -void omac_noekeon_last(const void* buffer, uint8_t length_b, const void* key, omac_noekeon_ctx_t* ctx){ +void omac_noekeon_last(const void *buffer, uint8_t length_b, const void *key, omac_noekeon_ctx_t *ctx){ while(length_b>128){ omac_noekeon_next(buffer, key, ctx); buffer = (uint8_t*)buffer +16; @@ -55,8 +55,8 @@ void omac_noekeon_last(const void* buffer, uint8_t length_b, const void* key, om } -void omac_noekeon(void* dest, const void* msg, uint16_t msglength_b, - const void* key, uint8_t t){ +void omac_noekeon(void *dest, const void *msg, uint16_t msglength_b, + const void *key, uint8_t t){ omac_noekeon_init(dest); if(t!=0xff) omac_noekeon_tweak(t,key,dest); diff --git a/present/present128.c b/present/present128.c index ac7c925..faea068 100644 --- a/present/present128.c +++ b/present/present128.c @@ -33,7 +33,7 @@ #include "present128.h" static -void key_update_128(uint8_t* buffer, uint8_t round){ +void key_update_128(uint8_t *buffer, uint8_t round){ uint8_t j; uint8_t t8; union __attribute__((packed)){ @@ -63,7 +63,7 @@ void key_update_128(uint8_t* buffer, uint8_t round){ static -void key_update_128_inv(uint8_t* buffer, uint8_t round){ +void key_update_128_inv(uint8_t *buffer, uint8_t round){ uint8_t j; uint8_t t8; union __attribute__((packed)){ @@ -93,7 +93,7 @@ void key_update_128_inv(uint8_t* buffer, uint8_t round){ }while(j--); } -void present128_init(const uint8_t* key, uint8_t keysize_b, present128_ctx_t* ctx){ +void present128_init(const uint8_t *key, uint8_t keysize_b, present128_ctx_t *ctx){ uint8_t i; memcpy(ctx->fwd_key, key, 16); memcpy(ctx->rev_key, key, 16); @@ -102,16 +102,16 @@ void present128_init(const uint8_t* key, uint8_t keysize_b, present128_ctx_t* ct } } -void present128_enc(void* buffer, present128_ctx_t* ctx){ +void present128_enc(void *buffer, present128_ctx_t *ctx){ present_generic_enc(buffer, (uint8_t*)ctx, 16, key_update_128); } -void present128_dec(void* buffer, present128_ctx_t* ctx){ +void present128_dec(void *buffer, present128_ctx_t *ctx){ present_generic_dec(buffer, (uint8_t*)ctx, 16, key_update_128_inv); } /* -void present128_enc(void* buffer, present128_ctx_t* ctx){ +void present128_enc(void *buffer, present128_ctx_t *ctx){ uint8_t i,j,tmp[8], k[16]; memcpy(k, ctx->fwd_key, 16); memxor(buffer, k, 8); @@ -126,7 +126,7 @@ void present128_enc(void* buffer, present128_ctx_t* ctx){ } } -void present128_dec(void* buffer, present128_ctx_t* ctx){ +void present128_dec(void *buffer, present128_ctx_t *ctx){ uint8_t j,tmp[8], k[16]; uint8_t i; memcpy(k, ctx->rev_key, 16); diff --git a/present/present128.h b/present/present128.h index d74fff9..7c37dc4 100644 --- a/present/present128.h +++ b/present/present128.h @@ -27,9 +27,9 @@ typedef struct __attribute__((packed)) present128_ctx_st { } present128_ctx_t; -void present128_init(const uint8_t* key, uint8_t keysize_b, present128_ctx_t* ctx); -void present128_enc(void* buffer, present128_ctx_t* ctx); -void present128_dec(void* buffer, present128_ctx_t* ctx); +void present128_init(const uint8_t *key, uint8_t keysize_b, present128_ctx_t *ctx); +void present128_enc(void *buffer, present128_ctx_t *ctx); +void present128_dec(void *buffer, present128_ctx_t *ctx); #endif /*PRESENT128_H_*/ diff --git a/present/present80.c b/present/present80.c index 2a5589b..bc17370 100644 --- a/present/present80.c +++ b/present/present80.c @@ -33,7 +33,7 @@ #include "present80.h" static -void key_update(uint8_t* buffer, uint8_t round){ +void key_update(uint8_t *buffer, uint8_t round){ uint8_t j; union __attribute__((packed)){ uint8_t v8[2]; @@ -63,7 +63,7 @@ void key_update(uint8_t* buffer, uint8_t round){ } static -void key_update_inv(uint8_t* buffer, uint8_t round){ +void key_update_inv(uint8_t *buffer, uint8_t round){ uint8_t j; union __attribute__((packed)){ uint8_t v8[2]; @@ -92,7 +92,7 @@ void key_update_inv(uint8_t* buffer, uint8_t round){ }while(j--); } -void present80_init(const uint8_t* key, uint8_t keysize_b, present80_ctx_t* ctx){ +void present80_init(const uint8_t *key, uint8_t keysize_b, present80_ctx_t *ctx){ uint8_t i; memcpy(ctx->fwd_key, key, 10); memcpy(ctx->rev_key, key, 10); @@ -101,16 +101,16 @@ void present80_init(const uint8_t* key, uint8_t keysize_b, present80_ctx_t* ctx) } } -void present80_enc(void* buffer, present80_ctx_t* ctx){ +void present80_enc(void *buffer, present80_ctx_t *ctx){ present_generic_enc(buffer, (uint8_t*)ctx, 10, key_update); } -void present80_dec(void* buffer, present80_ctx_t* ctx){ +void present80_dec(void *buffer, present80_ctx_t *ctx){ present_generic_dec(buffer, (uint8_t*)ctx, 10, key_update_inv); } /* -void present80_enc(void* buffer, present80_ctx_t* ctx){ +void present80_enc(void *buffer, present80_ctx_t *ctx){ uint8_t i,j,tmp[8], k[10]; memcpy(k, ctx->fwd_key, 10); memxor(buffer, k, 8); @@ -125,7 +125,7 @@ void present80_enc(void* buffer, present80_ctx_t* ctx){ } } -void present80_dec(void* buffer, present80_ctx_t* ctx){ +void present80_dec(void *buffer, present80_ctx_t *ctx){ uint8_t j,tmp[8], k[10]; uint8_t i; memcpy(k, ctx->rev_key, 10); diff --git a/present/present80.h b/present/present80.h index 9fb73e4..29f07b9 100644 --- a/present/present80.h +++ b/present/present80.h @@ -27,8 +27,8 @@ typedef struct __attribute__((packed)) present80_ctx_st { } present80_ctx_t; -void present80_init(const uint8_t* key, uint8_t keysize_b, present80_ctx_t* ctx); -void present80_enc(void* buffer, present80_ctx_t* ctx); -void present80_dec(void* buffer, present80_ctx_t* ctx); +void present80_init(const uint8_t *key, uint8_t keysize_b, present80_ctx_t *ctx); +void present80_enc(void *buffer, present80_ctx_t *ctx); +void present80_dec(void *buffer, present80_ctx_t *ctx); #endif /*PRESENT80_H_*/ diff --git a/present/present_common.c b/present/present_common.c index 198c67b..c1c000c 100644 --- a/present/present_common.c +++ b/present/present_common.c @@ -50,7 +50,7 @@ uint8_t present_sbox_inv(uint8_t b){ return (pgm_read_byte(&sb[b >> 4]) << 4) | pgm_read_byte(&sb[b & 0xf]); } -void present_p(uint8_t* o, uint8_t* i){ +void present_p(uint8_t *o, uint8_t *i){ uint8_t m,n=0,idx=0; for(m=0; m<64; ++m){ o[idx] <<= 1; @@ -67,7 +67,7 @@ void present_p(uint8_t* o, uint8_t* i){ } -void present_generic_enc(void* buffer, uint8_t* ctx, uint8_t ksize_B, +void present_generic_enc(void *buffer, uint8_t *ctx, uint8_t ksize_B, void(*update)(uint8_t*, uint8_t)){ uint8_t i,j,tmp[8], k[ksize_B]; memcpy(k, ctx, ksize_B); @@ -83,7 +83,7 @@ void present_generic_enc(void* buffer, uint8_t* ctx, uint8_t ksize_B, } } -void present_generic_dec(void* buffer, uint8_t* ctx, uint8_t ksize_B, +void present_generic_dec(void *buffer, uint8_t *ctx, uint8_t ksize_B, void(*update)(uint8_t*, uint8_t)){ uint8_t j,tmp[8], k[ksize_B]; uint8_t i; diff --git a/present/present_common.h b/present/present_common.h index f1d7ea4..db856dd 100644 --- a/present/present_common.h +++ b/present/present_common.h @@ -23,11 +23,11 @@ uint8_t present_sbox(uint8_t b); uint8_t present_sbox_inv(uint8_t b); -void present_p(uint8_t* o, uint8_t* i); +void present_p(uint8_t *o, uint8_t *i); -void present_generic_enc(void* buffer, uint8_t* ctx, uint8_t ksize_B, +void present_generic_enc(void *buffer, uint8_t *ctx, uint8_t ksize_B, void(*update)(uint8_t*, uint8_t)); -void present_generic_dec(void* buffer, uint8_t* ctx, uint8_t ksize_B, +void present_generic_dec(void *buffer, uint8_t *ctx, uint8_t ksize_B, void(*update)(uint8_t*, uint8_t)); #endif /*PRESENT_H_*/ diff --git a/present/present_speed.c b/present/present_speed.c index 00924e3..b2e21e3 100644 --- a/present/present_speed.c +++ b/present/present_speed.c @@ -31,7 +31,7 @@ #include "present_speed.h" static -void key_update(uint8_t* buffer, uint8_t round){ +void key_update(uint8_t *buffer, uint8_t round){ uint8_t j; union __attribute__((packed)){ uint8_t v8[2]; @@ -60,7 +60,7 @@ void key_update(uint8_t* buffer, uint8_t round){ buffer[7] ^= round >> 1; } -void present_init(const uint8_t* key, uint8_t keysize_b, present_ctx_t* ctx){ +void present_init(const uint8_t *key, uint8_t keysize_b, present_ctx_t *ctx){ uint8_t i,key_buffer[10]; memcpy(key_buffer, key, 10); memcpy(&(ctx->k[0]), key_buffer, 8); @@ -71,7 +71,7 @@ void present_init(const uint8_t* key, uint8_t keysize_b, present_ctx_t* ctx){ } -void present_enc(void* buffer, present_ctx_t* ctx){ +void present_enc(void *buffer, present_ctx_t *ctx){ uint8_t i,j,tmp[8]; for(i=0; i<31; ++i){ *((uint64_t*)buffer) ^= ctx->k[i]; @@ -86,7 +86,7 @@ void present_enc(void* buffer, present_ctx_t* ctx){ } -void present_dec(void* buffer, present_ctx_t* ctx){ +void present_dec(void *buffer, present_ctx_t *ctx){ uint8_t j,tmp[8]; uint8_t i; memxor(buffer, &ctx->k[31], 8); diff --git a/present/present_speed.h b/present/present_speed.h index 320a1d8..8fc6f83 100644 --- a/present/present_speed.h +++ b/present/present_speed.h @@ -26,9 +26,9 @@ typedef struct present_ctx_st{ } present_ctx_t; -void present_init(const uint8_t* key, uint8_t keysize_b, present_ctx_t* ctx); -void present_enc(void* buffer, present_ctx_t* ctx); -void present_dec(void* buffer, present_ctx_t* ctx); +void present_init(const uint8_t *key, uint8_t keysize_b, present_ctx_t *ctx); +void present_enc(void *buffer, present_ctx_t *ctx); +void present_dec(void *buffer, present_ctx_t *ctx); #endif /*PRESENT_H_*/ diff --git a/rabbit/rabbit.h b/rabbit/rabbit.h index b49b55a..75f3931 100644 --- a/rabbit/rabbit.h +++ b/rabbit/rabbit.h @@ -30,12 +30,12 @@ typedef struct { uint8_t buffer_idx; } rabbit_ctx_t; -void dump_ctx(rabbit_ctx_t* ctx); +void dump_ctx(rabbit_ctx_t *ctx); -uint8_t rabbit_gen(rabbit_ctx_t* ctx); -void rabbit_init(const void* key, uint16_t keysize_b, - const void* iv, - rabbit_ctx_t* ctx); +uint8_t rabbit_gen(rabbit_ctx_t *ctx); +void rabbit_init(const void *key, uint16_t keysize_b, + const void *iv, + rabbit_ctx_t *ctx); #endif /* RABBIT_H_ */ diff --git a/rabbit/rabbit_c.c b/rabbit/rabbit_c.c index 9b234d4..ae4c8d5 100644 --- a/rabbit/rabbit_c.c +++ b/rabbit/rabbit_c.c @@ -27,7 +27,7 @@ #endif /* -void dump_ctx(rabbit_ctx_t* ctx){ +void dump_ctx(rabbit_ctx_t *ctx){ uint8_t i=0; cli_putstr_P(PSTR("\r\n --- ctx dump ---\r\n b = ")); cli_hexdump_byte(ctx->carry); @@ -62,7 +62,7 @@ const uint32_t c_const[8] PROGMEM = { }; static -void gen_g(uint32_t* dest, rabbit_ctx_t* ctx){ +void gen_g(uint32_t *dest, rabbit_ctx_t *ctx){ uint8_t i=0; uint64_t a; uint32_t t, *x, *c; @@ -76,7 +76,7 @@ void gen_g(uint32_t* dest, rabbit_ctx_t* ctx){ } static -void update_c(rabbit_ctx_t* ctx){ +void update_c(rabbit_ctx_t *ctx){ uint8_t i=0; uint64_t a; uint32_t *c; @@ -97,7 +97,7 @@ void update_c(rabbit_ctx_t* ctx){ #define ROT8(a) (((a)<< 8) | ((a)>>24)) static -void step(rabbit_ctx_t* ctx){ +void step(rabbit_ctx_t *ctx){ uint32_t g[8]; uint8_t i=0; update_c(ctx); @@ -111,7 +111,7 @@ void step(rabbit_ctx_t* ctx){ } static -void keysetup(rabbit_ctx_t* ctx, const void* key){ +void keysetup(rabbit_ctx_t *ctx, const void *key){ uint16_t *x, *c; uint8_t i=0; x = (uint16_t*)(ctx->x); @@ -139,7 +139,7 @@ void keysetup(rabbit_ctx_t* ctx, const void* key){ } static -void ivsetup(rabbit_ctx_t* ctx, const void* iv){ +void ivsetup(rabbit_ctx_t *ctx, const void *iv){ uint8_t i; uint32_t t; union __attribute__((packed)){ @@ -173,7 +173,7 @@ void ivsetup(rabbit_ctx_t* ctx, const void* iv){ } static -void extract(rabbit_ctx_t* ctx){ +void extract(rabbit_ctx_t *ctx){ int8_t i=0; uint8_t *t; uint16_t v; @@ -204,9 +204,9 @@ void extract(rabbit_ctx_t* ctx){ static const uint8_t key80_pad[] PROGMEM = { 0xDE, 0x05, 0x6E, 0xAC, 0x8A, 0x11 }; -void rabbit_init(const void* key, uint16_t keysize_b, - const void* iv, - rabbit_ctx_t* ctx){ +void rabbit_init(const void *key, uint16_t keysize_b, + const void *iv, + rabbit_ctx_t *ctx){ uint8_t t_key[16]; if(keysize_b==80){ memcpy(t_key, key, 10); @@ -232,7 +232,7 @@ void rabbit_init(const void* key, uint16_t keysize_b, ctx->buffer_idx = 16; } -uint8_t rabbit_gen(rabbit_ctx_t* ctx){ +uint8_t rabbit_gen(rabbit_ctx_t *ctx){ if(ctx->buffer_idx==16){ step(ctx); extract(ctx); diff --git a/rc5/rc5.c b/rc5/rc5.c index 441f61d..7ad15a8 100644 --- a/rc5/rc5.c +++ b/rc5/rc5.c @@ -37,7 +37,7 @@ #define ROTL32(v,n) (((v)<<(n))|((v)>>(32-(n)))) #define ROTR32(v,n) (((v)>>(n))|((v)<<(32-(n)))) -void rc5_enc(void* buffer, const rc5_ctx_t* ctx){ +void rc5_enc(void *buffer, const rc5_ctx_t *ctx){ uint8_t i; A += ctx->s[0]; B += ctx->s[1]; @@ -47,7 +47,7 @@ void rc5_enc(void* buffer, const rc5_ctx_t* ctx){ } } -void rc5_dec(void* buffer, const rc5_ctx_t* ctx){ +void rc5_dec(void *buffer, const rc5_ctx_t *ctx){ uint8_t i; for(i=ctx->rounds; i>0; --i){ B = ROTR32(B - ctx->s[i*2+1], A&31) ^ A; @@ -64,7 +64,7 @@ Q32 = 10011110001101110111100110111001 = 9e3779b9 #define Q32 0x9e3779b9 -void rc5_init(void* key, uint16_t keysize_b, uint8_t rounds, rc5_ctx_t* ctx){ +void rc5_init(void *key, uint16_t keysize_b, uint8_t rounds, rc5_ctx_t *ctx){ uint16_t c,n,m,j,i,t; uint32_t a,b,l[(keysize_b+31)/32]; ctx->rounds = rounds; @@ -91,7 +91,7 @@ void rc5_init(void* key, uint16_t keysize_b, uint8_t rounds, rc5_ctx_t* ctx){ } } -void rc5_free(rc5_ctx_t* ctx){ +void rc5_free(rc5_ctx_t *ctx){ if(ctx->s) free(ctx->s); } diff --git a/rc5/rc5.h b/rc5/rc5.h index 2a0182c..959fa8e 100644 --- a/rc5/rc5.h +++ b/rc5/rc5.h @@ -38,9 +38,9 @@ typedef struct rc5_ctx_st { uint32_t *s; }rc5_ctx_t; -void rc5_enc(void* buffer, const rc5_ctx_t* ctx); -void rc5_dec(void* buffer, const rc5_ctx_t* ctx); -void rc5_init(void* key, uint16_t keysize_b, uint8_t rounds, rc5_ctx_t* ctx); -void rc5_free(rc5_ctx_t* ctx); +void rc5_enc(void *buffer, const rc5_ctx_t *ctx); +void rc5_dec(void *buffer, const rc5_ctx_t *ctx); +void rc5_init(void *key, uint16_t keysize_b, uint8_t rounds, rc5_ctx_t *ctx); +void rc5_free(rc5_ctx_t *ctx); #endif /*RC5_H_*/ diff --git a/rc6/rc6.c b/rc6/rc6.c index ea4d7bb..fdf866c 100644 --- a/rc6/rc6.c +++ b/rc6/rc6.c @@ -46,12 +46,12 @@ uint32_t rotr32(uint32_t a, uint8_t n){ return ( (a>>n)| (a<<(32-n)) ); } -uint8_t rc6_init(void* key, uint16_t keylength_b, rc6_ctx_t *s){ +uint8_t rc6_init(void *key, uint16_t keylength_b, rc6_ctx_t *s){ return rc6_initl(key, keylength_b, 20, s); } -uint8_t rc6_initl(void* key, uint16_t keylength_b, uint8_t rounds, rc6_ctx_t *s){ +uint8_t rc6_initl(void *key, uint16_t keylength_b, uint8_t rounds, rc6_ctx_t *s){ uint8_t i,j; uint16_t v,p,c; uint32_t a,b, l=0; @@ -104,7 +104,7 @@ void rc6_free(rc6_ctx_t *s){ #define C (((uint32_t*)block)[2]) #define D (((uint32_t*)block)[3]) -void rc6_enc(void* block, rc6_ctx_t *s){ +void rc6_enc(void *block, rc6_ctx_t *s){ uint8_t i; uint32_t t,u,x; /* greetings to Linux? */ B += s->S[0]; @@ -124,7 +124,7 @@ void rc6_enc(void* block, rc6_ctx_t *s){ C += s->S[2*s->rounds+3]; } -void rc6_dec(void* block, rc6_ctx_t *s){ +void rc6_dec(void *block, rc6_ctx_t *s){ uint8_t i; uint32_t t,u,x; /* greetings to Linux? */ diff --git a/rc6/rc6.h b/rc6/rc6.h index 429a1d3..3d9ccce 100644 --- a/rc6/rc6.h +++ b/rc6/rc6.h @@ -38,13 +38,13 @@ typedef struct rc6_ctx_st{ } rc6_ctx_t; -uint8_t rc6_init(void* key, uint16_t keylength_b, rc6_ctx_t *s); +uint8_t rc6_init(void *key, uint16_t keylength_b, rc6_ctx_t *s); -uint8_t rc6_initl(void* key, uint16_t keylength_b, uint8_t rounds, rc6_ctx_t *s); +uint8_t rc6_initl(void *key, uint16_t keylength_b, uint8_t rounds, rc6_ctx_t *s); -void rc6_enc(void* block, rc6_ctx_t *s); +void rc6_enc(void *block, rc6_ctx_t *s); -void rc6_dec(void* block, rc6_ctx_t *s); +void rc6_dec(void *block, rc6_ctx_t *s); void rc6_free(rc6_ctx_t *s); diff --git a/rsa/rsa_basic.c b/rsa/rsa_basic.c index fbdc80b..3d6581f 100644 --- a/rsa/rsa_basic.c +++ b/rsa/rsa_basic.c @@ -30,7 +30,7 @@ #include "cli.h" #endif -void rsa_enc(bigint_t* data, const rsa_publickey_t* key){ +void rsa_enc(bigint_t *data, const rsa_publickey_t *key){ /* cli_putstr_P(PSTR("\r\n -->rsa_enc()\r\n m = ")); bigint_print_hex(data); @@ -50,7 +50,7 @@ h = (m1 - m2) * qinv % p m = m2 + q * h */ -uint8_t rsa_dec_crt_mono(bigint_t* data, const rsa_privatekey_t* key){ +uint8_t rsa_dec_crt_mono(bigint_t *data, const rsa_privatekey_t *key){ bigint_t m1, m2; m1.wordv = malloc((key->components[0].length_W /* + 1 */) * sizeof(bigint_word_t)); m2.wordv = malloc((key->components[1].length_W /* + 1 */) * sizeof(bigint_word_t)); @@ -160,7 +160,7 @@ uint8_t rsa_dec_crt_mono(bigint_t* data, const rsa_privatekey_t* key){ return 0; } -uint8_t rsa_dec(bigint_t* data, const rsa_privatekey_t* key){ +uint8_t rsa_dec(bigint_t *data, const rsa_privatekey_t *key){ if(key->n == 1){ bigint_expmod_u(data, data, &(key->components[0]), &key->modulus); return 0; @@ -178,7 +178,7 @@ uint8_t rsa_dec(bigint_t* data, const rsa_privatekey_t* key){ return 2; } -void rsa_os2ip(bigint_t* dest, const void* data, uint32_t length_B){ +void rsa_os2ip(bigint_t *dest, const void *data, uint32_t length_B){ #if BIGINT_WORD_SIZE == 8 if(data){ memcpy(dest->wordv, data, length_B); @@ -214,7 +214,7 @@ void rsa_os2ip(bigint_t* dest, const void* data, uint32_t length_B){ bigint_adjust(dest); } -void rsa_i2osp(void* dest, bigint_t* src, uint16_t* out_length_B){ +void rsa_i2osp(void *dest, bigint_t *src, uint16_t *out_length_B){ #if BIGINT_WORD_SIZE == 8 if(dest){ uint8_t *e = src->wordv + src->length_W; diff --git a/rsa/rsa_basic.h b/rsa/rsa_basic.h index 3146540..200c0fb 100644 --- a/rsa/rsa_basic.h +++ b/rsa/rsa_basic.h @@ -30,7 +30,7 @@ typedef struct { typedef struct { uint8_t n; bigint_t modulus; - bigint_t* components; + bigint_t *components; } rsa_privatekey_t; @@ -40,9 +40,9 @@ typedef struct { } rsa_fullkey_t; -void rsa_enc(bigint_t* data, const rsa_publickey_t* key); -uint8_t rsa_dec(bigint_t* data, const rsa_privatekey_t* key); -void rsa_os2ip(bigint_t* dest, const void* data, uint32_t length_B); -void rsa_i2osp(void* dest, bigint_t* src, uint16_t* out_length_B); +void rsa_enc(bigint_t *data, const rsa_publickey_t *key); +uint8_t rsa_dec(bigint_t *data, const rsa_privatekey_t *key); +void rsa_os2ip(bigint_t *dest, const void *data, uint32_t length_B); +void rsa_i2osp(void *dest, bigint_t *src, uint16_t *out_length_B); #endif /* RSA_BASIC_H_ */ diff --git a/rsa/rsaes_oaep.c b/rsa/rsaes_oaep.c index c1c70e7..042f536 100644 --- a/rsa/rsaes_oaep.c +++ b/rsa/rsaes_oaep.c @@ -51,10 +51,10 @@ rsa_label_t rsa_oaep_default_label = { 0, NULL }; -uint8_t rsa_encrypt_oaep(void* dest, uint16_t* out_length, - const void* src, uint16_t length_B, - rsa_publickey_t* key, const rsa_oaep_parameter_t *p, - const rsa_label_t* label, const void* seed){ +uint8_t rsa_encrypt_oaep(void *dest, uint16_t *out_length, + const void *src, uint16_t length_B, + rsa_publickey_t *key, const rsa_oaep_parameter_t *p, + const rsa_label_t *label, const void *seed){ if(!p){ p = &rsa_oaep_default_parameter; @@ -74,7 +74,7 @@ uint8_t rsa_encrypt_oaep(void* dest, uint16_t* out_length, cli_putstr("\r\n modulus_len = "); cli_hexdump_rev(&key->modulus.length_W, 2); #endif - uint8_t* buffer = (uint8_t*)dest; + uint8_t *buffer = (uint8_t*)dest; uint8_t off; /* the following needs some explanation: * off is the offset which is used for compensating the effect of @@ -84,9 +84,9 @@ uint8_t rsa_encrypt_oaep(void* dest, uint16_t* out_length, % (sizeof(bigint_word_t)); buffer += off; buffer_len -= off; - uint8_t* seed_buffer = buffer + 1; + uint8_t *seed_buffer = buffer + 1; uint16_t db_len = buffer_len - hv_len - 1; - uint8_t* db = seed_buffer + hv_len; + uint8_t *db = seed_buffer + hv_len; uint16_t maskbuffer_len = db_len>hv_len?db_len:hv_len; uint8_t maskbuffer[maskbuffer_len]; bigint_t x; @@ -140,10 +140,10 @@ uint8_t rsa_encrypt_oaep(void* dest, uint16_t* out_length, return 0; } -uint8_t rsa_decrypt_oaep(void* dest, uint16_t* out_length, - const void* src, uint16_t length_B, - rsa_privatekey_t* key, const rsa_oaep_parameter_t *p, - const rsa_label_t* label, void* seed){ +uint8_t rsa_decrypt_oaep(void *dest, uint16_t *out_length, + const void *src, uint16_t length_B, + rsa_privatekey_t *key, const rsa_oaep_parameter_t *p, + const rsa_label_t *label, void *seed){ // cli_putstr("\r\n -->rsa_decrypt_oaep()"); uart_flush(0); if(!label){ diff --git a/rsa/rsaes_oaep.h b/rsa/rsaes_oaep.h index 8084653..9d8a529 100644 --- a/rsa/rsaes_oaep.h +++ b/rsa/rsaes_oaep.h @@ -24,31 +24,31 @@ #include "mgf1.h" -void mgf1(void* dest, const void* seed, uint16_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t* p); +void mgf1(void *dest, const void *seed, uint16_t seed_len_B, uint16_t out_length_B, const mgf1_parameter_t *p); typedef struct { - void (*mgf)(void* dst, const void* seed, uint16_t slen_B, uint16_t dstlen_B, const mgf1_parameter_t* p); - const hfdesc_t* hf; - mgf1_parameter_t* mgf_parameter; + void (*mgf)(void *dst, const void *seed, uint16_t slen_B, uint16_t dstlen_B, const mgf1_parameter_t *p); + const hfdesc_t *hf; + mgf1_parameter_t *mgf_parameter; } rsa_oaep_parameter_t; typedef struct { uint16_t length_b; - const void* label; + const void *label; } rsa_label_t; extern rsa_oaep_parameter_t rsa_oaep_default_parameter; extern rsa_label_t rsa_oaep_default_label; -uint8_t rsa_encrypt_oaep(void* dest, uint16_t* out_length, - const void* src, uint16_t length_B, - rsa_publickey_t* key, const rsa_oaep_parameter_t *p, - const rsa_label_t* label, const void* seed); +uint8_t rsa_encrypt_oaep(void *dest, uint16_t *out_length, + const void *src, uint16_t length_B, + rsa_publickey_t *key, const rsa_oaep_parameter_t *p, + const rsa_label_t *label, const void *seed); -uint8_t rsa_decrypt_oaep(void* dest, uint16_t* out_length, - const void* src, uint16_t length_B, - rsa_privatekey_t* key, const rsa_oaep_parameter_t *p, - const rsa_label_t* label, void* seed); +uint8_t rsa_decrypt_oaep(void *dest, uint16_t *out_length, + const void *src, uint16_t length_B, + rsa_privatekey_t *key, const rsa_oaep_parameter_t *p, + const rsa_label_t *label, void *seed); #endif /* RSA_OAEP_H_ */ diff --git a/rsa/rsaes_pkcs1v15.c b/rsa/rsaes_pkcs1v15.c index 2bc35ac..4f41546 100644 --- a/rsa/rsaes_pkcs1v15.c +++ b/rsa/rsaes_pkcs1v15.c @@ -33,12 +33,12 @@ #include "random_dummy.h" -uint16_t rsa_pkcs1v15_compute_padlength_B(bigint_t* modulus, uint16_t msg_length_B){ +uint16_t rsa_pkcs1v15_compute_padlength_B(bigint_t *modulus, uint16_t msg_length_B){ return bigint_get_first_set_bit(modulus) / 8 + 1 - msg_length_B - 3; } -uint8_t rsa_encrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, - uint16_t length_B, rsa_publickey_t* key, const void* pad){ +uint8_t rsa_encrypt_pkcs1v15(void *dest, uint16_t *out_length, const void *src, + uint16_t length_B, rsa_publickey_t *key, const void *pad){ int16_t pad_length; bigint_t x; pad_length = rsa_pkcs1v15_compute_padlength_B(&key->modulus, length_B); @@ -85,8 +85,8 @@ uint8_t rsa_encrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, return 0; } -uint8_t rsa_decrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, - uint16_t length_B, rsa_privatekey_t* key, void* pad){ +uint8_t rsa_decrypt_pkcs1v15(void *dest, uint16_t *out_length, const void *src, + uint16_t length_B, rsa_privatekey_t *key, void *pad){ bigint_t x; uint16_t m_length, pad_length=0, idx=0; x.wordv = dest; diff --git a/rsa/rsaes_pkcs1v15.h b/rsa/rsaes_pkcs1v15.h index cb12740..909b154 100644 --- a/rsa/rsaes_pkcs1v15.h +++ b/rsa/rsaes_pkcs1v15.h @@ -23,13 +23,13 @@ #include #include "bigint.h" -uint16_t rsa_pkcs1v15_compute_padlength_B(bigint_t* modulus, uint16_t msg_length_B); +uint16_t rsa_pkcs1v15_compute_padlength_B(bigint_t *modulus, uint16_t msg_length_B); -uint8_t rsa_encrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, - uint16_t length_B, rsa_publickey_t* key, const void* pad); +uint8_t rsa_encrypt_pkcs1v15(void *dest, uint16_t *out_length, const void *src, + uint16_t length_B, rsa_publickey_t *key, const void *pad); -uint8_t rsa_decrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, - uint16_t length_B, rsa_privatekey_t* key, void* pad); +uint8_t rsa_decrypt_pkcs1v15(void *dest, uint16_t *out_length, const void *src, + uint16_t length_B, rsa_privatekey_t *key, void *pad); #endif /* RSA_PKCS1V15_H_ */ diff --git a/salsa20/salsa20.c b/salsa20/salsa20.c index 95a38d5..6d9589b 100644 --- a/salsa20/salsa20.c +++ b/salsa20/salsa20.c @@ -26,7 +26,7 @@ #define ROTL32(a,n) (((a)<<(n))|((a)>>(32-(n)))) static -void quaterround(uint32_t* a, uint32_t* b, uint32_t* c, uint32_t* d){ +void quaterround(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d){ *b ^= ROTL32(*a + *d, 7); *c ^= ROTL32(*b + *a, 9); *d ^= ROTL32(*c + *b, 13); @@ -34,7 +34,7 @@ void quaterround(uint32_t* a, uint32_t* b, uint32_t* c, uint32_t* d){ } static -void rowround(uint32_t* a){ +void rowround(uint32_t *a){ quaterround(a+ 0, a+ 1, a+ 2, a+ 3); quaterround(a+ 5, a+ 6, a+ 7, a+ 4); quaterround(a+10, a+11, a+ 8, a+ 9); @@ -42,7 +42,7 @@ void rowround(uint32_t* a){ } static -void columnround(uint32_t* a){ +void columnround(uint32_t *a){ quaterround(a+ 0, a+ 4, a+ 8, a+12); quaterround(a+ 5, a+ 9, a+13, a+ 1); quaterround(a+10, a+14, a+ 2, a+ 6); @@ -50,14 +50,14 @@ void columnround(uint32_t* a){ } static -void doubleround(uint32_t* a){ +void doubleround(uint32_t *a){ columnround(a); rowround(a); } -void salsa20_hash(uint32_t* a){ +void salsa20_hash(uint32_t *a){ uint8_t i; uint32_t b[16]; memcpy(b, a, 64); @@ -72,7 +72,7 @@ void salsa20_hash(uint32_t* a){ const uint8_t sigma[] PROGMEM = {'e','x','p','a','n','d',' ','3','2','-','b','y','t','e',' ','k'}; const uint8_t theta[] PROGMEM = {'e','x','p','a','n','d',' ','1','6','-','b','y','t','e',' ','k'}; -void salsa_k32(uint32_t* dest, const uint32_t* k, const uint32_t* n){ +void salsa_k32(uint32_t *dest, const uint32_t *k, const uint32_t *n){ memcpy_P(dest+ 0, sigma+ 0, 4); memcpy( dest+ 4, k+ 0, 16); memcpy_P(dest+20, sigma+ 4, 4); @@ -83,7 +83,7 @@ void salsa_k32(uint32_t* dest, const uint32_t* k, const uint32_t* n){ salsa20_hash(dest); } -void salsa_k16(uint32_t* dest, const uint32_t* k, const uint32_t* n){ +void salsa_k16(uint32_t *dest, const uint32_t *k, const uint32_t *n){ memcpy_P(dest+ 0, theta+ 0, 4); memcpy( dest+ 4, k+ 0, 16); memcpy_P(dest+20, theta+ 4, 4); @@ -94,14 +94,14 @@ void salsa_k16(uint32_t* dest, const uint32_t* k, const uint32_t* n){ salsa20_hash(dest); } -void salsa20_genBlock256(void* dest, const void* k, const void* iv, uint64_t i){ +void salsa20_genBlock256(void *dest, const void *k, const void *iv, uint64_t i){ uint32_t n[4]; memcpy(n, iv, 8); memcpy(n+8, &i, 8); salsa_k32((uint32_t*)dest, (uint32_t*)k, n); } -void salsa20_genBlock128(void* dest, const void* k, const void* iv, uint64_t i){ +void salsa20_genBlock128(void *dest, const void *k, const void *iv, uint64_t i){ uint32_t n[4]; memcpy(n, iv, 8); memcpy(n+8, &i, 8); @@ -109,7 +109,7 @@ void salsa20_genBlock128(void* dest, const void* k, const void* iv, uint64_t i){ } -void salsa20_init(void* key, uint16_t keylength_b, void* iv, salsa20_ctx_t* ctx){ +void salsa20_init(void *key, uint16_t keylength_b, void *iv, salsa20_ctx_t *ctx){ if(keylength_b==256){ memcpy_P((ctx->a.v8+ 0), sigma+ 0, 4); memcpy_P((ctx->a.v8+20), sigma+ 4, 4); @@ -131,7 +131,7 @@ void salsa20_init(void* key, uint16_t keylength_b, void* iv, salsa20_ctx_t* ctx) ctx->buffer_idx=64; } -uint8_t salsa20_gen(salsa20_ctx_t* ctx){ +uint8_t salsa20_gen(salsa20_ctx_t *ctx){ if(ctx->buffer_idx==64){ memcpy(ctx->buffer, ctx->a.v8, 64); salsa20_hash((uint32_t*)(ctx->buffer)); diff --git a/salsa20/salsa20.h b/salsa20/salsa20.h index fe33228..7cdbc7b 100644 --- a/salsa20/salsa20.h +++ b/salsa20/salsa20.h @@ -31,13 +31,13 @@ typedef struct{ uint8_t buffer_idx; } salsa20_ctx_t; -void salsa20_hash(uint32_t* a); -void salsa_k32(uint32_t* dest, const uint32_t* k, const uint32_t* n); -void salsa_k16(uint32_t* dest, const uint32_t* k, const uint32_t* n); -void salsa20_genBlock256(void* dest, const void* k, const void* iv, uint64_t i); -void salsa20_genBlock128(void* dest, const void* k, const void* iv, uint64_t i); - -void salsa20_init(void* key, uint16_t keylength_b, void* iv, salsa20_ctx_t* ctx); -uint8_t salsa20_gen(salsa20_ctx_t* ctx); +void salsa20_hash(uint32_t *a); +void salsa_k32(uint32_t *dest, const uint32_t *k, const uint32_t *n); +void salsa_k16(uint32_t *dest, const uint32_t *k, const uint32_t *n); +void salsa20_genBlock256(void *dest, const void *k, const void *iv, uint64_t i); +void salsa20_genBlock128(void *dest, const void *k, const void *iv, uint64_t i); + +void salsa20_init(void *key, uint16_t keylength_b, void *iv, salsa20_ctx_t *ctx); +uint8_t salsa20_gen(salsa20_ctx_t *ctx); #endif /* SALSA20_H_ */ diff --git a/scal/scal-basic.c b/scal/scal-basic.c index 4e750d3..125efcf 100644 --- a/scal/scal-basic.c +++ b/scal/scal-basic.c @@ -24,9 +24,9 @@ #include "streamcipher_descriptor.h" #include "keysize_descriptor.h" -uint8_t scal_cipher_init(const scdesc_t* cipher_descriptor, - const void* key, uint16_t keysize_b, - const void* iv, uint16_t ivsize_b, scgen_ctx_t* ctx){ +uint8_t scal_cipher_init(const scdesc_t *cipher_descriptor, + const void *key, uint16_t keysize_b, + const void *iv, uint16_t ivsize_b, scgen_ctx_t *ctx){ ctx->buffer = NULL; ctx->ctx = NULL; @@ -79,7 +79,7 @@ uint8_t scal_cipher_init(const scdesc_t* cipher_descriptor, } -void scal_cipher_free(scgen_ctx_t* ctx){ +void scal_cipher_free(scgen_ctx_t *ctx){ if(ctx->buffer){ free(ctx->buffer); } @@ -88,7 +88,7 @@ void scal_cipher_free(scgen_ctx_t* ctx){ } } -uint8_t scal_cipher_gen_byte(scgen_ctx_t* ctx){ +uint8_t scal_cipher_gen_byte(scgen_ctx_t *ctx){ uint8_t flags; uint16_t blocksize_b; void_fpt gen_fpt; @@ -125,7 +125,7 @@ uint8_t scal_cipher_gen_byte(scgen_ctx_t* ctx){ } } -void scal_cipher_gen_block(void* block, scgen_ctx_t* ctx){ +void scal_cipher_gen_block(void *block, scgen_ctx_t *ctx){ uint8_t flags; void_fpt gen_fpt; flags = pgm_read_byte(&(ctx->desc_ptr->flags)); @@ -137,7 +137,7 @@ void scal_cipher_gen_block(void* block, scgen_ctx_t* ctx){ } } -void scal_cipher_gen_fillblock(void* block, uint16_t blocksize_B, scgen_ctx_t* ctx){ +void scal_cipher_gen_fillblock(void *block, uint16_t blocksize_B, scgen_ctx_t *ctx){ while(blocksize_B){ *((uint8_t*)block) = scal_cipher_gen_byte(ctx); block = (uint8_t*)block + 1; @@ -145,17 +145,17 @@ void scal_cipher_gen_fillblock(void* block, uint16_t blocksize_B, scgen_ctx_t* c } } -uint16_t scal_cipher_getBlocksize_b(const scdesc_t* desc){ +uint16_t scal_cipher_getBlocksize_b(const scdesc_t *desc){ uint16_t blocksize_b; blocksize_b = pgm_read_word(&(desc->gensize_b)); return blocksize_b; } -PGM_VOID_P scal_cipher_getKeysizeDesc(const scdesc_t* desc){ +PGM_VOID_P scal_cipher_getKeysizeDesc(const scdesc_t *desc){ return (PGM_VOID_P)pgm_read_word(&(desc->valid_keysize_desc)); } -PGM_VOID_P scal_cipher_getIVsizeDesc(const scdesc_t* desc){ +PGM_VOID_P scal_cipher_getIVsizeDesc(const scdesc_t *desc){ return (PGM_VOID_P)pgm_read_word(&(desc->valid_ivsize_desc)); } diff --git a/scal/scal-basic.h b/scal/scal-basic.h index 890a73d..0aa4148 100644 --- a/scal/scal-basic.h +++ b/scal/scal-basic.h @@ -26,16 +26,16 @@ #include "keysize_descriptor.h" #include -uint8_t scal_cipher_init(const scdesc_t* cipher_descriptor, - const void* key, uint16_t keysize_b, - const void* iv, uint16_t ivsize_b, scgen_ctx_t* ctx); -void scal_cipher_free(scgen_ctx_t* ctx); -uint8_t scal_cipher_gen_byte(scgen_ctx_t* ctx); -void scal_cipher_gen_block(void* block, scgen_ctx_t* ctx); -void scal_cipher_gen_fillblock(void* block, uint16_t blocksize_B, scgen_ctx_t* ctx); -uint16_t scal_cipher_getBlocksize_b(const scdesc_t* desc); -PGM_VOID_P scal_cipher_getKeysizeDesc(const scdesc_t* desc); -PGM_VOID_P scal_cipher_getIVsizeDesc(const scdesc_t* desc); +uint8_t scal_cipher_init(const scdesc_t *cipher_descriptor, + const void *key, uint16_t keysize_b, + const void *iv, uint16_t ivsize_b, scgen_ctx_t *ctx); +void scal_cipher_free(scgen_ctx_t *ctx); +uint8_t scal_cipher_gen_byte(scgen_ctx_t *ctx); +void scal_cipher_gen_block(void *block, scgen_ctx_t *ctx); +void scal_cipher_gen_fillblock(void *block, uint16_t blocksize_B, scgen_ctx_t *ctx); +uint16_t scal_cipher_getBlocksize_b(const scdesc_t *desc); +PGM_VOID_P scal_cipher_getKeysizeDesc(const scdesc_t *desc); +PGM_VOID_P scal_cipher_getIVsizeDesc(const scdesc_t *desc); #endif /* SCAL_BASIC_H_ */ diff --git a/scal/scal-nessie.c b/scal/scal-nessie.c index 8e4f30c..e4d7b19 100644 --- a/scal/scal-nessie.c +++ b/scal/scal-nessie.c @@ -54,7 +54,7 @@ static const char stream3_n[] PROGMEM = "stream[448..511]"; static const char streamX_n_estream[] PROGMEM = "xor-digest"; static const char streamX_n_nessie[] PROGMEM = "stream[0..511]xored"; -static const char* stream_n_str[] = { +static const char *stream_n_str[] = { stream0_n, stream1_n, stream2_n, @@ -68,7 +68,7 @@ static const char stream3_l[] PROGMEM = "stream[131008..131071]"; static const char streamX_l_estream[] PROGMEM = "xor-digest"; static const char streamX_l_nessie[] PROGMEM = "stream[0..131071]xored"; -static const char* stream_l_str[] = { +static const char *stream_l_str[] = { stream0_n, stream1_l, stream2_l, @@ -279,7 +279,7 @@ void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t i nessie_print_footer(); } -void scal_nessie_run(const scdesc_t* desc){ +void scal_nessie_run(const scdesc_t *desc){ uint16_t keysizes_count, ivsizes_count,i,j; uint16_t *keysizes=NULL, *ivsizes=NULL; keysizes_count = get_keysizes((PGM_VOID_P)pgm_read_word(&(desc->valid_keysize_desc)), &keysizes); diff --git a/scal/scal-nessie.h b/scal/scal-nessie.h index 3d785dd..ac1d718 100644 --- a/scal/scal-nessie.h +++ b/scal/scal-nessie.h @@ -27,6 +27,6 @@ void scal_nessie_set_estream(uint8_t v); uint8_t scal_nessie_get_estream(void); void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t ivsize_b); -void scal_nessie_run(const scdesc_t* desc); +void scal_nessie_run(const scdesc_t *desc); #endif /* SCALNESSIE_H_ */ diff --git a/seed/seed-asm.S b/seed/seed-asm.S index 84866c3..afdaf3c 100644 --- a/seed/seed-asm.S +++ b/seed/seed-asm.S @@ -222,7 +222,7 @@ seed_sbox2: /* static -uint64_t f_function(const uint64_t* a, uint32_t k0, uint32_t k1){ +uint64_t f_function(const uint64_t *a, uint32_t k0, uint32_t k1){ uint32_t c,d; c = *a & 0x00000000FFFFFFFFLL; diff --git a/seed/seed_C.c b/seed/seed_C.c index 7a9afc0..38aeec9 100644 --- a/seed/seed_C.c +++ b/seed/seed_C.c @@ -91,7 +91,7 @@ uint64_t bigendian_rotr8_64(uint64_t a){ /******************************************************************************/ static -uint64_t f_function(const uint64_t* a, uint32_t k0, uint32_t k1){ +uint64_t f_function(const uint64_t *a, uint32_t k0, uint32_t k1){ uint32_t c,d; c = *a & 0x00000000FFFFFFFFLL; diff --git a/serpent/serpent-asm.S b/serpent/serpent-asm.S index f5f7cc5..5a371b9 100644 --- a/serpent/serpent-asm.S +++ b/serpent/serpent-asm.S @@ -532,7 +532,7 @@ serpent_gen_w: ret /* - * void serpent_init(const void* key, uint16_t keysize_b, serpent_ctx_t* ctx) + * void serpent_init(const void *key, uint16_t keysize_b, serpent_ctx_t *ctx) */ /* * param key is passed in r24:r25 @@ -634,7 +634,7 @@ serpent_init: ret /* - * void serpent_enc(void* buffer, const serpent_ctx_t* ctx){ + * void serpent_enc(void *buffer, const serpent_ctx_t *ctx){ */ /* * param buffer is passed in r24:r25 @@ -685,7 +685,7 @@ serpent_enc: rjmp memxor /* - * void serpent_dec(void* buffer, const serpent_ctx_t* ctx){ + * void serpent_dec(void *buffer, const serpent_ctx_t *ctx){ */ /* * param buffer is passed in r24:r25 diff --git a/serpent/serpent-sboxes-bitslice.c b/serpent/serpent-sboxes-bitslice.c index 96f9c68..40bf2a6 100644 --- a/serpent/serpent-sboxes-bitslice.c +++ b/serpent/serpent-sboxes-bitslice.c @@ -35,7 +35,7 @@ /* depth = 5,7,4,2, Total gates=18 */ static -void sb0(uint8_t* out, const uint8_t* in){ +void sb0(uint8_t *out, const uint8_t *in){ // (a,b,c,d,w,x,y,z) uint8_t t01, t02, t03, t05, t06, t07, t08, t09, t11, t12, t13, t14, t15, t17; t01 = in[4*1] ^ in[4*2]; @@ -62,7 +62,7 @@ void sb0(uint8_t* out, const uint8_t* in){ /* depth = 8,4,3,6, Total gates=19 */ static -void sb0_inv(uint8_t* out, const uint8_t* in){ +void sb0_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t08, t09, t10, t12, t13, t14, t15, t17, t18, t01; t01 = in[4*2] ^ in[4*3]; t02 = in[4*0] | in[4*1]; @@ -89,7 +89,7 @@ void sb0_inv(uint8_t* out, const uint8_t* in){ /* depth = 10,7,3,5, Total gates=18 */ static -void sb1(uint8_t* out, const uint8_t* in){ +void sb1(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t07, t08, t10, t11, t12, t13, t16, t17, t01; t01 = in[4*0] | in[4*3]; t02 = in[4*2] ^ in[4*3]; @@ -114,7 +114,7 @@ void sb1(uint8_t* out, const uint8_t* in){ /* InvS1: 5 8 2 14 15 6 12 3 11 4 7 9 1 13 10 0 */ /* depth = 7,4,5,3, Total gates=18 */ -static void sb1_inv(uint8_t* out, const uint8_t* in){ +static void sb1_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t14, t15, t17, t01; t01 = in[4*0] ^ in[4*1]; t02 = in[4*1] | in[4*3]; @@ -139,7 +139,7 @@ static void sb1_inv(uint8_t* out, const uint8_t* in){ /* S2: 8 6 7 9 3 12 10 15 13 1 14 4 0 11 5 2 */ /* depth = 3,8,11,7, Total gates=16 */ -static void sb2(uint8_t* out, const uint8_t* in){ +static void sb2(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t05, t06, t07, t08, t09, t10, t12, t13, t14, t01; t01 = in[4*0] | in[4*2]; t02 = in[4*0] ^ in[4*1]; @@ -162,7 +162,7 @@ static void sb2(uint8_t* out, const uint8_t* in){ /* InvS2: 12 9 15 4 11 14 1 2 0 3 6 13 5 8 10 7 */ /* depth = 3,6,8,3, Total gates=18 */ -static void sb2_inv(uint8_t* out, const uint8_t* in){ +static void sb2_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t06, t07, t08, t09, t10, t11, t12, t15, t16, t17, t01; t01 = in[4*0] ^ in[4*3]; t02 = in[4*2] ^ in[4*3]; @@ -187,7 +187,7 @@ static void sb2_inv(uint8_t* out, const uint8_t* in){ /* S3: 0 15 11 8 12 9 6 3 13 1 2 4 10 7 5 14 */ /* depth = 8,3,5,5, Total gates=18 */ -static void sb3(uint8_t* out, const uint8_t* in){ +static void sb3(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t13, t14, t15, t01; t01 = in[4*0] ^ in[4*2]; t02 = in[4*0] | in[4*3]; @@ -212,7 +212,7 @@ static void sb3(uint8_t* out, const uint8_t* in){ /* InvS3: 0 9 10 7 11 14 6 13 3 5 12 2 4 8 15 1 */ /* depth = 3,6,4,4, Total gates=17 */ -static void sb3_inv(uint8_t* out, const uint8_t* in){ +static void sb3_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t07, t09, t11, t12, t13, t14, t16, t01; t01 = in[4*2] | in[4*3]; t02 = in[4*0] | in[4*3]; @@ -236,7 +236,7 @@ static void sb3_inv(uint8_t* out, const uint8_t* in){ /* S4: 1 15 8 3 12 0 11 6 2 5 4 10 9 14 7 13 */ /* depth = 6,7,5,3, Total gates=19 */ -static void sb4(uint8_t* out, const uint8_t* in){ +static void sb4(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t08, t09, t10, t11, t12, t13, t14, t15, t16, t01; t01 = in[4*0] | in[4*1]; t02 = in[4*1] | in[4*2]; @@ -262,7 +262,7 @@ static void sb4(uint8_t* out, const uint8_t* in){ /* InvS4: 5 0 8 3 10 9 7 14 2 12 11 6 4 15 13 1 */ /* depth = 6,4,7,3, Total gates=17 */ -static void sb4_inv(uint8_t* out, const uint8_t* in){ +static void sb4_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t07, t09, t10, t11, t12, t13, t15, t01; t01 = in[4*1] | in[4*3]; t02 = in[4*2] | in[4*3]; @@ -286,7 +286,7 @@ static void sb4_inv(uint8_t* out, const uint8_t* in){ /* S5: 15 5 2 11 4 10 9 12 0 3 14 8 13 6 7 1 */ /* depth = 4,6,8,6, Total gates=17 */ -static void sb5(uint8_t* out, const uint8_t* in){ +static void sb5(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t07, t08, t09, t10, t11, t12, t13, t14, t01; t01 = in[4*1] ^ in[4*3]; t02 = in[4*1] | in[4*3]; @@ -310,7 +310,7 @@ static void sb5(uint8_t* out, const uint8_t* in){ /* InvS5: 8 15 2 9 4 1 13 14 11 6 5 3 7 12 10 0 */ /* depth = 4,6,9,7, Total gates=17 */ -static void sb5_inv(uint8_t* out, const uint8_t* in){ +static void sb5_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t07, t08, t09, t10, t12, t13, t15, t16, t01; t01 = in[4*0] & in[4*3]; t02 = in[4*2] ^ t01; @@ -334,7 +334,7 @@ static void sb5_inv(uint8_t* out, const uint8_t* in){ /* S6: 7 2 12 5 8 4 6 11 14 9 1 15 13 3 10 0 */ /* depth = 8,3,6,3, Total gates=19 */ -static void sb6(uint8_t* out, const uint8_t* in){ +static void sb6(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t07, t08, t09, t10, t11, t12, t13, t15, t17, t18, t01; t01 = in[4*0] & in[4*3]; t02 = in[4*1] ^ in[4*2]; @@ -360,7 +360,7 @@ static void sb6(uint8_t* out, const uint8_t* in){ /* InvS6: 15 10 1 13 5 3 6 0 4 9 14 7 2 12 8 11 */ /* depth = 5,3,8,6, Total gates=19 */ -static void sb6_inv(uint8_t* out, const uint8_t* in){ +static void sb6_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t07, t08, t09, t12, t13, t14, t15, t16, t17, t01; t01 = in[4*0] ^ in[4*2]; t02 = ~ in[4*2]; @@ -386,7 +386,7 @@ static void sb6_inv(uint8_t* out, const uint8_t* in){ /* S7: 1 13 15 0 14 8 2 11 7 4 12 10 9 3 5 6 */ /* depth = 10,7,10,4, Total gates=19 */ -static void sb7(uint8_t* out, const uint8_t* in){ +static void sb7(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t05, t06, t08, t09, t10, t11, t13, t14, t15, t16, t17, t01; t01 = in[4*0] & in[4*2]; t02 = ~ in[4*3]; @@ -412,7 +412,7 @@ static void sb7(uint8_t* out, const uint8_t* in){ /* InvS7: 3 0 6 13 9 14 15 8 5 12 11 7 10 1 4 2 */ /* depth = 9,7,3,3, Total gates=18 */ -static void sb7_inv(uint8_t* out, const uint8_t* in){ +static void sb7_inv(uint8_t *out, const uint8_t *in){ uint8_t t02, t03, t04, t06, t07, t08, t09, t10, t11, t13, t14, t15, t16, t01; t01 = in[4*0] & in[4*1]; t02 = in[4*0] | in[4*1]; diff --git a/serpent/serpent-sboxes_c.c b/serpent/serpent-sboxes_c.c index bdbe175..c4ec83b 100644 --- a/serpent/serpent-sboxes_c.c +++ b/serpent/serpent-sboxes_c.c @@ -92,7 +92,7 @@ static void serpent_fp(uint32_t *i, uint32_t *o){ } /******************************************************************************/ -static void sbox128x(uint8_t box, void* w){ +static void sbox128x(uint8_t box, void *w){ uint8_t sb[16]; uint8_t i,t,x; box &= 0x0f; diff --git a/serpent/serpent.c b/serpent/serpent.c index 40ccecd..8f2428b 100644 --- a/serpent/serpent.c +++ b/serpent/serpent.c @@ -82,7 +82,7 @@ static uint32_t serpent_gen_w(uint32_t * b, uint8_t i){ return ret; } -void serpent_init(const void* key, uint16_t keysize_b, serpent_ctx_t* ctx){ +void serpent_init(const void *key, uint16_t keysize_b, serpent_ctx_t *ctx){ uint32_t buffer[8]; uint8_t i,j; if(keysize_b<256){ @@ -106,7 +106,7 @@ void serpent_init(const void* key, uint16_t keysize_b, serpent_ctx_t* ctx){ } } -void serpent_enc(void* buffer, const serpent_ctx_t* ctx){ +void serpent_enc(void *buffer, const serpent_ctx_t *ctx){ uint8_t i; for(i=0; i<31; ++i){ memxor(buffer, ctx->k[i], 16); @@ -119,7 +119,7 @@ void serpent_enc(void* buffer, const serpent_ctx_t* ctx){ memxor(buffer, ctx->k[i], 16); } -void serpent_dec(void* buffer, const serpent_ctx_t* ctx){ +void serpent_dec(void *buffer, const serpent_ctx_t *ctx){ int8_t i=32; memxor(buffer, ctx->k[i], 16); diff --git a/serpent/serpent.h b/serpent/serpent.h index 84e4a87..dbf0192 100644 --- a/serpent/serpent.h +++ b/serpent/serpent.h @@ -39,9 +39,9 @@ typedef struct serpent_ctx_st { /* key must be 256bit (32 byte) large! */ -void serpent_init(const void* key, uint16_t keysize_b, serpent_ctx_t* ctx); -void serpent_enc(void* buffer, const serpent_ctx_t* ctx); -void serpent_dec(void* buffer, const serpent_ctx_t* ctx); +void serpent_init(const void *key, uint16_t keysize_b, serpent_ctx_t *ctx); +void serpent_enc(void *buffer, const serpent_ctx_t *ctx); +void serpent_dec(void *buffer, const serpent_ctx_t *ctx); #endif /*SERPENT_H_*/ diff --git a/sha1/sha1.c b/sha1/sha1.c index 2e22b8e..7b5d40b 100644 --- a/sha1/sha1.c +++ b/sha1/sha1.c @@ -93,7 +93,7 @@ uint32_t parity(uint32_t x, uint32_t y, uint32_t z){ typedef uint32_t (*pf_t)(uint32_t x, uint32_t y, uint32_t z); -void sha1_nextBlock (sha1_ctx_t *state, const void* block){ +void sha1_nextBlock (sha1_ctx_t *state, const void *block){ uint32_t a[5]; uint32_t w[16]; uint32_t temp; @@ -173,7 +173,7 @@ void sha1_nextBlock (sha1_ctx_t *state, const void* block){ /********************************************************************************************************/ -void sha1_lastBlock(sha1_ctx_t *state, const void* block, uint16_t length){ +void sha1_lastBlock(sha1_ctx_t *state, const void *block, uint16_t length){ uint8_t lb[SHA1_BLOCK_BYTES]; /* local block */ while(length>=SHA1_BLOCK_BITS){ sha1_nextBlock(state, block); @@ -226,7 +226,7 @@ void sha1_ctx2hash (void *dest, sha1_ctx_t *state){ * * */ -void sha1 (void *dest, const void* msg, uint32_t length){ +void sha1 (void *dest, const void *msg, uint32_t length){ sha1_ctx_t s; DEBUG_S("\r\nBLA BLUB"); sha1_init(&s); diff --git a/sha1/sha1.h b/sha1/sha1.h index 1966786..0da9ee7 100644 --- a/sha1/sha1.h +++ b/sha1/sha1.h @@ -77,16 +77,16 @@ typedef uint8_t sha1_hash_t[SHA1_HASH_BITS/8]; */ void sha1_init(sha1_ctx_t *state); -/** \fn sha1_nextBlock(sha1_ctx_t *state, const void* block) +/** \fn sha1_nextBlock(sha1_ctx_t *state, const void *block) * \brief process one input block * This function processes one input block and updates the hash context * accordingly * \param state pointer to the state variable to update * \param block pointer to the message block to process */ -void sha1_nextBlock (sha1_ctx_t *state, const void* block); +void sha1_nextBlock (sha1_ctx_t *state, const void *block); -/** \fn sha1_lastBlock(sha1_ctx_t *state, const void* block, uint16_t length_b) +/** \fn sha1_lastBlock(sha1_ctx_t *state, const void *block, uint16_t length_b) * \brief processes the given block and finalizes the context * This function processes the last block in a SHA-1 hashing process. * The block should have a maximum length of a single input block. @@ -94,7 +94,7 @@ void sha1_nextBlock (sha1_ctx_t *state, const void* block); * \param block pointer to themessage block to process * \param length_b length of the message block in bits */ -void sha1_lastBlock (sha1_ctx_t *state, const void* block, uint16_t length_b); +void sha1_lastBlock (sha1_ctx_t *state, const void *block, uint16_t length_b); /** \fn sha1_ctx2hash(sha1_hash_t *dest, sha1_ctx_t *state) * \brief convert a state variable into an actual hash value @@ -104,7 +104,7 @@ void sha1_lastBlock (sha1_ctx_t *state, const void* block, uint16_t length_b); */ void sha1_ctx2hash (void *dest, sha1_ctx_t *state); -/** \fn sha1(sha1_hash_t *dest, const void* msg, uint32_t length_b) +/** \fn sha1(sha1_hash_t *dest, const void *msg, uint32_t length_b) * \brief hashing a message which in located entirely in RAM * This function automatically hashes a message which is entirely in RAM with * the SHA-1 hashing algorithm. @@ -112,7 +112,7 @@ void sha1_ctx2hash (void *dest, sha1_ctx_t *state); * \param msg pointer to the message which should be hashed * \param length_b length of the message in bits */ -void sha1(void *dest, const void* msg, uint32_t length_b); +void sha1(void *dest, const void *msg, uint32_t length_b); diff --git a/sha2/sha224.c b/sha2/sha224.c index 732cd5b..81a5cfd 100644 --- a/sha2/sha224.c +++ b/sha2/sha224.c @@ -67,12 +67,12 @@ void sha224_init(sha224_ctx_t *state){ } /*************************************************************************/ -void sha224_nextBlock (sha224_ctx_t *state, const void* block){ +void sha224_nextBlock (sha224_ctx_t *state, const void *block){ sha2_small_common_nextBlock(state, block); } /*************************************************************************/ -void sha224_lastBlock (sha224_ctx_t *state, const void* block, uint16_t length_b){ +void sha224_lastBlock (sha224_ctx_t *state, const void *block, uint16_t length_b){ sha2_small_common_lastBlock(state, block, length_b); } /*************************************************************************/ @@ -91,7 +91,7 @@ void sha224_lastBlock (sha224_ctx_t *state, const void* block, uint16_t length_b /* * length in bits! */ -void sha224(void* dest, const void* msg, uint32_t length_b){ /* length could be choosen longer but this is for µC */ +void sha224(void *dest, const void *msg, uint32_t length_b){ /* length could be choosen longer but this is for µC */ sha224_ctx_t s; sha224_init(&s); while(length_b >= SHA224_BLOCK_BITS){ @@ -107,7 +107,7 @@ void sha224(void* dest, const void* msg, uint32_t length_b){ /* length could be /*************************************************************************/ -void sha224_ctx2hash(void* dest, const sha224_ctx_t *state){ +void sha224_ctx2hash(void *dest, const sha224_ctx_t *state){ #if defined LITTLE_ENDIAN uint8_t i, j, *s=(uint8_t*)(state->h); i=7; diff --git a/sha2/sha224.h b/sha2/sha224.h index 2261ee5..dd31dfd 100644 --- a/sha2/sha224.h +++ b/sha2/sha224.h @@ -65,7 +65,7 @@ typedef sha2_small_common_ctx_t sha224_ctx_t; */ void sha224_init(sha224_ctx_t *state); -/** \fn void sha224_nextBlock (sha224_ctx_t* state, const void* block) +/** \fn void sha224_nextBlock (sha224_ctx_t *state, const void *block) * \brief update the context with a given block * * This function updates the SHA-224 hash context by processing the given block @@ -73,9 +73,9 @@ void sha224_init(sha224_ctx_t *state); * \param state pointer to the SHA-224 hash context * \param block pointer to the block of fixed length (512 bit = 64 byte) */ -void sha224_nextBlock (sha224_ctx_t* state, const void* block); +void sha224_nextBlock (sha224_ctx_t *state, const void *block); -/** \fn void sha224_lastBlock(sha224_ctx_t* state, const void* block, uint16_t length_b) +/** \fn void sha224_lastBlock(sha224_ctx_t *state, const void *block, uint16_t length_b) * \brief finalize the context with the given block * * This function finalizes the SHA-224 hash context by processing the given block @@ -84,17 +84,17 @@ void sha224_nextBlock (sha224_ctx_t* state, const void* block); * \param block pointer to the block of fixed length (512 bit = 64 byte) * \param length_b the length of the block in bits */ -void sha224_lastBlock(sha224_ctx_t* state, const void* block, uint16_t length_b); +void sha224_lastBlock(sha224_ctx_t *state, const void *block, uint16_t length_b); -/** \fn void sha224_ctx2hash(sha224_hash_t* dest, const sha224_ctx_t* state) +/** \fn void sha224_ctx2hash(sha224_hash_t *dest, const sha224_ctx_t *state) * \brief convert the hash state into the hash value * This function reads the context and writes the hash value to the destination * \param dest pointer to the location where the hash value should be written * \param state pointer to the SHA-224 hash context */ -void sha224_ctx2hash(void* dest, const sha224_ctx_t* state); +void sha224_ctx2hash(void *dest, const sha224_ctx_t *state); -/** \fn void sha224(sha224_hash_t* dest, const void* msg, uint32_t length_b) +/** \fn void sha224(sha224_hash_t *dest, const void *msg, uint32_t length_b) * \brief simple SHA-224 hashing function for direct hashing * * This function automatically hashes a given message of arbitary length with @@ -103,6 +103,6 @@ void sha224_ctx2hash(void* dest, const sha224_ctx_t* state); * \param msg pointer to the message thats going to be hashed * \param length_b length of the message in bits */ -void sha224(void* dest, const void* msg, uint32_t length_b); +void sha224(void *dest, const void *msg, uint32_t length_b); #endif /*SHA224_H_*/ diff --git a/sha2/sha256.c b/sha2/sha256.c index 61a9f8e..75a4ce6 100644 --- a/sha2/sha256.c +++ b/sha2/sha256.c @@ -66,12 +66,12 @@ void sha256_init(sha256_ctx_t *state){ } /*************************************************************************/ -void sha256_nextBlock (sha256_ctx_t *state, const void* block){ +void sha256_nextBlock (sha256_ctx_t *state, const void *block){ sha2_small_common_nextBlock(state, block); } /*************************************************************************/ -void sha256_lastBlock (sha256_ctx_t *state, const void* block, uint16_t length_b){ +void sha256_lastBlock (sha256_ctx_t *state, const void *block, uint16_t length_b){ sha2_small_common_lastBlock(state, block, length_b); } /*************************************************************************/ @@ -90,7 +90,7 @@ void sha256_lastBlock (sha256_ctx_t *state, const void* block, uint16_t length_b /* * length in bits! */ -void sha256(void* dest, const void* msg, uint32_t length_b){ /* length could be choosen longer but this is for µC */ +void sha256(void *dest, const void *msg, uint32_t length_b){ /* length could be choosen longer but this is for µC */ sha256_ctx_t s; sha256_init(&s); while(length_b >= SHA256_BLOCK_BITS){ @@ -106,7 +106,7 @@ void sha256(void* dest, const void* msg, uint32_t length_b){ /* length could be /*************************************************************************/ -void sha256_ctx2hash(void* dest, const sha256_ctx_t *state){ +void sha256_ctx2hash(void *dest, const sha256_ctx_t *state){ #if defined LITTLE_ENDIAN uint8_t i, j, *s=(uint8_t*)(state->h); i=8; diff --git a/sha2/sha256.h b/sha2/sha256.h index 2adf929..d6e74e4 100644 --- a/sha2/sha256.h +++ b/sha2/sha256.h @@ -65,7 +65,7 @@ typedef sha2_small_common_ctx_t sha256_ctx_t; */ void sha256_init(sha256_ctx_t *state); -/** \fn void sha256_nextBlock (sha256_ctx_t* state, const void* block) +/** \fn void sha256_nextBlock (sha256_ctx_t *state, const void *block) * \brief update the context with a given block * * This function updates the SHA-256 hash context by processing the given block @@ -73,9 +73,9 @@ void sha256_init(sha256_ctx_t *state); * \param state pointer to the SHA-256 hash context * \param block pointer to the block of fixed length (512 bit = 64 byte) */ -void sha256_nextBlock (sha256_ctx_t* state, const void* block); +void sha256_nextBlock (sha256_ctx_t *state, const void *block); -/** \fn void sha256_lastBlock(sha256_ctx_t* state, const void* block, uint16_t length_b) +/** \fn void sha256_lastBlock(sha256_ctx_t *state, const void *block, uint16_t length_b) * \brief finalize the context with the given block * * This function finalizes the SHA-256 hash context by processing the given block @@ -84,17 +84,17 @@ void sha256_nextBlock (sha256_ctx_t* state, const void* block); * \param block pointer to the block of fixed length (512 bit = 64 byte) * \param length_b the length of the block in bits */ -void sha256_lastBlock(sha256_ctx_t* state, const void* block, uint16_t length_b); +void sha256_lastBlock(sha256_ctx_t *state, const void *block, uint16_t length_b); -/** \fn void sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t* state) +/** \fn void sha256_ctx2hash(sha256_hash_t *dest, const sha256_ctx_t *state) * \brief convert the hash state into the hash value * This function reads the context and writes the hash value to the destination * \param dest pointer to the location where the hash value should be written * \param state pointer to the SHA-256 hash context */ -void sha256_ctx2hash(void* dest, const sha256_ctx_t* state); +void sha256_ctx2hash(void *dest, const sha256_ctx_t *state); -/** \fn void sha256(sha256_hash_t* dest, const void* msg, uint32_t length_b) +/** \fn void sha256(sha256_hash_t *dest, const void *msg, uint32_t length_b) * \brief simple SHA-256 hashing function for direct hashing * * This function automatically hashes a given message of arbitary length with @@ -103,6 +103,6 @@ void sha256_ctx2hash(void* dest, const sha256_ctx_t* state); * \param msg pointer to the message thats going to be hashed * \param length_b length of the message in bits */ -void sha256(void* dest, const void* msg, uint32_t length_b); +void sha256(void *dest, const void *msg, uint32_t length_b); #endif /*SHA256_H_*/ diff --git a/sha2/sha2_large_common.c b/sha2/sha2_large_common.c index fe23075..9225440 100644 --- a/sha2/sha2_large_common.c +++ b/sha2/sha2_large_common.c @@ -89,7 +89,7 @@ uint64_t pgm_read_uint64_t_P(const uint64_t * p){ #define SIGMA_a(x) (rotr64((x), 1) ^ rotr64((x), 8) ^ ((x)>>7)) #define SIGMA_b(x) (rotr64((x), 19) ^ rotl64((x), 3) ^ ((x)>>6)) -void sha2_large_common_nextBlock(sha2_large_common_ctx_t* ctx, const void* block){ +void sha2_large_common_nextBlock(sha2_large_common_ctx_t *ctx, const void *block){ uint64_t w[16], wx; uint64_t a[8]; uint64_t t1, t2; @@ -122,7 +122,7 @@ void sha2_large_common_nextBlock(sha2_large_common_ctx_t* ctx, const void* block ctx->length += 1; } -void sha2_large_common_lastBlock(sha2_large_common_ctx_t* ctx, const void* block, uint16_t length_b){ +void sha2_large_common_lastBlock(sha2_large_common_ctx_t *ctx, const void *block, uint16_t length_b){ while(length_b >= 1024){ sha2_large_common_nextBlock(ctx, block); block = (uint8_t*)block + 1024/8; diff --git a/sha2/sha2_large_common.h b/sha2/sha2_large_common.h index 8352546..c141e2a 100644 --- a/sha2/sha2_large_common.h +++ b/sha2/sha2_large_common.h @@ -26,8 +26,8 @@ typedef struct { } sha2_large_common_ctx_t; -void sha2_large_common_nextBlock(sha2_large_common_ctx_t* ctx, const void* block); -void sha2_large_common_lastBlock(sha2_large_common_ctx_t* ctx, const void* block, uint16_t length_b); +void sha2_large_common_nextBlock(sha2_large_common_ctx_t *ctx, const void *block); +void sha2_large_common_lastBlock(sha2_large_common_ctx_t *ctx, const void *block, uint16_t length_b); #endif /* SHA2_LARGE_COMMON_H_ */ diff --git a/sha2/sha2_small_common.c b/sha2/sha2_small_common.c index 1edd8f2..4072c6b 100644 --- a/sha2/sha2_small_common.c +++ b/sha2/sha2_small_common.c @@ -75,7 +75,7 @@ uint32_t k[] PROGMEM = { /** * block must be, 512, Bit = 64, Byte, long !!! */ -void sha2_small_common_nextBlock (sha2_small_common_ctx_t *state, const void* block){ +void sha2_small_common_nextBlock (sha2_small_common_ctx_t *state, const void *block){ uint32_t w[16], wx; uint8_t i; uint32_t a[8],t1,t2; @@ -120,7 +120,7 @@ void sha2_small_common_nextBlock (sha2_small_common_ctx_t *state, const void* bl } -void sha2_small_common_lastBlock(sha2_small_common_ctx_t *state, const void* block, uint16_t length_b){ +void sha2_small_common_lastBlock(sha2_small_common_ctx_t *state, const void *block, uint16_t length_b){ uint8_t lb[512/8]; /* local block */ uint64_t len; while(length_b>=512){ diff --git a/sha2/sha2_small_common.h b/sha2/sha2_small_common.h index a771d5d..9a28a9d 100644 --- a/sha2/sha2_small_common.h +++ b/sha2/sha2_small_common.h @@ -25,7 +25,7 @@ typedef struct { uint32_t length; } sha2_small_common_ctx_t; -void sha2_small_common_nextBlock(sha2_small_common_ctx_t* state, const void* block); -void sha2_small_common_lastBlock(sha2_small_common_ctx_t* state, const void* block, uint16_t length_b); +void sha2_small_common_nextBlock(sha2_small_common_ctx_t *state, const void *block); +void sha2_small_common_lastBlock(sha2_small_common_ctx_t *state, const void *block, uint16_t length_b); #endif /* SHA2_SMALL_COMMON_H_ */ diff --git a/sha2/sha384.c b/sha2/sha384.c index 5781dc3..6a3e9a0 100644 --- a/sha2/sha384.c +++ b/sha2/sha384.c @@ -25,11 +25,11 @@ #include "sha384.h" -void sha384_nextBlock (sha384_ctx_t* ctx, const void* block){ +void sha384_nextBlock (sha384_ctx_t *ctx, const void *block){ sha2_large_common_nextBlock(ctx, block); } -void sha384_lastBlock(sha384_ctx_t* ctx, const void* block, uint16_t length_b){ +void sha384_lastBlock(sha384_ctx_t *ctx, const void *block, uint16_t length_b){ sha2_large_common_lastBlock(ctx, block, length_b); } @@ -40,12 +40,12 @@ uint64_t sha384_init_values[8] PROGMEM = { }; -void sha384_init(sha384_ctx_t* ctx){ +void sha384_init(sha384_ctx_t *ctx){ ctx->length = 0; memcpy_P(ctx->h, sha384_init_values, 8*8); } -void sha384_ctx2hash(void* dest, const sha384_ctx_t* ctx){ +void sha384_ctx2hash(void *dest, const sha384_ctx_t *ctx){ uint8_t i=6, j, *s = (uint8_t*)(ctx->h); do{ j=7; @@ -58,7 +58,7 @@ void sha384_ctx2hash(void* dest, const sha384_ctx_t* ctx){ } -void sha384(void* dest, const void* msg, uint32_t length_b){ +void sha384(void *dest, const void *msg, uint32_t length_b){ sha384_ctx_t ctx; sha384_init(&ctx); while(length_b >= 1024){ diff --git a/sha2/sha384.h b/sha2/sha384.h index 59829b4..5ec39cc 100644 --- a/sha2/sha384.h +++ b/sha2/sha384.h @@ -33,10 +33,10 @@ typedef sha2_large_common_ctx_t sha384_ctx_t; void sha384_init(sha384_ctx_t *ctx); -void sha384_nextBlock (sha384_ctx_t* ctx, const void* block); -void sha384_lastBlock(sha384_ctx_t* ctx, const void* block, uint16_t length_b); -void sha384_ctx2hash(void* dest, const sha384_ctx_t* ctx); -void sha384(void* dest, const void* msg, uint32_t length_b); +void sha384_nextBlock (sha384_ctx_t *ctx, const void *block); +void sha384_lastBlock(sha384_ctx_t *ctx, const void *block, uint16_t length_b); +void sha384_ctx2hash(void *dest, const sha384_ctx_t *ctx); +void sha384(void *dest, const void *msg, uint32_t length_b); #endif /* SHA384_H_ */ diff --git a/sha2/sha512.c b/sha2/sha512.c index c09f109..bc6edf4 100644 --- a/sha2/sha512.c +++ b/sha2/sha512.c @@ -24,11 +24,11 @@ #include "sha512.h" -void sha512_nextBlock (sha512_ctx_t* ctx, const void* block){ +void sha512_nextBlock (sha512_ctx_t *ctx, const void *block){ sha2_large_common_nextBlock(ctx, block); } -void sha512_lastBlock(sha512_ctx_t* ctx, const void* block, uint16_t length_b){ +void sha512_lastBlock(sha512_ctx_t *ctx, const void *block, uint16_t length_b){ sha2_large_common_lastBlock(ctx, block, length_b); } @@ -39,12 +39,12 @@ uint64_t sha512_init_values[8] PROGMEM = { }; -void sha512_init(sha512_ctx_t* ctx){ +void sha512_init(sha512_ctx_t *ctx){ ctx->length = 0; memcpy_P(ctx->h, sha512_init_values, 8*8); } -void sha512_ctx2hash(void* dest, const sha512_ctx_t* ctx){ +void sha512_ctx2hash(void *dest, const sha512_ctx_t *ctx){ uint8_t i=8, j, *s = (uint8_t*)(ctx->h); do{ j=7; @@ -57,7 +57,7 @@ void sha512_ctx2hash(void* dest, const sha512_ctx_t* ctx){ } -void sha512(void* dest, const void* msg, uint32_t length_b){ +void sha512(void *dest, const void *msg, uint32_t length_b){ sha512_ctx_t ctx; sha512_init(&ctx); while(length_b >= 1024){ diff --git a/sha2/sha512.h b/sha2/sha512.h index 7484dad..15a0ae3 100644 --- a/sha2/sha512.h +++ b/sha2/sha512.h @@ -32,10 +32,10 @@ typedef sha2_large_common_ctx_t sha512_ctx_t; void sha512_init(sha512_ctx_t *ctx); -void sha512_nextBlock (sha512_ctx_t* ctx, const void* block); -void sha512_lastBlock(sha512_ctx_t* ctx, const void* block, uint16_t length_b); -void sha512_ctx2hash(void* dest, const sha512_ctx_t* ctx); -void sha512(void* dest, const void* msg, uint32_t length_b); +void sha512_nextBlock (sha512_ctx_t *ctx, const void *block); +void sha512_lastBlock(sha512_ctx_t *ctx, const void *block, uint16_t length_b); +void sha512_ctx2hash(void *dest, const sha512_ctx_t *ctx); +void sha512(void *dest, const void *msg, uint32_t length_b); #endif /* SHA512_H_ */ diff --git a/sha256/sha256.c b/sha256/sha256.c index 757ff77..3ee4b93 100644 --- a/sha256/sha256.c +++ b/sha256/sha256.c @@ -111,7 +111,7 @@ uint32_t k[]={ /** * block must be, 512, Bit = 64, Byte, long !!! */ -void sha256_nextBlock (sha256_ctx_t *state, const void* block){ +void sha256_nextBlock (sha256_ctx_t *state, const void *block){ uint32_t w[64]; /* this is 256, byte, large, */ uint8_t i; uint32_t a[8],t1,t2; @@ -158,7 +158,7 @@ void sha256_nextBlock (sha256_ctx_t *state, const void* block){ * bits are big endian, meaning high bits come first. * if you have a message with bits at the end, the byte must be padded with zeros */ -void sha256_lastBlock(sha256_ctx_t *state, const void* block, uint16_t length){ +void sha256_lastBlock(sha256_ctx_t *state, const void *block, uint16_t length){ uint8_t lb[SHA256_BLOCK_BITS/8]; /* local block */ while(length>=SHA256_BLOCK_BITS){ sha256_nextBlock(state, block); @@ -204,7 +204,7 @@ void sha256_lastBlock(sha256_ctx_t *state, const void* block, uint16_t length){ /* * length in bits! */ -void sha256(sha256_hash_t *dest, const void* msg, uint32_t length){ /* length could be choosen longer but this is for µC */ +void sha256(sha256_hash_t *dest, const void *msg, uint32_t length){ /* length could be choosen longer but this is for µC */ sha256_ctx_t s; sha256_init(&s); while(length >= SHA256_BLOCK_BITS){ diff --git a/sha256/sha256.h b/sha256/sha256.h index 24960a3..78704f5 100644 --- a/sha256/sha256.h +++ b/sha256/sha256.h @@ -67,7 +67,7 @@ typedef struct { * \brief SHA-256 hash value type * * A variable of this type may hold the hash value produced by the - * sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t* state) function. + * sha256_ctx2hash(sha256_hash_t *dest, const sha256_ctx_t *state) function. */ typedef uint8_t sha256_hash_t[SHA256_HASH_BYTES]; @@ -79,7 +79,7 @@ typedef uint8_t sha256_hash_t[SHA256_HASH_BYTES]; */ void sha256_init(sha256_ctx_t *state); -/** \fn void sha256_nextBlock (sha256_ctx_t* state, const void* block) +/** \fn void sha256_nextBlock (sha256_ctx_t *state, const void *block) * \brief update the context with a given block * * This function updates the SHA-256 hash context by processing the given block @@ -87,9 +87,9 @@ void sha256_init(sha256_ctx_t *state); * \param state pointer to the SHA-256 hash context * \param block pointer to the block of fixed length (512 bit = 64 byte) */ -void sha256_nextBlock (sha256_ctx_t* state, const void* block); +void sha256_nextBlock (sha256_ctx_t *state, const void *block); -/** \fn void sha256_lastBlock(sha256_ctx_t* state, const void* block, uint16_t length_b) +/** \fn void sha256_lastBlock(sha256_ctx_t *state, const void *block, uint16_t length_b) * \brief finalize the context with the given block * * This function finalizes the SHA-256 hash context by processing the given block @@ -98,17 +98,17 @@ void sha256_nextBlock (sha256_ctx_t* state, const void* block); * \param block pointer to the block of fixed length (512 bit = 64 byte) * \param length_b the length of the block in bits */ -void sha256_lastBlock(sha256_ctx_t* state, const void* block, uint16_t length_b); +void sha256_lastBlock(sha256_ctx_t *state, const void *block, uint16_t length_b); -/** \fn void sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t* state) +/** \fn void sha256_ctx2hash(sha256_hash_t *dest, const sha256_ctx_t *state) * \brief convert the hash state into the hash value * This function reads the context and writes the hash value to the destination * \param dest pointer to the location where the hash value should be written * \param state pointer to the SHA-256 hash context */ -void sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t* state); +void sha256_ctx2hash(sha256_hash_t *dest, const sha256_ctx_t *state); -/** \fn void sha256(sha256_hash_t* dest, const void* msg, uint32_t length_b) +/** \fn void sha256(sha256_hash_t *dest, const void *msg, uint32_t length_b) * \brief simple SHA-256 hashing function for direct hashing * * This function automaticaly hashes a given message of arbitary length with @@ -117,6 +117,6 @@ void sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t* state); * \param msg pointer to the message thats going to be hashed * \param length_b length of the message in bits */ -void sha256(sha256_hash_t* dest, const void* msg, uint32_t length_b); +void sha256(sha256_hash_t *dest, const void *msg, uint32_t length_b); #endif /*SHA256_H_*/ diff --git a/shabal/shabal-asm.S b/shabal/shabal-asm.S index 31879b3..493cdbf 100644 --- a/shabal/shabal-asm.S +++ b/shabal/shabal-asm.S @@ -28,7 +28,7 @@ /******************************************************************************/ /* -void shabal_p(shabal_ctx_t* ctx, const void* m){ +void shabal_p(shabal_ctx_t *ctx, const void *m){ uint8_t i,j; for(i=0;i<16;++i){ ctx->b[i] = ROTL32(ctx->b[i],17); @@ -459,9 +459,9 @@ mod12table: /******************************************************************************/ /* -void shabal_nextBlock(shabal_ctx_t* ctx, const void* block){ +void shabal_nextBlock(shabal_ctx_t *ctx, const void *block){ uint8_t i; - uint32_t* t; + uint32_t *t; for(i=0;i<16;++i){ ctx->b[i] += ((uint32_t*)block)[i]; } @@ -570,9 +570,9 @@ shabal_nextBlock: /******************************************************************************/ /* -void shabal_lastBlock(shabal_ctx_t* ctx, const void* block, uint16_t length_b){ +void shabal_lastBlock(shabal_ctx_t *ctx, const void *block, uint16_t length_b){ uint8_t i,j; - uint32_t* t; + uint32_t *t; uint8_t buffer[64]; while(length_b>=SHABAL_BLOCKSIZE){ shabal_nextBlock(ctx, block); diff --git a/shabal/shabal.c b/shabal/shabal.c index f18908a..0a32041 100644 --- a/shabal/shabal.c +++ b/shabal/shabal.c @@ -47,7 +47,7 @@ uint32_t shabal_v(uint32_t a){ #define ROTL32(a,n) (((a)<<(n))|((a)>>(32-(n)))) static -void shabal_p(shabal_ctx_t* ctx, const void* m){ +void shabal_p(shabal_ctx_t *ctx, const void *m){ uint8_t i,j; for(i=0;i<16;++i){ ctx->b[i] = ROTL32(ctx->b[i],17); @@ -70,9 +70,9 @@ void shabal_p(shabal_ctx_t* ctx, const void* m){ } } -void shabal_nextBlock(shabal_ctx_t* ctx, const void* block){ +void shabal_nextBlock(shabal_ctx_t *ctx, const void *block){ uint8_t i; - uint32_t* t; + uint32_t *t; for(i=0;i<16;++i){ ctx->b[i] += ((uint32_t*)block)[i]; } @@ -88,9 +88,9 @@ void shabal_nextBlock(shabal_ctx_t* ctx, const void* block){ ctx->b = t; } -void shabal_lastBlock(shabal_ctx_t* ctx, const void* block, uint16_t length_b){ +void shabal_lastBlock(shabal_ctx_t *ctx, const void *block, uint16_t length_b){ uint8_t i,j; - uint32_t* t; + uint32_t *t; uint8_t buffer[64]; while(length_b>=SHABAL_BLOCKSIZE){ shabal_nextBlock(ctx, block); @@ -116,6 +116,6 @@ void shabal_lastBlock(shabal_ctx_t* ctx, const void* block, uint16_t length_b){ } -void shabal_ctx2hash(void* dest, const shabal_ctx_t* ctx, uint16_t outlength_b){ +void shabal_ctx2hash(void *dest, const shabal_ctx_t *ctx, uint16_t outlength_b){ memcpy(dest, &(ctx->c[16-outlength_b/32]), outlength_b/8); } diff --git a/shabal/shabal.h b/shabal/shabal.h index fab23a1..f7477e1 100644 --- a/shabal/shabal.h +++ b/shabal/shabal.h @@ -49,27 +49,27 @@ typedef struct{ }shabal_ctx_t; -void shabal192_init(shabal_ctx_t* ctx); -void shabal224_init(shabal_ctx_t* ctx); -void shabal256_init(shabal_ctx_t* ctx); -void shabal384_init(shabal_ctx_t* ctx); -void shabal512_init(shabal_ctx_t* ctx); +void shabal192_init(shabal_ctx_t *ctx); +void shabal224_init(shabal_ctx_t *ctx); +void shabal256_init(shabal_ctx_t *ctx); +void shabal384_init(shabal_ctx_t *ctx); +void shabal512_init(shabal_ctx_t *ctx); -void shabal_nextBlock(shabal_ctx_t* ctx, const void* block); -void shabal_lastBlock(shabal_ctx_t* ctx, const void* block, uint16_t length_b); +void shabal_nextBlock(shabal_ctx_t *ctx, const void *block); +void shabal_lastBlock(shabal_ctx_t *ctx, const void *block, uint16_t length_b); -void shabal192_ctx2hash(void* dest, const shabal_ctx_t* ctx); -void shabal224_ctx2hash(void* dest, const shabal_ctx_t* ctx); -void shabal256_ctx2hash(void* dest, const shabal_ctx_t* ctx); -void shabal384_ctx2hash(void* dest, const shabal_ctx_t* ctx); -void shabal512_ctx2hash(void* dest, const shabal_ctx_t* ctx); +void shabal192_ctx2hash(void *dest, const shabal_ctx_t *ctx); +void shabal224_ctx2hash(void *dest, const shabal_ctx_t *ctx); +void shabal256_ctx2hash(void *dest, const shabal_ctx_t *ctx); +void shabal384_ctx2hash(void *dest, const shabal_ctx_t *ctx); +void shabal512_ctx2hash(void *dest, const shabal_ctx_t *ctx); -void shabal192(void* dest, void* msg, uint32_t length_b); -void shabal224(void* dest, void* msg, uint32_t length_b); -void shabal256(void* dest, void* msg, uint32_t length_b); -void shabal384(void* dest, void* msg, uint32_t length_b); -void shabal512(void* dest, void* msg, uint32_t length_b); +void shabal192(void *dest, void *msg, uint32_t length_b); +void shabal224(void *dest, void *msg, uint32_t length_b); +void shabal256(void *dest, void *msg, uint32_t length_b); +void shabal384(void *dest, void *msg, uint32_t length_b); +void shabal512(void *dest, void *msg, uint32_t length_b); -void shabal_ctx2hash(void* dest, const shabal_ctx_t* ctx, uint16_t outlength_b); +void shabal_ctx2hash(void *dest, const shabal_ctx_t *ctx, uint16_t outlength_b); #endif /* SHABAL_H_ */ diff --git a/shabal/shabal192-asm.S b/shabal/shabal192-asm.S index 09b41d5..ac864ad 100644 --- a/shabal/shabal192-asm.S +++ b/shabal/shabal192-asm.S @@ -45,7 +45,7 @@ shabal192_iv: /******************************************************************************/ /* -void shabal192_init(shabal_ctx_t* ctx){ +void shabal192_init(shabal_ctx_t *ctx){ uint8_t i; ctx->b = ctx->b_buffer; ctx->c = ctx->c_buffer; @@ -121,7 +121,7 @@ shabal192_ctx2hash: /******************************************************************************/ /* -void shabal192(void* dest, void* msg, uint32_t length_b){ +void shabal192(void *dest, void *msg, uint32_t length_b){ shabal_ctx_t ctx; shabal192_init(&ctx); while(length_b>=SHABAL_BLOCKSIZE){ diff --git a/shabal/shabal192.c b/shabal/shabal192.c index 73a9b40..389f4f3 100644 --- a/shabal/shabal192.c +++ b/shabal/shabal192.c @@ -47,7 +47,7 @@ const uint32_t shabal192_iv[] PROGMEM = { 0x1C096BF4, 0xAC76224B, 0x5215781C, 0xCD5D2669 }; -void shabal192_init(shabal_ctx_t* ctx){ +void shabal192_init(shabal_ctx_t *ctx){ uint8_t i; ctx->b = ctx->b_buffer; ctx->c = ctx->c_buffer; @@ -63,11 +63,11 @@ void shabal192_init(shabal_ctx_t* ctx){ } } -void shabal192_ctx2hash(void* dest, const shabal_ctx_t* ctx){ +void shabal192_ctx2hash(void *dest, const shabal_ctx_t *ctx){ shabal_ctx2hash(dest, ctx, 192); } -void shabal192(void* dest, void* msg, uint32_t length_b){ +void shabal192(void *dest, void *msg, uint32_t length_b){ shabal_ctx_t ctx; shabal192_init(&ctx); while(length_b>=SHABAL_BLOCKSIZE){ diff --git a/shabal/shabal224.c b/shabal/shabal224.c index cba9840..00a13d0 100644 --- a/shabal/shabal224.c +++ b/shabal/shabal224.c @@ -47,7 +47,7 @@ const uint32_t shabal224_iv[] PROGMEM = { 0x16F1AC05, 0x38BBEB56, 0x9B01DC60, 0xB1096D83 }; -void shabal224_init(shabal_ctx_t* ctx){ +void shabal224_init(shabal_ctx_t *ctx){ uint8_t i; ctx->b = ctx->b_buffer; ctx->c = ctx->c_buffer; @@ -63,11 +63,11 @@ void shabal224_init(shabal_ctx_t* ctx){ } } -void shabal224_ctx2hash(void* dest, const shabal_ctx_t* ctx){ +void shabal224_ctx2hash(void *dest, const shabal_ctx_t *ctx){ shabal_ctx2hash(dest, ctx, 224); } -void shabal224(void* dest, void* msg, uint32_t length_b){ +void shabal224(void *dest, void *msg, uint32_t length_b){ shabal_ctx_t ctx; shabal224_init(&ctx); while(length_b>=SHABAL_BLOCKSIZE){ diff --git a/shabal/shabal256.c b/shabal/shabal256.c index 7d0ced6..0ed81de 100644 --- a/shabal/shabal256.c +++ b/shabal/shabal256.c @@ -47,7 +47,7 @@ const uint32_t shabal256_iv[] PROGMEM = { 0xBC968828, 0xE6E00BF7, 0xBA839E55, 0x9B491C60 }; -void shabal256_init(shabal_ctx_t* ctx){ +void shabal256_init(shabal_ctx_t *ctx){ uint8_t i; ctx->b = ctx->b_buffer; ctx->c = ctx->c_buffer; @@ -63,11 +63,11 @@ void shabal256_init(shabal_ctx_t* ctx){ } } -void shabal256_ctx2hash(void* dest, const shabal_ctx_t* ctx){ +void shabal256_ctx2hash(void *dest, const shabal_ctx_t *ctx){ shabal_ctx2hash(dest, ctx, 256); } -void shabal256(void* dest, void* msg, uint32_t length_b){ +void shabal256(void *dest, void *msg, uint32_t length_b){ shabal_ctx_t ctx; shabal256_init(&ctx); while(length_b>=SHABAL_BLOCKSIZE){ diff --git a/shabal/shabal384.c b/shabal/shabal384.c index 464ab97..e11ead6 100644 --- a/shabal/shabal384.c +++ b/shabal/shabal384.c @@ -47,7 +47,7 @@ const uint32_t shabal384_iv[] PROGMEM = { 0x7C35073B, 0x28D95E6D, 0xAA340E0D, 0xCB3DEE70 }; -void shabal384_init(shabal_ctx_t* ctx){ +void shabal384_init(shabal_ctx_t *ctx){ uint8_t i; ctx->b = ctx->b_buffer; ctx->c = ctx->c_buffer; @@ -63,11 +63,11 @@ void shabal384_init(shabal_ctx_t* ctx){ } } -void shabal384_ctx2hash(void* dest, const shabal_ctx_t* ctx){ +void shabal384_ctx2hash(void *dest, const shabal_ctx_t *ctx){ shabal_ctx2hash(dest, ctx, 384); } -void shabal384(void* dest, void* msg, uint32_t length_b){ +void shabal384(void *dest, void *msg, uint32_t length_b){ shabal_ctx_t ctx; shabal384_init(&ctx); while(length_b>=SHABAL_BLOCKSIZE){ diff --git a/shabal/shabal512.c b/shabal/shabal512.c index 2b94b4e..23a7bfa 100644 --- a/shabal/shabal512.c +++ b/shabal/shabal512.c @@ -47,7 +47,7 @@ const uint32_t shabal512_iv[] PROGMEM = { 0x950C3434, 0xAED9A06D, 0x2537DC8D, 0x7CDB5969, }; -void shabal512_init(shabal_ctx_t* ctx){ +void shabal512_init(shabal_ctx_t *ctx){ uint8_t i; ctx->b = ctx->b_buffer; ctx->c = ctx->c_buffer; @@ -63,11 +63,11 @@ void shabal512_init(shabal_ctx_t* ctx){ } } -void shabal512_ctx2hash(void* dest, const shabal_ctx_t* ctx){ +void shabal512_ctx2hash(void *dest, const shabal_ctx_t *ctx){ shabal_ctx2hash(dest, ctx, 512); } -void shabal512(void* dest, void* msg, uint32_t length_b){ +void shabal512(void *dest, void *msg, uint32_t length_b){ shabal_ctx_t ctx; shabal512_init(&ctx); while(length_b>=SHABAL_BLOCKSIZE){ diff --git a/shacal1/shacal1_enc.c b/shacal1/shacal1_enc.c index 87e5d45..052dc27 100644 --- a/shacal1/shacal1_enc.c +++ b/shacal1/shacal1_enc.c @@ -31,7 +31,7 @@ #include "sha1.h" #include "shacal1_enc.h" -void shacal1_enc(void* buffer, void* key, uint16_t keysize_b){ +void shacal1_enc(void *buffer, void *key, uint16_t keysize_b){ sha1_ctx_t ctx, t_ctx; uint8_t i; memcpy(t_ctx.h, buffer, SHA1_HASH_BITS/8); diff --git a/shacal1/shacal1_enc.h b/shacal1/shacal1_enc.h index e1bdd98..7ff831b 100644 --- a/shacal1/shacal1_enc.h +++ b/shacal1/shacal1_enc.h @@ -26,6 +26,6 @@ #define SHACAL1_KEYSIZE 512 #define SHACAL1_KEYSIZE_B ((SHACAL1_KEYSIZE+7)/8) -void shacal1_enc(void* buffer, void* key, uint16_t keysize_b); +void shacal1_enc(void *buffer, void *key, uint16_t keysize_b); #endif /*SHACAL1_ENC_H_*/ diff --git a/shacal2/shacal2_enc.c b/shacal2/shacal2_enc.c index b5380e5..6d5e8aa 100644 --- a/shacal2/shacal2_enc.c +++ b/shacal2/shacal2_enc.c @@ -32,7 +32,7 @@ #include "shacal2_enc.h" -void shacal2_enc(void* buffer, void* key, uint16_t keysize_b){ +void shacal2_enc(void *buffer, void *key, uint16_t keysize_b){ uint8_t i; sha256_ctx_t ctx, t_ctx; memcpy(ctx.h, buffer, SHACAL2_BLOCKSIZE_B); diff --git a/shacal2/shacal2_enc.h b/shacal2/shacal2_enc.h index ffa277c..6ae89b7 100644 --- a/shacal2/shacal2_enc.h +++ b/shacal2/shacal2_enc.h @@ -27,7 +27,7 @@ #define SHACAL2_KEYSIZE SHA256_BLOCK_BITS #define SHACAL2_KEYSIZE_B ((SHACAL2_KEYSIZE+7)/8) -void shacal2_enc(void* buffer, void* key, uint16_t keysize_b); +void shacal2_enc(void *buffer, void *key, uint16_t keysize_b); #endif /*SHACAL2_ENC_H_*/ diff --git a/skein/skein.h b/skein/skein.h index 0fd5b51..fe12eee 100644 --- a/skein/skein.h +++ b/skein/skein.h @@ -45,32 +45,32 @@ typedef struct{ ubi256_ctx_t ubictx; }skein256_ctx_t; -void skein256_init(skein256_ctx_t* ctx, uint16_t outsize_b); -void skein256_nextBlock(skein256_ctx_t* ctx, const void* block); -void skein256_lastBlock(skein256_ctx_t* ctx, const void* block, uint16_t length_b); -void skein256_ctx2hash(void* dest, skein256_ctx_t* ctx); -void skein256(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b); +void skein256_init(skein256_ctx_t *ctx, uint16_t outsize_b); +void skein256_nextBlock(skein256_ctx_t *ctx, const void *block); +void skein256_lastBlock(skein256_ctx_t *ctx, const void *block, uint16_t length_b); +void skein256_ctx2hash(void *dest, skein256_ctx_t *ctx); +void skein256(void *dest, uint16_t outlength_b, const void *msg, uint32_t length_b); typedef struct{ uint16_t outsize_b; ubi512_ctx_t ubictx; }skein512_ctx_t; -void skein512_init(skein512_ctx_t* ctx, uint16_t outsize_b); -void skein512_nextBlock(skein512_ctx_t* ctx, const void* block); -void skein512_lastBlock(skein512_ctx_t* ctx, const void* block, uint16_t length_b); -void skein512_ctx2hash(void* dest, skein512_ctx_t* ctx); -void skein512(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b); +void skein512_init(skein512_ctx_t *ctx, uint16_t outsize_b); +void skein512_nextBlock(skein512_ctx_t *ctx, const void *block); +void skein512_lastBlock(skein512_ctx_t *ctx, const void *block, uint16_t length_b); +void skein512_ctx2hash(void *dest, skein512_ctx_t *ctx); +void skein512(void *dest, uint16_t outlength_b, const void *msg, uint32_t length_b); typedef struct{ uint16_t outsize_b; ubi1024_ctx_t ubictx; }skein1024_ctx_t; -void skein1024_init(skein1024_ctx_t* ctx, uint16_t outsize_b); -void skein1024_nextBlock(skein1024_ctx_t* ctx, const void* block); -void skein1024_lastBlock(skein1024_ctx_t* ctx, const void* block, uint16_t length_b); -void skein1024_ctx2hash(void* dest, skein1024_ctx_t* ctx); -void skein1024(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b); +void skein1024_init(skein1024_ctx_t *ctx, uint16_t outsize_b); +void skein1024_nextBlock(skein1024_ctx_t *ctx, const void *block); +void skein1024_lastBlock(skein1024_ctx_t *ctx, const void *block, uint16_t length_b); +void skein1024_ctx2hash(void *dest, skein1024_ctx_t *ctx); +void skein1024(void *dest, uint16_t outlength_b, const void *msg, uint32_t length_b); #endif /* SKEIN_H_ */ diff --git a/skein/skein1024.c b/skein/skein1024.c index ac3162e..3434f9a 100644 --- a/skein/skein1024.c +++ b/skein/skein1024.c @@ -30,7 +30,7 @@ #include "skein.h" -void skein1024_init(skein1024_ctx_t* ctx, uint16_t outsize_b){ +void skein1024_init(skein1024_ctx_t *ctx, uint16_t outsize_b){ skein_config_t conf; uint8_t null[UBI1024_BLOCKSIZE_B]; memset(null, 0, UBI1024_BLOCKSIZE_B); @@ -47,15 +47,15 @@ void skein1024_init(skein1024_ctx_t* ctx, uint16_t outsize_b){ ubi1024_init(&(ctx->ubictx), ctx->ubictx.g, UBI_TYPE_MSG); } -void skein1024_nextBlock(skein1024_ctx_t* ctx, const void* block){ +void skein1024_nextBlock(skein1024_ctx_t *ctx, const void *block){ ubi1024_nextBlock(&(ctx->ubictx), block); } -void skein1024_lastBlock(skein1024_ctx_t* ctx, const void* block, uint16_t length_b){ +void skein1024_lastBlock(skein1024_ctx_t *ctx, const void *block, uint16_t length_b){ ubi1024_lastBlock(&(ctx->ubictx), block, length_b); } -void skein1024_ctx2hash(void* dest, skein1024_ctx_t* ctx){ +void skein1024_ctx2hash(void *dest, skein1024_ctx_t *ctx){ ubi1024_ctx_t uctx; uint16_t outsize_b; @@ -80,7 +80,7 @@ void skein1024_ctx2hash(void* dest, skein1024_ctx_t* ctx){ } } -void skein1024(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b){ +void skein1024(void *dest, uint16_t outlength_b, const void *msg, uint32_t length_b){ skein1024_ctx_t ctx; skein1024_init(&ctx, outlength_b); while(length_b>SKEIN1024_BLOCKSIZE){ diff --git a/skein/skein1024_asm.S b/skein/skein1024_asm.S index 8983f6a..a96a930 100644 --- a/skein/skein1024_asm.S +++ b/skein/skein1024_asm.S @@ -27,7 +27,7 @@ /******************************************************************************/ /* -void skein1024_init(skein1024_ctx_t* ctx, uint16_t outsize_b){ +void skein1024_init(skein1024_ctx_t *ctx, uint16_t outsize_b){ skein_config_t conf; uint8_t null[UBI1024_BLOCKSIZE_B]; memset(null, 0, UBI1024_BLOCKSIZE_B); @@ -119,7 +119,7 @@ skein1024_lastBlock: /******************************************************************************/ /* -void skein1024_ctx2hash(void* dest, skein1024_ctx_t* ctx){ +void skein1024_ctx2hash(void *dest, skein1024_ctx_t *ctx){ ubi1024_ctx_t uctx; uint16_t outsize_b; @@ -282,7 +282,7 @@ skein1024_ctx2hash: /******************************************************************************/ /* -void skein1024(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b){ +void skein1024(void *dest, uint16_t outlength_b, const void *msg, uint32_t length_b){ skein1024_ctx_t ctx; skein1024_init(&ctx, outlength_b); while(length_b>SKEIN1024_BLOCKSIZE){ diff --git a/skein/skein256.c b/skein/skein256.c index dfe6ef3..acc0649 100644 --- a/skein/skein256.c +++ b/skein/skein256.c @@ -31,7 +31,7 @@ #include "cli.h" -void skein256_init(skein256_ctx_t* ctx, uint16_t outsize_b){ +void skein256_init(skein256_ctx_t *ctx, uint16_t outsize_b){ skein_config_t conf; uint8_t null[UBI256_BLOCKSIZE_B]; memset(null, 0, UBI256_BLOCKSIZE_B); @@ -48,15 +48,15 @@ void skein256_init(skein256_ctx_t* ctx, uint16_t outsize_b){ ubi256_init(&(ctx->ubictx), ctx->ubictx.g, UBI_TYPE_MSG); } -void skein256_nextBlock(skein256_ctx_t* ctx, const void* block){ +void skein256_nextBlock(skein256_ctx_t *ctx, const void *block){ ubi256_nextBlock(&(ctx->ubictx), block); } -void skein256_lastBlock(skein256_ctx_t* ctx, const void* block, uint16_t length_b){ +void skein256_lastBlock(skein256_ctx_t *ctx, const void *block, uint16_t length_b){ ubi256_lastBlock(&(ctx->ubictx), block, length_b); } -void skein256_ctx2hash(void* dest, skein256_ctx_t* ctx){ +void skein256_ctx2hash(void *dest, skein256_ctx_t *ctx){ ubi256_ctx_t uctx; uint16_t outsize_b; @@ -81,7 +81,7 @@ void skein256_ctx2hash(void* dest, skein256_ctx_t* ctx){ } } -void skein256(void* dest, uint16_t outlength_b,const void* msg, uint32_t length_b){ +void skein256(void *dest, uint16_t outlength_b,const void *msg, uint32_t length_b){ skein256_ctx_t ctx; skein256_init(&ctx, outlength_b); while(length_b>SKEIN256_BLOCKSIZE){ diff --git a/skein/skein256_asm.S b/skein/skein256_asm.S index 0c6c2d0..b82ced8 100644 --- a/skein/skein256_asm.S +++ b/skein/skein256_asm.S @@ -27,7 +27,7 @@ /******************************************************************************/ /* -void skein256_init(skein256_ctx_t* ctx, uint16_t outsize_b){ +void skein256_init(skein256_ctx_t *ctx, uint16_t outsize_b){ skein_config_t conf; uint8_t null[UBI256_BLOCKSIZE_B]; memset(null, 0, UBI256_BLOCKSIZE_B); @@ -118,7 +118,7 @@ skein256_lastBlock: /******************************************************************************/ /* -void skein256_ctx2hash(void* dest, skein256_ctx_t* ctx){ +void skein256_ctx2hash(void *dest, skein256_ctx_t *ctx){ ubi256_ctx_t uctx; uint16_t outsize_b; @@ -267,7 +267,7 @@ skein256_ctx2hash: /******************************************************************************/ /* -void skein256(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b){ +void skein256(void *dest, uint16_t outlength_b, const void *msg, uint32_t length_b){ skein256_ctx_t ctx; skein256_init(&ctx, outlength_b); while(length_b>SKEIN256_BLOCKSIZE){ diff --git a/skein/skein512.c b/skein/skein512.c index 2558f34..38d4b9b 100644 --- a/skein/skein512.c +++ b/skein/skein512.c @@ -30,7 +30,7 @@ #include "skein.h" -void skein512_init(skein512_ctx_t* ctx, uint16_t outsize_b){ +void skein512_init(skein512_ctx_t *ctx, uint16_t outsize_b){ skein_config_t conf; uint8_t null[UBI512_BLOCKSIZE_B]; memset(null, 0, UBI512_BLOCKSIZE_B); @@ -47,15 +47,15 @@ void skein512_init(skein512_ctx_t* ctx, uint16_t outsize_b){ ubi512_init(&(ctx->ubictx), ctx->ubictx.g, UBI_TYPE_MSG); } -void skein512_nextBlock(skein512_ctx_t* ctx, const void* block){ +void skein512_nextBlock(skein512_ctx_t *ctx, const void *block){ ubi512_nextBlock(&(ctx->ubictx), block); } -void skein512_lastBlock(skein512_ctx_t* ctx, const void* block, uint16_t length_b){ +void skein512_lastBlock(skein512_ctx_t *ctx, const void *block, uint16_t length_b){ ubi512_lastBlock(&(ctx->ubictx), block, length_b); } -void skein512_ctx2hash(void* dest, skein512_ctx_t* ctx){ +void skein512_ctx2hash(void *dest, skein512_ctx_t *ctx){ ubi512_ctx_t uctx; uint16_t outsize_b; @@ -80,7 +80,7 @@ void skein512_ctx2hash(void* dest, skein512_ctx_t* ctx){ } } -void skein512(void* dest, uint16_t outlength_b,const void* msg, uint32_t length_b){ +void skein512(void *dest, uint16_t outlength_b,const void *msg, uint32_t length_b){ skein512_ctx_t ctx; skein512_init(&ctx, outlength_b); while(length_b>SKEIN512_BLOCKSIZE){ diff --git a/skein/skein512_asm.S b/skein/skein512_asm.S index 8f6229d..46c4907 100644 --- a/skein/skein512_asm.S +++ b/skein/skein512_asm.S @@ -27,7 +27,7 @@ /******************************************************************************/ /* -void skein512_init(skein512_ctx_t* ctx, uint16_t outsize_b){ +void skein512_init(skein512_ctx_t *ctx, uint16_t outsize_b){ skein_config_t conf; uint8_t null[UBI512_BLOCKSIZE_B]; memset(null, 0, UBI512_BLOCKSIZE_B); @@ -119,7 +119,7 @@ skein512_lastBlock: /******************************************************************************/ /* -void skein512_ctx2hash(void* dest, skein512_ctx_t* ctx){ +void skein512_ctx2hash(void *dest, skein512_ctx_t *ctx){ ubi512_ctx_t uctx; uint16_t outsize_b; @@ -275,7 +275,7 @@ skein512_ctx2hash: /******************************************************************************/ /* -void skein512(void* dest, uint16_t outlength_b,const void* msg, uint32_t length_b){ +void skein512(void *dest, uint16_t outlength_b,const void *msg, uint32_t length_b){ skein512_ctx_t ctx; skein512_init(&ctx, outlength_b); while(length_b>SKEIN512_BLOCKSIZE){ diff --git a/skein/threefish.h b/skein/threefish.h index 3b4cc99..f1cf0f1 100644 --- a/skein/threefish.h +++ b/skein/threefish.h @@ -72,19 +72,19 @@ typedef struct{ } threefish1024_ctx_t; -void threefish_mix(void* data, uint8_t rot); -void threefish_invmix(void* data, uint8_t rot); +void threefish_mix(void *data, uint8_t rot); +void threefish_invmix(void *data, uint8_t rot); -void threefish256_init(const void* key, const void* tweak, threefish256_ctx_t* ctx); -void threefish512_init(const void* key, const void* tweak, threefish512_ctx_t* ctx); -void threefish1024_init(const void* key, const void* tweak, threefish1024_ctx_t* ctx); +void threefish256_init(const void *key, const void *tweak, threefish256_ctx_t *ctx); +void threefish512_init(const void *key, const void *tweak, threefish512_ctx_t *ctx); +void threefish1024_init(const void *key, const void *tweak, threefish1024_ctx_t *ctx); -void threefish256_enc(void* data, const threefish256_ctx_t* ctx); -void threefish512_enc(void* data, const threefish512_ctx_t* ctx); -void threefish1024_enc(void* data, const threefish1024_ctx_t* ctx); +void threefish256_enc(void *data, const threefish256_ctx_t *ctx); +void threefish512_enc(void *data, const threefish512_ctx_t *ctx); +void threefish1024_enc(void *data, const threefish1024_ctx_t *ctx); -void threefish256_dec(void* data, const threefish256_ctx_t* ctx); -void threefish512_dec(void* data, const threefish512_ctx_t* ctx); -void threefish1024_dec(void* data, const threefish1024_ctx_t* ctx); +void threefish256_dec(void *data, const threefish256_ctx_t *ctx); +void threefish512_dec(void *data, const threefish512_ctx_t *ctx); +void threefish1024_dec(void *data, const threefish1024_ctx_t *ctx); #endif /* THREEFISH_H_ */ diff --git a/skein/threefish1024_dec.c b/skein/threefish1024_dec.c index 3378e77..d01ff93 100644 --- a/skein/threefish1024_dec.c +++ b/skein/threefish1024_dec.c @@ -33,7 +33,7 @@ #define X(a) (((uint64_t*)data)[(a)]) static -void permute_inv16(void* data){ +void permute_inv16(void *data){ uint64_t t; t = X(15); X(15) = X(7); @@ -56,7 +56,7 @@ void permute_inv16(void* data){ } static -void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ +void add_key_16(void *data, const threefish1024_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<13; ++i){ X(i) -= ctx->k[(s+i)%17]; @@ -66,7 +66,7 @@ void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ X(15) -= ctx->k[(s+15)%17] + s; } -void threefish1024_dec(void* data, const threefish1024_ctx_t* ctx){ +void threefish1024_dec(void *data, const threefish1024_ctx_t *ctx){ uint8_t i=0,s=20; /* old round constants uint8_t r0[8] = {47, 58, 17, 28, 34, 33, 25, 55}; diff --git a/skein/threefish1024_dec_asm.S b/skein/threefish1024_dec_asm.S index 077281a..a733094 100644 --- a/skein/threefish1024_dec_asm.S +++ b/skein/threefish1024_dec_asm.S @@ -27,7 +27,7 @@ /******************************************************************************/ /* -void permute_inv16(void* data){ +void permute_inv16(void *data){ uint64_t t; t = X(15); X(15) = X(7); @@ -48,7 +48,7 @@ void permute_inv16(void* data){ X(10) = X(8); X(8) = t; } -void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ +void add_key_16(void *data, const threefish1024_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<13; ++i){ X(i) -= ctx->k[(s+i)%17]; @@ -57,7 +57,7 @@ void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ X(14) -= ctx->k[(s+14)%17] + ctx->t[(s+1)%3]; X(15) -= ctx->k[(s+15)%17] + s; } -void threefish1024_dec(void* data, const threefish1024_ctx_t* ctx){ +void threefish1024_dec(void *data, const threefish1024_ctx_t *ctx){ uint8_t i=0,s=20; uint8_t r0[8] = {0x69, 0x72, 0x21, 0x34, 0x42, 0x41, 0x31, 0x79}; uint8_t r1[8] = {0x61, 0x19, 0x1a, 0x19, 0x53, 0x10, 0x31, 0x53}; diff --git a/skein/threefish1024_dec_cstub.c b/skein/threefish1024_dec_cstub.c index 09b031f..89c7535 100644 --- a/skein/threefish1024_dec_cstub.c +++ b/skein/threefish1024_dec_cstub.c @@ -33,7 +33,7 @@ #define X(a) (((uint64_t*)data)[(a)]) static -void permute_inv16(void* data){ +void permute_inv16(void *data){ uint64_t t; t = X(15); X(15) = X(7); @@ -56,7 +56,7 @@ void permute_inv16(void* data){ } static -void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ +void add_key_16(void *data, const threefish1024_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<13; ++i){ X(i) -= ctx->k[(s+i)%17]; @@ -66,7 +66,7 @@ void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ X(15) -= ctx->k[(s+15)%17] + s; } -void threefish1024_dec(void* data, const threefish1024_ctx_t* ctx){ +void threefish1024_dec(void *data, const threefish1024_ctx_t *ctx){ uint8_t i=0,s=20; uint8_t r0[8] = {0x69, 0x72, 0x21, 0x34, 0x42, 0x41, 0x31, 0x79}; uint8_t r1[8] = {0x61, 0x19, 0x1a, 0x19, 0x53, 0x10, 0x31, 0x53}; diff --git a/skein/threefish1024_enc.c b/skein/threefish1024_enc.c index 5e6310b..662e79d 100644 --- a/skein/threefish1024_enc.c +++ b/skein/threefish1024_enc.c @@ -33,7 +33,7 @@ #define X(a) (((uint64_t*)data)[(a)]) static -void permute_16(void* data){ +void permute_16(void *data){ uint64_t t; t = X(1); X(1) = X(9); @@ -61,7 +61,7 @@ void permute_16(void* data){ #define K(s) (((uint64_t*)key)[(s)]) #define T(s) (((uint64_t*)tweak)[(s)]) -void threefish1024_init(const void* key, const void* tweak, threefish1024_ctx_t* ctx){ +void threefish1024_init(const void *key, const void *tweak, threefish1024_ctx_t *ctx){ memcpy(ctx->k, key, 16*8); if(tweak){ memcpy(ctx->t, tweak, 2*8); @@ -77,7 +77,7 @@ void threefish1024_init(const void* key, const void* tweak, threefish1024_ctx_t* } static -void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ +void add_key_16(void *data, const threefish1024_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<13; ++i){ X(i) += ctx->k[(s+i)%17]; @@ -87,7 +87,7 @@ void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ X(15) += ctx->k[(s+15)%17] + s; } -void threefish1024_enc(void* data, const threefish1024_ctx_t* ctx){ +void threefish1024_enc(void *data, const threefish1024_ctx_t *ctx){ uint8_t i=0,s=0; /* old constans, changed at round 2 of the SHA-3 contest uint8_t r0[8] = {55, 25, 33, 34, 28, 17, 58, 47}; diff --git a/skein/threefish1024_enc_asm.S b/skein/threefish1024_enc_asm.S index 17c1983..38f85ed 100644 --- a/skein/threefish1024_enc_asm.S +++ b/skein/threefish1024_enc_asm.S @@ -39,7 +39,7 @@ A7 = 21 #define K(s) (((uint64_t*)key)[(s)]) #define T(s) (((uint64_t*)tweak)[(s)]) -void threefish1024_init(const void* key, const void* tweak, threefish512_ctx_t* ctx){ +void threefish1024_init(const void *key, const void *tweak, threefish512_ctx_t *ctx){ memcpy(ctx->k, key, 16*8); memcpy(ctx->t, tweak, 2*8); uint8_t i; @@ -178,7 +178,7 @@ threefish1024_init: /******************************************************************************/ /* #define X(a) (((uint64_t*)data)[(a)]) -void permute_16(void* data){ +void permute_16(void *data){ uint64_t t; t = X(1); X(1) = X(9); @@ -199,7 +199,7 @@ void permute_16(void* data){ X(12) = X(14); X(14) = t; } -void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ +void add_key_16(void *data, const threefish1024_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<13; ++i){ X(i) += ctx->k[(s+i)%17]; @@ -208,7 +208,7 @@ void add_key_16(void* data, const threefish1024_ctx_t* ctx, uint8_t s){ X(14) += ctx->k[(s+14)%17] + ctx->t[(s+1)%3]; X(15) += ctx->k[(s+15)%17] + s; } -void threefish1024_enc(void* data, const threefish1024_ctx_t* ctx){ +void threefish1024_enc(void *data, const threefish1024_ctx_t *ctx){ uint8_t i=0,s=0; uint8_t r0[8] = {55, 25, 33, 34, 28, 17, 58, 47}; uint8_t r1[8] = {43, 25, 8, 43, 7, 6, 7, 49}; diff --git a/skein/threefish256_dec.c b/skein/threefish256_dec.c index 845cc19..658aa5b 100644 --- a/skein/threefish256_dec.c +++ b/skein/threefish256_dec.c @@ -32,7 +32,7 @@ #define X(a) (((uint64_t*)data)[(a)]) static -void permute_4(void* data){ +void permute_4(void *data){ uint64_t t; t = X(1); X(1) = X(3); @@ -43,14 +43,14 @@ void permute_4(void* data){ #define T(s) (((uint64_t*)tweak)[(s)]) static -void add_key_4(void* data, const threefish256_ctx_t* ctx, uint8_t s){ +void add_key_4(void *data, const threefish256_ctx_t *ctx, uint8_t s){ X(0) -= ctx->k[(s+0)%5]; X(1) -= ctx->k[(s+1)%5] + ctx->t[s%3]; X(2) -= ctx->k[(s+2)%5] + ctx->t[(s+1)%3]; X(3) -= ctx->k[(s+3)%5] + s; } -void threefish256_dec(void* data, const threefish256_ctx_t* ctx){ +void threefish256_dec(void *data, const threefish256_ctx_t *ctx){ uint8_t i=0,s=18; /* old constans, changed at round 2 of the SHA-3 contest uint8_t r0[8] = {59, 11, 53, 26, 58, 13, 36, 5}; diff --git a/skein/threefish256_dec_asm.S b/skein/threefish256_dec_asm.S index 4ae4f6e..2cb5b2f 100644 --- a/skein/threefish256_dec_asm.S +++ b/skein/threefish256_dec_asm.S @@ -27,19 +27,19 @@ /******************************************************************************/ /* -void permute_4(void* data){ +void permute_4(void *data){ uint64_t t; t = X(1); X(1) = X(3); X(3) = t; } -void add_key_4(void* data, const threefish256_ctx_t* ctx, uint8_t s){ +void add_key_4(void *data, const threefish256_ctx_t *ctx, uint8_t s){ X(0) -= ctx->k[(s+0)%5]; X(1) -= ctx->k[(s+1)%5] + ctx->t[s%3]; X(2) -= ctx->k[(s+2)%5] + ctx->t[(s+1)%3]; X(3) -= ctx->k[(s+3)%5] + s; } -void threefish256_dec(void* data, const threefish256_ctx_t* ctx){ +void threefish256_dec(void *data, const threefish256_ctx_t *ctx){ uint8_t i=0,s=18; uint8_t r0[8] = {0x73, 0x13, 0x7b, 0x32, 0x72, 0x2b, 0x44, 0x1b}; uint8_t r1[8] = {0x62, 0x52, 0x43, 0x24, 0x54, 0x6a, 0x34, 0x70}; diff --git a/skein/threefish256_dec_cstub.c b/skein/threefish256_dec_cstub.c index 1d89756..6453228 100644 --- a/skein/threefish256_dec_cstub.c +++ b/skein/threefish256_dec_cstub.c @@ -32,7 +32,7 @@ #define X(a) (((uint64_t*)data)[(a)]) static -void permute_4(void* data){ +void permute_4(void *data){ uint64_t t; t = X(1); X(1) = X(3); @@ -40,14 +40,14 @@ void permute_4(void* data){ } static -void add_key_4(void* data, const threefish256_ctx_t* ctx, uint8_t s){ +void add_key_4(void *data, const threefish256_ctx_t *ctx, uint8_t s){ X(0) -= ctx->k[(s+0)%5]; X(1) -= ctx->k[(s+1)%5] + ctx->t[s%3]; X(2) -= ctx->k[(s+2)%5] + ctx->t[(s+1)%3]; X(3) -= ctx->k[(s+3)%5] + s; } -void threefish256_dec(void* data, const threefish256_ctx_t* ctx){ +void threefish256_dec(void *data, const threefish256_ctx_t *ctx){ uint8_t i=0,s=18; uint8_t r0[8] = {0x73, 0x13, 0x7b, 0x32, 0x72, 0x2b, 0x44, 0x1b}; uint8_t r1[8] = {0x62, 0x52, 0x43, 0x24, 0x54, 0x6a, 0x34, 0x70}; diff --git a/skein/threefish256_enc.c b/skein/threefish256_enc.c index ebfa039..4ed6153 100644 --- a/skein/threefish256_enc.c +++ b/skein/threefish256_enc.c @@ -32,7 +32,7 @@ #define X(a) (((uint64_t*)data)[(a)]) static -void permute_4(void* data){ +void permute_4(void *data){ uint64_t t; t = X(1); X(1) = X(3); @@ -45,7 +45,7 @@ void permute_4(void* data){ #define K(s) (((uint64_t*)key)[(s)]) #define T(s) (((uint64_t*)tweak)[(s)]) -void threefish256_init(const void* key, const void* tweak, threefish256_ctx_t* ctx){ +void threefish256_init(const void *key, const void *tweak, threefish256_ctx_t *ctx){ memcpy(ctx->k, key, 4*8); if(tweak){ memcpy(ctx->t, tweak, 2*8); @@ -61,14 +61,14 @@ void threefish256_init(const void* key, const void* tweak, threefish256_ctx_t* c } static -void add_key_4(void* data, const threefish256_ctx_t* ctx, uint8_t s){ +void add_key_4(void *data, const threefish256_ctx_t *ctx, uint8_t s){ X(0) += ctx->k[(s+0)%5]; X(1) += ctx->k[(s+1)%5] + ctx->t[s%3]; X(2) += ctx->k[(s+2)%5] + ctx->t[(s+1)%3]; X(3) += ctx->k[(s+3)%5] + s; } -void threefish256_enc(void* data, const threefish256_ctx_t* ctx){ +void threefish256_enc(void *data, const threefish256_ctx_t *ctx){ uint8_t i=0,s=0; /* old constans, changed at round 2 of the SHA-3 contest uint8_t r0[8] = { 5, 36, 13, 58, 26, 53, 11, 59}; diff --git a/skein/threefish256_enc_asm.S b/skein/threefish256_enc_asm.S index 184d32a..b4db42f 100644 --- a/skein/threefish256_enc_asm.S +++ b/skein/threefish256_enc_asm.S @@ -40,7 +40,7 @@ A7 = 21 #define K(s) (((uint64_t*)key)[(s)]) #define T(s) (((uint64_t*)tweak)[(s)]) -void threefish256_init(void* key, void* tweak, threefish256_ctx_t* ctx){ +void threefish256_init(void *key, void *tweak, threefish256_ctx_t *ctx){ memcpy(ctx->k, key, 4*8); memcpy(ctx->t, tweak, 2*8); uint8_t i; @@ -180,19 +180,19 @@ threefish256_init: /******************************************************************************/ /* #define X(a) (((uint64_t*)data)[(a)]) -void permute_4(void* data){ +void permute_4(void *data){ uint64_t t; t = X(1); X(1) = X(3); X(3) = t; } -void add_key_4(void* data, threefish256_ctx_t* ctx, uint8_t s){ / * s: 0..19 * / +void add_key_4(void *data, threefish256_ctx_t *ctx, uint8_t s){ / * s: 0..19 * / X(0) += ctx->k[(s+0)%5]; X(1) += ctx->k[(s+1)%5] + ctx->t[s%3]; X(2) += ctx->k[(s+2)%5] + ctx->t[(s+1)%3]; X(3) += ctx->k[(s+3)%5] + s; } -void threefish256_enc(void* data, threefish256_ctx_t* ctx){ +void threefish256_enc(void *data, threefish256_ctx_t *ctx){ uint8_t i=0,s=0; uint8_t r0[8] = { 5, 36, 13, 58, 26, 53, 11, 59}; uint8_t r1[8] = {56, 28, 46, 44, 20, 35, 42, 50}; diff --git a/skein/threefish256_enc_small.S b/skein/threefish256_enc_small.S index a9a713c..c98f37f 100644 --- a/skein/threefish256_enc_small.S +++ b/skein/threefish256_enc_small.S @@ -40,7 +40,7 @@ A7 = 21 #define K(s) (((uint64_t*)key)[(s)]) #define T(s) (((uint64_t*)tweak)[(s)]) -void threefish256_init(void* key, void* tweak, threefish256_ctx_t* ctx){ +void threefish256_init(void *key, void *tweak, threefish256_ctx_t *ctx){ memcpy(ctx->k, key, 4*8); memcpy(ctx->t, tweak, 2*8); uint8_t i; @@ -179,19 +179,19 @@ threefish256_init: /******************************************************************************/ /* #define X(a) (((uint64_t*)data)[(a)]) -void permute_4(void* data){ +void permute_4(void *data){ uint64_t t; t = X(1); X(1) = X(3); X(3) = t; } -void add_key_4(void* data, threefish256_ctx_t* ctx, uint8_t s){ / * s: 0..19 * / +void add_key_4(void *data, threefish256_ctx_t *ctx, uint8_t s){ / * s: 0..19 * / X(0) += ctx->k[(s+0)%5]; X(1) += ctx->k[(s+1)%5] + ctx->t[s%3]; X(2) += ctx->k[(s+2)%5] + ctx->t[(s+1)%3]; X(3) += ctx->k[(s+3)%5] + s; } -void threefish256_enc(void* data, threefish256_ctx_t* ctx){ +void threefish256_enc(void *data, threefish256_ctx_t *ctx){ uint8_t i=0,s=0; uint8_t r0[8] = { 5, 36, 13, 58, 26, 53, 11, 59}; uint8_t r1[8] = {56, 28, 46, 44, 20, 35, 42, 50}; diff --git a/skein/threefish512_dec.c b/skein/threefish512_dec.c index 31e11af..c5d9910 100644 --- a/skein/threefish512_dec.c +++ b/skein/threefish512_dec.c @@ -35,7 +35,7 @@ static -void permute_inv8(void* data){ +void permute_inv8(void *data){ uint64_t t; t = X(6); X(6) = X(4); @@ -48,7 +48,7 @@ void permute_inv8(void* data){ } static -void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ +void add_key_8(void *data, const threefish512_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<5; ++i){ X(i) -= ctx->k[(s+i)%9]; @@ -58,7 +58,7 @@ void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ X(7) -= ctx->k[(s+7)%9] + s; } -void threefish512_dec(void* data, const threefish512_ctx_t* ctx){ +void threefish512_dec(void *data, const threefish512_ctx_t *ctx){ uint8_t i=0,s=18; /* old round constants uint8_t r0[8] = {33, 29, 39, 33, 26, 34, 48, 38}; diff --git a/skein/threefish512_dec_asm.S b/skein/threefish512_dec_asm.S index 3f8f8f6..795e05a 100644 --- a/skein/threefish512_dec_asm.S +++ b/skein/threefish512_dec_asm.S @@ -31,7 +31,7 @@ static -void permute_inv8(void* data){ +void permute_inv8(void *data){ uint64_t t; t = X(6); X(6) = X(4); @@ -44,7 +44,7 @@ void permute_inv8(void* data){ } static -void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ +void add_key_8(void *data, const threefish512_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<5; ++i){ X(i) -= ctx->k[(s+i)%9]; @@ -54,7 +54,7 @@ void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ X(7) -= ctx->k[(s+7)%9] + s; } -void threefish512_dec(void* data, const threefish512_ctx_t* ctx){ +void threefish512_dec(void *data, const threefish512_ctx_t *ctx){ uint8_t i=0,s=18; uint8_t r0[8] = {0x41, 0x4b, 0x59, 0x41, 0x32, 0x42, 0x60, 0x5a}; uint8_t r1[8] = {0x63, 0x32, 0x33, 0x61, 0x14, 0x2a, 0x24, 0x4a}; diff --git a/skein/threefish512_dec_cstub.c b/skein/threefish512_dec_cstub.c index aaa9886..df513bc 100644 --- a/skein/threefish512_dec_cstub.c +++ b/skein/threefish512_dec_cstub.c @@ -35,7 +35,7 @@ static -void permute_inv8(void* data){ +void permute_inv8(void *data){ uint64_t t; t = X(6); X(6) = X(4); @@ -48,7 +48,7 @@ void permute_inv8(void* data){ } static -void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ +void add_key_8(void *data, const threefish512_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<5; ++i){ X(i) -= ctx->k[(s+i)%9]; @@ -58,7 +58,7 @@ void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ X(7) -= ctx->k[(s+7)%9] + s; } -void threefish512_dec(void* data, const threefish512_ctx_t* ctx){ +void threefish512_dec(void *data, const threefish512_ctx_t *ctx){ uint8_t i=0,s=18; uint8_t r0[8] = {0x41, 0x4b, 0x59, 0x41, 0x32, 0x42, 0x60, 0x5a}; uint8_t r1[8] = {0x63, 0x32, 0x33, 0x61, 0x14, 0x2a, 0x24, 0x4a}; diff --git a/skein/threefish512_enc.c b/skein/threefish512_enc.c index ea7f1b7..4fbc886 100644 --- a/skein/threefish512_enc.c +++ b/skein/threefish512_enc.c @@ -35,7 +35,7 @@ static -void permute_8(void* data){ +void permute_8(void *data){ uint64_t t; t = X(0); X(0) = X(2); @@ -48,7 +48,7 @@ void permute_8(void* data){ } /* static -void permute_inv8(void* data){ +void permute_inv8(void *data){ uint64_t t; t = X(6); X(6) = X(4); @@ -67,7 +67,7 @@ void permute_inv8(void* data){ #define K(s) (((uint64_t*)key)[(s)]) #define T(s) (((uint64_t*)tweak)[(s)]) -void threefish512_init(const void* key, const void* tweak, threefish512_ctx_t* ctx){ +void threefish512_init(const void *key, const void *tweak, threefish512_ctx_t *ctx){ memcpy(ctx->k, key, 8*8); if(tweak){ memcpy(ctx->t, tweak, 2*8); @@ -83,7 +83,7 @@ void threefish512_init(const void* key, const void* tweak, threefish512_ctx_t* c } static -void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ +void add_key_8(void *data, const threefish512_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<5; ++i){ X(i) += ctx->k[(s+i)%9]; @@ -93,7 +93,7 @@ void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ X(7) += ctx->k[(s+7)%9] + s; } -void threefish512_enc(void* data, const threefish512_ctx_t* ctx){ +void threefish512_enc(void *data, const threefish512_ctx_t *ctx){ uint8_t i=0,s=0; /* old constans, changed at round 2 of the SHA-3 contest uint8_t r0[8] = {38, 48, 34, 26, 33, 39, 29, 33}; diff --git a/skein/threefish512_enc_asm.S b/skein/threefish512_enc_asm.S index 687b9b6..49ead01 100644 --- a/skein/threefish512_enc_asm.S +++ b/skein/threefish512_enc_asm.S @@ -39,7 +39,7 @@ A7 = 21 #define K(s) (((uint64_t*)key)[(s)]) #define T(s) (((uint64_t*)tweak)[(s)]) -void threefish512_init(const void* key, const void* tweak, threefish512_ctx_t* ctx){ +void threefish512_init(const void *key, const void *tweak, threefish512_ctx_t *ctx){ memcpy(ctx->k, key, 8*8); memcpy(ctx->t, tweak, 2*8); uint8_t i; @@ -178,7 +178,7 @@ threefish512_init: /******************************************************************************/ /* #define X(a) (((uint64_t*)data)[(a)]) -void permute_8(void* data){ +void permute_8(void *data){ uint64_t t; t = X(0); X(0) = X(2); @@ -189,7 +189,7 @@ void permute_8(void* data){ X(3) = X(7); X(7) = t; } -void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ +void add_key_8(void *data, const threefish512_ctx_t *ctx, uint8_t s){ uint8_t i; for(i=0; i<5; ++i){ X(i) += ctx->k[(s+i)%9]; @@ -198,7 +198,7 @@ void add_key_8(void* data, const threefish512_ctx_t* ctx, uint8_t s){ X(6) += ctx->k[(s+6)%9] + ctx->t[(s+1)%3]; X(7) += ctx->k[(s+7)%9] + s; } -void threefish512_enc(void* data, const threefish512_ctx_t* ctx){ +void threefish512_enc(void *data, const threefish512_ctx_t *ctx){ uint8_t i=0,s=0; uint8_t r0[8] = {38, 48, 34, 26, 33, 39, 29, 33}; uint8_t r1[8] = {30, 20, 14, 12, 49, 27, 26, 51}; diff --git a/skein/threefish_invmix.S b/skein/threefish_invmix.S index 1e55cf2..bae51c5 100644 --- a/skein/threefish_invmix.S +++ b/skein/threefish_invmix.S @@ -28,7 +28,7 @@ /* #define X0 (((uint64_t*)data)[0]) #define X1 (((uint64_t*)data)[1]) -void threefish_invmix(void* data, uint8_t rot){ +void threefish_invmix(void *data, uint8_t rot){ uint64_t x; x = X1; x ^= X0; diff --git a/skein/threefish_invmix_4c.S b/skein/threefish_invmix_4c.S index 59cc545..c512aca 100644 --- a/skein/threefish_invmix_4c.S +++ b/skein/threefish_invmix_4c.S @@ -28,7 +28,7 @@ /* #define X0 (((uint64_t*)data)[0]) #define X1 (((uint64_t*)data)[1]) -void threefish_invmix(void* data, uint8_t rot){ +void threefish_invmix(void *data, uint8_t rot){ uint64_t x; x = X1; x ^= X0; diff --git a/skein/threefish_invmix_c.c b/skein/threefish_invmix_c.c index f664888..45cb170 100644 --- a/skein/threefish_invmix_c.c +++ b/skein/threefish_invmix_c.c @@ -30,7 +30,7 @@ #define X0 (((uint64_t*)data)[0]) #define X1 (((uint64_t*)data)[1]) -void threefish_invmix(void* data, uint8_t rot){ +void threefish_invmix(void *data, uint8_t rot){ uint64_t x; x = X1; x ^= X0; diff --git a/skein/threefish_mix.S b/skein/threefish_mix.S index 07d076f..4009220 100644 --- a/skein/threefish_mix.S +++ b/skein/threefish_mix.S @@ -29,7 +29,7 @@ #define B0 (((uint64_t*)data)[0]) #define B1 (((uint64_t*)data)[1]) static -void mix(void* data, uint8_t rot){ +void mix(void *data, uint8_t rot){ uint64_t x; x = B1; B0 += x; diff --git a/skein/threefish_mix_4c.S b/skein/threefish_mix_4c.S index 063232e..f18e307 100644 --- a/skein/threefish_mix_4c.S +++ b/skein/threefish_mix_4c.S @@ -29,7 +29,7 @@ #define B0 (((uint64_t*)data)[0]) #define B1 (((uint64_t*)data)[1]) static -void mix(void* data, uint8_t rot){ +void mix(void *data, uint8_t rot){ uint64_t x; x = B1; B0 += x; diff --git a/skein/threefish_mix_c.c b/skein/threefish_mix_c.c index 2031bc8..21b08d8 100644 --- a/skein/threefish_mix_c.c +++ b/skein/threefish_mix_c.c @@ -30,7 +30,7 @@ #define X0 (((uint64_t*)data)[0]) #define X1 (((uint64_t*)data)[1]) -void threefish_mix(void* data, uint8_t rot){ +void threefish_mix(void *data, uint8_t rot){ uint64_t x; x = X1; X0 += x; diff --git a/skein/ubi.h b/skein/ubi.h index 3ad83cd..b8c53e1 100644 --- a/skein/ubi.h +++ b/skein/ubi.h @@ -78,20 +78,20 @@ typedef struct{ uint8_t g[128]; }ubi1024_ctx_t; -void ubi256_init(ubi256_ctx_t* ctx, const void* g, uint8_t type); -void ubi256_nextBlock(ubi256_ctx_t* ctx, const void* block); -void ubi256_lastBlock(ubi256_ctx_t* ctx, const void* block, uint16_t length_b); -void ubi256_ctx2hash(void* dest, const ubi256_ctx_t* ctx); - -void ubi512_init(ubi512_ctx_t* ctx, const void* g, uint8_t type); -void ubi512_nextBlock(ubi512_ctx_t* ctx, const void* block); -void ubi512_lastBlock(ubi512_ctx_t* ctx, const void* block, uint16_t length_b); -void ubi512_ctx2hash(void* dest, const ubi512_ctx_t* ctx); - -void ubi1024_init(ubi1024_ctx_t* ctx, const void* g, uint8_t type); -void ubi1024_nextBlock(ubi1024_ctx_t* ctx, const void* block); -void ubi1024_lastBlock(ubi1024_ctx_t* ctx, const void* block, uint16_t length_b); -void ubi1024_ctx2hash(void* dest, const ubi1024_ctx_t* ctx); +void ubi256_init(ubi256_ctx_t *ctx, const void *g, uint8_t type); +void ubi256_nextBlock(ubi256_ctx_t *ctx, const void *block); +void ubi256_lastBlock(ubi256_ctx_t *ctx, const void *block, uint16_t length_b); +void ubi256_ctx2hash(void *dest, const ubi256_ctx_t *ctx); + +void ubi512_init(ubi512_ctx_t *ctx, const void *g, uint8_t type); +void ubi512_nextBlock(ubi512_ctx_t *ctx, const void *block); +void ubi512_lastBlock(ubi512_ctx_t *ctx, const void *block, uint16_t length_b); +void ubi512_ctx2hash(void *dest, const ubi512_ctx_t *ctx); + +void ubi1024_init(ubi1024_ctx_t *ctx, const void *g, uint8_t type); +void ubi1024_nextBlock(ubi1024_ctx_t *ctx, const void *block); +void ubi1024_lastBlock(ubi1024_ctx_t *ctx, const void *block, uint16_t length_b); +void ubi1024_ctx2hash(void *dest, const ubi1024_ctx_t *ctx); typedef struct{ char schema[4]; diff --git a/skein/ubi1024.c b/skein/ubi1024.c index dafffbb..97a1c83 100644 --- a/skein/ubi1024.c +++ b/skein/ubi1024.c @@ -30,13 +30,13 @@ #include "memxor.h" #include "ubi.h" -void ubi1024_init(ubi1024_ctx_t* ctx, const void* g, uint8_t type){ +void ubi1024_init(ubi1024_ctx_t *ctx, const void *g, uint8_t type){ memset(ctx->tweak.v8, 0, 15); ctx->tweak.v8[15] = 0x40+type; memcpy(ctx->g, g, UBI1024_BLOCKSIZE_B); } -void ubi1024_nextBlock(ubi1024_ctx_t* ctx, const void* block){ +void ubi1024_nextBlock(ubi1024_ctx_t *ctx, const void *block){ threefish1024_ctx_t tfctx; ctx->tweak.v64[0] += UBI1024_BLOCKSIZE_B; threefish1024_init(ctx->g, ctx->tweak.v8, &tfctx); @@ -47,7 +47,7 @@ void ubi1024_nextBlock(ubi1024_ctx_t* ctx, const void* block){ } -void ubi1024_lastBlock(ubi1024_ctx_t* ctx, const void* block, uint16_t length_b){ +void ubi1024_lastBlock(ubi1024_ctx_t *ctx, const void *block, uint16_t length_b){ threefish1024_ctx_t tfctx; while(length_b>UBI1024_BLOCKSIZE){ ubi1024_nextBlock(ctx, block); @@ -70,7 +70,7 @@ void ubi1024_lastBlock(ubi1024_ctx_t* ctx, const void* block, uint16_t length_b) } } -void ubi1024_ctx2hash(void* dest, const ubi1024_ctx_t* ctx){ +void ubi1024_ctx2hash(void *dest, const ubi1024_ctx_t *ctx){ memcpy(dest, ctx->g, UBI1024_BLOCKSIZE_B); } diff --git a/skein/ubi1024_asm.S b/skein/ubi1024_asm.S index 28b6451..070242a 100644 --- a/skein/ubi1024_asm.S +++ b/skein/ubi1024_asm.S @@ -27,7 +27,7 @@ /******************************************************************************/ /* -void ubi1024_init(ubi1024_ctx_t* ctx, const void* g, uint8_t type){ +void ubi1024_init(ubi1024_ctx_t *ctx, const void *g, uint8_t type){ memset(ctx->tweak, 0, 15); ctx->tweak[15] = 0x40+type; memcpy(ctx->g, g, UBI1024_BLOCKSIZE_B); @@ -57,7 +57,7 @@ ubi1024_init: /******************************************************************************/ /* -void ubi1024_ctx2hash(void* dest, const ubi1024_ctx_t* ctx){ +void ubi1024_ctx2hash(void *dest, const ubi1024_ctx_t *ctx){ memcpy(dest, ctx->g, UBI1024_BLOCKSIZE_B); } */ @@ -79,7 +79,7 @@ ubi1024_ctx2hash: /******************************************************************************/ /* -void ubi1024_nextBlock(ubi1024_ctx_t* ctx, const void* block){ +void ubi1024_nextBlock(ubi1024_ctx_t *ctx, const void *block){ threefish1024_ctx_t tfctx; ((uint64_t*)(ctx->tweak))[0] += UBI1024_BLOCKSIZE_B; threefish1024_init(ctx->g, ctx->tweak, &tfctx); @@ -162,7 +162,7 @@ exit: /******************************************************************************/ /* -void ubi1024_lastBlock(ubi1024_ctx_t* ctx, const void* block, uint16_t length_b){ +void ubi1024_lastBlock(ubi1024_ctx_t *ctx, const void *block, uint16_t length_b){ threefish1024_ctx_t tfctx; while(length_b>UBI1024_BLOCKSIZE){ ubi1024_nextBlock(ctx, block); diff --git a/skein/ubi256.c b/skein/ubi256.c index 8e60d34..6b7509e 100644 --- a/skein/ubi256.c +++ b/skein/ubi256.c @@ -30,13 +30,13 @@ #include "memxor.h" #include "ubi.h" -void ubi256_init(ubi256_ctx_t* ctx, const void* g, uint8_t type){ +void ubi256_init(ubi256_ctx_t *ctx, const void *g, uint8_t type){ memset(ctx->tweak.v8, 0, 15); ctx->tweak.v8[15] = 0x40+type; memcpy(ctx->g, g, 32); } -void ubi256_nextBlock(ubi256_ctx_t* ctx, const void* block){ +void ubi256_nextBlock(ubi256_ctx_t *ctx, const void *block){ threefish256_ctx_t tfctx; ctx->tweak.v64[0] += UBI256_BLOCKSIZE_B; threefish256_init(ctx->g, ctx->tweak.v8, &tfctx); @@ -47,7 +47,7 @@ void ubi256_nextBlock(ubi256_ctx_t* ctx, const void* block){ } -void ubi256_lastBlock(ubi256_ctx_t* ctx, const void* block, uint16_t length_b){ +void ubi256_lastBlock(ubi256_ctx_t *ctx, const void *block, uint16_t length_b){ threefish256_ctx_t tfctx; while(length_b>UBI256_BLOCKSIZE){ ubi256_nextBlock(ctx, block); @@ -74,7 +74,7 @@ void ubi256_lastBlock(ubi256_ctx_t* ctx, const void* block, uint16_t length_b){ } -void ubi256_ctx2hash(void* dest, const ubi256_ctx_t* ctx){ +void ubi256_ctx2hash(void *dest, const ubi256_ctx_t *ctx){ memcpy(dest, ctx->g, UBI256_BLOCKSIZE_B); } diff --git a/skein/ubi256_asm.S b/skein/ubi256_asm.S index e5e6f9c..c5d1bc6 100644 --- a/skein/ubi256_asm.S +++ b/skein/ubi256_asm.S @@ -27,7 +27,7 @@ /******************************************************************************/ /* -void ubi256_init(ubi256_ctx_t* ctx, const void* g, uint8_t type){ +void ubi256_init(ubi256_ctx_t *ctx, const void *g, uint8_t type){ memset(ctx->tweak, 0, 15); ctx->tweak[15] = 0x40+type; memcpy(ctx->g, g, 32); @@ -57,7 +57,7 @@ ubi256_init: /******************************************************************************/ /* -void ubi256_ctx2hash(void* dest, const ubi256_ctx_t* ctx){ +void ubi256_ctx2hash(void *dest, const ubi256_ctx_t *ctx){ memcpy(dest, ctx->g, UBI256_BLOCKSIZE_B); } */ @@ -79,7 +79,7 @@ ubi256_ctx2hash: /******************************************************************************/ /* -void ubi256_nextBlock(ubi256_ctx_t* ctx, const void* block){ +void ubi256_nextBlock(ubi256_ctx_t *ctx, const void *block){ threefish256_ctx_t tfctx; ((uint64_t*)(ctx->tweak))[0] += UBI256_BLOCKSIZE_B; threefish256_init(ctx->g, ctx->tweak, &tfctx); @@ -160,7 +160,7 @@ exit: /******************************************************************************/ /* -void ubi256_lastBlock(ubi256_ctx_t* ctx, const void* block, uint16_t length_b){ +void ubi256_lastBlock(ubi256_ctx_t *ctx, const void *block, uint16_t length_b){ threefish256_ctx_t tfctx; while(length_b>UBI256_BLOCKSIZE){ ubi256_nextBlock(ctx, block); diff --git a/skein/ubi512.c b/skein/ubi512.c index 526018f..83621ed 100644 --- a/skein/ubi512.c +++ b/skein/ubi512.c @@ -30,13 +30,13 @@ #include "memxor.h" #include "ubi.h" -void ubi512_init(ubi512_ctx_t* ctx, const void* g, uint8_t type){ +void ubi512_init(ubi512_ctx_t *ctx, const void *g, uint8_t type){ memset(ctx->tweak.v8, 0, 15); ctx->tweak.v8[15] = 0x40+type; memcpy(ctx->g, g, UBI512_BLOCKSIZE_B); } -void ubi512_nextBlock(ubi512_ctx_t* ctx, const void* block){ +void ubi512_nextBlock(ubi512_ctx_t *ctx, const void *block){ threefish512_ctx_t tfctx; ctx->tweak.v64[0] += UBI512_BLOCKSIZE_B; threefish512_init(ctx->g, ctx->tweak.v8, &tfctx); @@ -47,7 +47,7 @@ void ubi512_nextBlock(ubi512_ctx_t* ctx, const void* block){ } -void ubi512_lastBlock(ubi512_ctx_t* ctx, const void* block, uint16_t length_b){ +void ubi512_lastBlock(ubi512_ctx_t *ctx, const void *block, uint16_t length_b){ threefish512_ctx_t tfctx; while(length_b>UBI512_BLOCKSIZE){ ubi512_nextBlock(ctx, block); @@ -70,7 +70,7 @@ void ubi512_lastBlock(ubi512_ctx_t* ctx, const void* block, uint16_t length_b){ } } -void ubi512_ctx2hash(void* dest, const ubi512_ctx_t* ctx){ +void ubi512_ctx2hash(void *dest, const ubi512_ctx_t *ctx){ memcpy(dest, ctx->g, UBI512_BLOCKSIZE_B); } diff --git a/skein/ubi512_asm.S b/skein/ubi512_asm.S index 6a17c48..b61ef9c 100644 --- a/skein/ubi512_asm.S +++ b/skein/ubi512_asm.S @@ -27,7 +27,7 @@ /******************************************************************************/ /* -void ubi512_init(ubi512_ctx_t* ctx, const void* g, uint8_t type){ +void ubi512_init(ubi512_ctx_t *ctx, const void *g, uint8_t type){ memset(ctx->tweak, 0, 15); ctx->tweak[15] = 0x40+type; memcpy(ctx->g, g, UBI512_BLOCKSIZE_B); @@ -57,7 +57,7 @@ ubi512_init: /******************************************************************************/ /* -void ubi512_ctx2hash(void* dest, const ubi512_ctx_t* ctx){ +void ubi512_ctx2hash(void *dest, const ubi512_ctx_t *ctx){ memcpy(dest, ctx->g, UBI512_BLOCKSIZE_B); } */ @@ -79,7 +79,7 @@ ubi512_ctx2hash: /******************************************************************************/ /* -void ubi512_nextBlock(ubi512_ctx_t* ctx, const void* block){ +void ubi512_nextBlock(ubi512_ctx_t *ctx, const void *block){ threefish512_ctx_t tfctx; ((uint64_t*)(ctx->tweak))[0] += UBI512_BLOCKSIZE_B; threefish512_init(ctx->g, ctx->tweak, &tfctx); @@ -161,7 +161,7 @@ exit: /******************************************************************************/ /* -void ubi512_lastBlock(ubi512_ctx_t* ctx, const void* block, uint16_t length_b){ +void ubi512_lastBlock(ubi512_ctx_t *ctx, const void *block, uint16_t length_b){ threefish512_ctx_t tfctx; while(length_b>UBI512_BLOCKSIZE){ ubi512_nextBlock(ctx, block); diff --git a/skipjack/skipjack.c b/skipjack/skipjack.c index 0b43249..588c4cb 100644 --- a/skipjack/skipjack.c +++ b/skipjack/skipjack.c @@ -114,7 +114,7 @@ uint16_t skipjack_g_inv(uint16_t g, uint8_t k, uint8_t *key){ /*****************************************************************************/ static -void skipjack_a(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_a(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[0]; w[0] = w[1]; @@ -125,7 +125,7 @@ void skipjack_a(uint16_t* w, uint8_t k, uint8_t* key){ /*****************************************************************************/ static -void skipjack_a_inv(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_a_inv(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[3] ^ w[2]; w[3] = skipjack_g_inv(w[2],k,key); @@ -136,7 +136,7 @@ void skipjack_a_inv(uint16_t* w, uint8_t k, uint8_t* key){ /*****************************************************************************/ static -void skipjack_b(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_b(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[3]; w[3] = w[0]; @@ -147,7 +147,7 @@ void skipjack_b(uint16_t* w, uint8_t k, uint8_t* key){ /*****************************************************************************/ static -void skipjack_b_inv(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_b_inv(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[1]; w[1] = w[0]; @@ -161,7 +161,7 @@ void skipjack_b_inv(uint16_t* w, uint8_t k, uint8_t* key){ * block is 64 bits (=8 bytes) in size, key is 80 bits (=10 bytes) in size. * */ -void skipjack_enc(void* block, void* key){ +void skipjack_enc(void *block, void *key){ uint8_t k; for(k=0; k<32; ++k){ if(k & 0x08){ @@ -176,7 +176,7 @@ void skipjack_enc(void* block, void* key){ * block is 64 bits (=8 bytes) in size, key is 80 bits (=10 bytes) in size. * */ -void skipjack_dec(void* block, void* key){ +void skipjack_dec(void *block, void *key){ int8_t k; for(k=31; k>=0; --k){ if(k & 0x08){ diff --git a/skipjack/skipjack.h b/skipjack/skipjack.h index 00f033d..9aee2c4 100644 --- a/skipjack/skipjack.h +++ b/skipjack/skipjack.h @@ -31,7 +31,7 @@ #include -/** \fn void skipjack_enc(void* block, void* key) +/** \fn void skipjack_enc(void *block, void *key) * \brief skipjack encryption function * * This function encrypts a block of plaintext with the Skipjac encryption @@ -40,9 +40,9 @@ * \param block pointer to the 64 bit (8 byte) block to encrypt * \param key pointer to the 80 bit (10 byte) key */ -void skipjack_enc(void* block, void* key); +void skipjack_enc(void *block, void *key); -/** \fn void skipjack_dec(void* block, void* key) +/** \fn void skipjack_dec(void *block, void *key) * \brief skipjack decryption function * * This function decrypts a block of ciphertext encrypted with the Skipjac @@ -51,6 +51,6 @@ void skipjack_enc(void* block, void* key); * \param block pointer to the 64 bit (8 byte) block to decrypt * \param key pointer to the 80 bit (10 byte) key */ -void skipjack_dec(void* block, void* key); +void skipjack_dec(void *block, void *key); #endif /*SKIPJACK_H_*/ diff --git a/skipjack/skipjack_nofix.c b/skipjack/skipjack_nofix.c index cb9e616..440c825 100644 --- a/skipjack/skipjack_nofix.c +++ b/skipjack/skipjack_nofix.c @@ -109,7 +109,7 @@ uint16_t skipjack_g_inv(uint16_t g, uint8_t k, uint8_t *key){ /*****************************************************************************/ -void skipjack_a(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_a(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[3]; @@ -121,7 +121,7 @@ void skipjack_a(uint16_t* w, uint8_t k, uint8_t* key){ /*****************************************************************************/ -void skipjack_a_inv(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_a_inv(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[0] ^ w[1]; w[0] = skipjack_g_inv(w[1],k,key); @@ -132,7 +132,7 @@ void skipjack_a_inv(uint16_t* w, uint8_t k, uint8_t* key){ /*****************************************************************************/ -void skipjack_b(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_b(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[0]; w[0] = w[3]; @@ -143,7 +143,7 @@ void skipjack_b(uint16_t* w, uint8_t k, uint8_t* key){ /*****************************************************************************/ -void skipjack_b_inv(uint16_t* w, uint8_t k, uint8_t* key){ +void skipjack_b_inv(uint16_t *w, uint8_t k, uint8_t *key){ uint16_t t; t = w[2]; w[2] = w[3]; @@ -158,7 +158,7 @@ void skipjack_b_inv(uint16_t* w, uint8_t k, uint8_t* key){ * */ #if NO_FIX -void skipjack_enc(void* block, void* key){ +void skipjack_enc(void *block, void *key){ uint8_t k; for(k=0; k<32; ++k){ if(k & 0x08){ @@ -169,7 +169,7 @@ void skipjack_enc(void* block, void* key){ } } #else -void skipjack_enc(void* block, void* key){ +void skipjack_enc(void *block, void *key){ uint8_t k; uint8_t buffer[8], local_key[10]; for(k=0; k<8; ++k){ @@ -196,7 +196,7 @@ void skipjack_enc(void* block, void* key){ * */ #if NO_FIX -void skipjack_dec(void* block, void* key){ +void skipjack_dec(void *block, void *key){ int8_t k; for(k=31; k>=0; --k){ if(k & 0x08){ @@ -207,7 +207,7 @@ void skipjack_dec(void* block, void* key){ } } #else -void skipjack_dec(void* block, void* key){ +void skipjack_dec(void *block, void *key){ int8_t k; uint8_t buffer[8], local_key[10]; for(k=0; k<8; ++k){ diff --git a/stack_measuring.h b/stack_measuring.h index 23ca63e..0b9a8b7 100644 --- a/stack_measuring.h +++ b/stack_measuring.h @@ -28,8 +28,8 @@ typedef struct { uint8_t pattern; } stack_measuring_ctx_t; -void stack_measure_init(stack_measuring_ctx_t* ctx, uint8_t pattern); -uint16_t stack_measure_final(const stack_measuring_ctx_t* ctx); +void stack_measure_init(stack_measuring_ctx_t *ctx, uint8_t pattern); +uint16_t stack_measure_final(const stack_measuring_ctx_t *ctx); /* for testing only void stack_measure_usestack(uint16_t size, uint8_t value); */ diff --git a/streamcipher_descriptor.h b/streamcipher_descriptor.h index 56815cc..54f4ef6 100644 --- a/streamcipher_descriptor.h +++ b/streamcipher_descriptor.h @@ -100,7 +100,7 @@ typedef struct { } scdesc_t; /* streamcipher descriptor type */ typedef struct{ - const scdesc_t* desc_ptr; + const scdesc_t *desc_ptr; uint16_t keysize; uint16_t ivsize; uint16_t index; diff --git a/string-extras.h b/string-extras.h index bf2cbf7..8576020 100644 --- a/string-extras.h +++ b/string-extras.h @@ -24,7 +24,7 @@ * */ -/** \fn stridentcnt_P(char* a, PGM_P b) +/** \fn stridentcnt_P(char *a, PGM_P b) * \brief counts the number of identic chars * * This function compares the supplyed strings and returns the index of the @@ -33,9 +33,9 @@ * \param b pointer to string in Flash * \return index of the first char where \c a and \c b differ */ -uint16_t stridentcnt_P(char* a, PGM_P b); +uint16_t stridentcnt_P(char *a, PGM_P b); -/** \fn firstword_length(char* s) +/** \fn firstword_length(char *s) * \brief compute the length of the first word in supllyed string * * This function searches for the first whitespace in the string and returns the @@ -43,13 +43,13 @@ uint16_t stridentcnt_P(char* a, PGM_P b); * \param s string * \return number of chars in first word */ -uint16_t firstword_length(char* s); +uint16_t firstword_length(char *s); -/** \fn strstrip(char* str) +/** \fn strstrip(char *str) * \brief removes whitespace at the beginning and the end of a string * * This function removes whitespaces at the end of a string. * \param str sting * \return pointer to the first non-whitespace char in string */ -char* strstrip(char* str); +char *strstrip(char *str); diff --git a/test_src/circularbytebuffer-asm.S b/test_src/circularbytebuffer-asm.S index 199c86a..fcd48f4 100644 --- a/test_src/circularbytebuffer-asm.S +++ b/test_src/circularbytebuffer-asm.S @@ -29,10 +29,10 @@ typedef struct { uint8_t buffer_size; uint8_t fillcount; - uint8_t* buffer; - uint8_t* head; - uint8_t* tail; - uint8_t* top; + uint8_t *buffer; + uint8_t *head; + uint8_t *tail; + uint8_t *top; } circularbytebuffer_t; */ @@ -57,7 +57,7 @@ /******************************************************************************/ /* - * uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t *cb){ * cb->buffer_size = buffersize; * cb->buffer = malloc(buffersize); * cb->head = cb->tail = cb->buffer; @@ -105,7 +105,7 @@ circularbytebuffer_init: /******************************************************************************/ /* - * void circularbytebuffer_free(circularbytebuffer_t* cb){ + * void circularbytebuffer_free(circularbytebuffer_t *cb){ * free(cb->buffer); * } * @@ -124,7 +124,7 @@ circularbytebuffer_free: /******************************************************************************/ /* - * void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t* cb, void* buffer){ + * void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t *cb, void *buffer){ * cb->buffer_size = buffersize; * cb->buffer = buffer * cb->head = cb->tail = cb->buffer; @@ -157,7 +157,7 @@ circularbytebuffer_init2: /******************************************************************************/ /* - * uint8_t circularbytebuffer_cnt(circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_cnt(circularbytebuffer_t *cb){ * return (cb->fillcount); * } * @@ -172,7 +172,7 @@ circularbytebuffer_cnt: /******************************************************************************/ /* - * uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t* cb){ + * uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t *cb){ * uint8_t ret; * if(cb->fillcount==0) * return 0xffff; @@ -216,7 +216,7 @@ circularbytebuffer_get_lifo: /******************************************************************************/ /* - * uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t* cb){ + * uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t *cb){ * uint8_t ret; * if(cb->fillcount==0) * return 0xffff; @@ -264,7 +264,7 @@ circularbytebuffer_get_fifo: /******************************************************************************/ /* - * uint8_t circularbytebuffer_append(uint8_t elem, circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_append(uint8_t elem, circularbytebuffer_t *cb){ * if(cb->fillcount==cb->buffer_size) * return 1; * cb->fillcount++; @@ -322,7 +322,7 @@ circularbytebuffer_append: /******************************************************************************/ /* - * uint8_t circularbytebuffer_push(uint8_t elem, circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_push(uint8_t elem, circularbytebuffer_t *cb){ * if(cb->fillcount==cb->buffer_size) * return 1; * cb->fillcount++; diff --git a/test_src/circularbytebuffer.h b/test_src/circularbytebuffer.h index 9f29003..917ee2a 100644 --- a/test_src/circularbytebuffer.h +++ b/test_src/circularbytebuffer.h @@ -40,10 +40,10 @@ typedef struct { uint8_t buffer_size; /**< holds the amount of bytes which may be stored in the buffer */ uint8_t fillcount; /**< holds the amount of bytes actually stored in the buffer */ - uint8_t* buffer; /**< pointer to the actual buffer */ - uint8_t* head; /**< pointer to the head of the buffer */ - uint8_t* tail; /**< pointer to the tail of the buffer */ - uint8_t* top; /**< pointer to the last free address in the buffer */ + uint8_t *buffer; /**< pointer to the actual buffer */ + uint8_t *head; /**< pointer to the head of the buffer */ + uint8_t *tail; /**< pointer to the tail of the buffer */ + uint8_t *top; /**< pointer to the last free address in the buffer */ } circularbytebuffer_t; @@ -55,7 +55,7 @@ * \param buffersize size of the buffer to allocate * \param cb buffer context to be initialized */ -uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t* cb); +uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t *cb); #endif #if CIRCULARBYTEBUFFER_NO_INIT2==0 /** \brief buffer initialisation without automatic allocation @@ -66,18 +66,18 @@ uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t* cb); * \param cb buffer context to be initialized * \param buffer buffer for the storage of data (you are responisble for allocation and freeing) */ -void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t* cb, void* buffer); +void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t *cb, void *buffer); #endif /** \brief * * */ -uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t* cb); -uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t* cb); -uint8_t circularbytebuffer_append(uint8_t, circularbytebuffer_t* cb); -uint8_t circularbytebuffer_push(uint8_t, circularbytebuffer_t* cb); -uint8_t circularbytebuffer_cnt(circularbytebuffer_t* cb); -void circularbytebuffer_free(circularbytebuffer_t* cb); +uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t *cb); +uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t *cb); +uint8_t circularbytebuffer_append(uint8_t, circularbytebuffer_t *cb); +uint8_t circularbytebuffer_push(uint8_t, circularbytebuffer_t *cb); +uint8_t circularbytebuffer_cnt(circularbytebuffer_t *cb); +void circularbytebuffer_free(circularbytebuffer_t *cb); /*@}*/ #endif /* CIRCULARBYTEBUFFER_H_ */ diff --git a/test_src/cli-core.S b/test_src/cli-core.S index 2c572e5..43dcb6c 100644 --- a/test_src/cli-core.S +++ b/test_src/cli-core.S @@ -24,7 +24,7 @@ /******************************************************************************/ /* uint16_t max_cmd_length(PGM_VOID_P cmdlist){ uint16_t t,ret=0; - char* str; + char *str; for(;;){ str = (char*)pgm_read_word(cmdlist); cmdlist = (uint8_t*)cmdlist + CMDLIST_ENTRY_SIZE; @@ -134,7 +134,7 @@ pecho: .asciz "\r\necho is o" /******************************************************************************/ -/* int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist) +/* int8_t search_and_call(char *cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist) * param cmd: r24:r25 * param maxcmdlength: r22:r23 * param cmdlist: r20:r21 @@ -257,7 +257,7 @@ nocommand_str: .asciz "\r\ncommand not found, try 'help'" /******************************************************************************/ -/* void cli_option_listing(char* buffer, PGM_VOID_P cmdlist) +/* void cli_option_listing(char *buffer, PGM_VOID_P cmdlist) * param buffer: r24:r25 * param cmdlist: r22:r23 */ diff --git a/test_src/cli-hexdump.S b/test_src/cli-hexdump.S index 032f59b..419ed1c 100644 --- a/test_src/cli-hexdump.S +++ b/test_src/cli-hexdump.S @@ -127,7 +127,7 @@ cli_hexdump2: rjmp 1b /******************************************************************************/ -/* void cli_hexdump_block(const void* data, uint16_t length, uint8_t indent, uint8_t width) +/* void cli_hexdump_block(const void *data, uint16_t length, uint8_t indent, uint8_t width) * param data: r24:r25 * param length: r22:r23 * param indent: r20 diff --git a/test_src/cli-stub.c b/test_src/cli-stub.c index cb3d271..619892a 100644 --- a/test_src/cli-stub.c +++ b/test_src/cli-stub.c @@ -40,10 +40,10 @@ cli_rx_fpt cli_rx = NULL; cli_tx_fpt cli_tx = NULL; uint8_t cli_echo = 1; -void echo_ctrl(char* s); +void echo_ctrl(char *s); uint16_t max_cmd_length(PGM_VOID_P cmdlist); -int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist); -void cli_option_listing(char* buffer, PGM_VOID_P cmdlist); +int8_t search_and_call(char *cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist); +void cli_option_listing(char *buffer, PGM_VOID_P cmdlist); void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist); typedef void(*str_fpt)(char*); @@ -51,10 +51,10 @@ typedef void(*str_fpt)(char*); #define CLI_BACKSPACE 8 #define CLI_TABULATOR 9 -uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){ +uint8_t cli_completion(char *buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){ uint8_t i=0; char ref[maxcmdlength+1]; - char* itemstr; + char *itemstr; ref[0]='\0'; /* check if we are behind the first word */ while(buffer[i]){ @@ -85,7 +85,7 @@ int8_t cmd_interface(PGM_VOID_P cmd_desc){ uint16_t cli_buffer_index; int8_t exit_code; uint8_t completion_failed=0; - char* cli_buffer; + char *cli_buffer; char c; uint16_t maxcmdlength = max_cmd_length(cmd_desc); cli_buffer = calloc(1,cli_buffer_size=maxcmdlength+2); diff --git a/test_src/cli.h b/test_src/cli.h index 70c4210..e463d2f 100644 --- a/test_src/cli.h +++ b/test_src/cli.h @@ -45,7 +45,7 @@ typedef struct { PGM_P cmd_name; /* string containing the function name */ PGM_P cmd_param_str; /* param descriptor string */ void_fpt cmd_function; /* function pointer */ - cmdoption_t* options; + cmdoption_t *options; } cmdlist_entry_t; extern cli_rx_fpt cli_rx; @@ -57,17 +57,17 @@ extern uint8_t cli_echo; void cli_putc(char c); uint16_t cli_getc(void); uint16_t cli_getc_cecho(void); -uint8_t cli_getsn(char* s, size_t n); -uint8_t cli_getsn_cecho(char* s, uint16_t n); -void cli_putstr(const char* s); +uint8_t cli_getsn(char *s, size_t n); +uint8_t cli_getsn_cecho(char *s, uint16_t n); +void cli_putstr(const char *s); void cli_putstr_P(PGM_P s); void cli_hexdump_byte(uint8_t byte); -void cli_hexdump(const void* data, size_t length); -void cli_hexdump_rev(const void* data, size_t length); -void cli_hexdump2(const void* data, size_t length); -void cli_hexdump_block(const void* data, size_t length, uint8_t indent, uint8_t width); +void cli_hexdump(const void *data, size_t length); +void cli_hexdump_rev(const void *data, size_t length); +void cli_hexdump2(const void *data, size_t length); +void cli_hexdump_block(const void *data, size_t length, uint8_t indent, uint8_t width); -void echo_ctrl(char* s); +void echo_ctrl(char *s); int8_t cmd_interface(PGM_VOID_P cmd_desc); diff --git a/test_src/cmacvs.c b/test_src/cmacvs.c index 64bfd0b..c86380f 100644 --- a/test_src/cmacvs.c +++ b/test_src/cmacvs.c @@ -54,7 +54,7 @@ bcdesc_t** cmacvs_algolist=NULL; void cmacvs_listalgos(void){ char option = 'a'; - bcdesc_t* t; + bcdesc_t *t; uint8_t i=0; cli_putstr_P(PSTR("\r\nthe following algorithms are available:\r\n")); while(option<='z' && (t=(bcdesc_t*)pgm_read_word(&(cmacvs_algolist[i])))){ @@ -68,7 +68,7 @@ void cmacvs_listalgos(void){ } } -void cmacvs_setalgo(char* param){ +void cmacvs_setalgo(char *param){ param = strstrip(param); if(param[1]=='\0'){ /* single letter specified */ uint8_t i,option = param[0]-'a'; @@ -85,7 +85,7 @@ void cmacvs_setalgo(char* param){ } cmacvs_algo=(bcdesc_t*)pgm_read_word(&(cmacvs_algolist[option])); } else { /* name specifyed */ - bcdesc_t* t=NULL; + bcdesc_t *t=NULL; uint8_t i=0; while((t=(bcdesc_t*)pgm_read_word(&(cmacvs_algolist[i]))) && strcasecmp_P(param, (void*)pgm_read_word(&(t->name)))) @@ -105,7 +105,7 @@ typedef struct { uint16_t buffersize_B; uint32_t blocks; bcal_cmac_ctx_t ctx; - uint8_t* buffer; + uint8_t *buffer; uint8_t in_byte; } cmacvs_ctx_t; @@ -148,7 +148,7 @@ uint8_t buffer_add(char c){ int32_t getValue_P(PGM_P key){ uint32_t val=0; char instr[21]; - char* str2; + char *str2; for(;;){ memset(instr, 0, 21); cli_getsn_cecho(instr, 20); @@ -173,7 +173,7 @@ int32_t getValue_P(PGM_P key){ return -2; } -uint8_t getKey(void* key_buffer, uint8_t klen_B){ +uint8_t getKey(void *key_buffer, uint8_t klen_B){ char c; uint8_t v,i=0; memset(key_buffer, 0x00, klen_B); @@ -213,7 +213,7 @@ uint8_t getKey(void* key_buffer, uint8_t klen_B){ return 0; } -uint8_t getMac(void* mac_buffer, uint8_t mlen_B){ +uint8_t getMac(void *mac_buffer, uint8_t mlen_B){ char c; uint8_t v,i=0; memset(mac_buffer, 0x00, mlen_B); diff --git a/test_src/cmacvs.h b/test_src/cmacvs.h index f436275..599e4b7 100644 --- a/test_src/cmacvs.h +++ b/test_src/cmacvs.h @@ -34,7 +34,7 @@ extern bcdesc_t* cmacvs_algo; extern bcdesc_t** cmacvs_algolist; void cmacvs_listalgos(void); -void cmacvs_setalgo(char* param); +void cmacvs_setalgo(char *param); void cmacvs_test1(void); void cmacvs_test2(void); diff --git a/test_src/dbz_strings.c b/test_src/dbz_strings.c index 436bf8c..2c3d1c6 100644 --- a/test_src/dbz_strings.c +++ b/test_src/dbz_strings.c @@ -33,7 +33,7 @@ /******************************************************************************/ -uint8_t dbz_strcount(const char* str){ +uint8_t dbz_strcount(const char *str){ uint8_t ret=1; if(*str=='\0' && *(str+1)=='\0') return 0; @@ -48,7 +48,7 @@ uint8_t dbz_strcount(const char* str){ /******************************************************************************/ -void dbz_splitup(char* dbzstr, char** strings){ +void dbz_splitup(char *dbzstr, char** strings){ if(*dbzstr=='\0' && *(dbzstr+1)=='\0') return; *strings++ = dbzstr; @@ -78,7 +78,7 @@ uint8_t dbz_strcount_P(PGM_P str){ /******************************************************************************/ -void dbz_splitup_P(PGM_P dbzstr, PGM_P* strings){ +void dbz_splitup_P(PGM_P dbzstr, PGM_P *strings){ if(pgm_read_byte(dbzstr)=='\0' && pgm_read_byte(dbzstr+1)=='\0') return; *strings++ = dbzstr; diff --git a/test_src/dbz_strings.h b/test_src/dbz_strings.h index 76c8b75..a1bc8d1 100644 --- a/test_src/dbz_strings.h +++ b/test_src/dbz_strings.h @@ -34,16 +34,16 @@ #include #include -/** \fn uint8_t dbz_strcount(const char* str) +/** \fn uint8_t dbz_strcount(const char *str) * \brief count stings in dbz-terminated string * * Count the single zero terminated strings in a * double terminated string * \param str pointer to the double-zero-terminated string */ -uint8_t dbz_strcount(const char* str); +uint8_t dbz_strcount(const char *str); -/** \fn void dbz_splitup(char* dbzstr, char** strings) +/** \fn void dbz_splitup(char *dbzstr, char** strings) * \brief split up a dbz-terminated string * * Fills an array with pointers to the single terminated string @@ -51,7 +51,7 @@ uint8_t dbz_strcount(const char* str); * \param dbzstr pointer to the double-zero-terminated string * \param strings pointer to the array of strings (char pointers) */ -void dbz_splitup(char* dbzstr, char** strings); +void dbz_splitup(char *dbzstr, char** strings); /** \fn uint8_t dbz_strcount_P(PGM_P str) * \brief count stings in dbz-terminated string in flash @@ -62,7 +62,7 @@ void dbz_splitup(char* dbzstr, char** strings); */ uint8_t dbz_strcount_P(PGM_P str); -/** \fn void dbz_splitup_P(PGM_P dbzstr, PGM_P* strings) +/** \fn void dbz_splitup_P(PGM_P dbzstr, PGM_P *strings) * \brief split up a dbz-terminated string in flash * * Fills an array with pointers (PGM_P) to the single terminated string @@ -70,6 +70,6 @@ uint8_t dbz_strcount_P(PGM_P str); * \param dbzstr pointer to the double-zero-terminated string in flash * \param strings pointer to the array of strings (PGM_P) */ -void dbz_splitup_P(PGM_P dbzstr, PGM_P* strings); +void dbz_splitup_P(PGM_P dbzstr, PGM_P *strings); #endif /*DBZ_STRINGS_H_*/ diff --git a/test_src/debug.c b/test_src/debug.c index 6526479..797fd2e 100644 --- a/test_src/debug.c +++ b/test_src/debug.c @@ -47,7 +47,7 @@ uart0_putc(c); } - void debug_str(char* s){ + void debug_str(char *s){ while (*s) debug_char(*s++); } diff --git a/test_src/dump-asm.S b/test_src/dump-asm.S index 26f04bd..971365a 100644 --- a/test_src/dump-asm.S +++ b/test_src/dump-asm.S @@ -43,7 +43,7 @@ charisinstr_P: ret /******************************************************************************/ -/* void dump_chars(uint8_t* buffer, uint8_t len) +/* void dump_chars(uint8_t *buffer, uint8_t len) * param buffer: r24:r25 * param len: r22 */ @@ -130,7 +130,7 @@ print_aligned: ret /*****************************************************************************/ - /* void dump(char* s) + /* void dump(char *s) * param s: r24:r25 */ @@ -354,7 +354,7 @@ suffix: .byte 0 /******************************************************************************/ -/* void pgm_read_block(void* buffer, uint32_t addr, uint8_t length) +/* void pgm_read_block(void *buffer, uint32_t addr, uint8_t length) * param buffer: r24:r25 * param addr: r20:r23 * param length: r18 @@ -390,7 +390,7 @@ pgm_read_block: #endif /******************************************************************************/ -/* void ram_read_block(void* buffer, uint32_t addr, uint8_t length) +/* void ram_read_block(void *buffer, uint32_t addr, uint8_t length) * param buffer: r24:r25 * param addr: r20:r23 * param length: r18 @@ -410,7 +410,7 @@ ram_read_block: ret /******************************************************************************/ -/* void ee_read_block(void* buffer, uint32_t addr, uint8_t length) +/* void ee_read_block(void *buffer, uint32_t addr, uint8_t length) * param buffer: r24:r25 * param addr: r20:r23 * param length: r18 diff --git a/test_src/dump-decl.c b/test_src/dump-decl.c index 984b8bd..ba74727 100644 --- a/test_src/dump-decl.c +++ b/test_src/dump-decl.c @@ -36,9 +36,9 @@ #define DUMP_WIDTH 16 -void pgm_read_block(void* buffer, uint32_t addr, uint8_t length); -void ee_read_block(void* buffer, uint32_t addr, uint8_t length); -void ram_read_block(void* buffer, uint32_t addr, uint8_t length); +void pgm_read_block(void *buffer, uint32_t addr, uint8_t length); +void ee_read_block(void *buffer, uint32_t addr, uint8_t length); +void ram_read_block(void *buffer, uint32_t addr, uint8_t length); const char flash_trigger[] PROGMEM = "fF"; const char ram_trigger[] PROGMEM = "sSrRmM"; @@ -61,4 +61,4 @@ memtype_desc_t memtype_desc[] PROGMEM = { { NULL, NULL, NULL } }; -void dump(char* s); +void dump(char *s); diff --git a/test_src/dump.h b/test_src/dump.h index 0561b4e..2f43dc2 100644 --- a/test_src/dump.h +++ b/test_src/dump.h @@ -37,6 +37,6 @@ #define DUMP_WIDTH 16 -void dump(char* s); +void dump(char *s); #endif /* DUMP_H_ */ diff --git a/test_src/main-a5_1-test.c b/test_src/main-a5_1-test.c index 6addf1a..d9d6abc 100644 --- a/test_src/main-a5_1-test.c +++ b/test_src/main-a5_1-test.c @@ -26,12 +26,12 @@ #include "A5_1.h" #include "nessie_stream_test.h" -char* algo_name = "A5_1"; +char *algo_name = "A5_1"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void a51_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){ +void a51_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){ a5_1_init(ctx,key, keysize, NULL, 0); } diff --git a/test_src/main-aes-test.c b/test_src/main-aes-test.c index 67e928e..92ac560 100644 --- a/test_src/main-aes-test.c +++ b/test_src/main-aes-test.c @@ -40,9 +40,9 @@ #include "bcal-performance.h" #include "bcal-nessie.h" -const char* algo_name = "AES"; +const char *algo_name = "AES"; -const bcdesc_t* const const algolist[] PROGMEM = { +const bcdesc_t *const const algolist[] PROGMEM = { (bcdesc_t*)&aes128_desc, (bcdesc_t*)&aes192_desc, (bcdesc_t*)&aes256_desc, diff --git a/test_src/main-arcfour-test.c b/test_src/main-arcfour-test.c index 89df1c7..eb2e63e 100644 --- a/test_src/main-arcfour-test.c +++ b/test_src/main-arcfour-test.c @@ -31,12 +31,12 @@ #include "scal-basic.h" #include "scal-nessie.h" -char* algo_name = "Arcfour"; +char *algo_name = "Arcfour"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void arcfour_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){ +void arcfour_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){ arcfour_init(key, (uint8_t)((keysize+7)/8), ctx); } diff --git a/test_src/main-base64-test.c b/test_src/main-base64-test.c index 9a1e461..894179b 100644 --- a/test_src/main-base64-test.c +++ b/test_src/main-base64-test.c @@ -30,7 +30,7 @@ #include "performance_test.h" -char* algo_name = "Base64"; +char *algo_name = "Base64"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-bigint-test.c b/test_src/main-bigint-test.c index b757f28..21ab09c 100644 --- a/test_src/main-bigint-test.c +++ b/test_src/main-bigint-test.c @@ -30,7 +30,7 @@ #include "performance_test.h" -char* algo_name = "BigInt"; +char *algo_name = "BigInt"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-blake-test.c b/test_src/main-blake-test.c index c15dad5..941a57a 100644 --- a/test_src/main-blake-test.c +++ b/test_src/main-blake-test.c @@ -34,9 +34,9 @@ #include "nessie_hash_test.h" #include "performance_test.h" -char* algo_name = "Blake"; +char *algo_name = "Blake"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&blake224_desc, (hfdesc_t*)&blake256_desc, (hfdesc_t*)&blake384_desc, @@ -51,19 +51,19 @@ const hfdesc_t* const algolist[] PROGMEM = { void testrun_nessie_blake(void){ hfal_nessie_multiple(algolist); } -void blake224_test(void* msg, uint32_t length_b){ +void blake224_test(void *msg, uint32_t length_b){ hfal_test(&blake224_desc, msg, length_b); } -void blake256_test(void* msg, uint32_t length_b){ +void blake256_test(void *msg, uint32_t length_b){ hfal_test(&blake256_desc, msg, length_b); } -void blake384_test(void* msg, uint32_t length_b){ +void blake384_test(void *msg, uint32_t length_b){ hfal_test(&blake384_desc, msg, length_b); } -void blake512_test(void* msg, uint32_t length_b){ +void blake512_test(void *msg, uint32_t length_b){ hfal_test(&blake512_desc, msg, length_b); } void testrun_stdtest_blake(void){ diff --git a/test_src/main-bmw-test.c b/test_src/main-bmw-test.c index 18d91a6..bfa53bc 100644 --- a/test_src/main-bmw-test.c +++ b/test_src/main-bmw-test.c @@ -35,10 +35,10 @@ #include "hfal-test.h" #include "performance_test.h" -char* algo_name = "BlueMidnightWish"; +char *algo_name = "BlueMidnightWish"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&bmw224_desc, (hfdesc_t*)&bmw256_desc, (hfdesc_t*)&bmw384_desc, @@ -58,18 +58,18 @@ void testrun_nessie_bmw(void){ hfal_nessie_multiple(algolist); } -void bmw224_test(void* msg, uint32_t length_b){ +void bmw224_test(void *msg, uint32_t length_b){ hfal_test(&bmw224_desc, msg, length_b); } -void bmw256_test(void* msg, uint32_t length_b){ +void bmw256_test(void *msg, uint32_t length_b){ hfal_test(&bmw256_desc, msg, length_b); } -void bmw384_test(void* msg, uint32_t length_b){ +void bmw384_test(void *msg, uint32_t length_b){ hfal_test(&bmw384_desc, msg, length_b); } -void bmw512_test(void* msg, uint32_t length_b){ +void bmw512_test(void *msg, uint32_t length_b){ hfal_test(&bmw512_desc, msg, length_b); } @@ -102,8 +102,8 @@ void test507(void){ } void testrun_stdtest_bmw(void){ - char* msg0 = "abc"; - char* msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; + char *msg0 = "abc"; + char *msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; bmw224_test(msg0, strlen(msg0)*8); bmw224_test(msg1, strlen(msg1)*8); bmw256_test(msg0, strlen(msg0)*8); @@ -114,18 +114,18 @@ void testrun_stdtest_bmw(void){ bmw512_test(msg1, strlen(msg1)*8); } -void bmw256_short_test(void* msg, uint32_t length_b){ +void bmw256_short_test(void *msg, uint32_t length_b){ bmw256_test("abc", 3*8); } void testshort(void){ - char* msg0 = "abc"; + char *msg0 = "abc"; bmw224_test(msg0, strlen(msg0)*8); } void testlshort(void){ - char* msg0 = "abc"; + char *msg0 = "abc"; bmw384_test(msg0, strlen(msg0)*8); } diff --git a/test_src/main-camellia-test.c b/test_src/main-camellia-test.c index 39702db..5e1246b 100644 --- a/test_src/main-camellia-test.c +++ b/test_src/main-camellia-test.c @@ -29,9 +29,9 @@ #include "bcal-performance.h" #include "bcal-nessie.h" -char* algo_name = "Camellia"; +char *algo_name = "Camellia"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&camellia128_desc, NULL }; @@ -61,7 +61,7 @@ const uint8_t test_keys[] PROGMEM = { 0xEF, 0xCD, 0xAB, 0x89, 0x67, 0x45, 0x23, 0x01, 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE }; -void hexdump128(void* data){ +void hexdump128(void *data){ uint8_t i; for(i=0; i<16; ++i){ cli_hexdump(data, 1); diff --git a/test_src/main-cast5-test.c b/test_src/main-cast5-test.c index 76af084..d23ba8a 100644 --- a/test_src/main-cast5-test.c +++ b/test_src/main-cast5-test.c @@ -29,9 +29,9 @@ #include "bcal-nessie.h" #include "bcal_cast5.h" -char* algo_name = "cast-128 (cast5)"; +char *algo_name = "cast-128 (cast5)"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&cast5_desc, NULL }; diff --git a/test_src/main-cast6-test.c b/test_src/main-cast6-test.c index 63fd3ca..30d49f8 100644 --- a/test_src/main-cast6-test.c +++ b/test_src/main-cast6-test.c @@ -11,9 +11,9 @@ #include "bcal-nessie.h" #include "bcal_cast6.h" -char* algo_name = "CAST-256"; +char *algo_name = "CAST-256"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&cast6_desc, NULL }; diff --git a/test_src/main-cscipher-test.c b/test_src/main-cscipher-test.c index b8191f7..0e96709 100644 --- a/test_src/main-cscipher-test.c +++ b/test_src/main-cscipher-test.c @@ -29,9 +29,9 @@ #include "bcal-performance.h" #include "bcal_cscipher.h" -char* algo_name = "CS-Cipher"; +char *algo_name = "CS-Cipher"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&cscipher_desc, NULL }; @@ -40,7 +40,7 @@ const bcdesc_t* const algolist[] PROGMEM = { * additional validation-functions * *****************************************************************************/ -void cscipher_init_dummy(const uint8_t* key, uint16_t keysize_b, void* ctx){ +void cscipher_init_dummy(const uint8_t *key, uint16_t keysize_b, void *ctx){ cscipher_init(key, ctx); } diff --git a/test_src/main-cubehash-test.c b/test_src/main-cubehash-test.c index 5014476..0d22e07 100644 --- a/test_src/main-cubehash-test.c +++ b/test_src/main-cubehash-test.c @@ -32,10 +32,10 @@ #include "hfal-performance.h" #include "hfal-test.h" -char* algo_name = "CubeHash"; +char *algo_name = "CubeHash"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&cubehash224_desc, (hfdesc_t*)&cubehash256_desc, (hfdesc_t*)&cubehash384_desc, diff --git a/test_src/main-des-test.c b/test_src/main-des-test.c index d85a830..a8029f7 100644 --- a/test_src/main-des-test.c +++ b/test_src/main-des-test.c @@ -31,9 +31,9 @@ #include "bcal_tdes.h" #include "bcal_tdes2.h" -char* algo_name = "DES"; +char *algo_name = "DES"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&des_desc, (bcdesc_t*)&tdes2_desc, (bcdesc_t*)&tdes_desc, @@ -43,12 +43,12 @@ const bcdesc_t* const algolist[] PROGMEM = { * additional validation-functions * *****************************************************************************/ -void testrun_nessie_des(const char* param){ +void testrun_nessie_des(const char *param){ if(!param){ bcal_nessie_multiple(algolist); }else{ uint8_t i=0; - bcdesc_t* ptr; + bcdesc_t *ptr; for(;;){ ptr = (bcdesc_t*)pgm_read_word(&algolist[i++]); if(ptr == NULL){ diff --git a/test_src/main-dsa-test.c b/test_src/main-dsa-test.c index f3710c0..1c66a93 100644 --- a/test_src/main-dsa-test.c +++ b/test_src/main-dsa-test.c @@ -35,7 +35,7 @@ #include "base64_enc.h" #include "base64_dec.h" -char* algo_name = "DSA"; +char *algo_name = "DSA"; /***************************************************************************** * additional validation-functions * @@ -47,7 +47,7 @@ void load_fix_dsa(void){ load_dsa_key_blob(&dsa_ctx); } -void dsa_print_item(bigint_t* a, PGM_P pstr){ +void dsa_print_item(bigint_t *a, PGM_P pstr){ uint8_t *p; cli_putstr_P(PSTR("\r\n")); cli_putstr_P(pstr); @@ -68,7 +68,7 @@ void dsa_print_item(bigint_t* a, PGM_P pstr){ cli_hexdump(p, 1); } -void dsa_print_signature_b64(dsa_signature_t* s){ +void dsa_print_signature_b64(dsa_signature_t *s){ uint16_t size_r, size_s, size_o, i,j; size_r = s->r.length_W +2; size_s = s->s.length_W +2; @@ -92,7 +92,7 @@ void dsa_print_signature_b64(dsa_signature_t* s){ cli_putstr(b64_b); } -void dsa_print_ctx(dsa_ctx_t* ctx){ +void dsa_print_ctx(dsa_ctx_t *ctx){ dsa_print_item(&(ctx->priv), PSTR("private")); dsa_print_item(&(ctx->pub), PSTR("public")); dsa_print_item(&(ctx->domain.p), PSTR("P")); @@ -100,7 +100,7 @@ void dsa_print_ctx(dsa_ctx_t* ctx){ dsa_print_item(&(ctx->domain.g), PSTR("G")); } -void dsa_print_signature(const dsa_signature_t* sig){ +void dsa_print_signature(const dsa_signature_t *sig){ cli_putstr_P(PSTR("\r\nDSA-Signature:\r\n r:")); bigint_print_hex(&(sig->r)); cli_putstr_P(PSTR("\r\n s:")); diff --git a/test_src/main-ecdsa-test.c b/test_src/main-ecdsa-test.c index f5b0db3..7aa1e30 100644 --- a/test_src/main-ecdsa-test.c +++ b/test_src/main-ecdsa-test.c @@ -45,7 +45,7 @@ #include "base64_enc.h" #include "base64_dec.h" -char* algo_name = "ECDSA"; +char *algo_name = "ECDSA"; /***************************************************************************** * additional validation-functions * @@ -95,7 +95,7 @@ uint8_t convert_hex_to_byte(char a, char b){ return (convert_hexchar_to_value(a) << 4) | convert_hexchar_to_value(b); } -void *hash_message(hfdesc_t* hash_function){ +void *hash_message(hfdesc_t *hash_function){ uint8_t *block, *hash_value; uint16_t index = 0; hfgen_ctx_t ctx; @@ -642,7 +642,7 @@ const uint8_t ecdsa_test_1_k[] PROGMEM = { 0x83, 0x07, 0xa1, 0x43, 0x70, 0xbc, 0x0a, 0xcb }; -void hash_mem_P(const hfdesc_t* hfdesc, void* dest, const void* msg, uint16_t msg_len_b){ +void hash_mem_P(const hfdesc_t *hfdesc, void *dest, const void *msg, uint16_t msg_len_b){ uint16_t blocksize = hfal_hash_getBlocksize(hfdesc); uint8_t block[blocksize / 8]; hfgen_ctx_t ctx; diff --git a/test_src/main-echo-test.c b/test_src/main-echo-test.c index ff2d7a3..878946f 100644 --- a/test_src/main-echo-test.c +++ b/test_src/main-echo-test.c @@ -32,10 +32,10 @@ #include "hfal-performance.h" #include "hfal-test.h" -char* algo_name = "Echo"; +char *algo_name = "Echo"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&echo224_desc, (hfdesc_t*)&echo256_desc, (hfdesc_t*)&echo384_desc, diff --git a/test_src/main-entropium-test.c b/test_src/main-entropium-test.c index 687f40b..812d213 100644 --- a/test_src/main-entropium-test.c +++ b/test_src/main-entropium-test.c @@ -27,7 +27,7 @@ #include "nessie_bc_test.h" #include "performance_test.h" -char* algo_name = "Entropium"; +char *algo_name = "Entropium"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-grain-test.c b/test_src/main-grain-test.c index 99ab493..3e8bd7a 100644 --- a/test_src/main-grain-test.c +++ b/test_src/main-grain-test.c @@ -29,17 +29,17 @@ #include "scal-nessie.h" #include "performance_test.h" -char* algo_name = "Grain"; +char *algo_name = "Grain"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void grain_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){ +void grain_genctx_dummy(uint8_t *key, uint16_t keysize_b, void *ctx){ uint8_t iv[8]={0}; grain_init(key, &iv, ctx); } -uint8_t grain_getbyte_dummy(grain_ctx_t* ctx){ +uint8_t grain_getbyte_dummy(grain_ctx_t *ctx){ uint8_t i,ret=0; for(i=0; i<8; ++i){ ret<<=1; @@ -48,7 +48,7 @@ uint8_t grain_getbyte_dummy(grain_ctx_t* ctx){ return ret; } -uint8_t grain_getbyte_dummy_rev(grain_ctx_t* ctx){ +uint8_t grain_getbyte_dummy_rev(grain_ctx_t *ctx){ uint8_t i,ret=0; for(i=0; i<8; ++i){ ret >>= 1; diff --git a/test_src/main-groestl-test.c b/test_src/main-groestl-test.c index 0c7b0b3..4122e33 100644 --- a/test_src/main-groestl-test.c +++ b/test_src/main-groestl-test.c @@ -34,10 +34,10 @@ #include "nessie_hash_test.h" #include "performance_test.h" -char* algo_name = "Groestl"; +char *algo_name = "Groestl"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&groestl224_desc, (hfdesc_t*)&groestl256_desc, (hfdesc_t*)&groestl384_desc, @@ -52,19 +52,19 @@ const hfdesc_t* const algolist[] PROGMEM = { void testrun_nessie_groestl(void){ hfal_nessie_multiple(algolist); } -void groestl224_test(void* msg, uint32_t length_b){ +void groestl224_test(void *msg, uint32_t length_b){ hfal_test(&groestl224_desc, msg, length_b); } -void groestl256_test(void* msg, uint32_t length_b){ +void groestl256_test(void *msg, uint32_t length_b){ hfal_test(&groestl256_desc, msg, length_b); } -void groestl384_test(void* msg, uint32_t length_b){ +void groestl384_test(void *msg, uint32_t length_b){ hfal_test(&groestl384_desc, msg, length_b); } -void groestl512_test(void* msg, uint32_t length_b){ +void groestl512_test(void *msg, uint32_t length_b){ hfal_test(&groestl512_desc, msg, length_b); } diff --git a/test_src/main-hmac-md5-test.c b/test_src/main-hmac-md5-test.c index 410592c..d5d6d3d 100644 --- a/test_src/main-hmac-md5-test.c +++ b/test_src/main-hmac-md5-test.c @@ -27,7 +27,7 @@ #include "hmac-md5.h" #include "nessie_mac_test.h" -char* algo_name = "HMAC-MD5"; +char *algo_name = "HMAC-MD5"; /***************************************************************************** * additional validation-functions * @@ -87,7 +87,7 @@ void hmacmd5_interactive(void){ cli_hexdump(hmac, HMAC_MD5_BYTES); } -void strhexdump(char* dest, void* src, uint16_t length){ +void strhexdump(char *dest, void *src, uint16_t length){ char table[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', diff --git a/test_src/main-hmac-sha1-test.c b/test_src/main-hmac-sha1-test.c index c8e6710..0cf9a1b 100644 --- a/test_src/main-hmac-sha1-test.c +++ b/test_src/main-hmac-sha1-test.c @@ -28,7 +28,7 @@ #include "nessie_mac_test.h" -char* algo_name = "HMAC-SHA1"; +char *algo_name = "HMAC-SHA1"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-hmac-sha256-test.c b/test_src/main-hmac-sha256-test.c index 3e7f51e..1aad966 100644 --- a/test_src/main-hmac-sha256-test.c +++ b/test_src/main-hmac-sha256-test.c @@ -28,7 +28,7 @@ #include "nessie_mac_test.h" -char* algo_name = "HMAC-SHA256"; +char *algo_name = "HMAC-SHA256"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-jh-test.c b/test_src/main-jh-test.c index f29a696..a54e913 100644 --- a/test_src/main-jh-test.c +++ b/test_src/main-jh-test.c @@ -32,10 +32,10 @@ #include "nessie_hash_test.h" #include "performance_test.h" -char* algo_name = "JH"; +char *algo_name = "JH"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&jh224_desc, (hfdesc_t*)&jh256_desc, (hfdesc_t*)&jh384_desc, diff --git a/test_src/main-keccak-test.c b/test_src/main-keccak-test.c index 127cb62..ab5f9a2 100644 --- a/test_src/main-keccak-test.c +++ b/test_src/main-keccak-test.c @@ -32,10 +32,10 @@ #include "hfal-performance.h" #include "hfal-test.h" -char* algo_name = "Keccak"; +char *algo_name = "Keccak"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&keccak224_desc, (hfdesc_t*)&keccak256_desc, (hfdesc_t*)&keccak384_desc, diff --git a/test_src/main-khazad-test.c b/test_src/main-khazad-test.c index 859e715..84e6086 100644 --- a/test_src/main-khazad-test.c +++ b/test_src/main-khazad-test.c @@ -28,9 +28,9 @@ #include "bcal-nessie.h" #include "bcal_khazad.h" -char* algo_name = "Khazad"; +char *algo_name = "Khazad"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&khazad_desc, NULL }; diff --git a/test_src/main-md5-test.c b/test_src/main-md5-test.c index a4054c9..afb0ab0 100644 --- a/test_src/main-md5-test.c +++ b/test_src/main-md5-test.c @@ -29,9 +29,9 @@ #include "hfal_md5.h" #include "hfal-performance.h" -char* algo_name = "MD5"; +char *algo_name = "MD5"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&md5_desc, NULL }; @@ -40,7 +40,7 @@ const hfdesc_t* const algolist[] PROGMEM = { * additional validation-functions * *****************************************************************************/ -void md5_ctx2hash_dummy(void* buffer, void* ctx){ +void md5_ctx2hash_dummy(void *buffer, void *ctx){ memcpy(buffer, ctx, 16); } @@ -77,7 +77,7 @@ void testrun_nessie_md5(void){ void testrun_md5(void){ md5_hash_t hash; - char* testv[]={ + char *testv[]={ "", "a", "abc", diff --git a/test_src/main-mickey128-test.c b/test_src/main-mickey128-test.c index 927680a..1da8b4d 100644 --- a/test_src/main-mickey128-test.c +++ b/test_src/main-mickey128-test.c @@ -11,7 +11,7 @@ #include "scal-basic.h" #include "scal-nessie.h" -char* algo_name = "Mickey128"; +char *algo_name = "Mickey128"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-mqq160-sign-test.c b/test_src/main-mqq160-sign-test.c index 56c168e..5e889d5 100644 --- a/test_src/main-mqq160-sign-test.c +++ b/test_src/main-mqq160-sign-test.c @@ -29,7 +29,7 @@ #include "performance_test.h" #include "stack_measuring.h" -char* algo_name = "MQQ160-sign"; +char *algo_name = "MQQ160-sign"; /***************************************************************************** diff --git a/test_src/main-mugi-test.c b/test_src/main-mugi-test.c index a741cc0..2f1a213 100644 --- a/test_src/main-mugi-test.c +++ b/test_src/main-mugi-test.c @@ -27,7 +27,7 @@ #include "nessie_stream_test.h" #include "performance_test.h" -char* algo_name = "MUGI"; +char *algo_name = "MUGI"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-noekeon-test.c b/test_src/main-noekeon-test.c index 95664b0..99362ed 100644 --- a/test_src/main-noekeon-test.c +++ b/test_src/main-noekeon-test.c @@ -29,9 +29,9 @@ #include "bcal-performance.h" #include "bcal_noekeon.h" -char* algo_name = "Noekeon"; +char *algo_name = "Noekeon"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&noekeon_direct_desc, (bcdesc_t*)&noekeon_indirect_desc, NULL @@ -45,7 +45,7 @@ void testrun_nessie_noekeon(void){ } -void testrun_stdtest_rundirect(void* data, void* key){ +void testrun_stdtest_rundirect(void *data, void *key){ cli_putstr_P(PSTR("\r\n ")); cli_putstr_P(PSTR("k = ")); cli_hexdump(key,16); @@ -64,7 +64,7 @@ void testrun_stdtest_rundirect(void* data, void* key){ cli_putstr_P(PSTR("\r\n")); } -void testrun_stdtest_runindirect(void* data, void* key){ +void testrun_stdtest_runindirect(void *data, void *key){ noekeon_ctx_t ctx; cli_putstr_P(PSTR("\r\n ")); cli_putstr_P(PSTR("k = ")); diff --git a/test_src/main-omac-noekeon-test.c b/test_src/main-omac-noekeon-test.c index fae8b35..503c886 100644 --- a/test_src/main-omac-noekeon-test.c +++ b/test_src/main-omac-noekeon-test.c @@ -29,13 +29,13 @@ #include "nessie_mac_test.h" #include "performance_test.h" -char* algo_name = "OMAC-Noekeon"; +char *algo_name = "OMAC-Noekeon"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void test_mac(void* key, void* data, uint16_t datalength_b){ +void test_mac(void *key, void *data, uint16_t datalength_b){ uint8_t mac[16]; cli_putstr_P(PSTR("\r\n-----------\r\n msg length (bit): 0x")); cli_hexdump(((uint8_t*)&datalength_b)+1, 1); @@ -64,16 +64,16 @@ void testrun_test_omac_noekeon(void){ uint8_t stat_key[16]; -void omac_noekeon_next_dummy(void* ctx, const void* buffer){ +void omac_noekeon_next_dummy(void *ctx, const void *buffer){ omac_noekeon_next(buffer, stat_key, ctx); } -void omac_noekeon_init_dummy(void* ctx, const void* key, uint16_t keysize_b){ +void omac_noekeon_init_dummy(void *ctx, const void *key, uint16_t keysize_b){ omac_noekeon_init(ctx); memcpy(stat_key, key, 16); } -void omac_noekeon_last_dummy(void* ctx, const void* buffer, uint16_t size_b){ +void omac_noekeon_last_dummy(void *ctx, const void *buffer, uint16_t size_b){ while(size_b>128){ omac_noekeon_next(buffer, stat_key, ctx); size_b -= 128; @@ -82,7 +82,7 @@ void omac_noekeon_last_dummy(void* ctx, const void* buffer, uint16_t size_b){ omac_noekeon_last(buffer, size_b, stat_key, ctx); } -void omac_noekeon_conv_dummy(void* buffer, void* ctx){ +void omac_noekeon_conv_dummy(void *buffer, void *ctx){ memcpy(buffer, ctx, 16); } diff --git a/test_src/main-present-test.c b/test_src/main-present-test.c index bd20b1e..226fcf7 100644 --- a/test_src/main-present-test.c +++ b/test_src/main-present-test.c @@ -31,9 +31,9 @@ #include "bcal_present80.h" #include "bcal_present128.h" -char* algo_name = "Present"; +char *algo_name = "Present"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&present80_desc, (bcdesc_t*)&present128_desc, NULL @@ -45,7 +45,7 @@ void testrun_nessie_present(void){ bcal_nessie_multiple(algolist); } -void testrun_selfenc(uint8_t* key, uint8_t* buffer){ +void testrun_selfenc(uint8_t *key, uint8_t *buffer){ present80_ctx_t ctx; cli_putstr_P(PSTR("\r\nkey : ")); @@ -62,7 +62,7 @@ void testrun_selfenc(uint8_t* key, uint8_t* buffer){ cli_putstr_P(PSTR("\r\n")); } -void testrun_selfenc_128(uint8_t* key, uint8_t* buffer){ +void testrun_selfenc_128(uint8_t *key, uint8_t *buffer){ present128_ctx_t ctx; cli_putstr_P(PSTR("\r\nkey : ")); @@ -78,7 +78,7 @@ void testrun_selfenc_128(uint8_t* key, uint8_t* buffer){ cli_hexdump(buffer, 8); cli_putstr_P(PSTR("\r\n")); } -// void present_key_test(const uint8_t* key); +// void present_key_test(const uint8_t *key); void testrun_self_present(void){ diff --git a/test_src/main-rabbit-test.c b/test_src/main-rabbit-test.c index 4f66c66..46ee61c 100644 --- a/test_src/main-rabbit-test.c +++ b/test_src/main-rabbit-test.c @@ -26,13 +26,13 @@ #include "scal-basic.h" #include "scal-nessie.h" -const char* algo_name = "Rabbit"; +const char *algo_name = "Rabbit"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void test_vector(void* key, void* iv, const void* ref){ +void test_vector(void *key, void *iv, const void *ref){ rabbit_ctx_t ctx; uint8_t fail=0; cli_putstr_P(PSTR("\r\n testing with\r\n key: ")); diff --git a/test_src/main-rc5-test.c b/test_src/main-rc5-test.c index 827a966..23e183c 100644 --- a/test_src/main-rc5-test.c +++ b/test_src/main-rc5-test.c @@ -30,9 +30,9 @@ #include "bcal_rc5.h" #define RC5_ROUNDS 12 -char* algo_name = "RC5-32/12/16"; +char *algo_name = "RC5-32/12/16"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&rc5_desc, NULL }; @@ -40,7 +40,7 @@ const bcdesc_t* const algolist[] PROGMEM = { /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void rc5_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){ +void rc5_genctx_dummy(uint8_t *key, uint16_t keysize_b, void *ctx){ rc5_init(key, keysize_b, RC5_ROUNDS, ctx); } diff --git a/test_src/main-rc6-test.c b/test_src/main-rc6-test.c index f486ee3..41fb19b 100644 --- a/test_src/main-rc6-test.c +++ b/test_src/main-rc6-test.c @@ -30,16 +30,16 @@ #include "bcal_rc6.h" #define RC6_ROUNDS 20 -char* algo_name = "RC6-32/20/16"; +char *algo_name = "RC6-32/20/16"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&rc6_desc, NULL }; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void rc6_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){ +void rc6_genctx_dummy(uint8_t *key, uint16_t keysize_b, void *ctx){ rc6_initl(key, keysize_b, RC6_ROUNDS, ctx); } diff --git a/test_src/main-rsaes_oaep-test.c b/test_src/main-rsaes_oaep-test.c index 5f86ec2..9d6ad40 100644 --- a/test_src/main-rsaes_oaep-test.c +++ b/test_src/main-rsaes_oaep-test.c @@ -32,7 +32,7 @@ #include "performance_test.h" -const char* algo_name = "RSAES-OAEP"; +const char *algo_name = "RSAES-OAEP"; #define BIGINT_CEIL(x) ((((x) + sizeof(bigint_word_t) - 1) / sizeof(bigint_word_t)) * sizeof(bigint_word_t)) #define BIGINT_OFF(x) ((sizeof(bigint_word_t) - (x) % sizeof(bigint_word_t)) % sizeof(bigint_word_t)) @@ -356,7 +356,7 @@ uint8_t convert_nibble(uint8_t c){ const char *block_ignore_string=" \t\r\n,;"; #define BUFFER_LIMIT 120 -uint16_t read_os(void* dst, uint16_t length, const char* ignore_string){ +uint16_t read_os(void *dst, uint16_t length, const char *ignore_string){ uint16_t counter = 0; uint16_t c; uint8_t v, tmp = 0, idx = 0; @@ -389,7 +389,7 @@ uint16_t read_os(void* dst, uint16_t length, const char* ignore_string){ return counter; } -uint16_t own_atou(const char* str){ +uint16_t own_atou(const char *str){ uint16_t r=0; while(*str && *str >= '0' && *str <= '9'){ r *= 10; @@ -398,7 +398,7 @@ uint16_t own_atou(const char* str){ return r; } -uint8_t read_bigint(bigint_t* a, char* prompt){ +uint8_t read_bigint(bigint_t *a, char *prompt){ uint16_t read_length, actual_length; uint8_t off; uint8_t *buffer; @@ -490,7 +490,7 @@ uint8_t read_key_conv(void){ return r; } -uint8_t load_bigint_from_os(bigint_t* a, PGM_VOID_P os, uint16_t length_B){ +uint8_t load_bigint_from_os(bigint_t *a, PGM_VOID_P os, uint16_t length_B){ a->length_W = BIGINT_CEIL(length_B) / sizeof(bigint_word_t); a->wordv = malloc(BIGINT_CEIL(length_B)); if(!a->wordv){ diff --git a/test_src/main-rsaes_pkcs1v15-test.c b/test_src/main-rsaes_pkcs1v15-test.c index 268c120..8933b02 100644 --- a/test_src/main-rsaes_pkcs1v15-test.c +++ b/test_src/main-rsaes_pkcs1v15-test.c @@ -34,7 +34,7 @@ #define DEBUG 1 -const char* algo_name = "RSAES-PKCS1V15"; +const char *algo_name = "RSAES-PKCS1V15"; #define BIGINT_CEIL(x) ((((x) + sizeof(bigint_word_t) - 1) / sizeof(bigint_word_t)) * sizeof(bigint_word_t)) #define BIGINT_OFF(x) ((sizeof(bigint_word_t) - (x) % sizeof(bigint_word_t)) % sizeof(bigint_word_t)) @@ -174,7 +174,7 @@ uint8_t convert_nibble(uint8_t c){ const char *block_ignore_string=" \t\r\n,;"; #define BUFFER_LIMIT 120 -uint16_t read_os(void* dst, uint16_t length, const char* ignore_string){ +uint16_t read_os(void *dst, uint16_t length, const char *ignore_string){ uint16_t counter = 0; uint16_t c; uint8_t v, tmp = 0, idx = 0; @@ -207,7 +207,7 @@ uint16_t read_os(void* dst, uint16_t length, const char* ignore_string){ return counter; } -uint16_t own_atou(const char* str){ +uint16_t own_atou(const char *str){ uint16_t r=0; while(*str && *str >= '0' && *str <= '9'){ r *= 10; @@ -216,7 +216,7 @@ uint16_t own_atou(const char* str){ return r; } -uint8_t read_bigint(bigint_t* a, char* prompt){ +uint8_t read_bigint(bigint_t *a, char *prompt){ uint16_t read_length, actual_length; uint8_t off; uint8_t *buffer; @@ -308,7 +308,7 @@ uint8_t read_key_conv(void){ return r; } -uint8_t load_bigint_from_os(bigint_t* a, PGM_VOID_P os, uint16_t length_B){ +uint8_t load_bigint_from_os(bigint_t *a, PGM_VOID_P os, uint16_t length_B){ a->length_W = BIGINT_CEIL(length_B) / sizeof(bigint_word_t); a->wordv = malloc(BIGINT_CEIL(length_B)); if(!a->wordv){ @@ -521,7 +521,7 @@ void load_priv_crt_mono(void){ } } -uint8_t load_bigint_from_os(bigint_t* a, PGM_VOID_P os, uint16_t length_B){ +uint8_t load_bigint_from_os(bigint_t *a, PGM_VOID_P os, uint16_t length_B){ a->length_W = BIGINT_CEIL(length_B) / sizeof(bigint_word_t); a->wordv = malloc(BIGINT_CEIL(length_B)); if(!a->wordv){ diff --git a/test_src/main-salsa20-test.c b/test_src/main-salsa20-test.c index fda3cf9..e3ad827 100644 --- a/test_src/main-salsa20-test.c +++ b/test_src/main-salsa20-test.c @@ -27,7 +27,7 @@ #include "scal-basic.h" #include "scal-nessie.h" -char* algo_name = "Salsa20"; +char *algo_name = "Salsa20"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-seed-test.c b/test_src/main-seed-test.c index d8a4ec2..ca9dbb9 100644 --- a/test_src/main-seed-test.c +++ b/test_src/main-seed-test.c @@ -36,16 +36,16 @@ #include "bcal-nessie.h" #include "bcal_seed.h" -char* algo_name = "Seed"; +char *algo_name = "Seed"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&seed_desc, NULL }; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void seed_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){ +void seed_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){ seed_init(key, ctx); } @@ -62,7 +62,7 @@ void testrun_performance_seed(void){ * self tests * *****************************************************************************/ -void testencrypt(uint8_t* block, uint8_t* key){ +void testencrypt(uint8_t *block, uint8_t *key){ seed_ctx_t ctx; cli_putstr("\r\n==testy-encrypt==\r\n key: "); cli_hexdump(key,16); @@ -74,7 +74,7 @@ void testencrypt(uint8_t* block, uint8_t* key){ cli_hexdump(block,16); } -void testdecrypt(uint8_t* block, uint8_t* key){ +void testdecrypt(uint8_t *block, uint8_t *key){ seed_ctx_t ctx; cli_putstr("\r\n==testy-decrypt==\r\n key: "); cli_hexdump(key,16); diff --git a/test_src/main-serpent-test.c b/test_src/main-serpent-test.c index 14d7b07..7cbf151 100644 --- a/test_src/main-serpent-test.c +++ b/test_src/main-serpent-test.c @@ -30,9 +30,9 @@ #include "bcal-nessie.h" #include "bcal_serpent.h" -char* algo_name = "Serpent"; +char *algo_name = "Serpent"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&serpent_desc, NULL }; @@ -40,7 +40,7 @@ const bcdesc_t* const algolist[] PROGMEM = { /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void serpent_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){ +void serpent_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){ serpent_init(key, keysize&0xff, ctx); } diff --git a/test_src/main-sha1-test.c b/test_src/main-sha1-test.c index 53ca357..95e003c 100644 --- a/test_src/main-sha1-test.c +++ b/test_src/main-sha1-test.c @@ -33,9 +33,9 @@ #include "hfal_sha1.h" #include "dump.h" -char* algo_name = "SHA-1"; +char *algo_name = "SHA-1"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&sha1_desc, NULL }; diff --git a/test_src/main-sha2-test.c b/test_src/main-sha2-test.c index 7b320c4..e86af0b 100644 --- a/test_src/main-sha2-test.c +++ b/test_src/main-sha2-test.c @@ -40,9 +40,9 @@ #include "sha512.h" #include "hfal_sha512.h" -const char* algo_name = "SHA-2"; +const char *algo_name = "SHA-2"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&sha224_desc, (hfdesc_t*)&sha256_desc, (hfdesc_t*)&sha384_desc, diff --git a/test_src/main-sha256-test.c b/test_src/main-sha256-test.c index 0aac309..d618286 100644 --- a/test_src/main-sha256-test.c +++ b/test_src/main-sha256-test.c @@ -35,9 +35,9 @@ #include "dump.h" -char* algo_name = "SHA-256"; +char *algo_name = "SHA-256"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&sha256_desc, NULL }; diff --git a/test_src/main-shabal-test.c b/test_src/main-shabal-test.c index 638f5b7..3140b76 100644 --- a/test_src/main-shabal-test.c +++ b/test_src/main-shabal-test.c @@ -33,9 +33,9 @@ #include "nessie_hash_test.h" #include "performance_test.h" -char* algo_name = "Shabal"; +char *algo_name = "Shabal"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&shabal192_desc, (hfdesc_t*)&shabal224_desc, (hfdesc_t*)&shabal256_desc, @@ -47,23 +47,23 @@ const hfdesc_t* const algolist[] PROGMEM = { /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void testrun_stdtest_shabal192(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal192(void *msg, uint16_t size_b){ hfal_test(&shabal192_desc, msg, size_b); } -void testrun_stdtest_shabal224(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal224(void *msg, uint16_t size_b){ hfal_test(&shabal224_desc, msg, size_b); } -void testrun_stdtest_shabal256(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal256(void *msg, uint16_t size_b){ hfal_test(&shabal256_desc, msg, size_b); } -void testrun_stdtest_shabal384(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal384(void *msg, uint16_t size_b){ hfal_test(&shabal384_desc, msg, size_b); } -void testrun_stdtest_shabal512(void* msg, uint16_t size_b){ +void testrun_stdtest_shabal512(void *msg, uint16_t size_b){ hfal_test(&shabal512_desc, msg, size_b); } @@ -94,9 +94,9 @@ void testshort(void){ testrun_stdtest_shabal192(ma, 64*8); } -void shabal_ctx_dump(shabal_ctx_t* ctx){ +void shabal_ctx_dump(shabal_ctx_t *ctx){ uint8_t i; - void* p; + void *p; cli_putstr_P(PSTR("\r\n=== shabal ctx dump ===\r\n size = ")); i=sizeof(shabal_ctx_t); if(i>=100) diff --git a/test_src/main-shabea-test.c b/test_src/main-shabea-test.c index 471881e..d35a29c 100644 --- a/test_src/main-shabea-test.c +++ b/test_src/main-shabea-test.c @@ -32,20 +32,20 @@ #include "nessie_bc_test.h" #include "performance_test.h" -char* algo_name = "Shabea"; +char *algo_name = "Shabea"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void shabea_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){ +void shabea_genctx_dummy(uint8_t *key, uint16_t keysize_b, void *ctx){ memcpy(ctx, key, (keysize_b+7)/8); } -void shabea_enc_dummy(void* buffer, void* ctx){ +void shabea_enc_dummy(void *buffer, void *ctx){ shabea256(buffer, ctx, 256, 1, 16); } -void shabea_dec_dummy(void* buffer, void* ctx){ +void shabea_dec_dummy(void *buffer, void *ctx){ shabea256(buffer, ctx, 256, 0, 16); } @@ -96,7 +96,7 @@ void testrun_performance_shabea(void){ * self tests * *****************************************************************************/ -void testencrypt(uint8_t* block, uint8_t* key){ +void testencrypt(uint8_t *block, uint8_t *key){ cli_putstr("\r\n==testy-encrypt==\r\n key: "); cli_hexdump(key,16); cli_putstr("\r\n plain: "); @@ -106,7 +106,7 @@ void testencrypt(uint8_t* block, uint8_t* key){ cli_hexdump(block,32); } -void testdecrypt(uint8_t* block, uint8_t* key){ +void testdecrypt(uint8_t *block, uint8_t *key){ cli_putstr("\r\n==testy-decrypt==\r\n key: "); cli_hexdump(key,16); diff --git a/test_src/main-shacal1_enc-test.c b/test_src/main-shacal1_enc-test.c index e3267b5..464c7e1 100644 --- a/test_src/main-shacal1_enc-test.c +++ b/test_src/main-shacal1_enc-test.c @@ -27,16 +27,16 @@ #include "nessie_bc_test.h" #include "performance_test.h" -char* algo_name = "Shacal1 encryption only"; +char *algo_name = "Shacal1 encryption only"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void shacal1_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){ +void shacal1_genctx_dummy(uint8_t *key, uint16_t keysize_b, void *ctx){ memcpy(ctx, key, (keysize_b+7)/8); } -void shacal1_enc_dummy(void* buffer, void* ctx){ +void shacal1_enc_dummy(void *buffer, void *ctx){ shacal1_enc(buffer, ctx, 512); } diff --git a/test_src/main-shacal2_enc-test.c b/test_src/main-shacal2_enc-test.c index bf631eb..58e77d4 100644 --- a/test_src/main-shacal2_enc-test.c +++ b/test_src/main-shacal2_enc-test.c @@ -27,16 +27,16 @@ #include "nessie_bc_test.h" #include "performance_test.h" -char* algo_name = "Shacal2 encryption only"; +char *algo_name = "Shacal2 encryption only"; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void shacal2_genctx_dummy(uint8_t* key, uint16_t keysize_b, void* ctx){ +void shacal2_genctx_dummy(uint8_t *key, uint16_t keysize_b, void *ctx){ memcpy(ctx, key, (keysize_b+7)/8); } -void shacal2_enc_dummy(void* buffer, void* ctx){ +void shacal2_enc_dummy(void *buffer, void *ctx){ shacal2_enc(buffer, ctx, SHACAL2_KEYSIZE); } diff --git a/test_src/main-skein-test.c b/test_src/main-skein-test.c index e38bf87..7cd7c0d 100644 --- a/test_src/main-skein-test.c +++ b/test_src/main-skein-test.c @@ -34,9 +34,9 @@ #include "hfal-nessie.h" #include "hfal-basic.h" -char* algo_name = "Skein"; +char *algo_name = "Skein"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&skein256_128_desc, (hfdesc_t*)&skein256_160_desc, (hfdesc_t*)&skein256_224_desc, @@ -181,7 +181,7 @@ void zeromsg_test_skein(uint16_t outsize_b){ cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16); } -void zeromsg_test_common(char* p){ +void zeromsg_test_common(char *p){ uint8_t i; uint16_t s=0; uint16_t sizes[]={128, 160, 224, 256, 384, 512, 1024}; diff --git a/test_src/main-skipjack-test.c b/test_src/main-skipjack-test.c index 0d2fe02..b39eee4 100644 --- a/test_src/main-skipjack-test.c +++ b/test_src/main-skipjack-test.c @@ -30,16 +30,16 @@ #include "bcal-nessie.h" #include "bcal_skipjack.h" -char* algo_name = "Skipjack"; +char *algo_name = "Skipjack"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&skipjack_desc, NULL }; /***************************************************************************** * additional validation-functions * *****************************************************************************/ -void skipjack_genctx_dummy(uint8_t* key, uint16_t keysize, void* ctx){ +void skipjack_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){ memcpy(ctx, key, 10); } @@ -52,7 +52,7 @@ void testrun_performance_skipjack(void){ bcal_performance_multiple(algolist); } -int test_enc(const void* buffer, void* key){ +int test_enc(const void *buffer, void *key){ uint8_t data[8]; int r; memcpy(data, buffer, 8); @@ -104,7 +104,7 @@ void testrun_nist_vectors(void){ * self tests * *****************************************************************************/ -void testencrypt(uint8_t* block, uint8_t* key){ +void testencrypt(uint8_t *block, uint8_t *key){ cli_putstr("\r\n==testy-encrypt==\r\n key: "); cli_hexdump(key,10); cli_putstr("\r\n plain: "); @@ -114,7 +114,7 @@ void testencrypt(uint8_t* block, uint8_t* key){ cli_hexdump(block,8); } -void testdecrypt(uint8_t* block, uint8_t* key){ +void testdecrypt(uint8_t *block, uint8_t *key){ cli_putstr("\r\n==testy-decrypt==\r\n key: "); cli_hexdump(key,10); cli_putstr("\r\n crypt: "); diff --git a/test_src/main-tdes-test.c b/test_src/main-tdes-test.c index e26cc91..29435b9 100644 --- a/test_src/main-tdes-test.c +++ b/test_src/main-tdes-test.c @@ -30,9 +30,9 @@ #include "bcal_tdes.h" #include "bcal_tdes2.h" -char* algo_name = "TDES"; +char *algo_name = "TDES"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&tdes_desc, (bcdesc_t*)&tdes2_desc, NULL diff --git a/test_src/main-test-common.c b/test_src/main-test-common.c index f5aed4a..2e1be81 100644 --- a/test_src/main-test-common.c +++ b/test_src/main-test-common.c @@ -20,7 +20,7 @@ #include "main-test-common.h" static -int std_stream_put(char c, FILE* f){ +int std_stream_put(char c, FILE *f){ static uint8_t did_r = 0; if(!did_r && c == '\n'){ uart0_putc('\r'); @@ -31,7 +31,7 @@ int std_stream_put(char c, FILE* f){ } static -int std_stream_get(FILE* f){ +int std_stream_get(FILE *f){ return (int)uart0_getc(); } @@ -42,7 +42,7 @@ void main_setup(void){ fdevopen(std_stream_put, std_stream_get); } -void welcome_msg(const char* algoname){ +void welcome_msg(const char *algoname){ /* cli_putstr_P(PSTR("\r\n\r\nAVR-Crypto-Lib VS (")); cli_putstr(algoname); diff --git a/test_src/main-test-common.h b/test_src/main-test-common.h index 9c65523..d1e4cbd 100644 --- a/test_src/main-test-common.h +++ b/test_src/main-test-common.h @@ -33,6 +33,6 @@ #include void main_setup(void); -void welcome_msg(const char* algoname); +void welcome_msg(const char *algoname); #endif /* MAINTESTCOMMON_H_ */ diff --git a/test_src/main-threefish-test.c b/test_src/main-threefish-test.c index a1e0a63..5dea4b7 100644 --- a/test_src/main-threefish-test.c +++ b/test_src/main-threefish-test.c @@ -32,9 +32,9 @@ #include "bcal_threefish512.h" #include "bcal_threefish1024.h" -char* algo_name = "Threefish"; +char *algo_name = "Threefish"; -const bcdesc_t* const algolist[] PROGMEM = { +const bcdesc_t *const algolist[] PROGMEM = { (bcdesc_t*)&threefish256_desc, (bcdesc_t*)&threefish512_desc, (bcdesc_t*)&threefish1024_desc, @@ -44,7 +44,7 @@ const bcdesc_t* const algolist[] PROGMEM = { * additional validation-functions * *****************************************************************************/ -void threefish256_dump(threefish256_ctx_t* ctx){ +void threefish256_dump(threefish256_ctx_t *ctx){ uint8_t i; cli_putstr_P(PSTR("\r\n=== ctx dump (256) === \r\n k: ")); for(i=0; i<5; ++i){ diff --git a/test_src/main-trivium-test.c b/test_src/main-trivium-test.c index bee2710..b131830 100644 --- a/test_src/main-trivium-test.c +++ b/test_src/main-trivium-test.c @@ -29,7 +29,7 @@ #include "scal-nessie.h" #include "performance_test.h" -char* algo_name = "Trivium"; +char *algo_name = "Trivium"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-twister-test.c b/test_src/main-twister-test.c index 6e23154..b2f11d7 100644 --- a/test_src/main-twister-test.c +++ b/test_src/main-twister-test.c @@ -37,9 +37,9 @@ #include "hfal-test.h" #include "shavs.h" -char* algo_name = "TWISTER"; +char *algo_name = "TWISTER"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&twister224_desc, (hfdesc_t*)&twister256_desc, (hfdesc_t*)&twister384_desc, @@ -60,27 +60,27 @@ void testrun_nessie_twister(void){ * *****************************************************************************/ -void test_twister224( void* msg, uint32_t length_b){ +void test_twister224( void *msg, uint32_t length_b){ hfal_test(&twister224_desc, msg, length_b); } -void test_twister256( void* msg, uint32_t length_b){ +void test_twister256( void *msg, uint32_t length_b){ hfal_test(&twister256_desc, msg, length_b); } -void test_twister384( void* msg, uint32_t length_b){ +void test_twister384( void *msg, uint32_t length_b){ hfal_test(&twister384_desc, msg, length_b); } -void test_twister512( void* msg, uint32_t length_b){ +void test_twister512( void *msg, uint32_t length_b){ hfal_test(&twister512_desc, msg, length_b); } void testrun_twister(void){ - const hfdesc_t* desc[4] = { &twister224_desc, &twister256_desc, + const hfdesc_t *desc[4] = { &twister224_desc, &twister256_desc, &twister384_desc, &twister512_desc }; uint8_t i,j; - char* testv[]={ + char *testv[]={ "", "a", "abc", diff --git a/test_src/main-ubi-test.c b/test_src/main-ubi-test.c index 435b716..79ba647 100644 --- a/test_src/main-ubi-test.c +++ b/test_src/main-ubi-test.c @@ -26,7 +26,7 @@ #include "ubi.h" #include "performance_test.h" -char* algo_name = "UBI-Threefish"; +char *algo_name = "UBI-Threefish"; /***************************************************************************** * additional validation-functions * diff --git a/test_src/main-whirlpool-0-test.c b/test_src/main-whirlpool-0-test.c index a044ddf..a1811a0 100644 --- a/test_src/main-whirlpool-0-test.c +++ b/test_src/main-whirlpool-0-test.c @@ -33,9 +33,9 @@ #include "hfal_whirlpool_0.h" #include "dump.h" -char* algo_name = "Whirlpool-0"; +char *algo_name = "Whirlpool-0"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&whirlpool_0_desc, NULL }; diff --git a/test_src/main-whirlpool-t-test.c b/test_src/main-whirlpool-t-test.c index 0474039..c85a967 100644 --- a/test_src/main-whirlpool-t-test.c +++ b/test_src/main-whirlpool-t-test.c @@ -34,9 +34,9 @@ #include "hfal_whirlpool_t.h" #include "dump.h" -char* algo_name = "Whirlpool-T"; +char *algo_name = "Whirlpool-T"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&whirlpool_t_desc, NULL }; diff --git a/test_src/main-whirlpool-test.c b/test_src/main-whirlpool-test.c index 4d2978b..1e1cea3 100644 --- a/test_src/main-whirlpool-test.c +++ b/test_src/main-whirlpool-test.c @@ -33,9 +33,9 @@ #include "hfal_whirlpool.h" #include "dump.h" -char* algo_name = "Whirlpool"; +char *algo_name = "Whirlpool"; -const hfdesc_t* const algolist[] PROGMEM = { +const hfdesc_t *const algolist[] PROGMEM = { (hfdesc_t*)&whirlpool_desc, NULL }; diff --git a/test_src/main-xtea-test.c b/test_src/main-xtea-test.c index 26a42a3..2371e1c 100644 --- a/test_src/main-xtea-test.c +++ b/test_src/main-xtea-test.c @@ -31,9 +31,9 @@ #include "bcal-nessie.h" #include "bcal_xtea.h" -char* algo_name = "XTEA"; +char *algo_name = "XTEA"; -const bcdesc_t* const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const algolist[] PROGMEM = { +const bcdesc_t *const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const const algolist[] PROGMEM = { (bcdesc_t*)&xtea_desc, NULL }; diff --git a/test_src/nessie_bc_test.c b/test_src/nessie_bc_test.c index 6d55c57..7959f3f 100644 --- a/test_src/nessie_bc_test.c +++ b/test_src/nessie_bc_test.c @@ -36,12 +36,12 @@ void nessie_bc_init(void){ memset(&nessie_bc_ctx, 0, sizeof(nessie_bc_ctx_t)); } static -void nessie_bc_free(void* ctx){ +void nessie_bc_free(void *ctx){ if(nessie_bc_ctx.cipher_free) nessie_bc_ctx.cipher_free(ctx); } -void nessie_bc_enc(uint8_t* key, uint8_t* pt){ +void nessie_bc_enc(uint8_t *key, uint8_t *pt){ uint8_t ctx[nessie_bc_ctx.ctx_size_B]; uint8_t buffer[nessie_bc_ctx.blocksize_B]; uint16_t i; @@ -76,7 +76,7 @@ void nessie_bc_enc(uint8_t* key, uint8_t* pt){ nessie_bc_free(ctx); } -void nessie_bc_dec(uint8_t* key, uint8_t* ct){ +void nessie_bc_dec(uint8_t *key, uint8_t *ct){ uint8_t ctx[nessie_bc_ctx.ctx_size_B]; uint8_t buffer[nessie_bc_ctx.blocksize_B]; diff --git a/test_src/nessie_bc_test.h b/test_src/nessie_bc_test.h index 350ea4b..0197b0e 100644 --- a/test_src/nessie_bc_test.h +++ b/test_src/nessie_bc_test.h @@ -21,16 +21,16 @@ #include -typedef void (*nessie_bc_gen_fpt)(const uint8_t* key, uint16_t keysize_b, void* ctx); -typedef void (*nessie_bc_free_fpt)(void* ctx); -typedef void (*nessie_bc_enc_fpt)(void* buffer, const void* ctx); -typedef void (*nessie_bc_dec_fpt)(void* buffer, const void* ctx); +typedef void (*nessie_bc_gen_fpt)(const uint8_t *key, uint16_t keysize_b, void *ctx); +typedef void (*nessie_bc_free_fpt)(void *ctx); +typedef void (*nessie_bc_enc_fpt)(void *buffer, const void *ctx); +typedef void (*nessie_bc_dec_fpt)(void *buffer, const void *ctx); typedef struct nessie_bc_ctx_st{ uint16_t keysize_b; uint16_t blocksize_B; uint16_t ctx_size_B; - char* name; + char *name; nessie_bc_gen_fpt cipher_genctx; nessie_bc_free_fpt cipher_free; nessie_bc_enc_fpt cipher_enc; diff --git a/test_src/nessie_common.c b/test_src/nessie_common.c index 4a8cfbc..518a5a7 100644 --- a/test_src/nessie_common.c +++ b/test_src/nessie_common.c @@ -35,7 +35,7 @@ #define nessie_out_file stdout -void nessie_set_output_stream(FILE* out_stream){ +void nessie_set_output_stream(FILE *out_stream){ nessie_out_file = out_stream; } @@ -51,7 +51,7 @@ void nessie_send_alive_a(uint16_t i){ } #endif -void nessie_print_block(uint8_t* block, uint16_t blocksize_bit){ +void nessie_print_block(uint8_t *block, uint16_t blocksize_bit){ uint16_t i; for(i=0; i<(blocksize_bit+7)/8; ++i){ putc(pgm_read_byte(hexdigit_tab_uc_P + ((block[i]) >> 4)), nessie_out_file); @@ -62,7 +62,7 @@ void nessie_print_block(uint8_t* block, uint16_t blocksize_bit){ #define SPACES 31 #define BYTESPERLINE 16 -void nessie_print_item(const char* name, uint8_t* buffer, uint16_t size_B){ +void nessie_print_item(const char *name, uint8_t *buffer, uint16_t size_B){ uint8_t name_len; uint8_t i; name_len = strlen(name); @@ -121,7 +121,7 @@ Key size: 256 bits Block size: 128 bits */ -void nessie_print_header(const char* name, +void nessie_print_header(const char *name, uint16_t keysize_b, uint16_t blocksize_b, uint16_t hashsize_b, diff --git a/test_src/nessie_common.h b/test_src/nessie_common.h index bfbcc1f..7eba1e3 100644 --- a/test_src/nessie_common.h +++ b/test_src/nessie_common.h @@ -57,13 +57,13 @@ void nessie_send_alive_a(uint16_t i); #endif */ -void nessie_set_output_stream(FILE* out_stream); +void nessie_set_output_stream(FILE *out_stream); -void nessie_print_block(uint8_t* block, uint16_t blocksize_bit); -void nessie_print_item(const char* name, uint8_t* buffer, uint16_t size_B); +void nessie_print_block(uint8_t *block, uint16_t blocksize_bit); +void nessie_print_item(const char *name, uint8_t *buffer, uint16_t size_B); void nessie_print_set_vector(uint8_t set, uint16_t vector); void nessie_print_setheader(uint8_t set); -void nessie_print_header(const char* name, +void nessie_print_header(const char *name, uint16_t keysize_b, uint16_t blocksize_b, uint16_t hashsize_b, diff --git a/test_src/nessie_hash_test.c b/test_src/nessie_hash_test.c index f112f4c..d80c70f 100644 --- a/test_src/nessie_hash_test.c +++ b/test_src/nessie_hash_test.c @@ -112,7 +112,7 @@ void one_in512_hash(uint16_t pos){ uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8]; uint8_t block[nessie_hash_ctx.blocksize_B]; uint16_t n=512; - char* tab[8] = { "80", "40", "20", "10", + char *tab[8] = { "80", "40", "20", "10", "08", "04", "02", "01" }; pos&=511; @@ -184,7 +184,7 @@ void nessie_hash_run(void){ nessie_print_header(nessie_hash_ctx.name, 0, 0, nessie_hash_ctx.hashsize_b, 0, 0); /* test set 1 */ - const char* challange_dbz= PSTR( + const char *challange_dbz= PSTR( "\0" "\"\" (empty string)\0" "a\0" diff --git a/test_src/nessie_hash_test.h b/test_src/nessie_hash_test.h index c3bf131..b010129 100644 --- a/test_src/nessie_hash_test.h +++ b/test_src/nessie_hash_test.h @@ -21,17 +21,17 @@ #include -typedef void (*nessie_hash_init_fpt)(void* ctx); -typedef void (*nessie_hash_next_fpt)(void* ctx, const void* buffer); -typedef void (*nessie_hash_last_fpt)(void* ctx, const void* buffer, uint16_t size_b); -typedef void (*nessie_hash_conv_fpt)(void* buffer, void* ctx); +typedef void (*nessie_hash_init_fpt)(void *ctx); +typedef void (*nessie_hash_next_fpt)(void *ctx, const void *buffer); +typedef void (*nessie_hash_last_fpt)(void *ctx, const void *buffer, uint16_t size_b); +typedef void (*nessie_hash_conv_fpt)(void *buffer, void *ctx); typedef struct nessie_hash_ctx_st{ uint16_t hashsize_b; uint16_t blocksize_B; uint16_t ctx_size_B; - char* name; + char *name; nessie_hash_init_fpt hash_init; nessie_hash_next_fpt hash_next; nessie_hash_last_fpt hash_last; diff --git a/test_src/nessie_mac_test.c b/test_src/nessie_mac_test.c index 90f3be6..9c5d2ee 100644 --- a/test_src/nessie_mac_test.c +++ b/test_src/nessie_mac_test.c @@ -50,7 +50,7 @@ const uint8_t keyproto[] PROGMEM = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }; static -void ascii_mac_P(PGM_P data, PGM_P desc, uint8_t* key){ +void ascii_mac_P(PGM_P data, PGM_P desc, uint8_t *key){ uint8_t ctx[nessie_mac_ctx.ctx_size_B]; uint8_t mac[MACSIZE_B]; uint16_t sl; @@ -76,7 +76,7 @@ void ascii_mac_P(PGM_P data, PGM_P desc, uint8_t* key){ // message=1 million times "a" static -void amillion_mac(uint8_t* key){ +void amillion_mac(uint8_t *key){ uint8_t ctx[nessie_mac_ctx.ctx_size_B]; uint8_t mac[MACSIZE_B]; uint8_t block[nessie_mac_ctx.blocksize_B]; @@ -101,7 +101,7 @@ void amillion_mac(uint8_t* key){ static -void zero_mac(uint16_t n, uint8_t* key){ +void zero_mac(uint16_t n, uint8_t *key){ uint8_t ctx[nessie_mac_ctx.ctx_size_B]; uint8_t mac[MACSIZE_B]; uint8_t block[nessie_mac_ctx.blocksize_B]; @@ -122,12 +122,12 @@ void zero_mac(uint16_t n, uint8_t* key){ } static -void one_in512_mac(uint16_t pos, uint8_t* key){ +void one_in512_mac(uint16_t pos, uint8_t *key){ uint8_t ctx[nessie_mac_ctx.ctx_size_B]; uint8_t mac[MACSIZE_B]; uint8_t block[nessie_mac_ctx.blocksize_B]; uint16_t n=512; - char* tab[8] = { "80", "40", "20", "10", + char *tab[8] = { "80", "40", "20", "10", "08", "04", "02", "01" }; pos&=511; @@ -140,7 +140,7 @@ void one_in512_mac(uint16_t pos, uint8_t* key){ /* now the real stuff */ memset(block, 0, 512/8); block[pos>>3] = 0x80>>(pos&0x7); - uint8_t* bp; + uint8_t *bp; bp = block; nessie_mac_ctx.mac_init(ctx, key, nessie_mac_ctx.keysize_b); while(n>nessie_mac_ctx.blocksize_B*8){ @@ -194,7 +194,7 @@ void nessie_mac_run(void){ nessie_print_header(nessie_mac_ctx.name, nessie_mac_ctx.keysize_b, 0, 0, nessie_mac_ctx.macsize_b, 0); /* test set 1 */ - const char* challange_dbz= PSTR( + const char *challange_dbz= PSTR( "\0" "\"\" (empty string)\0" "a\0" diff --git a/test_src/nessie_mac_test.h b/test_src/nessie_mac_test.h index 411d843..0f92f9c 100644 --- a/test_src/nessie_mac_test.h +++ b/test_src/nessie_mac_test.h @@ -21,10 +21,10 @@ #include -typedef void (*nessie_mac_init_fpt)(void* ctx, const void* key, uint16_t keysize_b); -typedef void (*nessie_mac_next_fpt)(void* ctx, const void* buffer); -typedef void (*nessie_mac_last_fpt)(void* ctx, const void* buffer, uint16_t size_b); -typedef void (*nessie_mac_conv_fpt)(void* buffer, void* ctx); +typedef void (*nessie_mac_init_fpt)(void *ctx, const void *key, uint16_t keysize_b); +typedef void (*nessie_mac_next_fpt)(void *ctx, const void *buffer); +typedef void (*nessie_mac_last_fpt)(void *ctx, const void *buffer, uint16_t size_b); +typedef void (*nessie_mac_conv_fpt)(void *buffer, void *ctx); typedef struct nessie_mac_ctx_st{ @@ -32,7 +32,7 @@ typedef struct nessie_mac_ctx_st{ uint16_t keysize_b; uint16_t blocksize_B; uint16_t ctx_size_B; - char* name; + char *name; nessie_mac_init_fpt mac_init; nessie_mac_next_fpt mac_next; nessie_mac_last_fpt mac_last; diff --git a/test_src/nessie_stream_test.c b/test_src/nessie_stream_test.c index 662259d..f9128a2 100644 --- a/test_src/nessie_stream_test.c +++ b/test_src/nessie_stream_test.c @@ -38,7 +38,7 @@ nessie_stream_ctx_t nessie_stream_ctx; static -void nessie_gen_block(void* ctx, uint8_t* block){ +void nessie_gen_block(void *ctx, uint8_t *block){ uint16_t i; for(i=0; i -typedef void (*nessie_stream_genctx_fpt)(uint8_t* key, uint16_t keylength_b, void* ctx); -typedef uint8_t (*nessie_stream_genenc_fpt)(void* ctx); +typedef void (*nessie_stream_genctx_fpt)(uint8_t *key, uint16_t keylength_b, void *ctx); +typedef uint8_t (*nessie_stream_genenc_fpt)(void *ctx); typedef struct nessie_stream_ctx_st{ uint16_t keysize_b; uint16_t ivsize_b; uint16_t outsize_b; uint16_t ctx_size_B; - char* name; + char *name; nessie_stream_genctx_fpt cipher_genctx; nessie_stream_genenc_fpt cipher_enc; } nessie_stream_ctx_t; diff --git a/test_src/performance_test.c b/test_src/performance_test.c index a5e897f..b3fff70 100644 --- a/test_src/performance_test.c +++ b/test_src/performance_test.c @@ -80,7 +80,7 @@ uint64_t stopTimer(void){ return ret; } -void getOverhead(uint16_t* constoh, uint16_t* intoh){ +void getOverhead(uint16_t *constoh, uint16_t *intoh){ *constoh = const_overhead; *intoh = int_overhead; } diff --git a/test_src/performance_test.h b/test_src/performance_test.h index 4b2329e..f40a496 100644 --- a/test_src/performance_test.h +++ b/test_src/performance_test.h @@ -31,7 +31,7 @@ void calibrateTimer(void); void startTimer(uint8_t granularity); uint64_t stopTimer(void); -void getOverhead(uint16_t* constoh, uint16_t* intoh); +void getOverhead(uint16_t *constoh, uint16_t *intoh); void print_time_P(PGM_P s, uint64_t t); void print_overhead(void); diff --git a/test_src/shavs.c b/test_src/shavs.c index 53fd488..4ba97f9 100644 --- a/test_src/shavs.c +++ b/test_src/shavs.c @@ -56,7 +56,7 @@ hfdesc_t** shavs_algolist=NULL; void shavs_listalgos(void){ char option = 'a'; - hfdesc_t* t; + hfdesc_t *t; uint8_t i=0; fputs_P(PSTR("\nthe following algorithms are available:\n"), shavs_out_file); while(option <= 'z' && (t = (hfdesc_t*)pgm_read_word(&(shavs_algolist[i])))){ @@ -66,7 +66,7 @@ void shavs_listalgos(void){ } } -void shavs_setalgo(char* param){ +void shavs_setalgo(char *param){ param = strstrip(param); if(param[1]=='\0'){ /* single letter specified */ uint8_t i, option = param[0] - 'a'; @@ -83,7 +83,7 @@ void shavs_setalgo(char* param){ } shavs_algo=(hfdesc_t*)pgm_read_word(&(shavs_algolist[option])); } else { /* name specifyed */ - hfdesc_t* t=NULL; + hfdesc_t *t=NULL; uint8_t i=0; while((t=(hfdesc_t*)pgm_read_word(&(shavs_algolist[i]))) && strcasecmp_P(param, (void*)pgm_read_word(&(t->name)))) @@ -104,7 +104,7 @@ typedef struct { uint16_t buffersize_B; uint32_t blocks; hfgen_ctx_t ctx; - uint8_t* buffer; + uint8_t *buffer; uint8_t in_byte; } shavs_ctx_t; @@ -143,7 +143,7 @@ uint8_t buffer_add(char c){ } static -uint32_t my_strtoul(const char* str){ +uint32_t my_strtoul(const char *str){ uint32_t r=0; while(*str && (*str<'0' || *str>'9')){ str++; @@ -162,7 +162,7 @@ uint32_t my_strtoul(const char* str){ int32_t getLength(void){ uint32_t len=0; char lenstr[21]; - char* len2; + char *len2; for(;;){ memset(lenstr, 0, 21); cli_getsn_cecho(lenstr, 20); diff --git a/test_src/shavs.h b/test_src/shavs.h index 2199351..555304e 100644 --- a/test_src/shavs.h +++ b/test_src/shavs.h @@ -34,7 +34,7 @@ extern hfdesc_t* shavs_algo; extern hfdesc_t** shavs_algolist; void shavs_listalgos(void); -void shavs_setalgo(char* param); +void shavs_setalgo(char *param); void shavs_test1(void); void shavs_test2(void); void shavs_test3(void); diff --git a/test_src/string-extras-asm.S b/test_src/string-extras-asm.S index 256ecd7..9246791 100644 --- a/test_src/string-extras-asm.S +++ b/test_src/string-extras-asm.S @@ -21,7 +21,7 @@ /******************************************************************************/ /* - uint16_t stridentcnt_P(char* a, PGM_P b){ + uint16_t stridentcnt_P(char *a, PGM_P b){ uint16_t i=0; char c; for(;;){ @@ -55,7 +55,7 @@ stridentcnt_P: /******************************************************************************/ /* - uint16_t firstword_length(char* s){ + uint16_t firstword_length(char *s){ uint16_t ret=0; while(isgraph(*s++)) ret++; @@ -91,10 +91,10 @@ firstword_length: /******************************************************************************/ /* - char* strstrip(char* str){ + char *strstrip(char *str){ if(!str) return str; - char* endptr; + char *endptr; while(*str && (*str==' ' || *str=='\t')) ++str; endptr=str; diff --git a/test_src/string-extras.h b/test_src/string-extras.h index bf2cbf7..8576020 100644 --- a/test_src/string-extras.h +++ b/test_src/string-extras.h @@ -24,7 +24,7 @@ * */ -/** \fn stridentcnt_P(char* a, PGM_P b) +/** \fn stridentcnt_P(char *a, PGM_P b) * \brief counts the number of identic chars * * This function compares the supplyed strings and returns the index of the @@ -33,9 +33,9 @@ * \param b pointer to string in Flash * \return index of the first char where \c a and \c b differ */ -uint16_t stridentcnt_P(char* a, PGM_P b); +uint16_t stridentcnt_P(char *a, PGM_P b); -/** \fn firstword_length(char* s) +/** \fn firstword_length(char *s) * \brief compute the length of the first word in supllyed string * * This function searches for the first whitespace in the string and returns the @@ -43,13 +43,13 @@ uint16_t stridentcnt_P(char* a, PGM_P b); * \param s string * \return number of chars in first word */ -uint16_t firstword_length(char* s); +uint16_t firstword_length(char *s); -/** \fn strstrip(char* str) +/** \fn strstrip(char *str) * \brief removes whitespace at the beginning and the end of a string * * This function removes whitespaces at the end of a string. * \param str sting * \return pointer to the first non-whitespace char in string */ -char* strstrip(char* str); +char *strstrip(char *str); diff --git a/trivium/trivium.c b/trivium/trivium.c index cbad461..737a068 100644 --- a/trivium/trivium.c +++ b/trivium/trivium.c @@ -32,7 +32,7 @@ #define G(i) ((((*ctx)[(i)/8])>>(((i)%8)))&1) #define S(i,v) ((*ctx)[(i)/8] = (((*ctx)[(i)/8]) & (uint8_t)~(1<<((i)%8))) | ((v)<<((i)%8))) -uint8_t trivium_enc(trivium_ctx_t* ctx){ +uint8_t trivium_enc(trivium_ctx_t *ctx){ uint8_t t1,t2,t3,z; t1 = G(65) ^ G(92); @@ -77,9 +77,9 @@ static const uint8_t rev_table[16] PROGMEM = { 0x03, 0x0B, 0x07, 0x0F /* 0011 1011 0111 1111 */ }; -void trivium_init(const void* key, uint16_t keysize_b, - const void* iv, uint16_t ivsize_b, - trivium_ctx_t* ctx){ +void trivium_init(const void *key, uint16_t keysize_b, + const void *iv, uint16_t ivsize_b, + trivium_ctx_t *ctx){ uint16_t i; uint8_t c1,c2; uint8_t t1,t2; diff --git a/trivium/trivium.h b/trivium/trivium.h index ced7784..4211c21 100644 --- a/trivium/trivium.h +++ b/trivium/trivium.h @@ -21,10 +21,10 @@ typedef uint8_t trivium_ctx_t[36]; /* 288bit */ -uint8_t trivium_enc(trivium_ctx_t* ctx); -uint8_t trivium_getbyte(trivium_ctx_t* ctx); -void trivium_init(const void* key, uint16_t keysize_b, - const void* iv, uint16_t ivsize_b, - trivium_ctx_t* ctx); +uint8_t trivium_enc(trivium_ctx_t *ctx); +uint8_t trivium_getbyte(trivium_ctx_t *ctx); +void trivium_init(const void *key, uint16_t keysize_b, + const void *iv, uint16_t ivsize_b, + trivium_ctx_t *ctx); #endif /*TRIVIUM_H_*/ diff --git a/twister/twister-asm.S b/twister/twister-asm.S index 746ea09..475309b 100644 --- a/twister/twister-asm.S +++ b/twister/twister-asm.S @@ -438,7 +438,7 @@ twister_ctx2hash: /*********************************************************************/ -/* void twister_small_nextBlock(twister_state_t* ctx, void* msg) */ +/* void twister_small_nextBlock(twister_state_t *ctx, void *msg) */ /* * param ctx: r24:r25 * param msg: r22:r23 diff --git a/twister/twister-large-asm.S b/twister/twister-large-asm.S index be10546..1e904ec 100644 --- a/twister/twister-large-asm.S +++ b/twister/twister-large-asm.S @@ -27,7 +27,7 @@ #include "avr-asm-macros.S" -/* void checksum_update(twister_large_ctx_t* ctx, uint8_t col) */ +/* void checksum_update(twister_large_ctx_t *ctx, uint8_t col) */ /* * param ctx: r24:r25 * param col: r22 @@ -117,7 +117,7 @@ checksum_update: ret /*********************************************************************/ -/* void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b)*/ +/* void twister_large_init(twister_large_ctx_t *ctx, uint16_t hashsize_b)*/ /* * param ctx: r24:r25 * param hashsize_b: r22:r23 @@ -163,7 +163,7 @@ twister_large_init: ret /*********************************************************************/ -/* void twister_large_nextBlock(twister_state_t* ctx, void* msg) */ +/* void twister_large_nextBlock(twister_state_t *ctx, void *msg) */ /* * param ctx: r24:r25 * param msg: r22:r23 @@ -350,7 +350,7 @@ twister_large_nextBlock: ret /*********************************************************************/ -/* void twister_large_lastBlock(twister_state_t* ctx, void* msg, uint16_t length_b) */ +/* void twister_large_lastBlock(twister_state_t *ctx, void *msg, uint16_t length_b) */ /* * param ctx: r24:r25 * param msg: r22:r23 diff --git a/twister/twister-large.c b/twister/twister-large.c index 36506be..905cd59 100644 --- a/twister/twister-large.c +++ b/twister/twister-large.c @@ -26,7 +26,7 @@ /*********************************************************************/ static -void checksum_update(twister_large_ctx_t* ctx, uint8_t col){ +void checksum_update(twister_large_ctx_t *ctx, uint8_t col){ uint8_t i, col2; uint8_t carry = 0; int sum = 0; @@ -46,7 +46,7 @@ void checksum_update(twister_large_ctx_t* ctx, uint8_t col){ /*********************************************************************/ -void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b){ +void twister_large_init(twister_large_ctx_t *ctx, uint16_t hashsize_b){ memset(ctx->state.s, 0, 64); memset(ctx->checksum, 0, 64); ctx->state.counter=0xffffffffffffffffLL; @@ -57,7 +57,7 @@ void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b){ /*********************************************************************/ -void twister_large_nextBlock(twister_large_ctx_t* ctx, const void* msg){ +void twister_large_nextBlock(twister_large_ctx_t *ctx, const void *msg){ uint8_t tmp[8][8]; /* 1st maxi round */ @@ -108,7 +108,7 @@ void twister_large_nextBlock(twister_large_ctx_t* ctx, const void* msg){ /*********************************************************************/ -void twister_inject_chksum(twister_large_ctx_t* ctx, uint8_t col){ +void twister_inject_chksum(twister_large_ctx_t *ctx, uint8_t col){ uint8_t i=7; do{ ctx->state.s[7][i] ^= ctx->checksum[col][i]; @@ -119,7 +119,7 @@ void twister_inject_chksum(twister_large_ctx_t* ctx, uint8_t col){ /*********************************************************************/ -void twister_large_lastBlock(twister_large_ctx_t* ctx, const void* msg, uint16_t length_b){ +void twister_large_lastBlock(twister_large_ctx_t *ctx, const void *msg, uint16_t length_b){ uint8_t tmp[64]; while(length_b>=512){ twister_large_nextBlock(ctx, msg); @@ -155,38 +155,38 @@ void twister_large_lastBlock(twister_large_ctx_t* ctx, const void* msg, uint16_t /*********************************************************************/ -void twister_large_ctx2hash(void* dest, twister_large_ctx_t* ctx, uint16_t hashsize_b){ +void twister_large_ctx2hash(void *dest, twister_large_ctx_t *ctx, uint16_t hashsize_b){ twister_ctx2hash(dest, &(ctx->state), hashsize_b); } /*********************************************************************/ /*********************************************************************/ -void twister384_init(twister384_ctx_t* ctx){ +void twister384_init(twister384_ctx_t *ctx){ twister_large_init(ctx, 384); } /*********************************************************************/ -void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg){ +void twister384_nextBlock(twister384_ctx_t *ctx, const void *msg){ twister_large_nextBlock(ctx, msg); } /*********************************************************************/ -void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b){ +void twister384_lastBlock(twister384_ctx_t *ctx, const void *msg, uint16_t length_b){ twister_large_lastBlock(ctx, msg, length_b); } /*********************************************************************/ -void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx){ +void twister384_ctx2hash(void *dest, twister384_ctx_t *ctx){ twister_large_ctx2hash(dest, ctx, 384); } /*********************************************************************/ -void twister384(void* dest, const void* msg, uint32_t msg_length_b){ +void twister384(void *dest, const void *msg, uint32_t msg_length_b){ twister_large_ctx_t ctx; twister_large_init(&ctx, 384); while(msg_length_b >=512){ @@ -202,31 +202,31 @@ void twister384(void* dest, const void* msg, uint32_t msg_length_b){ /*********************************************************************/ -void twister512_init(twister512_ctx_t* ctx){ +void twister512_init(twister512_ctx_t *ctx){ twister_large_init(ctx, 512); } /*********************************************************************/ -void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg){ +void twister512_nextBlock(twister512_ctx_t *ctx, const void *msg){ twister_large_nextBlock(ctx, msg); } /*********************************************************************/ -void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b){ +void twister512_lastBlock(twister512_ctx_t *ctx, const void *msg, uint16_t length_b){ twister_large_lastBlock(ctx, msg, length_b); } /*********************************************************************/ -void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx){ +void twister512_ctx2hash(void *dest, twister512_ctx_t *ctx){ twister_large_ctx2hash(dest, ctx, 512); } /*********************************************************************/ -void twister512(void* dest, const void* msg, uint32_t msg_length_b){ +void twister512(void *dest, const void *msg, uint32_t msg_length_b){ twister_large_ctx_t ctx; twister_large_init(&ctx, 512); while(msg_length_b >=512){ diff --git a/twister/twister-large.h b/twister/twister-large.h index 45de18b..582f3b0 100644 --- a/twister/twister-large.h +++ b/twister/twister-large.h @@ -19,26 +19,26 @@ typedef twister_large_ctx_t twister512_ctx_t; /*********************************************************************/ -void twister_large_nextBlock(twister_large_ctx_t* ctx, const void* msg); -void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b); -void twister_large_lastBlock(twister_large_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister_large_ctx2hash(void* dest, twister_large_ctx_t* ctx, uint16_t hashsize_b); +void twister_large_nextBlock(twister_large_ctx_t *ctx, const void *msg); +void twister_large_init(twister_large_ctx_t *ctx, uint16_t hashsize_b); +void twister_large_lastBlock(twister_large_ctx_t *ctx, const void *msg, uint16_t length_b); +void twister_large_ctx2hash(void *dest, twister_large_ctx_t *ctx, uint16_t hashsize_b); /*********************************************************************/ -void twister384_init(twister384_ctx_t* ctx); -void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg); -void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx); -void twister384(void* dest, const void* msg, uint32_t msg_length_b); +void twister384_init(twister384_ctx_t *ctx); +void twister384_nextBlock(twister384_ctx_t *ctx, const void *msg); +void twister384_lastBlock(twister384_ctx_t *ctx, const void *msg, uint16_t length_b); +void twister384_ctx2hash(void *dest, twister384_ctx_t *ctx); +void twister384(void *dest, const void *msg, uint32_t msg_length_b); /*********************************************************************/ -void twister512_init(twister512_ctx_t* ctx); -void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg); -void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx); -void twister512(void* dest, const void* msg, uint32_t msg_length_b); +void twister512_init(twister512_ctx_t *ctx); +void twister512_nextBlock(twister512_ctx_t *ctx, const void *msg); +void twister512_lastBlock(twister512_ctx_t *ctx, const void *msg, uint16_t length_b); +void twister512_ctx2hash(void *dest, twister512_ctx_t *ctx); +void twister512(void *dest, const void *msg, uint32_t msg_length_b); #endif /* TWISTER_large_H_ */ diff --git a/twister/twister-small-asm.S b/twister/twister-small-asm.S index 6cfda29..30dab88 100644 --- a/twister/twister-small-asm.S +++ b/twister/twister-small-asm.S @@ -27,7 +27,7 @@ #include "avr-asm-macros.S" -/* void twister_small_init(twister_state_t* ctx, uint16_t hashsize_b)*/ +/* void twister_small_init(twister_state_t *ctx, uint16_t hashsize_b)*/ /* * param ctx: r24:r25 * param hashsize_b: r22:r23 @@ -73,7 +73,7 @@ twister_small_init: ret #if 1 /*********************************************************************/ -/* void twister_small_lastBlock(twister_state_t* ctx, void* msg, uint16_t length_b) */ +/* void twister_small_lastBlock(twister_state_t *ctx, void *msg, uint16_t length_b) */ /* * param ctx: r24:r25 * param msg: r22:r23 diff --git a/twister/twister-small-stub.c b/twister/twister-small-stub.c index 9eb4112..331e818 100644 --- a/twister/twister-small-stub.c +++ b/twister/twister-small-stub.c @@ -7,7 +7,7 @@ /*********************************************************************/ #if 0 -void twister_small_init(twister_state_t* ctx, uint16_t hashsize_b){ +void twister_small_init(twister_state_t *ctx, uint16_t hashsize_b){ memset(ctx->s, 0, 64); ctx->counter=0xffffffffffffffffLL; ctx->s[0][7] = hashsize_b>>8; @@ -17,7 +17,7 @@ void twister_small_init(twister_state_t* ctx, uint16_t hashsize_b){ /*********************************************************************/ -void twister_small_nextBlock(twister_state_t* ctx, void* msg){ +void twister_small_nextBlock(twister_state_t *ctx, void *msg){ uint8_t tmp[8][8]; /* round 1 */ memcpy(tmp, ctx->s, 64); @@ -51,7 +51,7 @@ void twister_small_nextBlock(twister_state_t* ctx, void* msg){ #endif /*********************************************************************/ #if 0 -void twister_small_lastBlock(twister_state_t* ctx, void* msg, uint16_t length_b){ +void twister_small_lastBlock(twister_state_t *ctx, void *msg, uint16_t length_b){ uint8_t tmp[64]; while(length_b>512){ twister_small_nextBlock(ctx, msg); @@ -68,12 +68,12 @@ void twister_small_lastBlock(twister_state_t* ctx, void* msg, uint16_t length_b) } -void twister256_lastBlock(twister256_ctx_t* ctx, void* msg, uint16_t length_b){ +void twister256_lastBlock(twister256_ctx_t *ctx, void *msg, uint16_t length_b){ twister_small_lastBlock(ctx, msg, length_b); } -void twister224_lastBlock(twister224_ctx_t* ctx, void* msg, uint16_t length_b){ +void twister224_lastBlock(twister224_ctx_t *ctx, void *msg, uint16_t length_b){ twister_small_lastBlock(ctx, msg, length_b); } @@ -81,7 +81,7 @@ void twister224_lastBlock(twister224_ctx_t* ctx, void* msg, uint16_t length_b){ #if 0 /*********************************************************************/ -void twister_small_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_b){ +void twister_small_ctx2hash(void *dest, twister_state_t *ctx, uint16_t hashsize_b){ twister_ctx2hash(dest, ctx, hashsize_b); } @@ -90,13 +90,13 @@ void twister_small_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_ #ifndef NO_TWISTER_256 -void twister256_init(twister256_ctx_t* ctx){ +void twister256_init(twister256_ctx_t *ctx){ twister_small_init(ctx, 256); } /*********************************************************************/ -void twister256_nextBlock(twister256_ctx_t* ctx, void* msg){ +void twister256_nextBlock(twister256_ctx_t *ctx, void *msg){ twister_small_nextBlock(ctx, msg); } @@ -104,13 +104,13 @@ void twister256_nextBlock(twister256_ctx_t* ctx, void* msg){ /*********************************************************************/ -void twister256_ctx2hash(void* dest, twister256_ctx_t* ctx){ +void twister256_ctx2hash(void *dest, twister256_ctx_t *ctx){ twister_ctx2hash(dest, ctx, 256); } /*********************************************************************/ -void twister256(void* dest, void* msg, uint32_t msg_length_b){ +void twister256(void *dest, void *msg, uint32_t msg_length_b){ twister_state_t ctx; twister_small_init(&ctx, 256); while(msg_length_b >=512){ @@ -131,13 +131,13 @@ void twister256(void* dest, void* msg, uint32_t msg_length_b){ #ifndef NO_TWISTER_224 -void twister224_init(twister224_ctx_t* ctx){ +void twister224_init(twister224_ctx_t *ctx){ twister_small_init(ctx, 224); } /*********************************************************************/ -void twister224_nextBlock(twister224_ctx_t* ctx, void* msg){ +void twister224_nextBlock(twister224_ctx_t *ctx, void *msg){ twister_small_nextBlock(ctx, msg); } @@ -145,13 +145,13 @@ void twister224_nextBlock(twister224_ctx_t* ctx, void* msg){ /*********************************************************************/ -void twister224_ctx2hash(void* dest, twister224_ctx_t* ctx){ +void twister224_ctx2hash(void *dest, twister224_ctx_t *ctx){ twister_ctx2hash(dest, ctx, 224); } /*********************************************************************/ -void twister224(void* dest, void* msg, uint32_t msg_length_b){ +void twister224(void *dest, void *msg, uint32_t msg_length_b){ twister_state_t ctx; twister_small_init(&ctx, 224); while(msg_length_b >=512){ diff --git a/twister/twister-small.c b/twister/twister-small.c index 5fb0536..996066c 100644 --- a/twister/twister-small.c +++ b/twister/twister-small.c @@ -7,7 +7,7 @@ /*********************************************************************/ -void twister_small_init(twister_state_t* ctx, uint16_t hashsize_b){ +void twister_small_init(twister_state_t *ctx, uint16_t hashsize_b){ memset(ctx->s, 0, 64); ctx->counter=0xffffffffffffffffLL; ctx->s[0][7] = hashsize_b>>8; @@ -17,7 +17,7 @@ void twister_small_init(twister_state_t* ctx, uint16_t hashsize_b){ /*********************************************************************/ -void twister_small_nextBlock(twister_state_t* ctx, const void* msg){ +void twister_small_nextBlock(twister_state_t *ctx, const void *msg){ uint8_t tmp[8][8]; /* round 1 */ memcpy(tmp, ctx->s, 64); @@ -51,7 +51,7 @@ void twister_small_nextBlock(twister_state_t* ctx, const void* msg){ /*********************************************************************/ -void twister_small_lastBlock(twister_state_t* ctx, const void* msg, uint16_t length_b){ +void twister_small_lastBlock(twister_state_t *ctx, const void *msg, uint16_t length_b){ uint8_t tmp[64]; while(length_b>=512){ twister_small_nextBlock(ctx, msg); @@ -70,7 +70,7 @@ void twister_small_lastBlock(twister_state_t* ctx, const void* msg, uint16_t len /*********************************************************************/ -void twister_small_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_b){ +void twister_small_ctx2hash(void *dest, twister_state_t *ctx, uint16_t hashsize_b){ twister_ctx2hash(dest, ctx, hashsize_b); } @@ -79,31 +79,31 @@ void twister_small_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_ #ifndef NO_TWISTER_256 -void twister256_init(twister256_ctx_t* ctx){ +void twister256_init(twister256_ctx_t *ctx){ twister_small_init(ctx, 256); } /*********************************************************************/ -void twister256_nextBlock(twister256_ctx_t* ctx, const void* msg){ +void twister256_nextBlock(twister256_ctx_t *ctx, const void *msg){ twister_small_nextBlock(ctx, msg); } /*********************************************************************/ -void twister256_lastBlock(twister256_ctx_t* ctx, const void* msg, uint16_t length_b){ +void twister256_lastBlock(twister256_ctx_t *ctx, const void *msg, uint16_t length_b){ twister_small_lastBlock(ctx, msg, length_b); } /*********************************************************************/ -void twister256_ctx2hash(void* dest, twister256_ctx_t* ctx){ +void twister256_ctx2hash(void *dest, twister256_ctx_t *ctx){ twister_ctx2hash(dest, ctx, 256); } /*********************************************************************/ -void twister256(void* dest, const void* msg, uint32_t msg_length_b){ +void twister256(void *dest, const void *msg, uint32_t msg_length_b){ twister_state_t ctx; twister_small_init(&ctx, 256); while(msg_length_b >=512){ @@ -124,31 +124,31 @@ void twister256(void* dest, const void* msg, uint32_t msg_length_b){ #ifndef NO_TWISTER_224 -void twister224_init(twister224_ctx_t* ctx){ +void twister224_init(twister224_ctx_t *ctx){ twister_small_init(ctx, 224); } /*********************************************************************/ -void twister224_nextBlock(twister224_ctx_t* ctx, const void* msg){ +void twister224_nextBlock(twister224_ctx_t *ctx, const void *msg){ twister_small_nextBlock(ctx, msg); } /*********************************************************************/ -void twister224_lastBlock(twister224_ctx_t* ctx, const void* msg, uint16_t length_b){ +void twister224_lastBlock(twister224_ctx_t *ctx, const void *msg, uint16_t length_b){ twister_small_lastBlock(ctx, msg, length_b); } /*********************************************************************/ -void twister224_ctx2hash(void* dest, twister224_ctx_t* ctx){ +void twister224_ctx2hash(void *dest, twister224_ctx_t *ctx){ twister_ctx2hash(dest, ctx, 224); } /*********************************************************************/ -void twister224(void* dest, const void* msg, uint32_t msg_length_b){ +void twister224(void *dest, const void *msg, uint32_t msg_length_b){ twister_state_t ctx; twister_small_init(&ctx, 224); while(msg_length_b >=512){ diff --git a/twister/twister-small.h b/twister/twister-small.h index ca55119..e0b10fb 100644 --- a/twister/twister-small.h +++ b/twister/twister-small.h @@ -12,22 +12,22 @@ typedef uint8_t twister224_hash_t[224/8]; typedef twister_state_t twister256_ctx_t; typedef twister_state_t twister224_ctx_t; -void twister_small_init(twister_state_t* ctx, uint16_t hashsize_b); -void twister_small_lastBlock(twister_state_t* ctx, const void* msg, uint16_t length_b); -void twister_small_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_b); -void twister_small_nextBlock(twister_state_t* ctx, const void* msg); - - -void twister256_init(twister256_ctx_t* ctx); -void twister256_nextBlock(twister256_ctx_t* ctx, const void* msg); -void twister256_lastBlock(twister256_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister256_ctx2hash(void* dest, twister_state_t* ctx); -void twister256(void* dest, const void* msg, uint32_t msg_length_b); - -void twister224_init(twister224_ctx_t* ctx); -void twister224_nextBlock(twister224_ctx_t* ctx, const void* msg); -void twister224_lastBlock(twister224_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister224_ctx2hash(void* dest, twister224_ctx_t* ctx); -void twister224(void* dest, const void* msg, uint32_t msg_length_b); +void twister_small_init(twister_state_t *ctx, uint16_t hashsize_b); +void twister_small_lastBlock(twister_state_t *ctx, const void *msg, uint16_t length_b); +void twister_small_ctx2hash(void *dest, twister_state_t *ctx, uint16_t hashsize_b); +void twister_small_nextBlock(twister_state_t *ctx, const void *msg); + + +void twister256_init(twister256_ctx_t *ctx); +void twister256_nextBlock(twister256_ctx_t *ctx, const void *msg); +void twister256_lastBlock(twister256_ctx_t *ctx, const void *msg, uint16_t length_b); +void twister256_ctx2hash(void *dest, twister_state_t *ctx); +void twister256(void *dest, const void *msg, uint32_t msg_length_b); + +void twister224_init(twister224_ctx_t *ctx); +void twister224_nextBlock(twister224_ctx_t *ctx, const void *msg); +void twister224_lastBlock(twister224_ctx_t *ctx, const void *msg, uint16_t length_b); +void twister224_ctx2hash(void *dest, twister224_ctx_t *ctx); +void twister224(void *dest, const void *msg, uint32_t msg_length_b); #endif /* TWISTER_SMALL_H_ */ diff --git a/twister/twister.c b/twister/twister.c index b19c0d0..b279f60 100644 --- a/twister/twister.c +++ b/twister/twister.c @@ -37,7 +37,7 @@ # define MULT(a,b) gf256mul((a),(b), 0x4D) //#endif -void twister_blank_round(twister_state_t* ctx){ +void twister_blank_round(twister_state_t *ctx){ uint8_t i,j,k; uint8_t tmp[8][8]; /* add twist counter */ @@ -76,7 +76,7 @@ void twister_blank_round(twister_state_t* ctx){ } } } -void twister_mini_round(twister_state_t* ctx, const void* msg){ +void twister_mini_round(twister_state_t *ctx, const void *msg){ /* inject message */ uint8_t i; for(i=0; i<8; ++i){ @@ -86,7 +86,7 @@ void twister_mini_round(twister_state_t* ctx, const void* msg){ twister_blank_round(ctx); } -void twister_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_b){ +void twister_ctx2hash(void *dest, twister_state_t *ctx, uint16_t hashsize_b){ uint8_t tmp[8][8]; uint8_t j; uint16_t i=hashsize_b; diff --git a/twister/twister.h b/twister/twister.h index ec6b219..a44e9ba 100644 --- a/twister/twister.h +++ b/twister/twister.h @@ -37,8 +37,8 @@ typedef struct { typedef uint8_t twister_checksum_t[8][8]; -void twister_blank_round(twister_state_t* ctx); -void twister_mini_round(twister_state_t* ctx, const void* msg); -void twister_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_b); +void twister_blank_round(twister_state_t *ctx); +void twister_mini_round(twister_state_t *ctx, const void *msg); +void twister_ctx2hash(void *dest, twister_state_t *ctx, uint16_t hashsize_b); #endif /* TWISTER_H_ */ diff --git a/twister/twister224.S b/twister/twister224.S index e97ed55..2f79792 100644 --- a/twister/twister224.S +++ b/twister/twister224.S @@ -27,7 +27,7 @@ #include "avr-asm-macros.S" /*********************************************************************/ -/* void twister224(void* dest, void* msg, uint32_t msg_length_b) */ +/* void twister224(void *dest, void *msg, uint32_t msg_length_b) */ /* * param dest: r24:r25 * param msg: r22:r23 diff --git a/twister/twister256.S b/twister/twister256.S index ce1dc11..9e51979 100644 --- a/twister/twister256.S +++ b/twister/twister256.S @@ -27,7 +27,7 @@ #include "avr-asm-macros.S" /*********************************************************************/ -/* void twister256(void* dest, void* msg, uint32_t msg_length_b) */ +/* void twister256(void *dest, void *msg, uint32_t msg_length_b) */ /* * param dest: r24:r25 * param msg: r22:r23 diff --git a/twister/twister384.S b/twister/twister384.S index 6a15fc5..21bf8c7 100644 --- a/twister/twister384.S +++ b/twister/twister384.S @@ -27,7 +27,7 @@ #include "avr-asm-macros.S" /*********************************************************************/ -/* void twister384(void* dest, void* msg, uint32_t msg_length_b) */ +/* void twister384(void *dest, void *msg, uint32_t msg_length_b) */ /* * param dest: r24:r25 * param msg: r22:r23 diff --git a/twister/twister512.S b/twister/twister512.S index 0aece4d..5f65d61 100644 --- a/twister/twister512.S +++ b/twister/twister512.S @@ -27,7 +27,7 @@ #include "avr-asm-macros.S" /*********************************************************************/ -/* void twister384(void* dest, void* msg, uint32_t msg_length_b) */ +/* void twister384(void *dest, void *msg, uint32_t msg_length_b) */ /* * param dest: r24:r25 * param msg: r22:r23 diff --git a/whirlpool/whirlpool.c b/whirlpool/whirlpool.c index 2565b70..91cfbed 100644 --- a/whirlpool/whirlpool.c +++ b/whirlpool/whirlpool.c @@ -111,7 +111,7 @@ static const uint8_t sbox[256] PROGMEM = { #endif -static void gamma_1(uint8_t* a){ +static void gamma_1(uint8_t *a){ uint8_t i; for(i=0; i<64; ++i){ *a = whirlpool_sbox(*a); @@ -119,7 +119,7 @@ static void gamma_1(uint8_t* a){ } } -static void pi(uint8_t* a){ +static void pi(uint8_t *a){ uint8_t b[8]; uint8_t i,j; for(i=1; i<8; ++i){ @@ -144,7 +144,7 @@ static const uint8_t theta_matrix[8] PROGMEM = { #define POLYNOM 0x1D -static void theta(uint8_t* a){ +static void theta(uint8_t *a){ uint8_t b[8], c, accu; uint8_t i,j,k; for(i=0; i<8; ++i){ @@ -160,7 +160,7 @@ static void theta(uint8_t* a){ } } -static void w_round(uint8_t* a, const uint8_t* k){ +static void w_round(uint8_t *a, const uint8_t *k){ gamma_1(a); #if DEBUG cli_putstr_P(PSTR("\r\n pre-pi:")); @@ -179,7 +179,7 @@ static void w_round(uint8_t* a, const uint8_t* k){ memxor(a, k, 64); } -static void w_enc(uint8_t *a, const uint8_t* k){ +static void w_enc(uint8_t *a, const uint8_t *k){ #if DEBUG cli_putstr_P(PSTR("\r\n== w_enc ==\r\n w'_00:")); cli_hexdump_block(a, 64, 4, 8); @@ -215,12 +215,12 @@ static void w_enc(uint8_t *a, const uint8_t* k){ } } -void whirlpool_init(whirlpool_ctx_t* ctx){ +void whirlpool_init(whirlpool_ctx_t *ctx){ memset(ctx->s, 0, 64); ctx->blocks = 0; } -void whirlpool_nextBlock(whirlpool_ctx_t* ctx, const void* block){ +void whirlpool_nextBlock(whirlpool_ctx_t *ctx, const void *block){ uint8_t state[64]; ctx->blocks += 1; memcpy(state, block, 64); @@ -229,7 +229,7 @@ void whirlpool_nextBlock(whirlpool_ctx_t* ctx, const void* block){ memxor((ctx->s), block, 64); } -void whirlpool_lastBlock(whirlpool_ctx_t* ctx, const void* block, uint16_t length_b){ +void whirlpool_lastBlock(whirlpool_ctx_t *ctx, const void *block, uint16_t length_b){ while(length_b>=512){ whirlpool_nextBlock(ctx, block); block = (uint8_t*)block + 64; @@ -253,6 +253,6 @@ void whirlpool_lastBlock(whirlpool_ctx_t* ctx, const void* block, uint16_t lengt whirlpool_nextBlock(ctx, buffer); } -void whirlpool_ctx2hash(void* dest, const whirlpool_ctx_t* ctx){ +void whirlpool_ctx2hash(void *dest, const whirlpool_ctx_t *ctx){ memcpy(dest, (ctx->s), 64); } diff --git a/whirlpool/whirlpool.h b/whirlpool/whirlpool.h index d65f6e6..3c13d1e 100644 --- a/whirlpool/whirlpool.h +++ b/whirlpool/whirlpool.h @@ -28,9 +28,9 @@ typedef struct { } whirlpool_ctx_t; -void whirlpool_init(whirlpool_ctx_t* ctx); -void whirlpool_nextBlock(whirlpool_ctx_t* ctx,const void* block); -void whirlpool_lastBlock(whirlpool_ctx_t* ctx, const void* block, uint16_t length_b); -void whirlpool_ctx2hash(void* dest, const whirlpool_ctx_t* ctx); +void whirlpool_init(whirlpool_ctx_t *ctx); +void whirlpool_nextBlock(whirlpool_ctx_t *ctx,const void *block); +void whirlpool_lastBlock(whirlpool_ctx_t *ctx, const void *block, uint16_t length_b); +void whirlpool_ctx2hash(void *dest, const whirlpool_ctx_t *ctx); #endif /* WIRLPOOL_H_ */ diff --git a/xtea/xtea.c b/xtea/xtea.c index c517e9b..b6d6ccd 100644 --- a/xtea/xtea.c +++ b/xtea/xtea.c @@ -25,7 +25,7 @@ #include -void xtea_enc(void* dest, const void* v, const void* k) { +void xtea_enc(void *dest, const void *v, const void *k) { uint8_t i; uint32_t v0=((uint32_t*)v)[0], v1=((uint32_t*)v)[1]; uint32_t sum=0, delta=0x9E3779B9; @@ -37,7 +37,7 @@ void xtea_enc(void* dest, const void* v, const void* k) { ((uint32_t*)dest)[0]=v0; ((uint32_t*)dest)[1]=v1; } -void xtea_dec(void* dest, const void* v, const void* k) { +void xtea_dec(void *dest, const void *v, const void *k) { uint8_t i; uint32_t v0=((uint32_t*)v)[0], v1=((uint32_t*)v)[1]; uint32_t sum=0xC6EF3720, delta=0x9E3779B9; diff --git a/xtea/xtea.h b/xtea/xtea.h index b753bf7..64bf827 100644 --- a/xtea/xtea.h +++ b/xtea/xtea.h @@ -42,8 +42,8 @@ * v: the block to operate on (64 bit) * k: the key for en/decryption (128 bit) */ -void xtea_enc(void* dest, const void* v, const void* k); -void xtea_dec(void* dest, const void* v, const void* k); +void xtea_enc(void *dest, const void *v, const void *k); +void xtea_dec(void *dest, const void *v, const void *k); #endif /*XTEA_H_*/ -- 2.39.5