diff options
Diffstat (limited to '')
-rw-r--r-- | src/usr.bin/openssl/dgst.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/usr.bin/openssl/dgst.c b/src/usr.bin/openssl/dgst.c index d442bba266..94d98ac6a4 100644 --- a/src/usr.bin/openssl/dgst.c +++ b/src/usr.bin/openssl/dgst.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dgst.c,v 1.5 2015/09/10 16:01:06 jsing Exp $ */ | 1 | /* $OpenBSD: dgst.c,v 1.6 2015/09/11 14:30:23 bcook Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -101,7 +101,6 @@ list_md_fn(const EVP_MD * m, const char *from, const char *to, void *arg) | |||
101 | int | 101 | int |
102 | dgst_main(int argc, char **argv) | 102 | dgst_main(int argc, char **argv) |
103 | { | 103 | { |
104 | ENGINE *e = NULL; | ||
105 | unsigned char *buf = NULL; | 104 | unsigned char *buf = NULL; |
106 | int i, err = 1; | 105 | int i, err = 1; |
107 | const EVP_MD *md = NULL, *m; | 106 | const EVP_MD *md = NULL, *m; |
@@ -120,9 +119,6 @@ dgst_main(int argc, char **argv) | |||
120 | unsigned char *sigbuf = NULL; | 119 | unsigned char *sigbuf = NULL; |
121 | int siglen = 0; | 120 | int siglen = 0; |
122 | char *passargin = NULL, *passin = NULL; | 121 | char *passargin = NULL, *passin = NULL; |
123 | #ifndef OPENSSL_NO_ENGINE | ||
124 | char *engine = NULL; | ||
125 | #endif | ||
126 | char *hmac_key = NULL; | 122 | char *hmac_key = NULL; |
127 | char *mac_name = NULL; | 123 | char *mac_name = NULL; |
128 | STACK_OF(OPENSSL_STRING) * sigopts = NULL, *macopts = NULL; | 124 | STACK_OF(OPENSSL_STRING) * sigopts = NULL, *macopts = NULL; |
@@ -178,14 +174,6 @@ dgst_main(int argc, char **argv) | |||
178 | break; | 174 | break; |
179 | keyform = str2fmt(*(++argv)); | 175 | keyform = str2fmt(*(++argv)); |
180 | } | 176 | } |
181 | #ifndef OPENSSL_NO_ENGINE | ||
182 | else if (strcmp(*argv, "-engine") == 0) { | ||
183 | if (--argc < 1) | ||
184 | break; | ||
185 | engine = *(++argv); | ||
186 | e = setup_engine(bio_err, engine, 0); | ||
187 | } | ||
188 | #endif | ||
189 | else if (strcmp(*argv, "-hex") == 0) | 177 | else if (strcmp(*argv, "-hex") == 0) |
190 | out_bin = 0; | 178 | out_bin = 0; |
191 | else if (strcmp(*argv, "-binary") == 0) | 179 | else if (strcmp(*argv, "-binary") == 0) |
@@ -238,16 +226,13 @@ dgst_main(int argc, char **argv) | |||
238 | BIO_printf(bio_err, "-sign file sign digest using private key in file\n"); | 226 | BIO_printf(bio_err, "-sign file sign digest using private key in file\n"); |
239 | BIO_printf(bio_err, "-verify file verify a signature using public key in file\n"); | 227 | BIO_printf(bio_err, "-verify file verify a signature using public key in file\n"); |
240 | BIO_printf(bio_err, "-prverify file verify a signature using private key in file\n"); | 228 | BIO_printf(bio_err, "-prverify file verify a signature using private key in file\n"); |
241 | BIO_printf(bio_err, "-keyform arg key file format (PEM or ENGINE)\n"); | 229 | BIO_printf(bio_err, "-keyform arg key file format (PEM)\n"); |
242 | BIO_printf(bio_err, "-out filename output to filename rather than stdout\n"); | 230 | BIO_printf(bio_err, "-out filename output to filename rather than stdout\n"); |
243 | BIO_printf(bio_err, "-signature file signature to verify\n"); | 231 | BIO_printf(bio_err, "-signature file signature to verify\n"); |
244 | BIO_printf(bio_err, "-sigopt nm:v signature parameter\n"); | 232 | BIO_printf(bio_err, "-sigopt nm:v signature parameter\n"); |
245 | BIO_printf(bio_err, "-hmac key create hashed MAC with key\n"); | 233 | BIO_printf(bio_err, "-hmac key create hashed MAC with key\n"); |
246 | BIO_printf(bio_err, "-mac algorithm create MAC (not neccessarily HMAC)\n"); | 234 | BIO_printf(bio_err, "-mac algorithm create MAC (not neccessarily HMAC)\n"); |
247 | BIO_printf(bio_err, "-macopt nm:v MAC algorithm parameters or key\n"); | 235 | BIO_printf(bio_err, "-macopt nm:v MAC algorithm parameters or key\n"); |
248 | #ifndef OPENSSL_NO_ENGINE | ||
249 | BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); | ||
250 | #endif | ||
251 | 236 | ||
252 | EVP_MD_do_all_sorted(list_md_fn, bio_err); | 237 | EVP_MD_do_all_sorted(list_md_fn, bio_err); |
253 | goto end; | 238 | goto end; |
@@ -298,10 +283,10 @@ dgst_main(int argc, char **argv) | |||
298 | if (keyfile) { | 283 | if (keyfile) { |
299 | if (want_pub) | 284 | if (want_pub) |
300 | sigkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL, | 285 | sigkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL, |
301 | e, "key file"); | 286 | "key file"); |
302 | else | 287 | else |
303 | sigkey = load_key(bio_err, keyfile, keyform, 0, passin, | 288 | sigkey = load_key(bio_err, keyfile, keyform, 0, passin, |
304 | e, "key file"); | 289 | "key file"); |
305 | if (!sigkey) { | 290 | if (!sigkey) { |
306 | /* | 291 | /* |
307 | * load_[pub]key() has already printed an appropriate | 292 | * load_[pub]key() has already printed an appropriate |
@@ -313,7 +298,7 @@ dgst_main(int argc, char **argv) | |||
313 | if (mac_name) { | 298 | if (mac_name) { |
314 | EVP_PKEY_CTX *mac_ctx = NULL; | 299 | EVP_PKEY_CTX *mac_ctx = NULL; |
315 | int r = 0; | 300 | int r = 0; |
316 | if (!init_gen_str(bio_err, &mac_ctx, mac_name, e, 0)) | 301 | if (!init_gen_str(bio_err, &mac_ctx, mac_name, 0)) |
317 | goto mac_end; | 302 | goto mac_end; |
318 | if (macopts) { | 303 | if (macopts) { |
319 | char *macopt; | 304 | char *macopt; |
@@ -341,7 +326,7 @@ mac_end: | |||
341 | goto end; | 326 | goto end; |
342 | } | 327 | } |
343 | if (hmac_key) { | 328 | if (hmac_key) { |
344 | sigkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, e, | 329 | sigkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, |
345 | (unsigned char *) hmac_key, -1); | 330 | (unsigned char *) hmac_key, -1); |
346 | if (!sigkey) | 331 | if (!sigkey) |
347 | goto end; | 332 | goto end; |