]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
DH: add simple getters for commonly used DH struct members
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Wed, 16 May 2018 14:18:13 +0000 (16:18 +0200)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Fri, 18 May 2018 06:53:48 +0000 (08:53 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6273)

crypto/dh/dh_lib.c
doc/man3/DH_get0_pqg.pod
include/openssl/dh.h
util/libcrypto.num

index a33f3246a388bebdafc0ee95b5827db694f8e354..a61aa4dc635fdc6f6eea522b3defcf2c77dbf51a 100644 (file)
@@ -243,6 +243,31 @@ int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
     return 1;
 }
 
+const BIGNUM *DH_get0_p(const DH *dh)
+{
+    return dh->p;
+}
+
+const BIGNUM *DH_get0_q(const DH *dh)
+{
+    return dh->q;
+}
+
+const BIGNUM *DH_get0_g(const DH *dh)
+{
+    return dh->g;
+}
+
+const BIGNUM *DH_get0_priv_key(const DH *dh)
+{
+    return dh->priv_key;
+}
+
+const BIGNUM *DH_get0_pub_key(const DH *dh)
+{
+    return dh->pub_key;
+}
+
 void DH_clear_flags(DH *dh, int flags)
 {
     dh->flags &= ~flags;
index ec476a7d62135c79a5d06006fd1ad012910d2f87..6b25556ef7bf1ca43f15f961e02d08279fa68024 100644 (file)
@@ -2,9 +2,11 @@
 
 =head1 NAME
 
-DH_get0_pqg, DH_set0_pqg, DH_get0_key, DH_set0_key, DH_clear_flags,
-DH_test_flags, DH_set_flags, DH_get0_engine, DH_get_length,
-DH_set_length - Routines for getting and setting data in a DH object
+DH_get0_pqg, DH_set0_pqg, DH_get0_key, DH_set0_key,
+DH_get0_p, DH_get0_q, DH_get0_g,
+DH_get0_priv_key, DH_get0_pub_key,
+DH_clear_flags, DH_test_flags, DH_set_flags, DH_get0_engine,
+DH_get_length, DH_set_length - Routines for getting and setting data in a DH object
 
 =head1 SYNOPSIS
 
@@ -16,6 +18,11 @@ DH_set_length - Routines for getting and setting data in a DH object
  void DH_get0_key(const DH *dh,
                   const BIGNUM **pub_key, const BIGNUM **priv_key);
  int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
+ const BIGNUM *DH_get0_p(const DH *dh);
+ const BIGNUM *DH_get0_q(const DH *dh);
+ const BIGNUM *DH_get0_g(const DH *dh);
+ const BIGNUM *DH_get0_priv_key(const DH *dh);
+ const BIGNUM *DH_get0_pub_key(const DH *dh);
  void DH_clear_flags(DH *dh, int flags);
  int DH_test_flags(const DH *dh, int flags);
  void DH_set_flags(DH *dh, int flags);
@@ -54,6 +61,10 @@ untouched. As with DH_set0_pqg() this function transfers the memory management
 of the key values to the DH 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 DH_get0_p(), DH_get0_q(),
+DH_get0_g(), DH_get0_priv_key(), and DH_get0_pub_key(), respectively.
+
 DH_set_flags() sets the flags in the B<flags> parameter on the DH object.
 Multiple flags can be passed in one go (bitwise ORed together). Any flags that
 are already set are left set. DH_test_flags() tests to see whether the flags
@@ -81,6 +92,9 @@ duplicate.  The same applies to DH_get0_pqg() and DH_set0_pqg().
 
 DH_set0_pqg() and DH_set0_key() return 1 on success or 0 on failure.
 
+DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_priv_key(), and DH_get0_pub_key()
+return the respective value.
+
 DH_test_flags() returns the current state of the flags in the DH object.
 
 DH_get0_engine() returns the ENGINE set for the DH object or NULL if no ENGINE
index 9a1fddab0214575c33c7f0c68e0450b95f269ca7..3527540cdddb4387d6f39da625931b6c50e5e4e2 100644 (file)
@@ -183,6 +183,11 @@ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
 void DH_get0_key(const DH *dh,
                  const BIGNUM **pub_key, const BIGNUM **priv_key);
 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
+const BIGNUM *DH_get0_p(const DH *dh);
+const BIGNUM *DH_get0_q(const DH *dh);
+const BIGNUM *DH_get0_g(const DH *dh);
+const BIGNUM *DH_get0_priv_key(const DH *dh);
+const BIGNUM *DH_get0_pub_key(const DH *dh);
 void DH_clear_flags(DH *dh, int flags);
 int DH_test_flags(const DH *dh, int flags);
 void DH_set_flags(DH *dh, int flags);
index 6e7f635984860b439407a1fb8edc33bd305ff1e0..d3351c53d7f44baa73cc492f456649fd4a4693bf 100644 (file)
@@ -4528,3 +4528,8 @@ conf_ssl_name_find                      4469      1_1_0i  EXIST::FUNCTION:
 conf_ssl_get_cmd                        4470   1_1_0i  EXIST::FUNCTION:
 conf_ssl_get                            4471   1_1_0i  EXIST::FUNCTION:
 X509_VERIFY_PARAM_get_hostflags         4472   1_1_0i  EXIST::FUNCTION:
+DH_get0_p                               4473   1_1_0i  EXIST::FUNCTION:DH
+DH_get0_q                               4474   1_1_0i  EXIST::FUNCTION:DH
+DH_get0_g                               4475   1_1_0i  EXIST::FUNCTION:DH
+DH_get0_priv_key                        4476   1_1_0i  EXIST::FUNCTION:DH
+DH_get0_pub_key                         4477   1_1_0i  EXIST::FUNCTION:DH