dsaparam.c (109998) | dsaparam.c (111147) |
---|---|
1/* apps/dsaparam.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 76 unchanged lines hidden (view full) --- 85 */ 86 87static void MS_CALLBACK dsa_cb(int p, int n, void *arg); 88 89int MAIN(int, char **); 90 91int MAIN(int argc, char **argv) 92 { | 1/* apps/dsaparam.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 76 unchanged lines hidden (view full) --- 85 */ 86 87static void MS_CALLBACK dsa_cb(int p, int n, void *arg); 88 89int MAIN(int, char **); 90 91int MAIN(int argc, char **argv) 92 { |
93#ifndef OPENSSL_NO_ENGINE |
|
93 ENGINE *e = NULL; | 94 ENGINE *e = NULL; |
95#endif |
|
94 DSA *dsa=NULL; 95 int i,badops=0,text=0; 96 BIO *in=NULL,*out=NULL; 97 int informat,outformat,noout=0,C=0,ret=1; 98 char *infile,*outfile,*prog,*inrand=NULL; 99 int numbits= -1,num,genkey=0; 100 int need_rand=0; | 96 DSA *dsa=NULL; 97 int i,badops=0,text=0; 98 BIO *in=NULL,*out=NULL; 99 int informat,outformat,noout=0,C=0,ret=1; 100 char *infile,*outfile,*prog,*inrand=NULL; 101 int numbits= -1,num,genkey=0; 102 int need_rand=0; |
103#ifndef OPENSSL_NO_ENGINE |
|
101 char *engine=NULL; | 104 char *engine=NULL; |
105#endif |
|
102 103 apps_startup(); 104 105 if (bio_err == NULL) 106 if ((bio_err=BIO_new(BIO_s_file())) != NULL) 107 BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); 108 109 if (!load_config(bio_err, NULL)) --- 24 unchanged lines hidden (view full) --- 134 if (--argc < 1) goto bad; 135 infile= *(++argv); 136 } 137 else if (strcmp(*argv,"-out") == 0) 138 { 139 if (--argc < 1) goto bad; 140 outfile= *(++argv); 141 } | 106 107 apps_startup(); 108 109 if (bio_err == NULL) 110 if ((bio_err=BIO_new(BIO_s_file())) != NULL) 111 BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); 112 113 if (!load_config(bio_err, NULL)) --- 24 unchanged lines hidden (view full) --- 138 if (--argc < 1) goto bad; 139 infile= *(++argv); 140 } 141 else if (strcmp(*argv,"-out") == 0) 142 { 143 if (--argc < 1) goto bad; 144 outfile= *(++argv); 145 } |
146#ifndef OPENSSL_NO_ENGINE |
|
142 else if(strcmp(*argv, "-engine") == 0) 143 { 144 if (--argc < 1) goto bad; 145 engine = *(++argv); 146 } | 147 else if(strcmp(*argv, "-engine") == 0) 148 { 149 if (--argc < 1) goto bad; 150 engine = *(++argv); 151 } |
152#endif |
|
147 else if (strcmp(*argv,"-text") == 0) 148 text=1; 149 else if (strcmp(*argv,"-C") == 0) 150 C=1; 151 else if (strcmp(*argv,"-genkey") == 0) 152 { 153 genkey=1; 154 need_rand=1; --- 31 unchanged lines hidden (view full) --- 186 BIO_printf(bio_err," -outform arg output format - DER or PEM\n"); 187 BIO_printf(bio_err," -in arg input file\n"); 188 BIO_printf(bio_err," -out arg output file\n"); 189 BIO_printf(bio_err," -text print as text\n"); 190 BIO_printf(bio_err," -C Output C code\n"); 191 BIO_printf(bio_err," -noout no output\n"); 192 BIO_printf(bio_err," -genkey generate a DSA key\n"); 193 BIO_printf(bio_err," -rand files to use for random number input\n"); | 153 else if (strcmp(*argv,"-text") == 0) 154 text=1; 155 else if (strcmp(*argv,"-C") == 0) 156 C=1; 157 else if (strcmp(*argv,"-genkey") == 0) 158 { 159 genkey=1; 160 need_rand=1; --- 31 unchanged lines hidden (view full) --- 192 BIO_printf(bio_err," -outform arg output format - DER or PEM\n"); 193 BIO_printf(bio_err," -in arg input file\n"); 194 BIO_printf(bio_err," -out arg output file\n"); 195 BIO_printf(bio_err," -text print as text\n"); 196 BIO_printf(bio_err," -C Output C code\n"); 197 BIO_printf(bio_err," -noout no output\n"); 198 BIO_printf(bio_err," -genkey generate a DSA key\n"); 199 BIO_printf(bio_err," -rand files to use for random number input\n"); |
200#ifndef OPENSSL_NO_ENGINE |
|
194 BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); | 201 BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); |
202#endif |
|
195 BIO_printf(bio_err," number number of bits to use for generating private key\n"); 196 goto end; 197 } 198 199 ERR_load_crypto_strings(); 200 201 in=BIO_new(BIO_s_file()); 202 out=BIO_new(BIO_s_file()); --- 27 unchanged lines hidden (view full) --- 230 { 231 if (BIO_write_filename(out,outfile) <= 0) 232 { 233 perror(outfile); 234 goto end; 235 } 236 } 237 | 203 BIO_printf(bio_err," number number of bits to use for generating private key\n"); 204 goto end; 205 } 206 207 ERR_load_crypto_strings(); 208 209 in=BIO_new(BIO_s_file()); 210 out=BIO_new(BIO_s_file()); --- 27 unchanged lines hidden (view full) --- 238 { 239 if (BIO_write_filename(out,outfile) <= 0) 240 { 241 perror(outfile); 242 goto end; 243 } 244 } 245 |
246#ifndef OPENSSL_NO_ENGINE |
|
238 e = setup_engine(bio_err, engine, 0); | 247 e = setup_engine(bio_err, engine, 0); |
248#endif |
|
239 240 if (need_rand) 241 { 242 app_RAND_load_file(NULL, bio_err, (inrand != NULL)); 243 if (inrand != NULL) 244 BIO_printf(bio_err,"%ld semi-random bytes loaded\n", 245 app_RAND_load_files(inrand)); 246 } --- 146 unchanged lines hidden --- | 249 250 if (need_rand) 251 { 252 app_RAND_load_file(NULL, bio_err, (inrand != NULL)); 253 if (inrand != NULL) 254 BIO_printf(bio_err,"%ld semi-random bytes loaded\n", 255 app_RAND_load_files(inrand)); 256 } --- 146 unchanged lines hidden --- |