From 8a0943e1253db16d0e50200deb38c9c49e27a86e Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 30 Oct 2009 05:08:23 +0000 Subject: [PATCH] silence compiler warnings. [RT #20472] --- lib/dns/openssldh_link.c | 20 +++++++++++++++----- lib/dns/openssldsa_link.c | 21 ++++++++++++++++----- lib/dns/opensslrsa_link.c | 20 +++++++++++++++----- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/lib/dns/openssldh_link.c b/lib/dns/openssldh_link.c index 8773cbf9c3..5be3c9c67d 100644 --- a/lib/dns/openssldh_link.c +++ b/lib/dns/openssldh_link.c @@ -31,7 +31,7 @@ /* * Principal Author: Brian Wellington - * $Id: openssldh_link.c,v 1.17 2009/10/24 09:46:19 fdupont Exp $ + * $Id: openssldh_link.c,v 1.18 2009/10/30 05:08:23 marka Exp $ */ #ifdef OPENSSL @@ -153,11 +153,16 @@ openssldh_paramcompare(const dst_key_t *key1, const dst_key_t *key2) { static int progress_cb(int p, int n, BN_GENCB *cb) { - void (*callback)(int) = cb->arg; + union { + void *dptr; + void (*fptr)(int); + } u; UNUSED(n); - if (callback != NULL) - callback(p); + + u.dptr = cb->arg; + if (u.fptr != NULL) + u.fptr(p); return (1); } #endif @@ -167,6 +172,10 @@ openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) { DH *dh = NULL; #if OPENSSL_VERSION_NUMBER > 0x00908000L BN_GENCB cb; + union { + void *dptr; + void (*fptr)(int); + } u; #else UNUSED(callback); @@ -200,7 +209,8 @@ openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) { if (callback == NULL) { BN_GENCB_set_old(&cb, NULL, NULL); } else { - BN_GENCB_set(&cb, &progress_cb, callback); + u.fptr = callback; + BN_GENCB_set(&cb, &progress_cb, u.dptr); } if (!DH_generate_parameters_ex(dh, key->key_size, generator, diff --git a/lib/dns/openssldsa_link.c b/lib/dns/openssldsa_link.c index e25b27e6ba..feab1a7906 100644 --- a/lib/dns/openssldsa_link.c +++ b/lib/dns/openssldsa_link.c @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: openssldsa_link.c,v 1.17 2009/10/24 09:46:19 fdupont Exp $ */ +/* $Id: openssldsa_link.c,v 1.18 2009/10/30 05:08:23 marka Exp $ */ #ifdef OPENSSL #ifndef USE_EVP @@ -317,11 +317,16 @@ openssldsa_compare(const dst_key_t *key1, const dst_key_t *key2) { static int progress_cb(int p, int n, BN_GENCB *cb) { - void (*callback)(int) = cb->arg; + union { + void *dptr; + void (*fptr)(int); + } u; UNUSED(n); - if (callback != NULL) - callback(p); + + u.dptr = cb->arg; + if (u.fptr != NULL) + u.fptr(p); return (1); } #endif @@ -333,8 +338,13 @@ openssldsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { isc_result_t result; #if OPENSSL_VERSION_NUMBER > 0x00908000L BN_GENCB cb; + union { + void *dptr; + void (*fptr)(int); + } u; #else + UNUSED(callback); #endif UNUSED(unused); @@ -352,7 +362,8 @@ openssldsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { if (callback == NULL) { BN_GENCB_set_old(&cb, NULL, NULL); } else { - BN_GENCB_set(&cb, &progress_cb, callback); + u.fptr = callback; + BN_GENCB_set(&cb, &progress_cb, u.dptr); } if (!DSA_generate_parameters_ex(dsa, key->key_size, rand_array, diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index cdcda998bb..08bf8b39b8 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -17,7 +17,7 @@ /* * Principal Author: Brian Wellington - * $Id: opensslrsa_link.c,v 1.36 2009/10/28 21:07:09 marka Exp $ + * $Id: opensslrsa_link.c,v 1.37 2009/10/30 05:08:23 marka Exp $ */ #ifdef OPENSSL #include @@ -708,11 +708,16 @@ opensslrsa_compare(const dst_key_t *key1, const dst_key_t *key2) { static int progress_cb(int p, int n, BN_GENCB *cb) { - void (*callback)(int) = cb->arg; + union { + void *dptr; + void (*fptr)(int); + } u; UNUSED(n); - if (callback != NULL) - callback(p); + + u.dptr = cb->arg; + if (u.fptr != NULL) + u.fptr(p); return (1); } #endif @@ -721,6 +726,10 @@ static isc_result_t opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { #if OPENSSL_VERSION_NUMBER > 0x00908000L BN_GENCB cb; + union { + void *dptr; + void (*fptr)(int); + } u; RSA *rsa = RSA_new(); BIGNUM *e = BN_new(); #if USE_EVP @@ -749,7 +758,8 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { if (callback == NULL) { BN_GENCB_set_old(&cb, NULL, NULL); } else { - BN_GENCB_set(&cb, &progress_cb, callback); + u.fptr = callback; + BN_GENCB_set(&cb, &progress_cb, u.dptr); } if (RSA_generate_key_ex(rsa, key->key_size, e, &cb)) {