Skip to contentSkip to conversation

Fix mbed TLS compile if OpenSSL headers are not available

PATCH In review Arne Schwabe 2 participants 2 messages Feb 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix mbed TLS compile if OpenSSL headers are not available

We unconditionally include openssl/opensslv.h which fails if OpenSSL header are not available.

---
 src/openvpn/xkey_common.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/openvpn/xkey_common.h +6 -1
index e58748b4..67c888be 100644
@@ -25,11 +25,14 @@
 #ifndef XKEY_COMMON_H_
 #define XKEY_COMMON_H_
 
+/* Guard to only enable if OpenSSL is used and not trigger an error if mbed
+ * TLS is compiled without OpenSSL being installed */
+#if defined(ENABLE_CRYPTO_OPENSSL)
 #include <openssl/opensslv.h>
 #if OPENSSL_VERSION_NUMBER >= 0x30000010L && !defined(DISABLE_XKEY_PROVIDER)
 #define HAVE_XKEY_PROVIDER 1
 #include <openssl/provider.h>
-#include <openssl/core_dispatch.h>
+#include <openssl/core_dispatnch.h>
 
 /**
  * Initialization function for OpenVPN external key provider for OpenSSL
@@ -169,4 +172,6 @@ xkey_max_saltlen(int modBits, int hLen)
 }
 #endif /* HAVE_XKEY_PROVIDER */
 
+#endif /* ENABLE_CRYPTO_OPENSSL */
+
 #endif /* XKEY_COMMON_H_ */
Signature · 1 line
2.33.0
Acked-by on v1 1/1
#1 lore raw

"Because it makes sense" :-) - ignoring the "core_dispatnch.h" typo.

Your patch has been applied to the master branch.

commit e8a2794824ded011a1ed58aeb95321332b1ae684

Author: Arne Schwabe
Date:   Wed Feb 16 13:56:53 2022 +0100
     Fix mbed TLS compile if OpenSSL headers are not available

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23804.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering