Skip to contentSkip to conversation

Update openssl_compat.h for newer LibreSSL

PATCH Superseded Max Fillinger 2 participants 4 messages Aug 11, 2022 – Aug 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Update openssl_compat.h for newer LibreSSL

LibreSSL has added some of the functions that are defined here. However, we still need RSA_F_RSA_OSSL_PRIVATE_ENCRYPT.

v2: Change ifdef condition for RSA_F_RSA_OSSL_PRIVATE_ENCRYPT.

---
 src/openvpn/openssl_compat.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
src/openvpn/openssl_compat.h +5 -3
index b3ee94f1..c78d2229 100644
@@ -51,8 +51,8 @@
 #define SSL_CTX_set1_groups SSL_CTX_set1_curves
 #endif
 
-/* Functionality missing in LibreSSL and OpenSSL 1.0.2 */
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && !defined(ENABLE_CRYPTO_WOLFSSL)
+/* Functionality missing in LibreSSL before 3.5 and OpenSSL 1.0.2 */
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL)) && !defined(ENABLE_CRYPTO_WOLFSSL)
 /**
  * Destroy a X509 object
  *
@@ -68,11 +68,13 @@ X509_OBJECT_free(X509_OBJECT *obj)
     }
 }
 
-#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT       RSA_F_RSA_EAY_PRIVATE_ENCRYPT
 #define EVP_CTRL_AEAD_SET_TAG                EVP_CTRL_GCM_SET_TAG
 #define EVP_CTRL_AEAD_GET_TAG                EVP_CTRL_GCM_GET_TAG
 #endif
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT       RSA_F_RSA_EAY_PRIVATE_ENCRYPT
+#endif
 
 /* Functionality missing in 1.0.2 */
 #if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(ENABLE_CRYPTO_WOLFSSL)
Signature · 1 line
2.30.2
#1 lore raw

Am 11.08.22 um 19:11 schrieb Max Fillinger:

Quoted 28 lines

LibreSSL has added some of the functions that are defined here. However, we still need RSA_F_RSA_OSSL_PRIVATE_ENCRYPT.

v2: Change ifdef condition for RSA_F_RSA_OSSL_PRIVATE_ENCRYPT.

---
  src/openvpn/openssl_compat.h | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
src/openvpn/openssl_compat.h +2 -2
index b3ee94f1..c78d2229 100644
@@ -51,8 +51,8 @@
  #define SSL_CTX_set1_groups SSL_CTX_set1_curves
  #endif
 
-/* Functionality missing in LibreSSL and OpenSSL 1.0.2 */
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && !defined(ENABLE_CRYPTO_WOLFSSL)
+/* Functionality missing in LibreSSL before 3.5 and OpenSSL 1.0.2 */
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL)) && !defined(ENABLE_CRYPTO_WOLFSSL)
  /**
   * Destroy a X509 object
   *
@@ -68,11 +68,13 @@ X509_OBJECT_free(X509_OBJECT *obj)
      }
  }

src/openvpn/openssl_compat.h X509_OBJECT_free(X509_OBJECT *obj) · line 78

Quoted 10 lines
src/openvpn/openssl_compat.h +3 -1
 
-#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT       RSA_F_RSA_EAY_PRIVATE_ENCRYPT
  #define EVP_CTRL_AEAD_SET_TAG                EVP_CTRL_GCM_SET_TAG
  #define EVP_CTRL_AEAD_GET_TAG                EVP_CTRL_GCM_GET_TAG
  #endif
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT       RSA_F_RSA_EAY_PRIVATE_ENCRYPT
+#endif
 

The patch basically removes the !defined(ENABLE_CRYPTO_WOLFSSL) from this part of the ifdef and that breaks wolfSSL. While I don't think we should much effort into wolfSSL, we should also not break it on purpose.

Arne

#2 lore raw
Quoted 53 lines

-----Original Message-----
From: Arne Schwabe [mailto:[email protected]...]
Sent: donderdag 18 augustus 2022 22:16
To: Maximilian Fillinger <[email protected]...>; openvpn- [email protected]
Subject: Re: [Openvpn-devel] [PATCH v2 1/2] Update openssl_compat.h for newer LibreSSL

Am 11.08.22 um 19:11 schrieb Max Fillinger:

Quoted 1 line

LibreSSL has added some of the functions that are defined here.

However,

Review

Quoted 10 lines

we still need RSA_F_RSA_OSSL_PRIVATE_ENCRYPT.

v2: Change ifdef condition for RSA_F_RSA_OSSL_PRIVATE_ENCRYPT.

---
  src/openvpn/openssl_compat.h | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/src/openvpn/openssl_compat.h

src/openvpn/openssl_compat.h line 55

Quoted 9 lines

index b3ee94f1..c78d2229 100644

src/openvpn/openssl_compat.h +0 -2
@@ -51,8 +51,8 @@
  #define SSL_CTX_set1_groups SSL_CTX_set1_curves
  #endif
 
-/* Functionality missing in LibreSSL and OpenSSL 1.0.2 */
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L ||

defined(LIBRESSL_VERSION_NUMBER)) && !defined(ENABLE_CRYPTO_WOLFSSL)

src/openvpn/openssl_compat.h line 55

Quoted 2 lines
src/openvpn/openssl_compat.h +2 -0
+/* Functionality missing in LibreSSL before 3.5 and OpenSSL 1.0.2 */
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L ||

(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL)) && !defined(ENABLE_CRYPTO_WOLFSSL)

src/openvpn/openssl_compat.h X509_OBJECT_free(X509_OBJECT *obj) · line 71

Quoted 8 lines
src/openvpn/openssl_compat.h +0 -1
  /**
   * Destroy a X509 object
   *
@@ -68,11 +68,13 @@ X509_OBJECT_free(X509_OBJECT *obj)
      }
  }
 
-#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT

RSA_F_RSA_EAY_PRIVATE_ENCRYPT

src/openvpn/openssl_compat.h X509_OBJECT_free(X509_OBJECT *obj)

Quoted 5 lines
src/openvpn/openssl_compat.h +1 -0
  #define EVP_CTRL_AEAD_SET_TAG                EVP_CTRL_GCM_SET_TAG
  #define EVP_CTRL_AEAD_GET_TAG                EVP_CTRL_GCM_GET_TAG
  #endif
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L ||

defined(LIBRESSL_VERSION_NUMBER)

src/openvpn/openssl_compat.h X509_OBJECT_free(X509_OBJECT *obj) · line 76

Quoted 1 line
src/openvpn/openssl_compat.h +1 -0
+#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT

RSA_F_RSA_EAY_PRIVATE_ENCRYPT

Quoted 8 lines

src/openvpn/openssl_compat.h X509_OBJECT_free(X509_OBJECT *obj) · line 78

Quoted 2 lines
src/openvpn/openssl_compat.h +1 -0
+#endif
 

The patch basically removes the !defined(ENABLE_CRYPTO_WOLFSSL) from this part of the ifdef and that breaks wolfSSL. While I don't think we should much effort into wolfSSL, we should also not break it on purpose.

Arne

You told me to ignore it in IRC. But sure, I can make a v3.

#3 lore raw
Quoted 8 lines
Quoted 6 lines

The patch basically removes the !defined(ENABLE_CRYPTO_WOLFSSL) from this part of the ifdef and that breaks wolfSSL. While I don't think we should much effort into wolfSSL, we should also not break it on purpose.

Arne

You told me to ignore it in IRC. But sure, I can make a v3.

Ignore but not break on purpose :)

Arne