diff options
Diffstat (limited to 'src/usr.bin/openssl/gendh.c')
-rw-r--r-- | src/usr.bin/openssl/gendh.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/usr.bin/openssl/gendh.c b/src/usr.bin/openssl/gendh.c index b4e4f29111..b9dde3c773 100644 --- a/src/usr.bin/openssl/gendh.c +++ b/src/usr.bin/openssl/gendh.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gendh.c,v 1.13 2022/11/11 17:07:39 joshua Exp $ */ | 1 | /* $OpenBSD: gendh.c,v 1.14 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 | * |
@@ -89,7 +89,7 @@ static int dh_cb(int p, int n, BN_GENCB *cb); | |||
89 | static struct { | 89 | static struct { |
90 | int g; | 90 | int g; |
91 | char *outfile; | 91 | char *outfile; |
92 | } gendh_config; | 92 | } cfg; |
93 | 93 | ||
94 | static const struct option gendh_options[] = { | 94 | static const struct option gendh_options[] = { |
95 | { | 95 | { |
@@ -98,21 +98,21 @@ static const struct option gendh_options[] = { | |||
98 | "(default)", | 98 | "(default)", |
99 | .type = OPTION_VALUE, | 99 | .type = OPTION_VALUE, |
100 | .value = 2, | 100 | .value = 2, |
101 | .opt.value = &gendh_config.g, | 101 | .opt.value = &cfg.g, |
102 | }, | 102 | }, |
103 | { | 103 | { |
104 | .name = "5", | 104 | .name = "5", |
105 | .desc = "Generate DH parameters with a generator value of 5", | 105 | .desc = "Generate DH parameters with a generator value of 5", |
106 | .type = OPTION_VALUE, | 106 | .type = OPTION_VALUE, |
107 | .value = 5, | 107 | .value = 5, |
108 | .opt.value = &gendh_config.g, | 108 | .opt.value = &cfg.g, |
109 | }, | 109 | }, |
110 | { | 110 | { |
111 | .name = "out", | 111 | .name = "out", |
112 | .argname = "file", | 112 | .argname = "file", |
113 | .desc = "Output file (default stdout)", | 113 | .desc = "Output file (default stdout)", |
114 | .type = OPTION_ARG, | 114 | .type = OPTION_ARG, |
115 | .opt.arg = &gendh_config.outfile, | 115 | .opt.arg = &cfg.outfile, |
116 | }, | 116 | }, |
117 | { NULL }, | 117 | { NULL }, |
118 | }; | 118 | }; |
@@ -146,9 +146,9 @@ gendh_main(int argc, char **argv) | |||
146 | 146 | ||
147 | BN_GENCB_set(cb, dh_cb, bio_err); | 147 | BN_GENCB_set(cb, dh_cb, bio_err); |
148 | 148 | ||
149 | memset(&gendh_config, 0, sizeof(gendh_config)); | 149 | memset(&cfg, 0, sizeof(cfg)); |
150 | 150 | ||
151 | gendh_config.g = 2; | 151 | cfg.g = 2; |
152 | 152 | ||
153 | if (options_parse(argc, argv, gendh_options, &strbits, NULL) != 0) { | 153 | if (options_parse(argc, argv, gendh_options, &strbits, NULL) != 0) { |
154 | gendh_usage(); | 154 | gendh_usage(); |
@@ -169,21 +169,21 @@ gendh_main(int argc, char **argv) | |||
169 | ERR_print_errors(bio_err); | 169 | ERR_print_errors(bio_err); |
170 | goto end; | 170 | goto end; |
171 | } | 171 | } |
172 | if (gendh_config.outfile == NULL) { | 172 | if (cfg.outfile == NULL) { |
173 | BIO_set_fp(out, stdout, BIO_NOCLOSE); | 173 | BIO_set_fp(out, stdout, BIO_NOCLOSE); |
174 | } else { | 174 | } else { |
175 | if (BIO_write_filename(out, gendh_config.outfile) <= 0) { | 175 | if (BIO_write_filename(out, cfg.outfile) <= 0) { |
176 | perror(gendh_config.outfile); | 176 | perror(cfg.outfile); |
177 | goto end; | 177 | goto end; |
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
181 | BIO_printf(bio_err, "Generating DH parameters, %d bit long safe prime," | 181 | BIO_printf(bio_err, "Generating DH parameters, %d bit long safe prime," |
182 | " generator %d\n", numbits, gendh_config.g); | 182 | " generator %d\n", numbits, cfg.g); |
183 | BIO_printf(bio_err, "This is going to take a long time\n"); | 183 | BIO_printf(bio_err, "This is going to take a long time\n"); |
184 | 184 | ||
185 | if (((dh = DH_new()) == NULL) || | 185 | if (((dh = DH_new()) == NULL) || |
186 | !DH_generate_parameters_ex(dh, numbits, gendh_config.g, cb)) | 186 | !DH_generate_parameters_ex(dh, numbits, cfg.g, cb)) |
187 | goto end; | 187 | goto end; |
188 | 188 | ||
189 | if (!PEM_write_bio_DHparams(out, dh)) | 189 | if (!PEM_write_bio_DHparams(out, dh)) |