summaryrefslogtreecommitdiffstats
path: root/crypto/dsa/dsa_lib.c
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 /crypto/dsa/dsa_lib.c
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 'crypto/dsa/dsa_lib.c')
-rw-r--r--crypto/dsa/dsa_lib.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 08226181f9..4d5281a428 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -104,6 +104,11 @@ int DSA_set_method(DSA *dsa, const DSA_METHOD *meth)
return 1;
}
+const DSA_METHOD *DSA_get_method(DSA *d)
+{
+ return d->meth;
+}
+
DSA *DSA_new_method(ENGINE *engine)
{
DSA *ret;
@@ -281,19 +286,14 @@ DH *DSA_dup_DH(const DSA *r)
}
#endif
-BIGNUM *DSA_get0_p(const DSA *d)
-{
- return d->p;
-}
-
-BIGNUM *DSA_get0_q(const DSA *d)
+void DSA_get0_pqg(const DSA *d, BIGNUM **p, BIGNUM **q, BIGNUM **g)
{
- return d->q;
-}
-
-BIGNUM *DSA_get0_g(const DSA *d)
-{
- return d->g;
+ if (p != NULL)
+ *p = d->p;
+ if (q != NULL)
+ *q = d->q;
+ if (g != NULL)
+ *g = d->g;
}
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
@@ -310,17 +310,15 @@ int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
return 1;
}
-BIGNUM *DSA_get0_priv_key(const DSA *d)
-{
- return d->priv_key;
-}
-
-BIGNUM *DSA_get0_pub_key(const DSA *d)
+void DSA_get0_key(const DSA *d, BIGNUM **pub_key, BIGNUM **priv_key)
{
- return d->pub_key;
+ if (pub_key != NULL)
+ *pub_key = d->pub_key;
+ if (priv_key != NULL)
+ *priv_key = d->priv_key;
}
-void DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
+int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
{
/* Note that it is valid for priv_key to be NULL */
if (pub_key == NULL)