diff options
author | Matt Caswell <matt@openssl.org> | 2014-10-28 23:36:27 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-12-08 21:41:19 +0000 |
commit | 348d0d148a0698c687b16c72869401bd4caa8bd4 (patch) | |
tree | d4ade0b4f0d6d8524576e44412d595f0133aabb4 /apps/dsaparam.c | |
parent | 29e7a56d54e5a4e9b7cd1fdf95a2bf42dbf71a76 (diff) | |
download | openssl-348d0d148a0698c687b16c72869401bd4caa8bd4.tar.gz |
Update apps for bn opaque change
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'apps/dsaparam.c')
-rw-r--r-- | apps/dsaparam.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/apps/dsaparam.c b/apps/dsaparam.c index 03e33f9f7e..e51f5026de 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -119,6 +119,7 @@ int MAIN(int argc, char **argv) int numbits= -1,num,genkey=0; int need_rand=0; int non_fips_allow = 0; + BN_GENCB *cb = NULL; #ifndef OPENSSL_NO_ENGINE char *engine=NULL; #endif @@ -291,8 +292,13 @@ bad: if (numbits > 0) { - BN_GENCB cb; - BN_GENCB_set(&cb, dsa_cb, bio_err); + cb = BN_GENCB_new(); + if(!cb) + { + BIO_printf(bio_err,"Error allocating BN_GENCB object\n"); + goto end; + } + BN_GENCB_set(cb, dsa_cb, bio_err); assert(need_rand); dsa = DSA_new(); if(!dsa) @@ -320,7 +326,7 @@ bad: alarm(timebomb); } #endif - if(!DSA_generate_parameters_ex(dsa,num,NULL,0,NULL,NULL, &cb)) + if(!DSA_generate_parameters_ex(dsa,num,NULL,0,NULL,NULL, cb)) { #ifdef GENCB_TEST if(stop_keygen_flag) @@ -458,6 +464,7 @@ bad: app_RAND_write_file(NULL, bio_err); ret=0; end: + if (cb != NULL) BN_GENCB_free(cb); if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); @@ -473,8 +480,8 @@ static int MS_CALLBACK dsa_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 |