From 473b0319ad0fe860dacb91442d263dd296ec14a9 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Sun, 24 Aug 2014 18:24:15 +0200 Subject: [PATCH] re-enable "unused-parameters" warning --- makefile | 2 +- src/ciphers/aes/aes.c | 1 + src/ciphers/anubis.c | 1 + src/ciphers/blowfish.c | 1 + src/ciphers/camellia.c | 5 ++++- src/ciphers/cast5.c | 1 + src/ciphers/des.c | 2 ++ src/ciphers/kasumi.c | 1 + src/ciphers/khazad.c | 1 + src/ciphers/kseed.c | 1 + src/ciphers/multi2.c | 1 + src/ciphers/noekeon.c | 1 + src/ciphers/rc2.c | 1 + src/ciphers/rc5.c | 1 + src/ciphers/rc6.c | 1 + src/ciphers/safer/safer.c | 1 + src/ciphers/safer/saferp.c | 1 + src/ciphers/skipjack.c | 1 + src/ciphers/twofish/twofish.c | 1 + src/ciphers/xtea.c | 1 + src/headers/tomcrypt_macros.h | 4 ++++ src/prngs/rng_get_bytes.c | 4 ++++ src/prngs/sprng.c | 12 ++++++++++++ 23 files changed, 44 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index c775d55..ebfee4e 100644 --- a/makefile +++ b/makefile @@ -37,7 +37,7 @@ endif endif # Compilation flags. Note the += does not write over the user's CFLAGS! -CFLAGS += -c -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -Wno-unused-parameter -DLTC_SOURCE +CFLAGS += -c -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -DLTC_SOURCE # additional warnings (newer GCC 3.4 and higher) ifdef GCC_34 diff --git a/src/ciphers/aes/aes.c b/src/ciphers/aes/aes.c index 3a16507..aea8e19 100644 --- a/src/ciphers/aes/aes.c +++ b/src/ciphers/aes/aes.c @@ -725,6 +725,7 @@ int ECB_TEST(void) */ void ECB_DONE(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } diff --git a/src/ciphers/anubis.c b/src/ciphers/anubis.c index 36f480d..226a190 100644 --- a/src/ciphers/anubis.c +++ b/src/ciphers/anubis.c @@ -1520,6 +1520,7 @@ int anubis_test(void) */ void anubis_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/blowfish.c b/src/ciphers/blowfish.c index 5975858..cbe6942 100644 --- a/src/ciphers/blowfish.c +++ b/src/ciphers/blowfish.c @@ -567,6 +567,7 @@ int blowfish_test(void) */ void blowfish_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/camellia.c b/src/ciphers/camellia.c index e238525..3497cfa 100644 --- a/src/ciphers/camellia.c +++ b/src/ciphers/camellia.c @@ -721,7 +721,10 @@ int camellia_test(void) return CRYPT_OK; } -void camellia_done(symmetric_key *skey) {} +void camellia_done(symmetric_key *skey) +{ + LTC_UNUSED_PARAM(skey); +} int camellia_keysize(int *keysize) { diff --git a/src/ciphers/cast5.c b/src/ciphers/cast5.c index 01716ed..817ec5a 100644 --- a/src/ciphers/cast5.c +++ b/src/ciphers/cast5.c @@ -695,6 +695,7 @@ int cast5_test(void) */ void cast5_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/des.c b/src/ciphers/des.c index fa1991e..b706b07 100644 --- a/src/ciphers/des.c +++ b/src/ciphers/des.c @@ -1864,6 +1864,7 @@ int des3_test(void) */ void des_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** Terminate the context @@ -1871,6 +1872,7 @@ void des_done(symmetric_key *skey) */ void des3_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } diff --git a/src/ciphers/kasumi.c b/src/ciphers/kasumi.c index 5308607..c611331 100644 --- a/src/ciphers/kasumi.c +++ b/src/ciphers/kasumi.c @@ -236,6 +236,7 @@ int kasumi_setup(const unsigned char *key, int keylen, int num_rounds, symmetric void kasumi_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } int kasumi_keysize(int *keysize) diff --git a/src/ciphers/khazad.c b/src/ciphers/khazad.c index edb9823..285e8b1 100644 --- a/src/ciphers/khazad.c +++ b/src/ciphers/khazad.c @@ -830,6 +830,7 @@ int khazad_test(void) */ void khazad_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/kseed.c b/src/ciphers/kseed.c index c3d274a..e8f0fa8 100644 --- a/src/ciphers/kseed.c +++ b/src/ciphers/kseed.c @@ -298,6 +298,7 @@ int kseed_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key */ void kseed_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/multi2.c b/src/ciphers/multi2.c index 40c88e1..65249a3 100644 --- a/src/ciphers/multi2.c +++ b/src/ciphers/multi2.c @@ -295,6 +295,7 @@ int multi2_test(void) */ void multi2_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/noekeon.c b/src/ciphers/noekeon.c index 2bc29db..40c0711 100644 --- a/src/ciphers/noekeon.c +++ b/src/ciphers/noekeon.c @@ -318,6 +318,7 @@ int noekeon_test(void) */ void noekeon_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/rc2.c b/src/ciphers/rc2.c index 06374e4..87ccb6d 100644 --- a/src/ciphers/rc2.c +++ b/src/ciphers/rc2.c @@ -334,6 +334,7 @@ int rc2_test(void) */ void rc2_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/rc5.c b/src/ciphers/rc5.c index 9514cde..b267a5a 100644 --- a/src/ciphers/rc5.c +++ b/src/ciphers/rc5.c @@ -294,6 +294,7 @@ int rc5_test(void) */ void rc5_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/rc6.c b/src/ciphers/rc6.c index f477e64..611c00c 100644 --- a/src/ciphers/rc6.c +++ b/src/ciphers/rc6.c @@ -321,6 +321,7 @@ int rc6_test(void) */ void rc6_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/safer/safer.c b/src/ciphers/safer/safer.c index 94435de..434a7db 100644 --- a/src/ciphers/safer/safer.c +++ b/src/ciphers/safer/safer.c @@ -447,6 +447,7 @@ int safer_sk64_test(void) */ void safer_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } int safer_sk128_test(void) diff --git a/src/ciphers/safer/saferp.c b/src/ciphers/safer/saferp.c index 9d384da..6ef6d40 100644 --- a/src/ciphers/safer/saferp.c +++ b/src/ciphers/safer/saferp.c @@ -528,6 +528,7 @@ int saferp_test(void) */ void saferp_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/skipjack.c b/src/ciphers/skipjack.c index b57714a..9b2e101 100644 --- a/src/ciphers/skipjack.c +++ b/src/ciphers/skipjack.c @@ -318,6 +318,7 @@ int skipjack_test(void) */ void skipjack_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/twofish/twofish.c b/src/ciphers/twofish/twofish.c index 6fc2c8e..be6c7d5 100644 --- a/src/ciphers/twofish/twofish.c +++ b/src/ciphers/twofish/twofish.c @@ -677,6 +677,7 @@ int twofish_test(void) */ void twofish_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/ciphers/xtea.c b/src/ciphers/xtea.c index 13e58c4..963824d 100644 --- a/src/ciphers/xtea.c +++ b/src/ciphers/xtea.c @@ -249,6 +249,7 @@ int xtea_test(void) */ void xtea_done(symmetric_key *skey) { + LTC_UNUSED_PARAM(skey); } /** diff --git a/src/headers/tomcrypt_macros.h b/src/headers/tomcrypt_macros.h index 85de9e6..c2832ab 100644 --- a/src/headers/tomcrypt_macros.h +++ b/src/headers/tomcrypt_macros.h @@ -414,6 +414,10 @@ static inline ulong64 ROR64c(ulong64 word, const int i) #define MIN(x, y) ( ((x)<(y))?(x):(y) ) #endif +#ifndef LTC_UNUSED_PARAM + #define LTC_UNUSED_PARAM(x) (void)(x) +#endif + /* extract a byte portably */ #ifdef _MSC_VER #define byte(x, n) ((unsigned char)((x) >> (8 * (n)))) diff --git a/src/prngs/rng_get_bytes.c b/src/prngs/rng_get_bytes.c index 3839794..90338cb 100644 --- a/src/prngs/rng_get_bytes.c +++ b/src/prngs/rng_get_bytes.c @@ -20,7 +20,10 @@ static unsigned long rng_nix(unsigned char *buf, unsigned long len, void (*callback)(void)) { + LTC_UNUSED_PARAM(callback); #ifdef LTC_NO_FILE + LTC_UNUSED_PARAM(buf); + LTC_UNUSED_PARAM(len); return 0; #else FILE *f; @@ -103,6 +106,7 @@ static unsigned long rng_ansic(unsigned char *buf, unsigned long len, static unsigned long rng_win32(unsigned char *buf, unsigned long len, void (*callback)(void)) { + LTC_UNUSED_PARAM(callback); HCRYPTPROV hProv = 0; if (!CryptAcquireContext(&hProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, (CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET)) && diff --git a/src/prngs/sprng.c b/src/prngs/sprng.c index ae070b1..7b538dd 100644 --- a/src/prngs/sprng.c +++ b/src/prngs/sprng.c @@ -42,6 +42,7 @@ const struct ltc_prng_descriptor sprng_desc = */ int sprng_start(prng_state *prng) { + LTC_UNUSED_PARAM(prng); return CRYPT_OK; } @@ -54,6 +55,9 @@ int sprng_start(prng_state *prng) */ int sprng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng) { + LTC_UNUSED_PARAM(in); + LTC_UNUSED_PARAM(inlen); + LTC_UNUSED_PARAM(prng); return CRYPT_OK; } @@ -64,6 +68,7 @@ int sprng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state * */ int sprng_ready(prng_state *prng) { + LTC_UNUSED_PARAM(prng); return CRYPT_OK; } @@ -77,6 +82,7 @@ int sprng_ready(prng_state *prng) unsigned long sprng_read(unsigned char *out, unsigned long outlen, prng_state *prng) { LTC_ARGCHK(out != NULL); + LTC_UNUSED_PARAM(prng); return rng_get_bytes(out, outlen, NULL); } @@ -87,6 +93,7 @@ unsigned long sprng_read(unsigned char *out, unsigned long outlen, prng_state *p */ int sprng_done(prng_state *prng) { + LTC_UNUSED_PARAM(prng); return CRYPT_OK; } @@ -100,6 +107,8 @@ int sprng_done(prng_state *prng) int sprng_export(unsigned char *out, unsigned long *outlen, prng_state *prng) { LTC_ARGCHK(outlen != NULL); + LTC_UNUSED_PARAM(out); + LTC_UNUSED_PARAM(prng); *outlen = 0; return CRYPT_OK; @@ -114,6 +123,9 @@ int sprng_export(unsigned char *out, unsigned long *outlen, prng_state *prng) */ int sprng_import(const unsigned char *in, unsigned long inlen, prng_state *prng) { + LTC_UNUSED_PARAM(in); + LTC_UNUSED_PARAM(inlen); + LTC_UNUSED_PARAM(prng); return CRYPT_OK; }