summaryrefslogtreecommitdiffstats
path: root/crypto/dsa
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-06-14 15:48:16 +0200
committerRichard Levitte <levitte@openssl.org>2016-06-15 20:09:27 +0200
commitfd809cfdbd6e32b6b67b68c59f6d55fbed7a9327 (patch)
tree59cd0002b3161e2892f3f06aeb509d897453c38f /crypto/dsa
parent9c1a9ccf65d0ea1912675d3a622fa8e51b524b9e (diff)
Constify the parameter getters for RSA, DSA and DH
Including documentation changes Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
Diffstat (limited to 'crypto/dsa')
-rw-r--r--crypto/dsa/dsa_lib.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 14cb35f82e..8146330a54 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -253,7 +253,8 @@ DH *DSA_dup_DH(const DSA *r)
}
#endif
-void DSA_get0_pqg(const DSA *d, BIGNUM **p, BIGNUM **q, BIGNUM **g)
+void DSA_get0_pqg(const DSA *d,
+ const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
{
if (p != NULL)
*p = d->p;
@@ -265,13 +266,12 @@ void DSA_get0_pqg(const DSA *d, BIGNUM **p, BIGNUM **q, BIGNUM **g)
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
{
- /* If the fields in d are NULL, the corresponding input
+ /* If the fields p, q and g in d are NULL, the corresponding input
* parameters MUST be non-NULL.
- *
- * It is an error to give the results from get0 on d
- * as input parameters.
*/
- if (p == d->p || q == d->q || g == d->g)
+ if (d->p == NULL && p == NULL
+ || d->q == NULL && q == NULL
+ || d->g == NULL && g == NULL)
return 0;
if (p != NULL) {
@@ -290,7 +290,8 @@ int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
return 1;
}
-void DSA_get0_key(const DSA *d, BIGNUM **pub_key, BIGNUM **priv_key)
+void DSA_get0_key(const DSA *d,
+ const BIGNUM **pub_key, const BIGNUM **priv_key)
{
if (pub_key != NULL)
*pub_key = d->pub_key;
@@ -300,15 +301,11 @@ void DSA_get0_key(const DSA *d, BIGNUM **pub_key, BIGNUM **priv_key)
int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
{
- /* If the pub_key in d is NULL, the corresponding input
+ /* If the field pub_key in d is NULL, the corresponding input
* parameters MUST be non-NULL. The priv_key field may
* be left NULL.
- *
- * It is an error to give the results from get0 on d
- * as input parameters.
*/
- if (d->pub_key == pub_key
- || (d->priv_key != NULL && priv_key == d->priv_key))
+ if (d->pub_key == NULL && pub_key == NULL)
return 0;
if (pub_key != NULL) {