summaryrefslogtreecommitdiffstats
path: root/apps/gendh.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-10-29 04:14:08 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-10-29 04:14:08 +0000
commit2aaec9cced89edfdc8375b38a130fa1c35a98025 (patch)
tree8f9339b8dac8d23ae1b424216b769cdeef7f59f0 /apps/gendh.c
parent9d473aa2e4076beb959bc9701786a0860877ee12 (diff)
Update any code that was using deprecated functions so that everything builds
and links with OPENSSL_NO_DEPRECATED defined.
Diffstat (limited to 'apps/gendh.c')
-rw-r--r--apps/gendh.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/gendh.c b/apps/gendh.c
index b90087493a..69baa50b01 100644
--- a/apps/gendh.c
+++ b/apps/gendh.c
@@ -81,12 +81,13 @@
#undef PROG
#define PROG gendh_main
-static void MS_CALLBACK dh_cb(int p, int n, void *arg);
+static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
+ BN_GENCB cb;
#ifndef OPENSSL_NO_ENGINE
ENGINE *e = NULL;
#endif
@@ -102,6 +103,7 @@ int MAIN(int argc, char **argv)
apps_startup();
+ BN_GENCB_set(&cb, dh_cb, bio_err);
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
@@ -199,10 +201,10 @@ bad:
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");
- dh=DH_generate_parameters(num,g,dh_cb,bio_err);
-
- if (dh == NULL) goto end;
+ if(((dh = DH_new()) == NULL) || !DH_generate_parameters_ex(dh, num, g, &cb))
+ goto end;
+
app_RAND_write_file(NULL, bio_err);
if (!PEM_write_bio_DHparams(out,dh))
@@ -217,7 +219,7 @@ end:
OPENSSL_EXIT(ret);
}
-static void MS_CALLBACK dh_cb(int p, int n, void *arg)
+static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
{
char c='*';
@@ -225,10 +227,11 @@ static void MS_CALLBACK dh_cb(int p, int n, void *arg)
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
- BIO_write((BIO *)arg,&c,1);
- (void)BIO_flush((BIO *)arg);
+ BIO_write(cb->arg,&c,1);
+ (void)BIO_flush(cb->arg);
#ifdef LINT
p=n;
#endif
+ return 1;
}
#endif