summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/apps/dsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/apps/dsa.c')
-rw-r--r--src/lib/libssl/src/apps/dsa.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/lib/libssl/src/apps/dsa.c b/src/lib/libssl/src/apps/dsa.c
index 37b9a3ffb0..a4132de0ea 100644
--- a/src/lib/libssl/src/apps/dsa.c
+++ b/src/lib/libssl/src/apps/dsa.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */ 59#include <openssl/opensslconf.h>/* for OPENSSL_NO_DSA */
60#ifndef OPENSSL_NO_DSA 60#ifndef OPENSSL_NO_DSA
61#include <stdio.h> 61#include <stdio.h>
62#include <stdlib.h> 62#include <stdlib.h>
@@ -119,7 +119,7 @@ MAIN(int argc, char **argv)
119 119
120 if (bio_err == NULL) 120 if (bio_err == NULL)
121 if ((bio_err = BIO_new(BIO_s_file())) != NULL) 121 if ((bio_err = BIO_new(BIO_s_file())) != NULL)
122 BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT); 122 BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
123 123
124 if (!load_config(bio_err, NULL)) 124 if (!load_config(bio_err, NULL))
125 goto end; 125 goto end;
@@ -147,26 +147,25 @@ MAIN(int argc, char **argv)
147 } else if (strcmp(*argv, "-in") == 0) { 147 } else if (strcmp(*argv, "-in") == 0) {
148 if (--argc < 1) 148 if (--argc < 1)
149 goto bad; 149 goto bad;
150 infile= *(++argv); 150 infile = *(++argv);
151 } 151 } else if (strcmp(*argv, "-out") == 0) {
152 else if (strcmp(*argv, "-out") == 0) {
153 if (--argc < 1) 152 if (--argc < 1)
154 goto bad; 153 goto bad;
155 outfile= *(++argv); 154 outfile = *(++argv);
156 } else if (strcmp(*argv, "-passin") == 0) { 155 } else if (strcmp(*argv, "-passin") == 0) {
157 if (--argc < 1) 156 if (--argc < 1)
158 goto bad; 157 goto bad;
159 passargin= *(++argv); 158 passargin = *(++argv);
160 } else if (strcmp(*argv, "-passout") == 0) { 159 } else if (strcmp(*argv, "-passout") == 0) {
161 if (--argc < 1) 160 if (--argc < 1)
162 goto bad; 161 goto bad;
163 passargout= *(++argv); 162 passargout = *(++argv);
164 } 163 }
165#ifndef OPENSSL_NO_ENGINE 164#ifndef OPENSSL_NO_ENGINE
166 else if (strcmp(*argv, "-engine") == 0) { 165 else if (strcmp(*argv, "-engine") == 0) {
167 if (--argc < 1) 166 if (--argc < 1)
168 goto bad; 167 goto bad;
169 engine= *(++argv); 168 engine = *(++argv);
170 } 169 }
171#endif 170#endif
172 else if (strcmp(*argv, "-pvk-strong") == 0) 171 else if (strcmp(*argv, "-pvk-strong") == 0)
@@ -228,7 +227,6 @@ bad:
228 BIO_printf(bio_err, " -modulus print the DSA public value\n"); 227 BIO_printf(bio_err, " -modulus print the DSA public value\n");
229 goto end; 228 goto end;
230 } 229 }
231
232 ERR_load_crypto_strings(); 230 ERR_load_crypto_strings();
233 231
234#ifndef OPENSSL_NO_ENGINE 232#ifndef OPENSSL_NO_ENGINE
@@ -239,14 +237,12 @@ bad:
239 BIO_printf(bio_err, "Error getting passwords\n"); 237 BIO_printf(bio_err, "Error getting passwords\n");
240 goto end; 238 goto end;
241 } 239 }
242
243 in = BIO_new(BIO_s_file()); 240 in = BIO_new(BIO_s_file());
244 out = BIO_new(BIO_s_file()); 241 out = BIO_new(BIO_s_file());
245 if ((in == NULL) || (out == NULL)) { 242 if ((in == NULL) || (out == NULL)) {
246 ERR_print_errors(bio_err); 243 ERR_print_errors(bio_err);
247 goto end; 244 goto end;
248 } 245 }
249
250 if (infile == NULL) 246 if (infile == NULL)
251 BIO_set_fp(in, stdin, BIO_NOCLOSE); 247 BIO_set_fp(in, stdin, BIO_NOCLOSE);
252 else { 248 else {
@@ -259,7 +255,7 @@ bad:
259 BIO_printf(bio_err, "read DSA key\n"); 255 BIO_printf(bio_err, "read DSA key\n");
260 256
261 { 257 {
262 EVP_PKEY *pkey; 258 EVP_PKEY *pkey;
263 259
264 if (pubin) 260 if (pubin)
265 pkey = load_pubkey(bio_err, infile, informat, 1, 261 pkey = load_pubkey(bio_err, infile, informat, 1,
@@ -278,7 +274,6 @@ bad:
278 ERR_print_errors(bio_err); 274 ERR_print_errors(bio_err);
279 goto end; 275 goto end;
280 } 276 }
281
282 if (outfile == NULL) { 277 if (outfile == NULL) {
283 BIO_set_fp(out, stdout, BIO_NOCLOSE); 278 BIO_set_fp(out, stdout, BIO_NOCLOSE);
284 } else { 279 } else {
@@ -295,13 +290,11 @@ bad:
295 goto end; 290 goto end;
296 } 291 }
297 } 292 }
298
299 if (modulus) { 293 if (modulus) {
300 fprintf(stdout, "Public Key="); 294 fprintf(stdout, "Public Key=");
301 BN_print(out, dsa->pub_key); 295 BN_print(out, dsa->pub_key);
302 fprintf(stdout, "\n"); 296 fprintf(stdout, "\n");
303 } 297 }
304
305 if (noout) 298 if (noout)
306 goto end; 299 goto end;
307 BIO_printf(bio_err, "writing DSA key\n"); 300 BIO_printf(bio_err, "writing DSA key\n");
@@ -350,12 +343,12 @@ end:
350 if (passout) 343 if (passout)
351 free(passout); 344 free(passout);
352 apps_shutdown(); 345 apps_shutdown();
353 return(ret); 346 return (ret);
354} 347}
355#else /* !OPENSSL_NO_DSA */ 348#else /* !OPENSSL_NO_DSA */
356 349
357# if PEDANTIC 350#if PEDANTIC
358static void *dummy = &dummy; 351static void *dummy = &dummy;
359# endif 352#endif
360 353
361#endif 354#endif