From a741d73f3a638cbcc4176f99548e19619d509a37 Mon Sep 17 00:00:00 2001
From: tb <>
Date: Sat, 19 Jan 2019 01:17:41 +0000
Subject: Partial port of EC_KEY_METHOD from OpenSSL 1.1. Pass const method to
 EC_KEY_METHOD_get_*() to get rid of an XXX.

from markus
---
 src/lib/libcrypto/ec/ec.h       |  8 ++++----
 src/lib/libcrypto/ec/ec_kmeth.c | 10 +++++-----
 src/lib/libcrypto/ecdsa/ecdsa.h |  6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h
index 0b8d2cb355..1c5641eca0 100644
--- a/src/lib/libcrypto/ec/ec.h
+++ b/src/lib/libcrypto/ec/ec.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec.h,v 1.15 2019/01/19 01:12:48 tb Exp $ */
+/* $OpenBSD: ec.h,v 1.16 2019/01/19 01:17:41 tb Exp $ */
 /*
  * Originally written by Bodo Moeller for the OpenSSL project.
  */
@@ -971,16 +971,16 @@ void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth,
 void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth,
     int (*ckey)(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)));
-void EC_KEY_METHOD_get_init(EC_KEY_METHOD *meth,
+void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth,
     int (**pinit)(EC_KEY *key),
     void (**pfinish)(EC_KEY *key),
     int (**pcopy)(EC_KEY *dest, const EC_KEY *src),
     int (**pset_group)(EC_KEY *key, const EC_GROUP *grp),
     int (**pset_private)(EC_KEY *key, const BIGNUM *priv_key),
     int (**pset_public)(EC_KEY *key, const EC_POINT *pub_key));
-void EC_KEY_METHOD_get_keygen(EC_KEY_METHOD *meth,
+void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth,
     int (**pkeygen)(EC_KEY *key));
-void EC_KEY_METHOD_get_compute_key(EC_KEY_METHOD *meth,
+void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth,
     int (**pck)(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)));
 
diff --git a/src/lib/libcrypto/ec/ec_kmeth.c b/src/lib/libcrypto/ec/ec_kmeth.c
index 158f542d40..3e847e5fc5 100644
--- a/src/lib/libcrypto/ec/ec_kmeth.c
+++ b/src/lib/libcrypto/ec/ec_kmeth.c
@@ -262,7 +262,7 @@ EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth,
 
 
 void
-EC_KEY_METHOD_get_init(EC_KEY_METHOD *meth,
+EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth,
     int (**pinit)(EC_KEY *key),
     void (**pfinish)(EC_KEY *key),
     int (**pcopy)(EC_KEY *dest, const EC_KEY *src),
@@ -285,7 +285,7 @@ EC_KEY_METHOD_get_init(EC_KEY_METHOD *meth,
 }
 
 void
-EC_KEY_METHOD_get_keygen(EC_KEY_METHOD *meth,
+EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth,
     int (**pkeygen)(EC_KEY *key))
 {
 	if (pkeygen != NULL)
@@ -293,7 +293,7 @@ EC_KEY_METHOD_get_keygen(EC_KEY_METHOD *meth,
 }
 
 void
-EC_KEY_METHOD_get_compute_key(EC_KEY_METHOD *meth,
+EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth,
     int (**pck)(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)))
 {
@@ -302,7 +302,7 @@ EC_KEY_METHOD_get_compute_key(EC_KEY_METHOD *meth,
 }
 
 void
-EC_KEY_METHOD_get_sign(EC_KEY_METHOD *meth,
+EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth,
     int (**psign)(int type, const unsigned char *dgst,
 	int dlen, unsigned char *sig, unsigned int *siglen,
 	const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey),
@@ -321,7 +321,7 @@ EC_KEY_METHOD_get_sign(EC_KEY_METHOD *meth,
 }
 
 void
-EC_KEY_METHOD_get_verify(EC_KEY_METHOD *meth,
+EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth,
     int (**pverify)(int type, const unsigned char *dgst, int dgst_len,
 	const unsigned char *sigbuf, int sig_len, EC_KEY *eckey),
     int (**pverify_sig)(const unsigned char *dgst, int dgst_len,
diff --git a/src/lib/libcrypto/ecdsa/ecdsa.h b/src/lib/libcrypto/ecdsa/ecdsa.h
index 71b8825436..c4e107eee5 100644
--- a/src/lib/libcrypto/ecdsa/ecdsa.h
+++ b/src/lib/libcrypto/ecdsa/ecdsa.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecdsa.h,v 1.7 2019/01/19 01:12:48 tb Exp $ */
+/* $OpenBSD: ecdsa.h,v 1.8 2019/01/19 01:17:41 tb Exp $ */
 /**
  * \file   crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
  * \author Written by Nils Larsch for the OpenSSL project
@@ -284,7 +284,7 @@ void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth,
 	const unsigned char *sigbuf, int sig_len, EC_KEY *eckey),
     int (*verify_sig)(const unsigned char *dgst, int dgst_len,
 	const ECDSA_SIG *sig, EC_KEY *eckey));
-void EC_KEY_METHOD_get_sign(EC_KEY_METHOD *meth,
+void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth,
     int (**psign)(int type, const unsigned char *dgst,
 	int dlen, unsigned char *sig, unsigned int *siglen,
 	const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey),
@@ -293,7 +293,7 @@ void EC_KEY_METHOD_get_sign(EC_KEY_METHOD *meth,
     ECDSA_SIG *(**psign_sig)(const unsigned char *dgst,
 	int dgst_len, const BIGNUM *in_kinv, const BIGNUM *in_r,
 	EC_KEY *eckey));
-void EC_KEY_METHOD_get_verify(EC_KEY_METHOD *meth,
+void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth,
     int (**pverify)(int type, const unsigned char *dgst, int dgst_len,
 	const unsigned char *sigbuf, int sig_len, EC_KEY *eckey),
     int (**pverify_sig)(const unsigned char *dgst, int dgst_len,
-- 
cgit v1.2.3-55-g6feb