summaryrefslogtreecommitdiffstats
path: root/apps/dhparam.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-10-28 23:36:27 +0000
committerMatt Caswell <matt@openssl.org>2014-12-08 21:41:19 +0000
commit348d0d148a0698c687b16c72869401bd4caa8bd4 (patch)
treed4ade0b4f0d6d8524576e44412d595f0133aabb4 /apps/dhparam.c
parent29e7a56d54e5a4e9b7cd1fdf95a2bf42dbf71a76 (diff)
Update apps for bn opaque change
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'apps/dhparam.c')
-rw-r--r--apps/dhparam.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/apps/dhparam.c b/apps/dhparam.c
index 606365e180..c4cf1685a3 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -292,8 +292,15 @@ bad:
if(num) {
- BN_GENCB cb;
- BN_GENCB_set(&cb, dh_cb, bio_err);
+ BN_GENCB *cb;
+ cb = BN_GENCB_new();
+ if(!cb)
+ {
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+
+ BN_GENCB_set(cb, dh_cb, bio_err);
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)
{
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
@@ -309,9 +316,10 @@ bad:
BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num);
if(!dsa || !DSA_generate_parameters_ex(dsa, num,
- NULL, 0, NULL, NULL, &cb))
+ NULL, 0, NULL, NULL, cb))
{
if(dsa) DSA_free(dsa);
+ BN_GENCB_free(cb);
ERR_print_errors(bio_err);
goto end;
}
@@ -320,6 +328,7 @@ bad:
DSA_free(dsa);
if (dh == NULL)
{
+ BN_GENCB_free(cb);
ERR_print_errors(bio_err);
goto end;
}
@@ -330,13 +339,15 @@ bad:
dh = DH_new();
BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g);
BIO_printf(bio_err,"This is going to take a long time\n");
- if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb))
+ if(!dh || !DH_generate_parameters_ex(dh, num, g, cb))
{
+ BN_GENCB_free(cb);
ERR_print_errors(bio_err);
goto end;
}
}
+ BN_GENCB_free(cb);
app_RAND_write_file(NULL, bio_err);
} else {
@@ -547,8 +558,8 @@ static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
- BIO_write(cb->arg,&c,1);
- (void)BIO_flush(cb->arg);
+ BIO_write(BN_GENCB_get_arg(cb),&c,1);
+ (void)BIO_flush(BN_GENCB_get_arg(cb));
#ifdef LINT
p=n;
#endif