summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/pkeyparam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr.bin/openssl/pkeyparam.c')
-rw-r--r--src/usr.bin/openssl/pkeyparam.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/usr.bin/openssl/pkeyparam.c b/src/usr.bin/openssl/pkeyparam.c
index 57b5ad8042..946195640e 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.16 2023/03/05 13:12:53 tb Exp $ */ 1/* $OpenBSD: pkeyparam.c,v 1.17 2023/03/06 14:32:06 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 */
@@ -71,40 +71,40 @@ static struct {
71 int noout; 71 int noout;
72 char *outfile; 72 char *outfile;
73 int text; 73 int text;
74} pkeyparam_config; 74} cfg;
75 75
76static const struct option pkeyparam_options[] = { 76static const struct option pkeyparam_options[] = {
77 { 77 {
78 .name = "check", 78 .name = "check",
79 .desc = "Check validity of key parameters", 79 .desc = "Check validity of key parameters",
80 .type = OPTION_FLAG, 80 .type = OPTION_FLAG,
81 .opt.flag = &pkeyparam_config.check, 81 .opt.flag = &cfg.check,
82 }, 82 },
83 { 83 {
84 .name = "in", 84 .name = "in",
85 .argname = "file", 85 .argname = "file",
86 .desc = "Input file (default stdin)", 86 .desc = "Input file (default stdin)",
87 .type = OPTION_ARG, 87 .type = OPTION_ARG,
88 .opt.arg = &pkeyparam_config.infile, 88 .opt.arg = &cfg.infile,
89 }, 89 },
90 { 90 {
91 .name = "noout", 91 .name = "noout",
92 .desc = "Do not print encoded version of the parameters", 92 .desc = "Do not print encoded version of the parameters",
93 .type = OPTION_FLAG, 93 .type = OPTION_FLAG,
94 .opt.flag = &pkeyparam_config.noout, 94 .opt.flag = &cfg.noout,
95 }, 95 },
96 { 96 {
97 .name = "out", 97 .name = "out",
98 .argname = "file", 98 .argname = "file",
99 .desc = "Output file (default stdout)", 99 .desc = "Output file (default stdout)",
100 .type = OPTION_ARG, 100 .type = OPTION_ARG,
101 .opt.arg = &pkeyparam_config.outfile, 101 .opt.arg = &cfg.outfile,
102 }, 102 },
103 { 103 {
104 .name = "text", 104 .name = "text",
105 .desc = "Print out the parameters in plain text", 105 .desc = "Print out the parameters in plain text",
106 .type = OPTION_FLAG, 106 .type = OPTION_FLAG,
107 .opt.flag = &pkeyparam_config.text, 107 .opt.flag = &cfg.text,
108 }, 108 },
109 { NULL }, 109 { NULL },
110}; 110};
@@ -130,26 +130,26 @@ pkeyparam_main(int argc, char **argv)
130 exit(1); 130 exit(1);
131 } 131 }
132 132
133 memset(&pkeyparam_config, 0, sizeof(pkeyparam_config)); 133 memset(&cfg, 0, sizeof(cfg));
134 134
135 if (options_parse(argc, argv, pkeyparam_options, NULL, NULL) != 0) { 135 if (options_parse(argc, argv, pkeyparam_options, NULL, NULL) != 0) {
136 pkeyparam_usage(); 136 pkeyparam_usage();
137 return (1); 137 return (1);
138 } 138 }
139 139
140 if (pkeyparam_config.infile) { 140 if (cfg.infile) {
141 if (!(in = BIO_new_file(pkeyparam_config.infile, "r"))) { 141 if (!(in = BIO_new_file(cfg.infile, "r"))) {
142 BIO_printf(bio_err, "Can't open input file %s\n", 142 BIO_printf(bio_err, "Can't open input file %s\n",
143 pkeyparam_config.infile); 143 cfg.infile);
144 goto end; 144 goto end;
145 } 145 }
146 } else 146 } else
147 in = BIO_new_fp(stdin, BIO_NOCLOSE); 147 in = BIO_new_fp(stdin, BIO_NOCLOSE);
148 148
149 if (pkeyparam_config.outfile) { 149 if (cfg.outfile) {
150 if (!(out = BIO_new_file(pkeyparam_config.outfile, "w"))) { 150 if (!(out = BIO_new_file(cfg.outfile, "w"))) {
151 BIO_printf(bio_err, "Can't open output file %s\n", 151 BIO_printf(bio_err, "Can't open output file %s\n",
152 pkeyparam_config.outfile); 152 cfg.outfile);
153 goto end; 153 goto end;
154 } 154 }
155 } else { 155 } else {
@@ -163,15 +163,15 @@ pkeyparam_main(int argc, char **argv)
163 goto end; 163 goto end;
164 } 164 }
165 165
166 if (pkeyparam_config.check) { 166 if (cfg.check) {
167 if (!pkey_check(out, pkey, EVP_PKEY_param_check, "Parameters")) 167 if (!pkey_check(out, pkey, EVP_PKEY_param_check, "Parameters"))
168 goto end; 168 goto end;
169 } 169 }
170 170
171 if (!pkeyparam_config.noout) 171 if (!cfg.noout)
172 PEM_write_bio_Parameters(out, pkey); 172 PEM_write_bio_Parameters(out, pkey);
173 173
174 if (pkeyparam_config.text) 174 if (cfg.text)
175 EVP_PKEY_print_params(out, pkey, 0, NULL); 175 EVP_PKEY_print_params(out, pkey, 0, NULL);
176 176
177 ret = 0; 177 ret = 0;