summaryrefslogtreecommitdiffstats
path: root/apps/dhparam.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2020-11-11 18:03:38 -0500
committerRichard Levitte <levitte@openssl.org>2020-11-13 14:45:22 +0100
commit1696b8909bbe1485871ce68ed129bf91af5e17e2 (patch)
tree6a18dba8afb0297ed730c3acc15c60065d823b2a /apps/dhparam.c
parent256d41d4371720ccfe1a4fead6bd28ed5071bcdd (diff)
Remove -C from dhparam,dsaparam,ecparam
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13384)
Diffstat (limited to 'apps/dhparam.c')
-rw-r--r--apps/dhparam.c47
1 files changed, 2 insertions, 45 deletions
diff --git a/apps/dhparam.c b/apps/dhparam.c
index 84f5f3ed8f..d2a8400e26 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -41,7 +41,7 @@ typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT,
OPT_ENGINE, OPT_CHECK, OPT_TEXT, OPT_NOOUT,
- OPT_DSAPARAM, OPT_C, OPT_2, OPT_3, OPT_5,
+ OPT_DSAPARAM, OPT_2, OPT_3, OPT_5,
OPT_R_ENUM, OPT_PROV_ENUM
} OPTION_CHOICE;
@@ -68,7 +68,6 @@ const OPTIONS dhparam_options[] = {
{"outform", OPT_OUTFORM, 'F', "Output format, DER or PEM"},
{"text", OPT_TEXT, '-', "Print a text form of the DH parameters"},
{"noout", OPT_NOOUT, '-', "Don't output any DH parameters"},
- {"C", OPT_C, '-', "Print C code"},
{"2", OPT_2, '-', "Generate parameters using 2 as the generator value"},
{"3", OPT_3, '-', "Generate parameters using 3 as the generator value"},
{"5", OPT_5, '-', "Generate parameters using 5 as the generator value"},
@@ -92,7 +91,7 @@ int dhparam_main(int argc, char **argv)
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
int dsaparam = 0;
#endif
- int i, text = 0, C = 0, ret = 1, num = 0, g = 0;
+ int i, text = 0, ret = 1, num = 0, g = 0;
int informat = FORMAT_PEM, outformat = FORMAT_PEM, check = 0, noout = 0;
OPTION_CHOICE o;
@@ -140,9 +139,6 @@ int dhparam_main(int argc, char **argv)
# endif
#endif
break;
- case OPT_C:
- C = 1;
- break;
case OPT_2:
g = 2;
break;
@@ -316,45 +312,6 @@ int dhparam_main(int argc, char **argv)
goto end;
}
}
- if (C) {
- unsigned char *data;
- int len, bits;
- const BIGNUM *pbn, *gbn;
-
- dh = EVP_PKEY_get0_DH(pkey);
- len = EVP_PKEY_size(pkey);
- bits = EVP_PKEY_size(pkey);
- DH_get0_pqg(dh, &pbn, NULL, &gbn);
- data = app_malloc(len, "print a BN");
-
- BIO_printf(out, "static DH *get_dh%d(void)\n{\n", bits);
- print_bignum_var(out, pbn, "dhp", bits, data);
- print_bignum_var(out, gbn, "dhg", bits, data);
- BIO_printf(out, " DH *dh = DH_new();\n"
- " BIGNUM *p, *g;\n"
- "\n"
- " if (dh == NULL)\n"
- " return NULL;\n");
- BIO_printf(out, " p = BN_bin2bn(dhp_%d, sizeof(dhp_%d), NULL);\n",
- bits, bits);
- BIO_printf(out, " g = BN_bin2bn(dhg_%d, sizeof(dhg_%d), NULL);\n",
- bits, bits);
- BIO_printf(out, " if (p == NULL || g == NULL\n"
- " || !DH_set0_pqg(dh, p, NULL, g)) {\n"
- " DH_free(dh);\n"
- " BN_free(p);\n"
- " BN_free(g);\n"
- " return NULL;\n"
- " }\n");
- if (DH_get_length(dh) > 0)
- BIO_printf(out,
- " if (!DH_set_length(dh, %ld)) {\n"
- " DH_free(dh);\n"
- " return NULL;\n"
- " }\n", DH_get_length(dh));
- BIO_printf(out, " return dh;\n}\n");
- OPENSSL_free(data);
- }
if (!noout) {
const BIGNUM *q;