diff options
author | tb <> | 2022-01-10 12:17:49 +0000 |
---|---|---|
committer | tb <> | 2022-01-10 12:17:49 +0000 |
commit | d7610bb566b677b7cd1dff6af83c18174a305942 (patch) | |
tree | f72f56bcb9b07746c05844ed107e00d748cda463 /src/usr.bin/openssl/pkeyparam.c | |
parent | 6b5741e4f43381bf67a7a82640e37e6bb4ac4d68 (diff) | |
download | openbsd-d7610bb566b677b7cd1dff6af83c18174a305942.tar.gz openbsd-d7610bb566b677b7cd1dff6af83c18174a305942.tar.bz2 openbsd-d7610bb566b677b7cd1dff6af83c18174a305942.zip |
Implement openssl pkey -{,pub}check and pkeyparam -check
These expose EVP_PKEY_{,public_,param_}check() to the command line.
They are currently noops and will be enabled in the upcoming bump.
ok inoguchi jsing
Diffstat (limited to 'src/usr.bin/openssl/pkeyparam.c')
-rw-r--r-- | src/usr.bin/openssl/pkeyparam.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/usr.bin/openssl/pkeyparam.c b/src/usr.bin/openssl/pkeyparam.c index 81bed13958..6ac4558578 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.12 2019/07/14 03:30:46 guenther Exp $ */ | 1 | /* $OpenBSD: pkeyparam.c,v 1.13 2022/01/10 12:17:49 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,6 +66,7 @@ | |||
66 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
67 | 67 | ||
68 | struct { | 68 | struct { |
69 | int check; | ||
69 | char *infile; | 70 | char *infile; |
70 | int noout; | 71 | int noout; |
71 | char *outfile; | 72 | char *outfile; |
@@ -74,6 +75,12 @@ struct { | |||
74 | 75 | ||
75 | static const struct option pkeyparam_options[] = { | 76 | static const struct option pkeyparam_options[] = { |
76 | { | 77 | { |
78 | .name = "check", | ||
79 | .desc = "Check validity of key parameters", | ||
80 | .type = OPTION_FLAG, | ||
81 | .opt.flag = &pkeyparam_config.check, | ||
82 | }, | ||
83 | { | ||
77 | .name = "in", | 84 | .name = "in", |
78 | .argname = "file", | 85 | .argname = "file", |
79 | .desc = "Input file (default stdin)", | 86 | .desc = "Input file (default stdin)", |
@@ -106,7 +113,7 @@ static void | |||
106 | pkeyparam_usage() | 113 | pkeyparam_usage() |
107 | { | 114 | { |
108 | fprintf(stderr, | 115 | fprintf(stderr, |
109 | "usage: pkeyparam [-in file] [-noout] [-out file] " | 116 | "usage: pkeyparam [-check] [-in file] [-noout] [-out file] " |
110 | "[-text]\n"); | 117 | "[-text]\n"); |
111 | options_usage(pkeyparam_options); | 118 | options_usage(pkeyparam_options); |
112 | } | 119 | } |
@@ -157,6 +164,14 @@ pkeyparam_main(int argc, char **argv) | |||
157 | ERR_print_errors(bio_err); | 164 | ERR_print_errors(bio_err); |
158 | goto end; | 165 | goto end; |
159 | } | 166 | } |
167 | |||
168 | #if notyet | ||
169 | if (pkeyparam_config.check) { | ||
170 | if (!pkey_check(out, pkey, EVP_PKEY_param_check, "Parameters")) | ||
171 | goto end; | ||
172 | } | ||
173 | #endif | ||
174 | |||
160 | if (!pkeyparam_config.noout) | 175 | if (!pkeyparam_config.noout) |
161 | PEM_write_bio_Parameters(out, pkey); | 176 | PEM_write_bio_Parameters(out, pkey); |
162 | 177 | ||