From: "plaisthos (Code Review)" Date: Sat, 28 Oct 2023 14:54:29 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="gMJvqhjjzwM="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix building with cmake and mbed TLS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --gMJvqhjjzwM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/377?usp=3Demail to review the following change. Change subject: Fix building with cmake and mbed TLS ...................................................................... Fix building with cmake and mbed TLS Change-Id: I7fd9e730e87210d2b7d090c8f9c7c6734bd7374e --- M CMakeLists.txt M config.h.cmake.in 2 files changed, 19 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/77/377/1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 376a060..2f57771 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,8 @@ endif () option(MBED "BUILD with mbed" OFF) +set(MBED_INCLUDE_PATH "" CACHE STRING "Path to mbed TLS include directory") +set(MBED_LIBRARY_PATH "" CACHE STRING "Path to mbed library directory") option(WOLFSSL "BUILD with wolfSSL" OFF) option(ENABLE_LZ4 "BUILD with lz4" ON) option(ENABLE_LZO "BUILD with lzo" ON) @@ -219,6 +221,13 @@ check_type_size("struct msghdr" MSGHDR) set(CMAKE_EXTRA_INCLUDE_FILES) +if (${MBED}) + check_symbol_exists(mbedtls_ctr_drbg_update_ret mbedtls/ctr_drbg.h HAV= E_CTR_DRBG_UPDATE_RET) + check_symbol_exists(mbedtls_ssl_conf_export_keys_ext_cb mbedtls/ssl.h = HAVE_EXPORT_KEYING_MATERIAL) +else () + set (HAVE_EXPORT_KEYING_MATERIAL TRUE) +endif () + find_program(IFCONFIG_PATH ifconfig) find_program(IPROUTE_PATH ip) find_program(ROUTE_PATH route) @@ -237,7 +246,14 @@ function(add_library_deps target) if (${MBED}) - target_link_libraries(${target} -lmbedtls -lmbedx509 -lmbedcrypto) + if (NOT (MBED_INCLUDE_PATH STREQUAL "") ) + target_include_directories(${target} PRIVATE ${MBED_INCLUDE_PA= TH}) + endif () + if(NOT (MBED_LIBRARY_PATH STREQUAL "")) + target_link_directories(${target} PRIVATE ${MBED_LIBRARY_PATH}) + endif () + + target_link_libraries(${target} PRIVATE -lmbedtls -lmbedx509 -lmbe= dcrypto) elseif (${WOLFSSL}) pkg_search_module(wolfssl wolfssl REQUIRED) target_link_libraries(${target} PUBLIC ${wolfssl_LINK_LIBRARIES}) diff --git a/config.h.cmake.in b/config.h.cmake.in index f2cdd39..633dfd6 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -118,7 +118,7 @@ #cmakedefine HAVE_ERR_H /* Crypto library supports keying material exporter */ -#define HAVE_EXPORT_KEYING_MATERIAL 1 +#cmakedefine HAVE_EXPORT_KEYING_MATERIAL 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_FCNTL_H @@ -387,7 +387,7 @@ #undef HAVE_VSNPRINTF /* we always assume a recent mbed TLS version */ -#define HAVE_CTR_DRBG_UPDATE_RET 1 +#cmakedefine HAVE_CTR_DRBG_UPDATE_RET /* Path to ifconfig tool */ #define IFCONFIG_PATH "@IFCONFIG_PATH@" -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/377?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I7fd9e730e87210d2b7d090c8f9c7c6734bd7374e Gerrit-Change-Number: 377 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --gMJvqhjjzwM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

Vi= ew Change

Fix building with cmake and mbed TLS

Change-Id: I7fd9e= 730e87210d2b7d090c8f9c7c6734bd7374e
---
M CMakeLists.txt
M config.= h.cmake.in
2 files changed, 19 insertions(+), 3 deletions(-)

g=
it pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/77/377/1
<= pre style=3D"font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CMakeLists.txt b/CMakeLists.txt
index 376a06= 0..2f57771 100644
--- a/CMakeLists.txt
+++ = b/CMakeLists.txt
@@ -32,6 +32,8 @@
endif (= )

option(MBED "BUILD with mbed"= ; OFF)
+set(MBED_INCL= UDE_PATH "" CACHE STRING "Path to mbed TLS include directory= ")
+set(MBED_LIB= RARY_PATH "" CACHE STRING "Path to mbed library directory&qu= ot;)
option(WOLFSSL "BUILD with wolfSSL" OFF)
option(ENABLE_LZ4 "BUILD with lz4" ON)
<= span> option(ENABLE_LZO "BUILD with lzo" ON)

@@ -= 219,6 +221,13 @@
check_type_size("struct msghdr"= MSGHDR)
set(CMAKE_EXTRA_INCLUDE_FILES)
<= /span>
+if (${MBED})<= br>+ check_symbol_exists(mbe= dtls_ctr_drbg_update_ret mbedtls/ctr_drbg.h HAVE_CTR_DRBG_UPDATE_RET)
+ check_symbol_exists(m= bedtls_ssl_conf_export_keys_ext_cb mbedtls/ssl.h HAVE_EXPORT_KEYING_MATERIA= L)
+else ()+ set (HAVE_EXPORT_KEYING_M= ATERIAL TRUE)
+endif = ()
+
= find_program(IFCONFIG_PATH ifconfig)
find_program(IPROUTE= _PATH ip)
find_program(ROUTE_PATH route)
@= @ -237,7 +246,14 @@

function(add_library= _deps target)
if (${MBED})
- target_link_libraries(${target} -lmbedtls= -lmbedx509 -lmbedcrypto)
+ if (NOT (MBED_INCLUDE_PATH STREQUAL "") )+ target_include_di= rectories(${target} PRIVATE ${MBED_INCLUDE_PATH})
+ endif ()
+ if(NOT (MBED_LIBRARY_PATH STREQUAL "= ;"))
+ = target_link_directories(${target} PRIVATE ${MBED_LIBRARY_PATH})+ endif ()
+

+ target_link_libraries(${target} P= RIVATE -lmbedtls -lmbedx509 -lmbedcrypto)
elseif (${WO= LFSSL})
pkg_search_module(wolfssl wolfssl REQUIRED= )
target_link_libraries(${target} PUBLIC ${wolfssl= _LINK_LIBRARIES})
diff --git a/config.h.cmake.in b/config.h= .cmake.in
index f2cdd39..633dfd6 100644
---= a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -118,7 +118,7 @@

#cmakedefine HAVE_ERR_H

/* Crypto library supports keying material exporter = */
-#define HAVE_EXPORT= _KEYING_MATERIAL 1
+#= cmakedefine HAVE_EXPORT_KEYING_MATERIAL 1

/* Define to 1 if you have the <fcntl.h> header file. */
= #cmakedefine HAVE_FCNTL_H
@@ -387,7 +387,7 @@=
#undef HAVE_VSNPRINTF

/* we a= lways assume a recent mbed TLS version */
-#define HAVE_CTR_DRBG_UPDATE_RET 1
+#cmakedefine HAVE_CTR_DRBG_UPDATE_RET


/* Path to ifconfig tool */
#define IFCONFIG_PATH "@IFCONFIG_PATH@"

To view, visit change 377. To unsubscribe, or for help writing mai= l filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7fd9e730e87210d2b7d090c8f9c= 7c6734bd7374e
Gerrit-Change-Number: 377
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--gMJvqhjjzwM=--