]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
DSA: add simple getters for commonly used struct members
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Sun, 27 May 2018 06:57:55 +0000 (08:57 +0200)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Mon, 28 May 2018 17:11:23 +0000 (19:11 +0200)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6290)

crypto/dsa/dsa_lib.c
doc/man3/DSA_get0_pqg.pod
include/openssl/dsa.h
util/libcrypto.num

index e730e8e68a556b3f3b452c2958792e590c095bed..9275a530811637270e2ea12a75a4cdfba7c4a48c 100644 (file)
@@ -305,6 +305,31 @@ int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
     return 1;
 }
 
+const BIGNUM *DSA_get0_p(const DSA *d)
+{
+    return d->p;
+}
+
+const BIGNUM *DSA_get0_q(const DSA *d)
+{
+    return d->q;
+}
+
+const BIGNUM *DSA_get0_g(const DSA *d)
+{
+    return d->g;
+}
+
+const BIGNUM *DSA_get0_pub_key(const DSA *d)
+{
+    return d->pub_key;
+}
+
+const BIGNUM *DSA_get0_priv_key(const DSA *d)
+{
+    return d->priv_key;
+}
+
 void DSA_clear_flags(DSA *d, int flags)
 {
     d->flags &= ~flags;
index 58e3ab5b5675b3a48992f44611da8857290d14dc..17eb9fe65960d8c0f472a714c055bb0910875589 100644 (file)
@@ -2,8 +2,11 @@
 
 =head1 NAME
 
-DSA_get0_pqg, DSA_set0_pqg, DSA_get0_key, DSA_set0_key, DSA_clear_flags,
-DSA_test_flags, DSA_set_flags, DSA_get0_engine - Routines for getting and
+DSA_get0_pqg, DSA_set0_pqg, DSA_get0_key, DSA_set0_key,
+DSA_get0_p, DSA_get0_q, DSA_get0_g,
+DSA_get0_pub_key, DSA_get0_priv_key,
+DSA_clear_flags, DSA_test_flags, DSA_set_flags,
+DSA_get0_engine - Routines for getting and
 setting data in a DSA object
 
 =head1 SYNOPSIS
@@ -16,6 +19,11 @@ setting data in a DSA object
  void DSA_get0_key(const DSA *d,
                    const BIGNUM **pub_key, const BIGNUM **priv_key);
  int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
+ const BIGNUM *DSA_get0_p(const DSA *d);
+ const BIGNUM *DSA_get0_q(const DSA *d);
+ const BIGNUM *DSA_get0_g(const DSA *d);
+ const BIGNUM *DSA_get0_pub_key(const DSA *d);
+ const BIGNUM *DSA_get0_priv_key(const DSA *d);
  void DSA_clear_flags(DSA *d, int flags);
  int DSA_test_flags(const DSA *d, int flags);
  void DSA_set_flags(DSA *d, int flags);
@@ -53,6 +61,10 @@ this function transfers the memory management of the key values to the DSA
 object, and therefore they should not be freed directly after this function has
 been called.
 
+Any of the values B<p>, B<q>, B<g>, B<priv_key>, and B<pub_key> can also be
+retrieved separately by the corresponding function DSA_get0_p(), DSA_get0_q(),
+DSA_get0_g(), DSA_get0_priv_key(), and DSA_get0_pub_key(), respectively.
+
 DSA_set_flags() sets the flags in the B<flags> parameter on the DSA object.
 Multiple flags can be passed in one go (bitwise ORed together). Any flags that
 are already set are left set. DSA_test_flags() tests to see whether the flags
index 5a06847e3cc56b5c5b2ea28fb3a5096b44a856d9..e1be0ad82ec2d272add2ba3f61e8326b2d39b9d6 100644 (file)
@@ -171,6 +171,11 @@ int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
 void DSA_get0_key(const DSA *d,
                   const BIGNUM **pub_key, const BIGNUM **priv_key);
 int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
+const BIGNUM *DSA_get0_p(const DSA *d);
+const BIGNUM *DSA_get0_q(const DSA *d);
+const BIGNUM *DSA_get0_g(const DSA *d);
+const BIGNUM *DSA_get0_pub_key(const DSA *d);
+const BIGNUM *DSA_get0_priv_key(const DSA *d);
 void DSA_clear_flags(DSA *d, int flags);
 int DSA_test_flags(const DSA *d, int flags);
 void DSA_set_flags(DSA *d, int flags);
index bef3aa9b6a7eaade63ac7d1042f0f8f538d0172a..a7f50a2410c1d3d7751b6dfdb4f9684d9528af27 100644 (file)
@@ -4533,3 +4533,8 @@ DH_get0_q                               4474      1_1_1   EXIST::FUNCTION:DH
 DH_get0_g                               4475   1_1_1   EXIST::FUNCTION:DH
 DH_get0_priv_key                        4476   1_1_1   EXIST::FUNCTION:DH
 DH_get0_pub_key                         4477   1_1_1   EXIST::FUNCTION:DH
+DSA_get0_priv_key                       4478   1_1_1   EXIST::FUNCTION:DSA
+DSA_get0_pub_key                        4479   1_1_1   EXIST::FUNCTION:DSA
+DSA_get0_q                              4480   1_1_1   EXIST::FUNCTION:DSA
+DSA_get0_p                              4481   1_1_1   EXIST::FUNCTION:DSA
+DSA_get0_g                              4482   1_1_1   EXIST::FUNCTION:DSA