[Openvpn-devel] Fix mbed TLS compile if OpenSSL headers are not available

Message ID 20220216125653.4080943-1-arne@rfc2549.org
State Accepted
Headers show
Series [Openvpn-devel] Fix mbed TLS compile if OpenSSL headers are not available | expand

Commit Message

Arne Schwabe Feb. 16, 2022, 1:56 a.m. UTC
We unconditionally include openssl/opensslv.h which fails if OpenSSL header
are not available.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/xkey_common.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Gert Doering Feb. 16, 2022, 2:09 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

"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 <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220216125653.4080943-1-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23804.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/xkey_common.h b/src/openvpn/xkey_common.h
index e58748b4..67c888be 100644
--- a/src/openvpn/xkey_common.h
+++ b/src/openvpn/xkey_common.h
@@ -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_ */