diff options
Diffstat (limited to '')
-rw-r--r-- | src/usr.bin/openssl/pkeyutl.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/usr.bin/openssl/pkeyutl.c b/src/usr.bin/openssl/pkeyutl.c index 0529b97798..2caa61e282 100644 --- a/src/usr.bin/openssl/pkeyutl.c +++ b/src/usr.bin/openssl/pkeyutl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkeyutl.c,v 1.6 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: pkeyutl.c,v 1.7 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 | */ |
@@ -72,7 +72,7 @@ static void usage(void); | |||
72 | 72 | ||
73 | static EVP_PKEY_CTX *init_ctx(int *pkeysize, | 73 | static EVP_PKEY_CTX *init_ctx(int *pkeysize, |
74 | char *keyfile, int keyform, int key_type, | 74 | char *keyfile, int keyform, int key_type, |
75 | char *passargin, int pkey_op, ENGINE * e); | 75 | char *passargin, int pkey_op); |
76 | 76 | ||
77 | static int setup_peer(BIO * err, EVP_PKEY_CTX * ctx, int peerform, | 77 | static int setup_peer(BIO * err, EVP_PKEY_CTX * ctx, int peerform, |
78 | const char *file); | 78 | const char *file); |
@@ -86,7 +86,6 @@ pkeyutl_main(int argc, char **argv) | |||
86 | { | 86 | { |
87 | BIO *in = NULL, *out = NULL; | 87 | BIO *in = NULL, *out = NULL; |
88 | char *infile = NULL, *outfile = NULL, *sigfile = NULL; | 88 | char *infile = NULL, *outfile = NULL, *sigfile = NULL; |
89 | ENGINE *e = NULL; | ||
90 | int pkey_op = EVP_PKEY_OP_SIGN, key_type = KEY_PRIVKEY; | 89 | int pkey_op = EVP_PKEY_OP_SIGN, key_type = KEY_PRIVKEY; |
91 | int keyform = FORMAT_PEM, peerform = FORMAT_PEM; | 90 | int keyform = FORMAT_PEM, peerform = FORMAT_PEM; |
92 | char badarg = 0, rev = 0; | 91 | char badarg = 0, rev = 0; |
@@ -126,7 +125,7 @@ pkeyutl_main(int argc, char **argv) | |||
126 | else { | 125 | else { |
127 | ctx = init_ctx(&keysize, | 126 | ctx = init_ctx(&keysize, |
128 | *(++argv), keyform, key_type, | 127 | *(++argv), keyform, key_type, |
129 | passargin, pkey_op, e); | 128 | passargin, pkey_op); |
130 | if (!ctx) { | 129 | if (!ctx) { |
131 | BIO_puts(bio_err, | 130 | BIO_puts(bio_err, |
132 | "Error initializing context\n"); | 131 | "Error initializing context\n"); |
@@ -155,14 +154,6 @@ pkeyutl_main(int argc, char **argv) | |||
155 | else | 154 | else |
156 | keyform = str2fmt(*(++argv)); | 155 | keyform = str2fmt(*(++argv)); |
157 | } | 156 | } |
158 | #ifndef OPENSSL_NO_ENGINE | ||
159 | else if (!strcmp(*argv, "-engine")) { | ||
160 | if (--argc < 1) | ||
161 | badarg = 1; | ||
162 | else | ||
163 | e = setup_engine(bio_err, *(++argv), 0); | ||
164 | } | ||
165 | #endif | ||
166 | else if (!strcmp(*argv, "-pubin")) | 157 | else if (!strcmp(*argv, "-pubin")) |
167 | key_type = KEY_PUBKEY; | 158 | key_type = KEY_PUBKEY; |
168 | else if (!strcmp(*argv, "-certin")) | 159 | else if (!strcmp(*argv, "-certin")) |
@@ -342,9 +333,6 @@ usage() | |||
342 | BIO_printf(bio_err, "-decrypt decrypt with private key\n"); | 333 | BIO_printf(bio_err, "-decrypt decrypt with private key\n"); |
343 | BIO_printf(bio_err, "-derive derive shared secret\n"); | 334 | BIO_printf(bio_err, "-derive derive shared secret\n"); |
344 | BIO_printf(bio_err, "-hexdump hex dump output\n"); | 335 | BIO_printf(bio_err, "-hexdump hex dump output\n"); |
345 | #ifndef OPENSSL_NO_ENGINE | ||
346 | BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); | ||
347 | #endif | ||
348 | BIO_printf(bio_err, "-passin arg pass phrase source\n"); | 336 | BIO_printf(bio_err, "-passin arg pass phrase source\n"); |
349 | 337 | ||
350 | } | 338 | } |
@@ -352,7 +340,7 @@ usage() | |||
352 | static EVP_PKEY_CTX * | 340 | static EVP_PKEY_CTX * |
353 | init_ctx(int *pkeysize, | 341 | init_ctx(int *pkeysize, |
354 | char *keyfile, int keyform, int key_type, | 342 | char *keyfile, int keyform, int key_type, |
355 | char *passargin, int pkey_op, ENGINE * e) | 343 | char *passargin, int pkey_op) |
356 | { | 344 | { |
357 | EVP_PKEY *pkey = NULL; | 345 | EVP_PKEY *pkey = NULL; |
358 | EVP_PKEY_CTX *ctx = NULL; | 346 | EVP_PKEY_CTX *ctx = NULL; |
@@ -372,17 +360,17 @@ init_ctx(int *pkeysize, | |||
372 | switch (key_type) { | 360 | switch (key_type) { |
373 | case KEY_PRIVKEY: | 361 | case KEY_PRIVKEY: |
374 | pkey = load_key(bio_err, keyfile, keyform, 0, | 362 | pkey = load_key(bio_err, keyfile, keyform, 0, |
375 | passin, e, "Private Key"); | 363 | passin, "Private Key"); |
376 | break; | 364 | break; |
377 | 365 | ||
378 | case KEY_PUBKEY: | 366 | case KEY_PUBKEY: |
379 | pkey = load_pubkey(bio_err, keyfile, keyform, 0, | 367 | pkey = load_pubkey(bio_err, keyfile, keyform, 0, |
380 | NULL, e, "Public Key"); | 368 | NULL, "Public Key"); |
381 | break; | 369 | break; |
382 | 370 | ||
383 | case KEY_CERT: | 371 | case KEY_CERT: |
384 | x = load_cert(bio_err, keyfile, keyform, | 372 | x = load_cert(bio_err, keyfile, keyform, |
385 | NULL, e, "Certificate"); | 373 | NULL, "Certificate"); |
386 | if (x) { | 374 | if (x) { |
387 | pkey = X509_get_pubkey(x); | 375 | pkey = X509_get_pubkey(x); |
388 | X509_free(x); | 376 | X509_free(x); |
@@ -396,7 +384,7 @@ init_ctx(int *pkeysize, | |||
396 | if (!pkey) | 384 | if (!pkey) |
397 | goto end; | 385 | goto end; |
398 | 386 | ||
399 | ctx = EVP_PKEY_CTX_new(pkey, e); | 387 | ctx = EVP_PKEY_CTX_new(pkey, NULL); |
400 | 388 | ||
401 | EVP_PKEY_free(pkey); | 389 | EVP_PKEY_free(pkey); |
402 | 390 | ||
@@ -452,7 +440,7 @@ setup_peer(BIO * err, EVP_PKEY_CTX * ctx, int peerform, | |||
452 | BIO_puts(err, "-peerkey command before -inkey\n"); | 440 | BIO_puts(err, "-peerkey command before -inkey\n"); |
453 | return 0; | 441 | return 0; |
454 | } | 442 | } |
455 | peer = load_pubkey(bio_err, file, peerform, 0, NULL, NULL, "Peer Key"); | 443 | peer = load_pubkey(bio_err, file, peerform, 0, NULL, "Peer Key"); |
456 | 444 | ||
457 | if (!peer) { | 445 | if (!peer) { |
458 | BIO_printf(bio_err, "Error reading peer key %s\n", file); | 446 | BIO_printf(bio_err, "Error reading peer key %s\n", file); |