summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2018-10-08 17:59:10 +0300
committerArne Schwabe <arne@rfc2549.org>2018-10-08 17:59:10 +0300
commit0cdf936963a5cc19c433ff22b8f88e614327e850 (patch)
treeac6f1d7580adc48b2ab8ccab51c9a73a24c3a44a
parent4d9b77fca20b169ac328fdc5a29e2dc4cbd51392 (diff)
Include possibility to use mbedtls+openvpn2
-rw-r--r--main/src/main/cpp/CMakeLists.txt18
-rw-r--r--main/src/main/cpp/openvpn-config/config.h1
-rw-r--r--main/src/main/java/de/blinkt/openvpn/VpnProfile.java2
3 files changed, 17 insertions, 4 deletions
diff --git a/main/src/main/cpp/CMakeLists.txt b/main/src/main/cpp/CMakeLists.txt
index ce28ed3b..24b13f3a 100644
--- a/main/src/main/cpp/CMakeLists.txt
+++ b/main/src/main/cpp/CMakeLists.txt
@@ -13,6 +13,9 @@ OPTION(ENABLE_PROGRAMS "" OFF)
OPTION(USE_SHARED_MBEDTLS_LIBRARY "" OFF)
OPTION(ENABLE_TESTING "" OFF)
+# Own options
+OPTION(OPENVPN2MBED "Use mbed TLS for OpenVPN2" OFF)
+
#add_subdirectory(lzo)
include(tools.cmake)
include(lzo.cmake)
@@ -169,16 +172,18 @@ set(openvpn_srcs
src/openvpn/compstub.c
)
-PREPEND(openvpn_srcs_with_path "openvpn" ${openvpn_srcs})
+PREPEND(openvpn_srcs_with_path "openvpn" ${openvpn_srcs})
+
add_library(openvpn SHARED ${openvpn_srcs_with_path})
+
target_include_directories(openvpn PRIVATE
openvpn-config
openvpn/src/compat
openvpn/include
+ mbedtls/include
lzo/include
openvpn
)
-
target_compile_definitions(openvpn PRIVATE
-DHAVE_CONFIG_H
-DCONFIGURE_GIT_REVISION=\"${OPENVPN2_GIT}\"
@@ -186,10 +191,17 @@ target_compile_definitions(openvpn PRIVATE
-DTARGET_ABI=\"${ANDROID_ABI}\"
)
+if (${OPENVPN2MBED})
+target_compile_definitions(openvpn PRIVATE
+ -DENABLE_CRYPTO_MBEDTLS=1
+ )
+ target_link_libraries(openvpn mbedtls mbedx509 mbedcrypto lzo)
+else()
target_compile_definitions(openvpn PRIVATE
-DENABLE_CRYPTO_OPENSSL=1
)
-target_link_libraries(openvpn crypto ssl lzo)
+ target_link_libraries(openvpn crypto ssl lzo)
+endif()
add_executable(pie_openvpn.${ANDROID_ABI} minivpn/minivpn.c)
target_compile_options(pie_openvpn.${ANDROID_ABI} PRIVATE -fPIE)
diff --git a/main/src/main/cpp/openvpn-config/config.h b/main/src/main/cpp/openvpn-config/config.h
index 7a25ea96..b15c83dd 100644
--- a/main/src/main/cpp/openvpn-config/config.h
+++ b/main/src/main/cpp/openvpn-config/config.h
@@ -673,5 +673,6 @@ int res_init();
#define HAVE_EVP_PKEY_GET0_EC_KEY 1
#define HAVE_EC_GROUP_ORDER_BITS 1
#define HAVE_RSA_METH_GET0_APP_DATA 1
+#define HAVE_RSA_METH_SET_SIGN 1
#define ENABLE_OFB_CFB_MODE 1 \ No newline at end of file
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
index 1ac4d2ca..43891c3d 100644
--- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
+++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
@@ -445,7 +445,7 @@ public class VpnProfile implements Serializable, Cloneable {
cfg.append("### From Keystore/ext auth app ####\n");
if (ks != null) {
cfg.append("<ca>\n").append(ks[0]).append("\n</ca>\n");
- if (ks[1] != null)
+ if (!TextUtils.isEmpty(ks[1]))
cfg.append("<extra-certs>\n").append(ks[1]).append("\n</extra-certs>\n");
cfg.append("<cert>\n").append(ks[2]).append("\n</cert>\n");
cfg.append("management-external-key nopadding\n");