diff options
author | tb <> | 2023-03-06 14:32:06 +0000 |
---|---|---|
committer | tb <> | 2023-03-06 14:32:06 +0000 |
commit | 6c965e26b1a93da63948edae6b68564be1ded507 (patch) | |
tree | bbe07d6e06b695cebe22802551f2db0a61354d7c /src/usr.bin/openssl/gendsa.c | |
parent | 48e828ea26ee91710242131cd75cd9d1d20b773c (diff) | |
download | openbsd-6c965e26b1a93da63948edae6b68564be1ded507.tar.gz openbsd-6c965e26b1a93da63948edae6b68564be1ded507.tar.bz2 openbsd-6c965e26b1a93da63948edae6b68564be1ded507.zip |
Rename struct ${app}_config to plain cfg
All the structs are static and we need to reach into them many times.
Having a shorter name is more concise and results in less visual clutter.
It also avoids many overlong lines and we will be able to get rid of some
unfortunate line wrapping down the road.
Discussed with jsing
Diffstat (limited to 'src/usr.bin/openssl/gendsa.c')
-rw-r--r-- | src/usr.bin/openssl/gendsa.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/usr.bin/openssl/gendsa.c b/src/usr.bin/openssl/gendsa.c index fa83ea2c67..00635c4551 100644 --- a/src/usr.bin/openssl/gendsa.c +++ b/src/usr.bin/openssl/gendsa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gendsa.c,v 1.16 2022/11/11 17:07:39 joshua Exp $ */ | 1 | /* $OpenBSD: gendsa.c,v 1.17 2023/03/06 14:32:06 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 | * |
@@ -78,7 +78,7 @@ static struct { | |||
78 | const EVP_CIPHER *enc; | 78 | const EVP_CIPHER *enc; |
79 | char *outfile; | 79 | char *outfile; |
80 | char *passargout; | 80 | char *passargout; |
81 | } gendsa_config; | 81 | } cfg; |
82 | 82 | ||
83 | static const EVP_CIPHER *get_cipher_by_name(char *name) | 83 | static const EVP_CIPHER *get_cipher_by_name(char *name) |
84 | { | 84 | { |
@@ -122,7 +122,7 @@ set_enc(int argc, char **argv, int *argsused) | |||
122 | if (*name++ != '-') | 122 | if (*name++ != '-') |
123 | return (1); | 123 | return (1); |
124 | 124 | ||
125 | if ((gendsa_config.enc = get_cipher_by_name(name)) == NULL) | 125 | if ((cfg.enc = get_cipher_by_name(name)) == NULL) |
126 | return (1); | 126 | return (1); |
127 | 127 | ||
128 | *argsused = 1; | 128 | *argsused = 1; |
@@ -197,14 +197,14 @@ static const struct option gendsa_options[] = { | |||
197 | .argname = "file", | 197 | .argname = "file", |
198 | .desc = "Output the key to 'file'", | 198 | .desc = "Output the key to 'file'", |
199 | .type = OPTION_ARG, | 199 | .type = OPTION_ARG, |
200 | .opt.arg = &gendsa_config.outfile, | 200 | .opt.arg = &cfg.outfile, |
201 | }, | 201 | }, |
202 | { | 202 | { |
203 | .name = "passout", | 203 | .name = "passout", |
204 | .argname = "src", | 204 | .argname = "src", |
205 | .desc = "Output file passphrase source", | 205 | .desc = "Output file passphrase source", |
206 | .type = OPTION_ARG, | 206 | .type = OPTION_ARG, |
207 | .opt.arg = &gendsa_config.passargout, | 207 | .opt.arg = &cfg.passargout, |
208 | }, | 208 | }, |
209 | { NULL }, | 209 | { NULL }, |
210 | }; | 210 | }; |
@@ -234,7 +234,7 @@ gendsa_main(int argc, char **argv) | |||
234 | exit(1); | 234 | exit(1); |
235 | } | 235 | } |
236 | 236 | ||
237 | memset(&gendsa_config, 0, sizeof(gendsa_config)); | 237 | memset(&cfg, 0, sizeof(cfg)); |
238 | 238 | ||
239 | if (options_parse(argc, argv, gendsa_options, &dsaparams, NULL) != 0) { | 239 | if (options_parse(argc, argv, gendsa_options, &dsaparams, NULL) != 0) { |
240 | gendsa_usage(); | 240 | gendsa_usage(); |
@@ -245,7 +245,7 @@ gendsa_main(int argc, char **argv) | |||
245 | gendsa_usage(); | 245 | gendsa_usage(); |
246 | goto end; | 246 | goto end; |
247 | } | 247 | } |
248 | if (!app_passwd(bio_err, NULL, gendsa_config.passargout, NULL, | 248 | if (!app_passwd(bio_err, NULL, cfg.passargout, NULL, |
249 | &passout)) { | 249 | &passout)) { |
250 | BIO_printf(bio_err, "Error getting password\n"); | 250 | BIO_printf(bio_err, "Error getting password\n"); |
251 | goto end; | 251 | goto end; |
@@ -266,11 +266,11 @@ gendsa_main(int argc, char **argv) | |||
266 | if (out == NULL) | 266 | if (out == NULL) |
267 | goto end; | 267 | goto end; |
268 | 268 | ||
269 | if (gendsa_config.outfile == NULL) { | 269 | if (cfg.outfile == NULL) { |
270 | BIO_set_fp(out, stdout, BIO_NOCLOSE); | 270 | BIO_set_fp(out, stdout, BIO_NOCLOSE); |
271 | } else { | 271 | } else { |
272 | if (BIO_write_filename(out, gendsa_config.outfile) <= 0) { | 272 | if (BIO_write_filename(out, cfg.outfile) <= 0) { |
273 | perror(gendsa_config.outfile); | 273 | perror(cfg.outfile); |
274 | goto end; | 274 | goto end; |
275 | } | 275 | } |
276 | } | 276 | } |
@@ -280,7 +280,7 @@ gendsa_main(int argc, char **argv) | |||
280 | if (!DSA_generate_key(dsa)) | 280 | if (!DSA_generate_key(dsa)) |
281 | goto end; | 281 | goto end; |
282 | 282 | ||
283 | if (!PEM_write_bio_DSAPrivateKey(out, dsa, gendsa_config.enc, NULL, 0, | 283 | if (!PEM_write_bio_DSAPrivateKey(out, dsa, cfg.enc, NULL, 0, |
284 | NULL, passout)) | 284 | NULL, passout)) |
285 | goto end; | 285 | goto end; |
286 | ret = 0; | 286 | ret = 0; |