[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Wed Jun 15 18:09:33 UTC 2016


The branch master has been updated
       via  2ac6115d9ee35308300b82d96078d03d81e7d320 (commit)
       via  fd809cfdbd6e32b6b67b68c59f6d55fbed7a9327 (commit)
      from  9c1a9ccf65d0ea1912675d3a622fa8e51b524b9e (commit)


- Log -----------------------------------------------------------------
commit 2ac6115d9ee35308300b82d96078d03d81e7d320
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Jun 14 15:49:05 2016 +0200

    Deal with the consequences of constifying getters
    
    Reviewed-by: Stephen Henson <steve at openssl.org>
    Reviewed-by: Emilia Käsper <emilia at openssl.org>

commit fd809cfdbd6e32b6b67b68c59f6d55fbed7a9327
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Jun 14 15:48:16 2016 +0200

    Constify the parameter getters for RSA, DSA and DH
    
    Including documentation changes
    
    Reviewed-by: Stephen Henson <steve at openssl.org>
    Reviewed-by: Emilia Käsper <emilia at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 apps/apps.c                 |  2 +-
 apps/apps.h                 |  3 ++-
 apps/dhparam.c              |  4 ++--
 apps/dsa.c                  |  2 +-
 apps/dsaparam.c             |  2 +-
 apps/gendsa.c               |  2 +-
 apps/genrsa.c               |  2 +-
 apps/req.c                  |  2 +-
 apps/rsa.c                  |  2 +-
 apps/x509.c                 |  4 ++--
 crypto/dh/dh_lib.c          | 19 +++++++------------
 crypto/dsa/dsa_lib.c        | 23 ++++++++++-------------
 crypto/pem/pvkfmt.c         | 12 +++++++-----
 crypto/rsa/rsa_lib.c        | 34 +++++++++++++++-------------------
 doc/crypto/DH_get0_pqg.pod  |  6 ++++--
 doc/crypto/DSA_get0_pqg.pod |  6 ++++--
 doc/crypto/RSA_get0_key.pod |  8 +++++---
 include/openssl/dh.h        |  6 ++++--
 include/openssl/dsa.h       |  6 ++++--
 include/openssl/rsa.h       |  8 +++++---
 ssl/statem/statem_clnt.c    |  2 +-
 ssl/statem/statem_srvr.c    |  2 +-
 22 files changed, 80 insertions(+), 77 deletions(-)

diff --git a/apps/apps.c b/apps/apps.c
index fca3775..ec1cfe9 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -1148,7 +1148,7 @@ void print_name(BIO *out, const char *title, X509_NAME *nm,
     }
 }
 
