Skip to contentSkip to conversation

Add OpenSSL compat definition for RSA_meth_set_sign

PATCH Superseded Arne Schwabe 2 participants 5 messages Oct 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add OpenSSL compat definition for RSA_meth_set_sign

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 ++++++++++++++++++++
 src/openvpn/ssl_openssl.c    |  4 ++++
 3 files changed, 25 insertions(+)
configure.ac +1 -0
index 3d8e15bd..399cdf4e 100644
@@ -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 \
src/openvpn/openssl_compat.h +20 -0
index f5328c4c..3877734f 100644
@@ -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 init               the init 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
src/openvpn/ssl_openssl.c +4 -0
index cfc628b6..0861db4f 100644
@@ -2000,6 +2000,10 @@ show_available_tls_ciphers_list(const char *cipher_list,
     tls_ctx_set_cert_profile(&tls_ctx, tls_cert_profile);
     tls_ctx_restrict_ciphers(&tls_ctx, cipher_list);
 
+    /* Even though setting the version does not seem to work,
+     * we do this because it might get fixed in future SSL
+     * versions
+     */
 #if (OPENSSL_VERSION_NUMBER >= 0x1010100fL)
     if (tls13)
     {
Signature · 1 line
2.19.0
#1 lore raw

PATCH v2 1/1 Add OpenSSL compat definition for RSA_meth_set_sign

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(+)
configure.ac +1 -0
index 3d8e15bd..399cdf4e 100644
@@ -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 \
src/openvpn/openssl_compat.h +20 -0
index f5328c4c..d2c8d4a6 100644
@@ -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
Signature · 1 line
2.19.0
#2 lore raw

PATCH v3 1/1 Add OpenSSL compat definition for RSA_meth_set_sign

In reply to Arne Schwabe

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(+)
configure.ac +1 -0
index 3d8e15bd..399cdf4e 100644
@@ -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 \
src/openvpn/openssl_compat.h +20 -0
index f5328c4c..d2c8d4a6 100644
@@ -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
Signature · 1 line
2.19.0
#3 lore raw

PATCH v3 1/1 Add OpenSSL compat definition for RSA_meth_set_sign

In reply to Arne Schwabe

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(+)
configure.ac +1 -0
index 3d8e15bd..399cdf4e 100644
@@ -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 \
src/openvpn/openssl_compat.h +20 -0
index f5328c4c..9560b29f 100644
@@ -585,6 +585,26 @@ RSA_meth_set_init(RSA_METHOD *meth, int (*init) (RSA *rsa))
 }
 #endif
 
+#if !defined (HAVE_RSA_METH_SET_SIGN)
+/**
+ * Set the sign 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
Signature · 1 line
2.19.0
Acked-by on v3 1/1
#4 lore raw

Thanks :-)

Your patch has been applied to the master and release/2.4 branch (keep our compat wrapper aligned).

commit 720c880a8ca73e0f9e9b03e3c9d6031c026bccac (master) commit c75e937657bf0ae9e9551163f77305d7658c71b3 (release/2.4)

Author: Arne Schwabe
Date:   Fri Oct 5 14:23:30 2018 +0200
     Add OpenSSL compat definition for RSA_meth_set_sign

     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/search?l=mid&[email protected]...
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering