Constify EC_KEY in ECDH_compute_key.
authorDr. Stephen Henson <steve@openssl.org>
Sun, 13 Dec 2015 00:11:42 +0000 (00:11 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 16 Dec 2015 14:17:53 +0000 (14:17 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/ec/ec_kmeth.c
crypto/ec/ec_lcl.h
crypto/ec/ecdh_ossl.c
include/openssl/ec.h

index e75417972615006d3643b36450f63bbc0c34b42a..d6c2811fc89bb078484a9939001552a825e3fb7b 100644 (file)
@@ -134,7 +134,7 @@ EC_KEY *EC_KEY_new_method(ENGINE *engine)
 }
 
 int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
 }
 
 int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
-                     EC_KEY *eckey,
+                     const EC_KEY *eckey,
                      void *(*KDF) (const void *in, size_t inlen, void *out,
                                    size_t *outlen))
 {
                      void *(*KDF) (const void *in, size_t inlen, void *out,
                                    size_t *outlen))
 {
@@ -190,7 +190,7 @@ void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth,
                                    int (*ckey)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
                                    int (*ckey)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
-                                               EC_KEY *ecdh,
+                                               const EC_KEY *ecdh,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,
@@ -268,7 +268,7 @@ void EC_KEY_METHOD_get_compute_key(EC_KEY_METHOD *meth,
                                    int (**pck)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
                                    int (**pck)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
-                                               EC_KEY *ecdh,
+                                               const EC_KEY *ecdh,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,
index 3cd23456954650033cb757808c41f783a3c65a4e..ebfaae3a15c5fca4cc53584b0218948c5caab7d5 100644 (file)
@@ -568,7 +568,7 @@ struct ec_key_method_st {
     int (*set_public)(EC_KEY *key, const EC_POINT *pub_key);
     int (*keygen)(EC_KEY *key);
     int (*compute_key)(void *out, size_t outlen, const EC_POINT *pub_key,
     int (*set_public)(EC_KEY *key, const EC_POINT *pub_key);
     int (*keygen)(EC_KEY *key);
     int (*compute_key)(void *out, size_t outlen, const EC_POINT *pub_key,
-                       EC_KEY *ecdh,
+                       const EC_KEY *ecdh,
                        void *(*KDF) (const void *in, size_t inlen,
                                      void *out, size_t *outlen));
 
                        void *(*KDF) (const void *in, size_t inlen,
                                      void *out, size_t *outlen));
 
@@ -591,7 +591,7 @@ struct ec_key_method_st {
 
 int ossl_ec_key_gen(EC_KEY *eckey);
 int ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
 
 int ossl_ec_key_gen(EC_KEY *eckey);
 int ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
-                          EC_KEY *ecdh,
+                          const EC_KEY *ecdh,
                           void *(*KDF) (const void *in, size_t inlen,
                                         void *out, size_t *outlen));
 
                           void *(*KDF) (const void *in, size_t inlen,
                                         void *out, size_t *outlen));
 
index 94339e4ad989e465ec49579b51520bd518d25d3a..b7f09eba17616cc5be4b551f897d9cb03dafa61f 100644 (file)
@@ -85,7 +85,7 @@
  * Finally an optional KDF is applied.
  */
 int ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
  * Finally an optional KDF is applied.
  */
 int ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
-                          EC_KEY *ecdh,
+                          const EC_KEY *ecdh,
                           void *(*KDF) (const void *in, size_t inlen,
                                         void *out, size_t *outlen))
 {
                           void *(*KDF) (const void *in, size_t inlen,
                                         void *out, size_t *outlen))
 {
index 33f1c7319e133bd86102258a90228a16a846cc19..1dc2db18cc5bdca9743122eb0584d21e06962f92 100644 (file)
@@ -1031,8 +1031,9 @@ int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,
                    const EVP_MD *md);
 
 int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
                    const EVP_MD *md);
 
 int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
-                     EC_KEY *ecdh, void *(*KDF) (const void *in, size_t inlen,
-                                                 void *out, size_t *outlen));
+                     const EC_KEY *ecdh,
+                     void *(*KDF) (const void *in, size_t inlen,
+                                   void *out, size_t *outlen));
 
 typedef struct ECDSA_SIG_st ECDSA_SIG;
 
 
 typedef struct ECDSA_SIG_st ECDSA_SIG;
 
@@ -1188,7 +1189,7 @@ void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth,
                                    int (*ckey)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
                                    int (*ckey)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
-                                               EC_KEY *ecdh,
+                                               const EC_KEY *ecdh,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,
@@ -1236,7 +1237,7 @@ void EC_KEY_METHOD_get_compute_key(EC_KEY_METHOD *meth,
                                    int (**pck)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
                                    int (**pck)(void *out,
                                                size_t outlen,
                                                const EC_POINT *pub_key,
-                                               EC_KEY *ecdh,
+                                               const EC_KEY *ecdh,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,
                                                void *(*KDF) (const void *in,
                                                              size_t inlen,
                                                              void *out,