-void print_bignum_var(BIO *out, BIGNUM *in, const char *var,
+void print_bignum_var(BIO *out, const BIGNUM *in, const char *var,
                       int len, unsigned char *buffer)
 {
     BIO_printf(out, "    static unsigned char %s_%d[] = {", var, len);
diff --git a/apps/apps.h b/apps/apps.h
index 6a0acab..d56c07d 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -380,7 +380,8 @@ int dump_cert_text(BIO *out, X509 *x);
 void print_name(BIO *out, const char *title, X509_NAME *nm,
                 unsigned long lflags);
 # endif
-void print_bignum_var(BIO *, BIGNUM *, const char*, int, unsigned char *);
+void print_bignum_var(BIO *, const BIGNUM *, const char*,
+                      int, unsigned char *);
 void print_array(BIO *, const char *, int, const unsigned char *);
 int set_cert_ex(unsigned long *flags, const char *arg);
 int set_name_ex(unsigned long *flags, const char *arg);
diff --git a/apps/dhparam.c b/apps/dhparam.c
index f86e315..ab2e787 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -298,7 +298,7 @@ int dhparam_main(int argc, char **argv)
     if (C) {
         unsigned char *data;
         int len, bits;
-        BIGNUM *pbn, *gbn;
+        const BIGNUM *pbn, *gbn;
 
         len = DH_size(dh);
         bits = DH_bits(dh);
@@ -337,7 +337,7 @@ int dhparam_main(int argc, char **argv)
     }
 
     if (!noout) {
-        BIGNUM *q;
+        const BIGNUM *q;
         DH_get0_pqg(dh, NULL, &q, NULL);
         if (outformat == FORMAT_ASN1)
             i = i2d_DHparams_bio(out, dh);
diff --git a/apps/dsa.c b/apps/dsa.c
index ef50fed..6ac9a40 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -195,7 +195,7 @@ int dsa_main(int argc, char **argv)
     }
 
     if (modulus) {
-        BIGNUM *pub_key = NULL;
+        const BIGNUM *pub_key = NULL;
         DSA_get0_key(dsa, &pub_key, NULL);
         BIO_printf(out, "Public Key=");
         BN_print(out, pub_key);
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index cd2ca4c..4042660 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -215,7 +215,7 @@ int dsaparam_main(int argc, char **argv)
     }
 
     if (C) {
-        BIGNUM *p = NULL, *q = NULL, *g = NULL;
+        const BIGNUM *p = NULL, *q = NULL, *g = NULL;
         unsigned char *data;
         int len, bits_p;
 
diff --git a/apps/gendsa.c b/apps/gendsa.c
index 2be3b9a..5dacf1b 100644
--- a/apps/gendsa.c
+++ b/apps/gendsa.c
@@ -53,7 +53,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;
+    const BIGNUM *p = NULL;
 
     prog = opt_init(argc, argv, gendsa_options);
     while ((o = opt_next()) != OPT_EOF) {
diff --git a/apps/genrsa.c b/apps/genrsa.c
index 79e2dae..4d104d2 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -59,7 +59,7 @@ int genrsa_main(int argc, char **argv)
     ENGINE *eng = NULL;
     BIGNUM *bn = BN_new();
     BIO *out = NULL;
-    BIGNUM *e;
+    const BIGNUM *e;
     RSA *rsa = NULL;
     const EVP_CIPHER *enc = NULL;
     int ret = 1, num = DEFBITS, private = 0;
diff --git a/apps/req.c b/apps/req.c
index ca8a9af..d1f5dcb 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -768,7 +768,7 @@ int req_main(int argc, char **argv)
         fprintf(stdout, "Modulus=");
 #ifndef OPENSSL_NO_RSA
         if (EVP_PKEY_base_id(tpubkey) == EVP_PKEY_RSA) {
-            BIGNUM *n;
+            const BIGNUM *n;
             RSA_get0_key(EVP_PKEY_get0_RSA(tpubkey), &n, NULL, NULL);
             BN_print(out, n);
         } else
diff --git a/apps/rsa.c b/apps/rsa.c
index 3a1195f..63e88e6 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -214,7 +214,7 @@ int rsa_main(int argc, char **argv)
     }
 
     if (modulus) {
-        BIGNUM *n;
+        const BIGNUM *n;
         RSA_get0_key(rsa, &n, NULL, NULL);
         BIO_printf(out, "Modulus=");
         BN_print(out, n);
diff --git a/apps/x509.c b/apps/x509.c
index 0753817..4191a34 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -684,14 +684,14 @@ int x509_main(int argc, char **argv)
                 BIO_printf(out, "Modulus=");
 #ifndef OPENSSL_NO_RSA
                 if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {
-                    BIGNUM *n;
+                    const BIGNUM *n;
                     RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, NULL, NULL);
                     BN_print(out, n);
                 } else
 #endif
 #ifndef OPENSSL_NO_DSA
                 if (EVP_PKEY_id(pkey) == EVP_PKEY_DSA) {
-                    BIGNUM *dsapub = NULL;
+                    const BIGNUM *dsapub = NULL;
                     DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &dsapub, NULL);
                     BN_print(out, dsapub);
                 } else
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index 6a59f7f..56f9db6 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -183,7 +183,8 @@ int DH_security_bits(const DH *dh)
 }
 
 
-void DH_get0_pqg(const DH *dh, BIGNUM **p, BIGNUM **q, BIGNUM **g)
+void DH_get0_pqg(const DH *dh,
+                 const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
 {
     if (p != NULL)
         *p = dh->p;
@@ -197,11 +198,9 @@ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
 {
     /* If the fields p and g in d are NULL, the corresponding input
      * parameters MUST be non-NULL.  q may remain NULL.
-     *
-     * It is an error to give the results from get0 on d
-     * as input parameters.
      */
-    if (p == dh->p || (dh->q != NULL && q == dh->q) || g == dh->g)
+    if (dh->p == NULL && p == NULL
+        || dh->g == NULL && g == NULL)
         return 0;
 
     if (p != NULL) {
@@ -235,7 +234,7 @@ int DH_set_length(DH *dh, long length)
     return 1;
 }
 
-void DH_get0_key(const DH *dh, BIGNUM **pub_key, BIGNUM **priv_key)
+void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
 {
     if (pub_key != NULL)
         *pub_key = dh->pub_key;
@@ -245,15 +244,11 @@ void DH_get0_key(const DH *dh, BIGNUM **pub_key, BIGNUM **priv_key)
 
 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
 {
-    /* If the pub_key in dh is NULL, the corresponding input
+    /* If the field pub_key in dh 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 dh
-     * as input parameters.
      */
-    if (dh->pub_key == pub_key
-        || (dh->priv_key != NULL && priv_key == dh->priv_key))
+    if (dh->pub_key == NULL && pub_key == NULL)
         return 0;
 
     if (pub_key != NULL) {
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 14cb35f..8146330 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) {
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c
index 4c07aee..bf512ec 100644
--- a/crypto/pem/pvkfmt.c
+++ b/crypto/pem/pvkfmt.c
@@ -467,7 +467,8 @@ static int do_i2b_bio(BIO *out, EVP_PKEY *pk, int ispub)
 static int check_bitlen_dsa(DSA *dsa, int ispub, unsigned int *pmagic)
 {
     int bitlen;
-    BIGNUM *p = NULL, *q = NULL, *g = NULL, *pub_key = NULL, *priv_key = NULL;
+    const BIGNUM *p = NULL, *q = NULL, *g = NULL;
+    const BIGNUM *pub_key = NULL, *priv_key = NULL;
 
     DSA_get0_pqg(dsa, &p, &q, &g);
     DSA_get0_key(dsa, &pub_key, &priv_key);
@@ -494,7 +495,7 @@ static int check_bitlen_dsa(DSA *dsa, int ispub, unsigned int *pmagic)
 static int check_bitlen_rsa(RSA *rsa, int ispub, unsigned int *pmagic)
 {
     int nbyte, hnbyte, bitlen;
-    BIGNUM *e;
+    const BIGNUM *e;
 
     RSA_get0_key(rsa, &e, NULL, NULL);
     if (BN_num_bits(e) > 32)
@@ -506,7 +507,7 @@ static int check_bitlen_rsa(RSA *rsa, int ispub, unsigned int *pmagic)
         *pmagic = MS_RSA1MAGIC;
         return bitlen;
     } else {
-        BIGNUM *d, *p, *q, *iqmp, *dmp1, *dmq1;
+        const BIGNUM *d, *p, *q, *iqmp, *dmp1, *dmq1;
 
         *pmagic = MS_RSA2MAGIC;
 
@@ -534,7 +535,7 @@ static int check_bitlen_rsa(RSA *rsa, int ispub, unsigned int *pmagic)
 static void write_rsa(unsigned char **out, RSA *rsa, int ispub)
 {
     int nbyte, hnbyte;
-    BIGNUM *n, *d, *e, *p, *q, *iqmp, *dmp1, *dmq1;
+    const BIGNUM *n, *d, *e, *p, *q, *iqmp, *dmp1, *dmq1;
 
     nbyte = RSA_size(rsa);
     hnbyte = (RSA_bits(rsa) + 15) >> 4;
@@ -556,7 +557,8 @@ static void write_rsa(unsigned char **out, RSA *rsa, int ispub)
 static void write_dsa(unsigned char **out, DSA *dsa, int ispub)
 {
     int nbyte;
-    BIGNUM *p = NULL, *q = NULL, *g = NULL, *pub_key = NULL, *priv_key = NULL;
+    const BIGNUM *p = NULL, *q = NULL, *g = NULL;
+    const BIGNUM *pub_key = NULL, *priv_key = NULL;
 
     DSA_get0_pqg(dsa, &p, &q, &g);
     DSA_get0_key(dsa, &pub_key, &priv_key);
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c
index 4f93cbc..540dc93 100644
--- a/crypto/rsa/rsa_lib.c
+++ b/crypto/rsa/rsa_lib.c
@@ -232,15 +232,12 @@ int RSA_security_bits(const RSA *rsa)
 
 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
 {
-    /* If the fields in r are NULL, the corresponding input
+    /* If the fields n and e in r are NULL, the corresponding input
      * parameters MUST be non-NULL for n and e.  d may be
      * left NULL (in case only the public key is used).
-     *
-     * It is an error to give the results from get0 on r
-     * as input parameters.
      */
-    if (n == r->n || e == r->e
-        || (r->d != NULL && d == r->d))
+    if (r->n == NULL && n == NULL
+        || r->e == NULL && e == NULL)
         return 0;
 
     if (n != NULL) {
@@ -261,13 +258,11 @@ int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
 
 int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
 {
-    /* If the fields in r are NULL, the corresponding input
+    /* If the fields p and q in r are NULL, the corresponding input
      * parameters MUST be non-NULL.
-     *
-     * It is an error to give the results from get0 on r
-     * as input parameters.
      */
-    if (p == r->p || q == r->q)
+    if (r->p == NULL && p == NULL
+        || r->q == NULL && q == NULL)
         return 0;
 
     if (p != NULL) {
@@ -284,13 +279,12 @@ int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
 
 int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
 {
-    /* If the fields in r are NULL, the corresponding input
+    /* If the fields dmp1, dmq1 and iqmp in r are NULL, the corresponding input
      * parameters MUST be non-NULL.
-     *
-     * It is an error to give the results from get0 on r
-     * as input parameters.
      */
-    if (dmp1 == r->dmp1 || dmq1 == r->dmq1 || iqmp == r->iqmp)
+    if (r->dmp1 == NULL && dmp1 == NULL
+        || r->dmq1 == NULL && dmq1 == NULL
+        || r->iqmp == NULL && iqmp == NULL)
         return 0;
 
     if (dmp1 != NULL) {
@@ -309,7 +303,8 @@ int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
     return 1;
 }
 
-void RSA_get0_key(const RSA *r, BIGNUM **n, BIGNUM **e, BIGNUM **d)
+void RSA_get0_key(const RSA *r,
+                  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
 {
     if (n != NULL)
         *n = r->n;
@@ -319,7 +314,7 @@ void RSA_get0_key(const RSA *r, BIGNUM **n, BIGNUM **e, BIGNUM **d)
         *d = r->d;
 }
 
-void RSA_get0_factors(const RSA *r, BIGNUM **p, BIGNUM **q)
+void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
 {
     if (p != NULL)
         *p = r->p;
@@ -328,7 +323,8 @@ void RSA_get0_factors(const RSA *r, BIGNUM **p, BIGNUM **q)
 }
 
 void RSA_get0_crt_params(const RSA *r,
-                         BIGNUM **dmp1, BIGNUM **dmq1, BIGNUM **iqmp)
+                         const BIGNUM **dmp1, const BIGNUM **dmq1,
+                         const BIGNUM **iqmp)
 {
     if (dmp1 != NULL)
         *dmp1 = r->dmp1;
diff --git a/doc/crypto/DH_get0_pqg.pod b/doc/crypto/DH_get0_pqg.pod
index 6c6b661..79647bf 100644
--- a/doc/crypto/DH_get0_pqg.pod
+++ b/doc/crypto/DH_get0_pqg.pod
@@ -10,9 +10,11 @@ DH_set_length - Routines for getting and setting data in a DH object
 
  #include <openssl/dh.h>
 
- void DH_get0_pqg(const DH *dh, BIGNUM **p, BIGNUM **q, BIGNUM **g);
+ void DH_get0_pqg(const DH *dh,
+                  const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
  int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
- void DH_get0_key(const DH *dh, BIGNUM **pub_key, BIGNUM **priv_key);
+ 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);
  void DH_clear_flags(DH *dh, int flags);
  int DH_test_flags(const DH *dh, int flags);
diff --git a/doc/crypto/DSA_get0_pqg.pod b/doc/crypto/DSA_get0_pqg.pod
index 95173bc..e87e42a 100644
--- a/doc/crypto/DSA_get0_pqg.pod
+++ b/doc/crypto/DSA_get0_pqg.pod
@@ -10,9 +10,11 @@ setting data in a DSA object
 
  #include <openssl/dsa.h>
 
- 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);
  int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
- 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);
  int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
  void DSA_clear_flags(DSA *d, int flags);
  int DSA_test_flags(const DSA *d, int flags);
diff --git a/doc/crypto/RSA_get0_key.pod b/doc/crypto/RSA_get0_key.pod
index 19c7f3d..77e0d3b 100644
--- a/doc/crypto/RSA_get0_key.pod
+++ b/doc/crypto/RSA_get0_key.pod
@@ -14,10 +14,12 @@ and setting data in an RSA object
  int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
  int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
  int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
- void RSA_get0_key(const RSA *r, BIGNUM **n, BIGNUM **e, BIGNUM **d);
- void RSA_get0_factors(const RSA *r, BIGNUM **p, BIGNUM **q);
+ void RSA_get0_key(const RSA *r,
+                   const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
+ void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
  void RSA_get0_crt_params(const RSA *r,
-                          BIGNUM **dmp1, BIGNUM **dmq1, BIGNUM **iqmp);
+                          const BIGNUM **dmp1, const BIGNUM **dmq1,
+                          const BIGNUM **iqmp);
  void RSA_clear_flags(RSA *r, int flags);
  int RSA_test_flags(const RSA *r, int flags);
  void RSA_set_flags(RSA *r, int flags);
diff --git a/include/openssl/dh.h b/include/openssl/dh.h
index 2eb596d..a574e18 100644
--- a/include/openssl/dh.h
+++ b/include/openssl/dh.h
@@ -151,9 +151,11 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
                  const unsigned char *ukm, size_t ukmlen, const EVP_MD *md);
 # endif
 
-void DH_get0_pqg(const DH *dh, BIGNUM **p, BIGNUM **q, BIGNUM **g);
+void DH_get0_pqg(const DH *dh,
+                 const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
-void DH_get0_key(const DH *dh, BIGNUM **pub_key, BIGNUM **priv_key);
+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);
 void DH_clear_flags(DH *dh, int flags);
 int DH_test_flags(const DH *dh, int flags);
diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h
index ce1346c..0c5196d 100644
--- a/include/openssl/dsa.h
+++ b/include/openssl/dsa.h
@@ -169,9 +169,11 @@ DH *DSA_dup_DH(const DSA *r);
 # define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS       (EVP_PKEY_ALG_CTRL + 2)
 # define EVP_PKEY_CTRL_DSA_PARAMGEN_MD           (EVP_PKEY_ALG_CTRL + 3)
 
-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);
 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
-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);
 int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
 void DSA_clear_flags(DSA *d, int flags);
 int DSA_test_flags(const DSA *d, int flags);
diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h
index 4b82081..70d3755 100644
--- a/include/openssl/rsa.h
+++ b/include/openssl/rsa.h
@@ -178,10 +178,12 @@ int RSA_security_bits(const RSA *rsa);
 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
 int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
 int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
-void RSA_get0_key(const RSA *r, BIGNUM **n, BIGNUM **e, BIGNUM **d);
-void RSA_get0_factors(const RSA *r, BIGNUM **p, BIGNUM **q);
+void RSA_get0_key(const RSA *r,
+                  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
+void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
 void RSA_get0_crt_params(const RSA *r,
-                         BIGNUM **dmp1, BIGNUM **dmq1, BIGNUM **iqmp);
+                         const BIGNUM **dmp1, const BIGNUM **dmq1,
+                         const BIGNUM **iqmp);
 void RSA_clear_flags(RSA *r, int flags);
 int RSA_test_flags(const RSA *r, int flags);
 void RSA_set_flags(RSA *r, int flags);
diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c
index 078349f..9fae190 100644
--- a/ssl/statem/statem_clnt.c
+++ b/ssl/statem/statem_clnt.c
@@ -2178,7 +2178,7 @@ psk_err:
 #ifndef OPENSSL_NO_DH
     else if (alg_k & (SSL_kDHE | SSL_kDHEPSK)) {
         DH *dh_clnt = NULL;
-        BIGNUM *pub_key;
+        const BIGNUM *pub_key;
         skey = s->s3->peer_tmp;
         if (skey == NULL) {
             SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE,
diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c
index f4fe2b9..f88b6c8 100644
--- a/ssl/statem/statem_srvr.c
+++ b/ssl/statem/statem_srvr.c
@@ -1602,7 +1602,7 @@ int tls_construct_server_key_exchange(SSL *s)
     int al, i;
     unsigned long type;
     int n;
-    BIGNUM *r[4];
+    const BIGNUM *r[4];
     int nr[4], kn;
     BUF_MEM *buf;
     EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();


More information about the openssl-commits mailing list