summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-03-30 17:18:55 +0100
committerMatt Caswell <matt@openssl.org>2016-04-03 00:23:56 +0100
commit6e9fa57c6ddde7df49983251373a05cd663aac22 (patch)
tree1930de43f7e9ec5a9a9597f8d70965f4b1aa80b7 /apps
parent1258396d73cf937e4daaf2c35377011b9366f956 (diff)
Make DSA_METHOD opaque
Move the dsa_method structure out of the public header file, and provide getter and setter functions for creating and modifying custom DSA_METHODs. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Stephen Henson <steve@openssl.org>
Diffstat (limited to 'apps')
-rw-r--r--apps/dsa.c4
-rw-r--r--apps/dsaparam.c15
-rw-r--r--apps/gendsa.c4
-rw-r--r--apps/x509.c10
4 files changed, 23 insertions, 10 deletions
diff --git a/apps/dsa.c b/apps/dsa.c
index 9038e3bfb7..1c841a3a80 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -243,8 +243,10 @@ int dsa_main(int argc, char **argv)
}
if (modulus) {
+ BIGNUM *pub_key = NULL;
+ DSA_get0_key(dsa, &pub_key, NULL);
BIO_printf(out, "Public Key=");
- BN_print(out, DSA_get0_pub_key(dsa));
+ BN_print(out, pub_key);
BIO_printf(out, "\n");
}
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index 5b0bb625c6..64e92ae052 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -263,14 +263,19 @@ int dsaparam_main(int argc, char **argv)
}
if (C) {
- int len = BN_num_bytes(DSA_get0_p(dsa));
- int bits_p = BN_num_bits(DSA_get0_p(dsa));
+ BIGNUM *p = NULL, *q = NULL, *g = NULL;
+ int len, bits_p;
+
+ DSA_get0_pqg(dsa, &p, &q, &g);
+ len = BN_num_bytes(p);
+ bits_p = BN_num_bits(p);
+
unsigned char *data = app_malloc(len + 20, "BN space");
BIO_printf(bio_out, "DSA *get_dsa%d()\n{\n", bits_p);
- print_bignum_var(bio_out, DSA_get0_p(dsa), "dsap", len, data);
- print_bignum_var(bio_out, DSA_get0_q(dsa), "dsaq", len, data);
- print_bignum_var(bio_out, DSA_get0_g(dsa), "dsag", len, data);
+ print_bignum_var(bio_out, p, "dsap", len, data);
+ print_bignum_var(bio_out, q, "dsaq", len, data);
+ print_bignum_var(bio_out, g, "dsag", len, data);
BIO_printf(bio_out, " DSA *dsa = DSA_new();\n"
"\n");
BIO_printf(bio_out, " if (dsa == NULL)\n"
diff --git a/apps/gendsa.c b/apps/gendsa.c
index bf01f563ba..33166b77ad 100644
--- a/apps/gendsa.c
+++ b/apps/gendsa.c
@@ -101,6 +101,7 @@ int gendsa_main(int argc, char **argv)
char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
OPTION_CHOICE o;
int ret = 1, private = 0;
+ BIGNUM *p = NULL;
prog = opt_init(argc, argv, gendsa_options);
while ((o = opt_next()) != OPT_EOF) {
@@ -168,7 +169,8 @@ int gendsa_main(int argc, char **argv)
BIO_printf(bio_err, "%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
- BIO_printf(bio_err, "Generating DSA key, %d bits\n", BN_num_bits(DSA_get0_p(dsa)));
+ DSA_get0_pqg(dsa, &p, NULL, NULL);
+ BIO_printf(bio_err, "Generating DSA key, %d bits\n", BN_num_bits(p));
if (!DSA_generate_key(dsa))
goto end;
diff --git a/apps/x509.c b/apps/x509.c
index 4319d69f81..00c0d97aa2 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -734,11 +734,15 @@ int x509_main(int argc, char **argv)
else
#endif
#ifndef OPENSSL_NO_DSA
- if (EVP_PKEY_id(pkey) == EVP_PKEY_DSA)
- BN_print(out, DSA_get0_pub_key(EVP_PKEY_get0_DSA(pkey)));
- else
+ if (EVP_PKEY_id(pkey) == EVP_PKEY_DSA) {
+ BIGNUM *dsapub = NULL;
+ DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &dsapub, NULL);
+ BN_print(out, dsapub);
+ } else
#endif
+ {
BIO_printf(out, "Wrong Algorithm type");
+ }
BIO_printf(out, "\n");
} else if (pubkey == i) {
EVP_PKEY *pkey;