From: Arne Schwabe Date: Fri, 5 Oct 2018 14:20:32 +0200 Message-Id: <20181005122032.31208-1-arne@...1227...> In-Reply-To: <20181005114918.30626-1-arne@...1227...> References: <20181005114918.30626-1-arne@...1227...> Subject: [Openvpn-devel] [PATCH v3] Add OpenSSL compat definition for RSA_meth_set_sign List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: openvpn-devel@lists.sourceforge.net Commit 6b495dc4c5cfc118091ddc9c19330b3c9e3e3dff introduced RSA_meth_set_sign, which is OpenSSL 1.1.0 and newer. Add a compatibility definition. --- configure.ac | 1 + src/openvpn/openssl_compat.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index 3d8e15bd..399cdf4e 100644 --- a/configure.ac +++ b/configure.ac @@ -943,6 +943,7 @@ if test "${with_crypto_library}" = "openssl"; then RSA_meth_set_priv_enc \ RSA_meth_set_priv_dec \ RSA_meth_set_init \ + RSA_meth_set_sign \ RSA_meth_set_finish \ RSA_meth_set0_app_data \ RSA_meth_get0_app_data \ diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h index f5328c4c..d2c8d4a6 100644 --- a/src/openvpn/openssl_compat.h +++ b/src/openvpn/openssl_compat.h @@ -585,6 +585,26 @@ RSA_meth_set_init(RSA_METHOD *meth, int (*init) (RSA *rsa)) } #endif +#if !(defined HAVE_RSA_MATH_SET_SIGN) +/** + * Set the init function of an RSA_METHOD object + * + * @param meth The RSA_METHOD object + * @param sign The sign function + * @return 1 on success, 0 on error + */ +static inline +int RSA_meth_set_sign(RSA_METHOD *meth, + int (*sign) (int type, const unsigned char *m, + unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa)) +{ + meth->rsa_sign = sign; + return 1; +} +#endif + #if !defined(HAVE_RSA_METH_SET_FINISH) /** * Set the finish function of an RSA_METHOD object -- 2.19.0