diff options
author | Niels Möller <nisse@lysator.liu.se> | 2012-06-25 22:35:51 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2012-06-25 22:35:51 +0200 |
commit | ba98962d5fb20ff238c5c77fa0206264b8c0bd64 (patch) | |
tree | 7417f564feaebf44ac0594df27ca2bf66cbbd385 | |
parent | 0cc9526c98860e8edf6811e62a8134fffdc860d6 (diff) | |
download | nettle-ba98962d5fb20ff238c5c77fa0206264b8c0bd64.tar.gz |
Consistently use foo_func *f (rather than foo_func f) for declaring function pointer arguments.
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | bignum-next-prime.c | 2 | ||||
-rw-r--r-- | bignum-random-prime.c | 6 | ||||
-rw-r--r-- | bignum-random.c | 4 | ||||
-rw-r--r-- | bignum.h | 12 | ||||
-rw-r--r-- | cbc.c | 4 | ||||
-rw-r--r-- | cbc.h | 4 | ||||
-rw-r--r-- | ctr.c | 2 | ||||
-rw-r--r-- | ctr.h | 4 | ||||
-rw-r--r-- | dsa-keygen.c | 4 | ||||
-rw-r--r-- | dsa-sha1-sign.c | 4 | ||||
-rw-r--r-- | dsa-sha256-sign.c | 4 | ||||
-rw-r--r-- | dsa-sign.c | 2 | ||||
-rw-r--r-- | dsa.h | 17 | ||||
-rw-r--r-- | gcm.c | 2 | ||||
-rw-r--r-- | pkcs1-encrypt.c | 2 | ||||
-rw-r--r-- | pkcs1.h | 2 | ||||
-rw-r--r-- | rsa-blind.c | 2 | ||||
-rw-r--r-- | rsa-decrypt-tr.c | 2 | ||||
-rw-r--r-- | rsa-encrypt.c | 2 | ||||
-rw-r--r-- | rsa-keygen.c | 4 | ||||
-rw-r--r-- | rsa-pkcs1-sign-tr.c | 2 | ||||
-rw-r--r-- | rsa.h | 4 |
23 files changed, 70 insertions, 47 deletions
@@ -1,5 +1,31 @@ 2012-06-25 Niels Möller <nisse@lysator.liu.se> + * bignum-next-prime.c (nettle_next_prime): Consistently use the + type nettle_random_func * (rather then just nettle_random_func) + when passing the function pointer as argument. Similar change for + nettle_progress_func. Should have been done for the 2.0 release, + but a few arguments were overlooked. + * bignum-random-prime.c (_nettle_generate_pocklington_prime) + (nettle_random_prime): Likewise. + * bignum-random.c (nettle_mpz_random_size, nettle_mpz_random): + Likewise. + * dsa-keygen.c (dsa_generate_keypair): Likewise. + * dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise. + * dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign): + Likewise. + * dsa-sign.c (_dsa_sign): Likewise. + * pkcs1-encrypt.c (pkcs1_encrypt): Likewise. + * rsa-blind.c (_rsa_blind): Likewise. + * rsa-decrypt-tr.c (rsa_decrypt_tr): Likewise. + * rsa-encrypt.c (rsa_encrypt): Likewise. + * rsa-keygen.c (rsa_generate_keypair): Likewise. + * rsa-pkcs1-sign-tr.c (rsa_pkcs1_sign_tr): Likewise. + + * cbc.c (cbc_encrypt, cbc_decrypt): Similarly, use the type + nettle_crypt_func * rather than just nettle_crypt_func. + * ctr.c (ctr_crypt): Likewise. + * gcm.c (gcm_set_key): Likewise. + * testsuite/des-compat-test.c (test_main): Disable declarations of disabled functions and variables, to avoid warnings. No verbose output unless verbose flag is set. diff --git a/bignum-next-prime.c b/bignum-next-prime.c index d3980a55..953f6b72 100644 --- a/bignum-next-prime.c +++ b/bignum-next-prime.c @@ -74,7 +74,7 @@ static const uint16_t primes[] = { /* NOTE: The mpz_nextprime in current GMP is unoptimized. */ void nettle_next_prime(mpz_t p, mpz_t n, unsigned count, unsigned prime_limit, - void *progress_ctx, nettle_progress_func progress) + void *progress_ctx, nettle_progress_func *progress) { mpz_t tmp; TMP_DECL(moduli, unsigned, NUMBER_OF_PRIMES); diff --git a/bignum-random-prime.c b/bignum-random-prime.c index e0454a88..f172d6d8 100644 --- a/bignum-random-prime.c +++ b/bignum-random-prime.c @@ -260,7 +260,7 @@ miller_rabin_pocklington(mpz_t n, mpz_t nm1, mpz_t nm1dq, mpz_t a) void _nettle_generate_pocklington_prime (mpz_t p, mpz_t r, unsigned bits, int top_bits_set, - void *ctx, nettle_random_func random, + void *ctx, nettle_random_func *random, const mpz_t p0, const mpz_t q, const mpz_t p0q) @@ -345,8 +345,8 @@ _nettle_generate_pocklington_prime (mpz_t p, mpz_t r, the variant in fips186-3). */ void nettle_random_prime(mpz_t p, unsigned bits, int top_bits_set, - void *random_ctx, nettle_random_func random, - void *progress_ctx, nettle_progress_func progress) + void *random_ctx, nettle_random_func *random, + void *progress_ctx, nettle_progress_func *progress) { assert (bits >= 3); if (bits <= 10) diff --git a/bignum-random.c b/bignum-random.c index 6b745d88..d1174d9d 100644 --- a/bignum-random.c +++ b/bignum-random.c @@ -34,7 +34,7 @@ void nettle_mpz_random_size(mpz_t x, - void *ctx, nettle_random_func random, + void *ctx, nettle_random_func *random, unsigned bits) { unsigned length = (bits + 7) / 8; @@ -52,7 +52,7 @@ nettle_mpz_random_size(mpz_t x, /* Returns a random number x, 0 <= x < n */ void nettle_mpz_random(mpz_t x, - void *ctx, nettle_random_func random, + void *ctx, nettle_random_func *random, const mpz_t n) { /* NOTE: This leaves some bias, which may be bad for DSA. A better @@ -71,29 +71,29 @@ nettle_mpz_init_set_str_256_u(mpz_t x, /* Returns a uniformly distributed random number 0 <= x < 2^n */ void nettle_mpz_random_size(mpz_t x, - void *ctx, nettle_random_func random, + void *ctx, nettle_random_func *random, unsigned bits); /* Returns a number x, almost uniformly random in the range * 0 <= x < n. */ void nettle_mpz_random(mpz_t x, - void *ctx, nettle_random_func random, + void *ctx, nettle_random_func *random, const mpz_t n); void nettle_next_prime(mpz_t p, mpz_t n, unsigned count, unsigned prime_limit, - void *progress_ctx, nettle_progress_func progress); + void *progress_ctx, nettle_progress_func *progress); void nettle_random_prime(mpz_t p, unsigned bits, int top_bits_set, - void *ctx, nettle_random_func random, - void *progress_ctx, nettle_progress_func progress); + void *ctx, nettle_random_func *random, + void *progress_ctx, nettle_progress_func *progress); void _nettle_generate_pocklington_prime (mpz_t p, mpz_t r, unsigned bits, int top_bits_set, - void *ctx, nettle_random_func random, + void *ctx, nettle_random_func *random, const mpz_t p0, const mpz_t q, const mpz_t p0q); @@ -37,7 +37,7 @@ #include "nettle-internal.h" void -cbc_encrypt(void *ctx, nettle_crypt_func f, +cbc_encrypt(void *ctx, nettle_crypt_func *f, unsigned block_size, uint8_t *iv, unsigned length, uint8_t *dst, const uint8_t *src) @@ -56,7 +56,7 @@ cbc_encrypt(void *ctx, nettle_crypt_func f, #define CBC_BUFFER_LIMIT 512 void -cbc_decrypt(void *ctx, nettle_crypt_func f, +cbc_decrypt(void *ctx, nettle_crypt_func *f, unsigned block_size, uint8_t *iv, unsigned length, uint8_t *dst, const uint8_t *src) @@ -37,13 +37,13 @@ extern "C" { #define cbc_decrypt nettle_cbc_decrypt void -cbc_encrypt(void *ctx, nettle_crypt_func f, +cbc_encrypt(void *ctx, nettle_crypt_func *f, unsigned block_size, uint8_t *iv, unsigned length, uint8_t *dst, const uint8_t *src); void -cbc_decrypt(void *ctx, nettle_crypt_func f, +cbc_decrypt(void *ctx, nettle_crypt_func *f, unsigned block_size, uint8_t *iv, unsigned length, uint8_t *dst, const uint8_t *src); @@ -40,7 +40,7 @@ #define NBLOCKS 4 void -ctr_crypt(void *ctx, nettle_crypt_func f, +ctr_crypt(void *ctx, nettle_crypt_func *f, unsigned block_size, uint8_t *ctr, unsigned length, uint8_t *dst, const uint8_t *src) @@ -37,7 +37,7 @@ extern "C" { #define ctr_crypt nettle_ctr_crypt void -ctr_crypt(void *ctx, nettle_crypt_func f, +ctr_crypt(void *ctx, nettle_crypt_func *f, unsigned block_size, uint8_t *ctr, unsigned length, uint8_t *dst, const uint8_t *src); @@ -51,7 +51,7 @@ memcpy((ctx)->ctr, (data), sizeof((ctx)->ctr)) #define CTR_CRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, 0, NULL, NULL)) \ : ctr_crypt((void *) &(self)->ctx, \ - (nettle_crypt_func) (f), \ + (nettle_crypt_func *) (f), \ sizeof((self)->ctr), (self)->ctr, \ (length), (dst), (src))) diff --git a/dsa-keygen.c b/dsa-keygen.c index 757f1753..84cea545 100644 --- a/dsa-keygen.c +++ b/dsa-keygen.c @@ -42,8 +42,8 @@ int dsa_generate_keypair(struct dsa_public_key *pub, struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, - void *progress_ctx, nettle_progress_func progress, + void *random_ctx, nettle_random_func *random, + void *progress_ctx, nettle_progress_func *progress, unsigned p_bits, unsigned q_bits) { mpz_t p0, p0q, r; diff --git a/dsa-sha1-sign.c b/dsa-sha1-sign.c index 264a89c1..821702e8 100644 --- a/dsa-sha1-sign.c +++ b/dsa-sha1-sign.c @@ -32,7 +32,7 @@ int dsa_sha1_sign_digest(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, const uint8_t *digest, struct dsa_signature *signature) { @@ -44,7 +44,7 @@ dsa_sha1_sign_digest(const struct dsa_public_key *pub, int dsa_sha1_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, struct sha1_ctx *hash, struct dsa_signature *signature) { diff --git a/dsa-sha256-sign.c b/dsa-sha256-sign.c index f8569f9f..020d146b 100644 --- a/dsa-sha256-sign.c +++ b/dsa-sha256-sign.c @@ -32,7 +32,7 @@ int dsa_sha256_sign_digest(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, const uint8_t *digest, struct dsa_signature *signature) { @@ -43,7 +43,7 @@ dsa_sha256_sign_digest(const struct dsa_public_key *pub, int dsa_sha256_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, struct sha256_ctx *hash, struct dsa_signature *signature) { @@ -38,7 +38,7 @@ int _dsa_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned digest_size, const uint8_t *digest, struct dsa_signature *signature) @@ -32,9 +32,6 @@ #include "sha.h" -/* For nettle_random_func */ -#include "nettle-meta.h" - #ifdef __cplusplus extern "C" { #endif @@ -152,14 +149,14 @@ dsa_signature_clear(struct dsa_signature *signature); int dsa_sha1_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, struct sha1_ctx *hash, struct dsa_signature *signature); int dsa_sha256_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, struct sha256_ctx *hash, struct dsa_signature *signature); @@ -176,13 +173,13 @@ dsa_sha256_verify(const struct dsa_public_key *key, int dsa_sha1_sign_digest(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, const uint8_t *digest, struct dsa_signature *signature); int dsa_sha256_sign_digest(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, const uint8_t *digest, struct dsa_signature *signature); @@ -202,9 +199,9 @@ int dsa_generate_keypair(struct dsa_public_key *pub, struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, - void *progress_ctx, nettle_progress_func progress, + void *progress_ctx, nettle_progress_func *progress, unsigned p_bits, unsigned q_bits); /* Keys in sexp form. */ @@ -277,7 +274,7 @@ dsa_openssl_private_key_from_der(struct dsa_public_key *pub, int _dsa_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned digest_size, const uint8_t *digest, struct dsa_signature *signature); @@ -323,7 +323,7 @@ gcm_gf_mul (union gcm_block *x, const union gcm_block *table) */ void gcm_set_key(struct gcm_key *key, - void *cipher, nettle_crypt_func f) + void *cipher, nettle_crypt_func *f) { /* Middle element if GCM_TABLE_BITS > 0, otherwise the first element */ diff --git a/pkcs1-encrypt.c b/pkcs1-encrypt.c index 10f4f9a3..403bf696 100644 --- a/pkcs1-encrypt.c +++ b/pkcs1-encrypt.c @@ -39,7 +39,7 @@ int pkcs1_encrypt (unsigned key_size, /* For padding */ - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned length, const uint8_t *message, mpz_t m) { @@ -62,7 +62,7 @@ pkcs1_signature_prefix(unsigned key_size, int pkcs1_encrypt (unsigned key_size, /* For padding */ - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned length, const uint8_t *message, mpz_t m); diff --git a/rsa-blind.c b/rsa-blind.c index eb5d0088..96ed81ff 100644 --- a/rsa-blind.c +++ b/rsa-blind.c @@ -35,7 +35,7 @@ returns the inverse (ri), for use by rsa_unblind. */ void _rsa_blind (const struct rsa_public_key *pub, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, mpz_t c, mpz_t ri) { mpz_t r; diff --git a/rsa-decrypt-tr.c b/rsa-decrypt-tr.c index 1e21e985..0ef52112 100644 --- a/rsa-decrypt-tr.c +++ b/rsa-decrypt-tr.c @@ -36,7 +36,7 @@ int rsa_decrypt_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned *length, uint8_t *message, const mpz_t gibberish) { diff --git a/rsa-encrypt.c b/rsa-encrypt.c index 2e1df1d8..877de7c9 100644 --- a/rsa-encrypt.c +++ b/rsa-encrypt.c @@ -34,7 +34,7 @@ int rsa_encrypt(const struct rsa_public_key *key, /* For padding */ - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned length, const uint8_t *message, mpz_t gibberish) { diff --git a/rsa-keygen.c b/rsa-keygen.c index b67aab85..8ca947f2 100644 --- a/rsa-keygen.c +++ b/rsa-keygen.c @@ -45,8 +45,8 @@ int rsa_generate_keypair(struct rsa_public_key *pub, struct rsa_private_key *key, - void *random_ctx, nettle_random_func random, - void *progress_ctx, nettle_progress_func progress, + void *random_ctx, nettle_random_func *random, + void *progress_ctx, nettle_progress_func *progress, unsigned n_size, unsigned e_size) { diff --git a/rsa-pkcs1-sign-tr.c b/rsa-pkcs1-sign-tr.c index 672b902b..90c412c3 100644 --- a/rsa-pkcs1-sign-tr.c +++ b/rsa-pkcs1-sign-tr.c @@ -34,7 +34,7 @@ int rsa_pkcs1_sign_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned length, const uint8_t *digest_info, mpz_t s) { @@ -179,7 +179,7 @@ rsa_pkcs1_sign(const struct rsa_private_key *key, int rsa_pkcs1_sign_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned length, const uint8_t *digest_info, mpz_t s); int @@ -406,7 +406,7 @@ _rsa_check_size(mpz_t n); void _rsa_blind (const struct rsa_public_key *pub, - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, mpz_t c, mpz_t ri); void _rsa_unblind (const struct rsa_public_key *pub, mpz_t c, const mpz_t ri); |