X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fdhparam.c;h=606365e1805d255433e9b248d82eb1d42439a258;hb=c0b90b3237b337e4b1abb7c352952ebe3ef9ca03;hp=e3cabcfcdccd4e4598380c476bad58bb3a35bfaa;hpb=2aaec9cced89edfdc8375b38a130fa1c35a98025;p=oweals%2Fopenssl.git diff --git a/apps/dhparam.c b/apps/dhparam.c index e3cabcfcdc..606365e180 100644 --- a/apps/dhparam.c +++ b/apps/dhparam.c @@ -109,6 +109,7 @@ * */ +#include /* for OPENSSL_NO_DH */ #ifndef OPENSSL_NO_DH #include #include @@ -129,7 +130,7 @@ #undef PROG #define PROG dhparam_main -#define DEFBITS 512 +#define DEFBITS 2048 /* -inform arg - input format - default PEM (DER or PEM) * -outform arg - output format - default PEM @@ -148,9 +149,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif DH *dh=NULL; int i,badops=0,text=0; #ifndef OPENSSL_NO_DSA @@ -255,7 +253,7 @@ bad: BIO_printf(bio_err," -C Output C code\n"); BIO_printf(bio_err," -2 generate parameters using 2 as the generator value\n"); BIO_printf(bio_err," -5 generate parameters using 5 as the generator value\n"); - BIO_printf(bio_err," numbits number of bits in to generate (default 512)\n"); + BIO_printf(bio_err," numbits number of bits in to generate (default 2048)\n"); #ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); #endif @@ -269,7 +267,7 @@ bad: ERR_load_crypto_strings(); #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if (g && !num) @@ -334,7 +332,6 @@ bad: 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_free(dh); ERR_print_errors(bio_err); goto end; } @@ -515,7 +512,12 @@ bad: if (outformat == FORMAT_ASN1) i=i2d_DHparams_bio(out,dh); else if (outformat == FORMAT_PEM) - i=PEM_write_bio_DHparams(out,dh); + { + if (dh->q) + i=PEM_write_bio_DHxparams(out,dh); + else + i=PEM_write_bio_DHparams(out,dh); + } else { BIO_printf(bio_err,"bad output format specified for outfile\n"); goto end; @@ -553,4 +555,10 @@ static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb) return 1; } +#else /* !OPENSSL_NO_DH */ + +# if PEDANTIC +static void *dummy=&dummy; +# endif + #endif