/*
* 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
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
DH *dh = NULL;
#if OPENSSL_VERSION_NUMBER > 0x00908000L
BN_GENCB cb;
+ union {
+ void *dptr;
+ void (*fptr)(int);
+ } u;
#else
UNUSED(callback);
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,
* 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
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
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);
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,
/*
* 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 <config.h>
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
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
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)) {