diff options
author | tb <> | 2025-01-19 10:24:17 +0000 |
---|---|---|
committer | tb <> | 2025-01-19 10:24:17 +0000 |
commit | 554fa5724d58481f6d98cf1f31538602c83777e3 (patch) | |
tree | c9aaf8dfef4c4e6a68d7d8444e4bfbbd8df24f13 /src/usr.bin/openssl/dsaparam.c | |
parent | 74c210a1e6252560bd02d5adadd7034dc48d1483 (diff) | |
download | openbsd-554fa5724d58481f6d98cf1f31538602c83777e3.tar.gz openbsd-554fa5724d58481f6d98cf1f31538602c83777e3.tar.bz2 openbsd-554fa5724d58481f6d98cf1f31538602c83777e3.zip |
Remove -C option from "apps"
As far as I can tell, this way of generating "C code" was only used to add
stuff to pretty regress and even prettier speed "app" and otherwise it just
served to make the library maintainer's lives even more miserable.
ok jsing
Diffstat (limited to 'src/usr.bin/openssl/dsaparam.c')
-rw-r--r-- | src/usr.bin/openssl/dsaparam.c | 65 |
1 files changed, 2 insertions, 63 deletions
diff --git a/src/usr.bin/openssl/dsaparam.c b/src/usr.bin/openssl/dsaparam.c index bc9ccd14d8..962f261210 100644 --- a/src/usr.bin/openssl/dsaparam.c +++ b/src/usr.bin/openssl/dsaparam.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsaparam.c,v 1.15 2023/03/06 14:32:06 tb Exp $ */ | 1 | /* $OpenBSD: dsaparam.c,v 1.16 2025/01/19 10:24:17 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 | * |
@@ -80,7 +80,6 @@ | |||
80 | #include <openssl/x509.h> | 80 | #include <openssl/x509.h> |
81 | 81 | ||
82 | static struct { | 82 | static struct { |
83 | int C; | ||
84 | int genkey; | 83 | int genkey; |
85 | char *infile; | 84 | char *infile; |
86 | int informat; | 85 | int informat; |
@@ -92,12 +91,6 @@ static struct { | |||
92 | 91 | ||
93 | static const struct option dsaparam_options[] = { | 92 | static const struct option dsaparam_options[] = { |
94 | { | 93 | { |
95 | .name = "C", | ||
96 | .desc = "Convert DSA parameters into C code", | ||
97 | .type = OPTION_FLAG, | ||
98 | .opt.flag = &cfg.C, | ||
99 | }, | ||
100 | { | ||
101 | .name = "genkey", | 94 | .name = "genkey", |
102 | .desc = "Generate a DSA key", | 95 | .desc = "Generate a DSA key", |
103 | .type = OPTION_FLAG, | 96 | .type = OPTION_FLAG, |
@@ -150,7 +143,7 @@ static void | |||
150 | dsaparam_usage(void) | 143 | dsaparam_usage(void) |
151 | { | 144 | { |
152 | fprintf(stderr, | 145 | fprintf(stderr, |
153 | "usage: dsaparam [-C] [-genkey] [-in file]\n" | 146 | "usage: dsaparam [-genkey] [-in file]\n" |
154 | " [-inform format] [-noout] [-out file] [-outform format]\n" | 147 | " [-inform format] [-noout] [-out file] [-outform format]\n" |
155 | " [-text] [numbits]\n\n"); | 148 | " [-text] [numbits]\n\n"); |
156 | options_usage(dsaparam_options); | 149 | options_usage(dsaparam_options); |
@@ -253,60 +246,6 @@ dsaparam_main(int argc, char **argv) | |||
253 | if (cfg.text) { | 246 | if (cfg.text) { |
254 | DSAparams_print(out, dsa); | 247 | DSAparams_print(out, dsa); |
255 | } | 248 | } |
256 | if (cfg.C) { | ||
257 | unsigned char *data; | ||
258 | int l, len, bits_p; | ||
259 | |||
260 | len = BN_num_bytes(DSA_get0_p(dsa)); | ||
261 | bits_p = BN_num_bits(DSA_get0_p(dsa)); | ||
262 | data = malloc(len + 20); | ||
263 | if (data == NULL) { | ||
264 | perror("malloc"); | ||
265 | goto end; | ||
266 | } | ||
267 | l = BN_bn2bin(DSA_get0_p(dsa), data); | ||
268 | printf("static unsigned char dsa%d_p[] = {", bits_p); | ||
269 | for (i = 0; i < l; i++) { | ||
270 | if ((i % 12) == 0) | ||
271 | printf("\n\t"); | ||
272 | printf("0x%02X, ", data[i]); | ||
273 | } | ||
274 | printf("\n\t};\n"); | ||
275 | |||
276 | l = BN_bn2bin(DSA_get0_q(dsa), data); | ||
277 | printf("static unsigned char dsa%d_q[] = {", bits_p); | ||
278 | for (i = 0; i < l; i++) { | ||
279 | if ((i % 12) == 0) | ||
280 | printf("\n\t"); | ||
281 | printf("0x%02X, ", data[i]); | ||
282 | } | ||
283 | printf("\n\t};\n"); | ||
284 | |||
285 | l = BN_bn2bin(DSA_get0_g(dsa), data); | ||
286 | printf("static unsigned char dsa%d_g[] = {", bits_p); | ||
287 | for (i = 0; i < l; i++) { | ||
288 | if ((i % 12) == 0) | ||
289 | printf("\n\t"); | ||
290 | printf("0x%02X, ", data[i]); | ||
291 | } | ||
292 | free(data); | ||
293 | printf("\n\t};\n\n"); | ||
294 | |||
295 | printf("DSA *get_dsa%d()\n\t{\n", bits_p); | ||
296 | printf("\tBIGNUM *p = NULL, *q = NULL, *g = NULL;\n"); | ||
297 | printf("\tDSA *dsa;\n\n"); | ||
298 | printf("\tif ((dsa = DSA_new()) == NULL) return(NULL);\n"); | ||
299 | printf("\tp = BN_bin2bn(dsa%d_p, sizeof(dsa%d_p), NULL);\n", | ||
300 | bits_p, bits_p); | ||
301 | printf("\tq = BN_bin2bn(dsa%d_q, sizeof(dsa%d_q), NULL);\n", | ||
302 | bits_p, bits_p); | ||
303 | printf("\tg = BN_bin2bn(dsa%d_g, sizeof(dsa%d_g), NULL);\n", | ||
304 | bits_p, bits_p); | ||
305 | printf("\tif (p == NULL || q == NULL || g == NULL)\n"); | ||
306 | printf("\t\t{ BN_free(p); BN_free(q); BN_free(g); DSA_free(dsa); return(NULL); }\n"); | ||
307 | printf("\tDSA_set0_pqg(dsa, p, q, g);\n"); | ||
308 | printf("\treturn(dsa);\n\t}\n"); | ||
309 | } | ||
310 | if (!cfg.noout) { | 249 | if (!cfg.noout) { |
311 | if (cfg.outformat == FORMAT_ASN1) | 250 | if (cfg.outformat == FORMAT_ASN1) |
312 | i = i2d_DSAparams_bio(out, dsa); | 251 | i = i2d_DSAparams_bio(out, dsa); |