summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/pkcs12.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/usr.bin/openssl/pkcs12.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/usr.bin/openssl/pkcs12.c b/src/usr.bin/openssl/pkcs12.c
index 901ddc05f3..eaa7bcceac 100644
--- a/src/usr.bin/openssl/pkcs12.c
+++ b/src/usr.bin/openssl/pkcs12.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs12.c,v 1.3 2015/08/22 16:36:05 jsing Exp $ */ 1/* $OpenBSD: pkcs12.c,v 1.4 2015/09/11 14:30:23 bcook Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -95,7 +95,6 @@ static int set_pbe(BIO * err, int *ppbe, const char *str);
95int 95int
96pkcs12_main(int argc, char **argv) 96pkcs12_main(int argc, char **argv)
97{ 97{
98 ENGINE *e = NULL;
99 char *infile = NULL, *outfile = NULL, *keyname = NULL; 98 char *infile = NULL, *outfile = NULL, *keyname = NULL;
100 char *certfile = NULL; 99 char *certfile = NULL;
101 BIO *in = NULL, *out = NULL; 100 BIO *in = NULL, *out = NULL;
@@ -124,9 +123,6 @@ pkcs12_main(int argc, char **argv)
124 char *passin = NULL, *passout = NULL; 123 char *passin = NULL, *passout = NULL;
125 char *macalg = NULL; 124 char *macalg = NULL;
126 char *CApath = NULL, *CAfile = NULL; 125 char *CApath = NULL, *CAfile = NULL;
127#ifndef OPENSSL_NO_ENGINE
128 char *engine = NULL;
129#endif
130 126
131 cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; 127 cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
132 128
@@ -285,14 +281,6 @@ pkcs12_main(int argc, char **argv)
285 CAfile = *args; 281 CAfile = *args;
286 } else 282 } else
287 badarg = 1; 283 badarg = 1;
288#ifndef OPENSSL_NO_ENGINE
289 } else if (!strcmp(*args, "-engine")) {
290 if (args[1]) {
291 args++;
292 engine = *args;
293 } else
294 badarg = 1;
295#endif
296 } else 284 } else
297 badarg = 1; 285 badarg = 1;
298 286
@@ -349,16 +337,10 @@ pkcs12_main(int argc, char **argv)
349 BIO_printf(bio_err, "-password p set import/export password source\n"); 337 BIO_printf(bio_err, "-password p set import/export password source\n");
350 BIO_printf(bio_err, "-passin p input file pass phrase source\n"); 338 BIO_printf(bio_err, "-passin p input file pass phrase source\n");
351 BIO_printf(bio_err, "-passout p output file pass phrase source\n"); 339 BIO_printf(bio_err, "-passout p output file pass phrase source\n");
352#ifndef OPENSSL_NO_ENGINE
353 BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n");
354#endif
355 BIO_printf(bio_err, "-CSP name Microsoft CSP name\n"); 340 BIO_printf(bio_err, "-CSP name Microsoft CSP name\n");
356 BIO_printf(bio_err, "-LMK Add local machine keyset attribute to private key\n"); 341 BIO_printf(bio_err, "-LMK Add local machine keyset attribute to private key\n");
357 goto end; 342 goto end;
358 } 343 }
359#ifndef OPENSSL_NO_ENGINE
360 e = setup_engine(bio_err, engine, 0);
361#endif
362 344
363 if (passarg) { 345 if (passarg) {
364 if (export_cert) 346 if (export_cert)
@@ -428,14 +410,14 @@ pkcs12_main(int argc, char **argv)
428 410
429 if (!(options & NOKEYS)) { 411 if (!(options & NOKEYS)) {
430 key = load_key(bio_err, keyname ? keyname : infile, 412 key = load_key(bio_err, keyname ? keyname : infile,
431 FORMAT_PEM, 1, passin, e, "private key"); 413 FORMAT_PEM, 1, passin, "private key");
432 if (!key) 414 if (!key)
433 goto export_end; 415 goto export_end;
434 } 416 }
435 417
436 /* Load in all certs in input file */ 418 /* Load in all certs in input file */
437 if (!(options & NOCERTS)) { 419 if (!(options & NOCERTS)) {
438 certs = load_certs(bio_err, infile, FORMAT_PEM, NULL, e, 420 certs = load_certs(bio_err, infile, FORMAT_PEM, NULL,
439 "certificates"); 421 "certificates");
440 if (!certs) 422 if (!certs)
441 goto export_end; 423 goto export_end;
@@ -465,8 +447,7 @@ pkcs12_main(int argc, char **argv)
465 if (certfile) { 447 if (certfile) {
466 STACK_OF(X509) * morecerts = NULL; 448 STACK_OF(X509) * morecerts = NULL;
467 if (!(morecerts = load_certs(bio_err, certfile, FORMAT_PEM, 449 if (!(morecerts = load_certs(bio_err, certfile, FORMAT_PEM,
468 NULL, e, 450 NULL, "certificates from certfile")))
469 "certificates from certfile")))
470 goto export_end; 451 goto export_end;
471 while (sk_X509_num(morecerts) > 0) 452 while (sk_X509_num(morecerts) > 0)
472 sk_X509_push(certs, sk_X509_shift(morecerts)); 453 sk_X509_push(certs, sk_X509_shift(morecerts));