summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/pkey.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/usr.bin/openssl/pkey.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/usr.bin/openssl/pkey.c b/src/usr.bin/openssl/pkey.c
index be6bffa001..72c03181f6 100644
--- a/src/usr.bin/openssl/pkey.c
+++ b/src/usr.bin/openssl/pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkey.c,v 1.4 2015/08/22 16:36:05 jsing Exp $ */ 1/* $OpenBSD: pkey.c,v 1.5 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 2006 3 * project 2006
4 */ 4 */
@@ -68,7 +68,6 @@
68int 68int
69pkey_main(int argc, char **argv) 69pkey_main(int argc, char **argv)
70{ 70{
71 ENGINE *e = NULL;
72 char **args, *infile = NULL, *outfile = NULL; 71 char **args, *infile = NULL, *outfile = NULL;
73 char *passargin = NULL, *passargout = NULL; 72 char *passargin = NULL, *passargout = NULL;
74 BIO *in = NULL, *out = NULL; 73 BIO *in = NULL, *out = NULL;
@@ -78,9 +77,6 @@ pkey_main(int argc, char **argv)
78 EVP_PKEY *pkey = NULL; 77 EVP_PKEY *pkey = NULL;
79 char *passin = NULL, *passout = NULL; 78 char *passin = NULL, *passout = NULL;
80 int badarg = 0; 79 int badarg = 0;
81#ifndef OPENSSL_NO_ENGINE
82 char *engine = NULL;
83#endif
84 int ret = 1; 80 int ret = 1;
85 81
86 informat = FORMAT_PEM; 82 informat = FORMAT_PEM;
@@ -109,13 +105,6 @@ pkey_main(int argc, char **argv)
109 goto bad; 105 goto bad;
110 passargout = *(++args); 106 passargout = *(++args);
111 } 107 }
112#ifndef OPENSSL_NO_ENGINE
113 else if (strcmp(*args, "-engine") == 0) {
114 if (!args[1])
115 goto bad;
116 engine = *(++args);
117 }
118#endif
119 else if (!strcmp(*args, "-in")) { 108 else if (!strcmp(*args, "-in")) {
120 if (args[1]) { 109 if (args[1]) {
121 args++; 110 args++;
@@ -162,14 +151,8 @@ bad:
162 BIO_printf(bio_err, "-outform X output format (DER or PEM)\n"); 151 BIO_printf(bio_err, "-outform X output format (DER or PEM)\n");
163 BIO_printf(bio_err, "-out file output file\n"); 152 BIO_printf(bio_err, "-out file output file\n");
164 BIO_printf(bio_err, "-passout arg output file pass phrase source\n"); 153 BIO_printf(bio_err, "-passout arg output file pass phrase source\n");
165#ifndef OPENSSL_NO_ENGINE
166 BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n");
167#endif
168 return 1; 154 return 1;
169 } 155 }
170#ifndef OPENSSL_NO_ENGINE
171 e = setup_engine(bio_err, engine, 0);
172#endif
173 156
174 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { 157 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
175 BIO_printf(bio_err, "Error getting passwords\n"); 158 BIO_printf(bio_err, "Error getting passwords\n");
@@ -187,10 +170,9 @@ bad:
187 170
188 if (pubin) 171 if (pubin)
189 pkey = load_pubkey(bio_err, infile, informat, 1, 172 pkey = load_pubkey(bio_err, infile, informat, 1,
190 passin, e, "Public Key"); 173 passin, "Public Key");
191 else 174 else
192 pkey = load_key(bio_err, infile, informat, 1, 175 pkey = load_key(bio_err, infile, informat, 1, passin, "key");
193 passin, e, "key");
194 if (!pkey) 176 if (!pkey)
195 goto end; 177 goto end;
196 178