diff options
author | tb <> | 2024-08-29 17:01:02 +0000 |
---|---|---|
committer | tb <> | 2024-08-29 17:01:02 +0000 |
commit | 482529e0eb9abf923bbc35107ad61a209528d296 (patch) | |
tree | 7ea546b46cd3970f3bc3adc5466a9a5dc89fd00d | |
parent | de7d0ab1c83083dedcf2e492963189bc2ba71ef0 (diff) | |
download | openbsd-482529e0eb9abf923bbc35107ad61a209528d296.tar.gz openbsd-482529e0eb9abf923bbc35107ad61a209528d296.tar.bz2 openbsd-482529e0eb9abf923bbc35107ad61a209528d296.zip |
Remove check and pubcheck from openssl pkey and pkeyparam
The underlying API will be removed, so these commands have to go.
ok beck
-rw-r--r-- | src/usr.bin/openssl/apps.c | 30 | ||||
-rw-r--r-- | src/usr.bin/openssl/apps.h | 5 | ||||
-rw-r--r-- | src/usr.bin/openssl/pkey.c | 28 | ||||
-rw-r--r-- | src/usr.bin/openssl/pkeyparam.c | 17 |
4 files changed, 7 insertions, 73 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index f58aa5365f..a04190910d 100644 --- a/src/usr.bin/openssl/apps.c +++ b/src/usr.bin/openssl/apps.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.c,v 1.68 2024/08/18 20:24:11 tb Exp $ */ | 1 | /* $OpenBSD: apps.c,v 1.69 2024/08/29 17:01:02 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -2156,31 +2156,3 @@ show_cipher(const OBJ_NAME *name, void *arg) | |||
2156 | 2156 | ||
2157 | fprintf(stderr, " -%-24s%s", name->name, (++*n % 3 != 0 ? "" : "\n")); | 2157 | fprintf(stderr, " -%-24s%s", name->name, (++*n % 3 != 0 ? "" : "\n")); |
2158 | } | 2158 | } |
2159 | |||
2160 | int | ||
2161 | pkey_check(BIO *out, EVP_PKEY *pkey, int (check_fn)(EVP_PKEY_CTX *), | ||
2162 | const char *desc) | ||
2163 | { | ||
2164 | EVP_PKEY_CTX *ctx; | ||
2165 | |||
2166 | if ((ctx = EVP_PKEY_CTX_new(pkey, NULL)) == NULL) { | ||
2167 | ERR_print_errors(bio_err); | ||
2168 | return 0; | ||
2169 | } | ||
2170 | |||
2171 | if (check_fn(ctx) == 1) { | ||
2172 | BIO_printf(out, "%s valid\n", desc); | ||
2173 | } else { | ||
2174 | unsigned long err; | ||
2175 | |||
2176 | BIO_printf(out, "%s invalid\n", desc); | ||
2177 | |||
2178 | while ((err = ERR_get_error()) != 0) | ||
2179 | BIO_printf(out, "Detailed error: %s\n", | ||
2180 | ERR_reason_error_string(err)); | ||
2181 | } | ||
2182 | |||
2183 | EVP_PKEY_CTX_free(ctx); | ||
2184 | |||
2185 | return 1; | ||
2186 | } | ||
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h index 7a59b737e1..a30706e364 100644 --- a/src/usr.bin/openssl/apps.h +++ b/src/usr.bin/openssl/apps.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.h,v 1.37 2024/05/21 05:00:48 jsg Exp $ */ | 1 | /* $OpenBSD: apps.h,v 1.38 2024/08/29 17:01:02 tb 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 | * |
@@ -315,7 +315,4 @@ int options_parse(int argc, char **argv, const struct option *opts, | |||
315 | char **unnamed, int *argsused); | 315 | char **unnamed, int *argsused); |
316 | 316 | ||
317 | void show_cipher(const OBJ_NAME *name, void *arg); | 317 | void show_cipher(const OBJ_NAME *name, void *arg); |
318 | |||
319 | int pkey_check(BIO *out, EVP_PKEY *pkey, int (check_fn)(EVP_PKEY_CTX *), | ||
320 | const char *desc); | ||
321 | #endif | 318 | #endif |
diff --git a/src/usr.bin/openssl/pkey.c b/src/usr.bin/openssl/pkey.c index 47fa2dd362..d3c9f27d25 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.20 2023/07/23 11:39:29 tb Exp $ */ | 1 | /* $OpenBSD: pkey.c,v 1.21 2024/08/29 17:01:02 tb 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 | */ |
@@ -66,7 +66,6 @@ | |||
66 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
67 | 67 | ||
68 | static struct { | 68 | static struct { |
69 | int check; | ||
70 | const EVP_CIPHER *cipher; | 69 | const EVP_CIPHER *cipher; |
71 | char *infile; | 70 | char *infile; |
72 | int informat; | 71 | int informat; |
@@ -75,7 +74,6 @@ static struct { | |||
75 | int outformat; | 74 | int outformat; |
76 | char *passargin; | 75 | char *passargin; |
77 | char *passargout; | 76 | char *passargout; |
78 | int pubcheck; | ||
79 | int pubin; | 77 | int pubin; |
80 | int pubout; | 78 | int pubout; |
81 | int pubtext; | 79 | int pubtext; |
@@ -101,12 +99,6 @@ pkey_opt_cipher(int argc, char **argv, int *argsused) | |||
101 | 99 | ||
102 | static const struct option pkey_options[] = { | 100 | static const struct option pkey_options[] = { |
103 | { | 101 | { |
104 | .name = "check", | ||
105 | .desc = "Check validity of key", | ||
106 | .type = OPTION_FLAG, | ||
107 | .opt.flag = &cfg.check, | ||
108 | }, | ||
109 | { | ||
110 | .name = "in", | 102 | .name = "in", |
111 | .argname = "file", | 103 | .argname = "file", |
112 | .desc = "Input file (default stdin)", | 104 | .desc = "Input file (default stdin)", |
@@ -155,12 +147,6 @@ static const struct option pkey_options[] = { | |||
155 | .opt.arg = &cfg.passargout, | 147 | .opt.arg = &cfg.passargout, |
156 | }, | 148 | }, |
157 | { | 149 | { |
158 | .name = "pubcheck", | ||
159 | .desc = "Check validity of public key", | ||
160 | .type = OPTION_FLAG, | ||
161 | .opt.flag = &cfg.pubcheck, | ||
162 | }, | ||
163 | { | ||
164 | .name = "pubin", | 150 | .name = "pubin", |
165 | .desc = "Expect a public key (default private key)", | 151 | .desc = "Expect a public key (default private key)", |
166 | .type = OPTION_VALUE, | 152 | .type = OPTION_VALUE, |
@@ -200,9 +186,9 @@ pkey_usage(void) | |||
200 | int n = 0; | 186 | int n = 0; |
201 | 187 | ||
202 | fprintf(stderr, | 188 | fprintf(stderr, |
203 | "usage: pkey [-check] [-ciphername] [-in file] [-inform fmt] " | 189 | "usage: pkey [-ciphername] [-in file] [-inform fmt] " |
204 | "[-noout] [-out file]\n" | 190 | "[-noout] [-out file]\n" |
205 | " [-outform fmt] [-passin src] [-passout src] [-pubcheck] " | 191 | " [-outform fmt] [-passin src] [-passout src] " |
206 | "[-pubin] [-pubout]\n" | 192 | "[-pubin] [-pubout]\n" |
207 | " [-text] [-text_pub]\n\n"); | 193 | " [-text] [-text_pub]\n\n"); |
208 | options_usage(pkey_options); | 194 | options_usage(pkey_options); |
@@ -264,14 +250,6 @@ pkey_main(int argc, char **argv) | |||
264 | if (!pkey) | 250 | if (!pkey) |
265 | goto end; | 251 | goto end; |
266 | 252 | ||
267 | if (cfg.check) { | ||
268 | if (!pkey_check(out, pkey, EVP_PKEY_check, "Key pair")) | ||
269 | goto end; | ||
270 | } else if (cfg.pubcheck) { | ||
271 | if (!pkey_check(out, pkey, EVP_PKEY_public_check, "Public key")) | ||
272 | goto end; | ||
273 | } | ||
274 | |||
275 | if (!cfg.noout) { | 253 | if (!cfg.noout) { |
276 | if (cfg.outformat == FORMAT_PEM) { | 254 | if (cfg.outformat == FORMAT_PEM) { |
277 | if (cfg.pubout) | 255 | if (cfg.pubout) |
diff --git a/src/usr.bin/openssl/pkeyparam.c b/src/usr.bin/openssl/pkeyparam.c index 543715e521..ce0206a700 100644 --- a/src/usr.bin/openssl/pkeyparam.c +++ b/src/usr.bin/openssl/pkeyparam.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkeyparam.c,v 1.18 2023/07/23 11:39:29 tb Exp $ */ | 1 | /* $OpenBSD: pkeyparam.c,v 1.19 2024/08/29 17:01:02 tb 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 | */ |
@@ -66,7 +66,6 @@ | |||
66 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
67 | 67 | ||
68 | static struct { | 68 | static struct { |
69 | int check; | ||
70 | char *infile; | 69 | char *infile; |
71 | int noout; | 70 | int noout; |
72 | char *outfile; | 71 | char *outfile; |
@@ -75,12 +74,6 @@ static struct { | |||
75 | 74 | ||
76 | static const struct option pkeyparam_options[] = { | 75 | static const struct option pkeyparam_options[] = { |
77 | { | 76 | { |
78 | .name = "check", | ||
79 | .desc = "Check validity of key parameters", | ||
80 | .type = OPTION_FLAG, | ||
81 | .opt.flag = &cfg.check, | ||
82 | }, | ||
83 | { | ||
84 | .name = "in", | 77 | .name = "in", |
85 | .argname = "file", | 78 | .argname = "file", |
86 | .desc = "Input file (default stdin)", | 79 | .desc = "Input file (default stdin)", |
@@ -113,8 +106,7 @@ static void | |||
113 | pkeyparam_usage(void) | 106 | pkeyparam_usage(void) |
114 | { | 107 | { |
115 | fprintf(stderr, | 108 | fprintf(stderr, |
116 | "usage: pkeyparam [-check] [-in file] [-noout] [-out file] " | 109 | "usage: pkeyparam [-in file] [-noout] [-out file] [-text]\n"); |
117 | "[-text]\n"); | ||
118 | options_usage(pkeyparam_options); | 110 | options_usage(pkeyparam_options); |
119 | } | 111 | } |
120 | 112 | ||
@@ -163,11 +155,6 @@ pkeyparam_main(int argc, char **argv) | |||
163 | goto end; | 155 | goto end; |
164 | } | 156 | } |
165 | 157 | ||
166 | if (cfg.check) { | ||
167 | if (!pkey_check(out, pkey, EVP_PKEY_param_check, "Parameters")) | ||
168 | goto end; | ||
169 | } | ||
170 | |||
171 | if (!cfg.noout) | 158 | if (!cfg.noout) |
172 | PEM_write_bio_Parameters(out, pkey); | 159 | PEM_write_bio_Parameters(out, pkey); |
173 | 160 | ||