diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/cpp/CMakeLists.txt | 25 | ||||
-rw-r--r-- | main/src/main/cpp/opvpnutil/jniglue.c | 12 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 5 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java | 5 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/AboutFragment.java | 6 | ||||
-rw-r--r-- | main/src/main/res/layout/about.xml | 17 | ||||
-rw-r--r-- | main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java | 39 |
7 files changed, 77 insertions, 32 deletions
diff --git a/main/src/main/cpp/CMakeLists.txt b/main/src/main/cpp/CMakeLists.txt index 24b13f3a..8b22a82a 100644 --- a/main/src/main/cpp/CMakeLists.txt +++ b/main/src/main/cpp/CMakeLists.txt @@ -15,6 +15,9 @@ OPTION(ENABLE_TESTING "" OFF) # Own options OPTION(OPENVPN2MBED "Use mbed TLS for OpenVPN2" OFF) +OPTION(OPENVPN3OSSL "Use OpenSSL for OpenVPN3" ON) +SET(OPENVPN3OSSL ON) + #add_subdirectory(lzo) include(tools.cmake) @@ -61,26 +64,38 @@ if (NOT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} MATCHES "build/intermediates/cmake/.*n ${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/include ) - target_compile_options(ovpn3 PRIVATE -std=c++1y) + if (${OPENVPN3OSSL}) + target_compile_definitions(ovpn3 PRIVATE + -DUSE_OPENSSL + ) + target_link_libraries(ovpn3 crypto ssl lzo lz4) + else() + target_compile_definitions(ovpn3 PRIVATE + -DUSE_MBEDTLS + ) + target_link_libraries(ovpn3 mbedtls mbedx509 mbedcrypto lzo lz4) + endif() + + target_compile_options(ovpn3 PRIVATE -std=c++1y) target_compile_definitions(ovpn3 PRIVATE -DHAVE_CONFIG_H -DHAVE_LZO -DHAVE_LZ4 -DASIO_STANDALONE -DUSE_ASIO - -DUSE_MBEDTLS -DGIT_VERSION_STRING=\"${OPENVPN3_GIT}\" -DNO_ROUTE_EXCLUDE_EMULATION -DOPENVPN_SHOW_SESSION_TOKEN - -DASIO_HAS_STD_STRING_VIEW ) - target_link_libraries(ovpn3 mbedtls mbedx509 mbedcrypto lzo lz4) else() message ("Not budiling OpenVPN for output dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") endif() add_library(opvpnutil SHARED opvpnutil/jniglue.c opvpnutil/scan_ifs.c opvpnutil/sslspeed.c) -target_compile_definitions(opvpnutil PRIVATE -DTARGET_ARCH_ABI=\"${ANDROID_ABI}\") +target_compile_definitions(opvpnutil PRIVATE -DTARGET_ARCH_ABI=\"${ANDROID_ABI}\" + -DOPENVPN2_GIT_REVISION=\"${OPENVPN2_GIT}\" + -DOPENVPN3_GIT_REVISION=\"${OPENVPN3_GIT}\" + ) target_link_libraries(opvpnutil log crypto ssl) # The magic Jellybean keystore signing hack. Beware dragons and dlsyms magic ahead diff --git a/main/src/main/cpp/opvpnutil/jniglue.c b/main/src/main/cpp/opvpnutil/jniglue.c index b0c6c704..264b18a8 100644 --- a/main/src/main/cpp/opvpnutil/jniglue.c +++ b/main/src/main/cpp/opvpnutil/jniglue.c @@ -31,3 +31,15 @@ jstring Java_de_blinkt_openvpn_core_NativeUtils_getJNIAPI(JNIEnv *env, jclass jo return (*env)->NewStringUTF(env, TARGET_ARCH_ABI); } + +jstring Java_de_blinkt_openvpn_core_NativeUtils_getOpenVPN2GitVersion(JNIEnv *env, jclass jo) +{ + + return (*env)->NewStringUTF(env, OPENVPN2_GIT_REVISION); +} + +jstring Java_de_blinkt_openvpn_core_NativeUtils_getOpenVPN3GitVersion(JNIEnv *env, jclass jo) +{ + + return (*env)->NewStringUTF(env, OPENVPN3_GIT_REVISION); +} diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java index a715805d..85ee6807 100644 --- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -551,7 +551,10 @@ public class VpnProfile implements Serializable, Cloneable { if (mMssFix != 0) { if (mMssFix != 1450) { - cfg.append(String.format(Locale.US, "mssfix %d\n", mMssFix)); + if (configForOvpn3) + cfg.append(String.format(Locale.US, "mssfix %d mtu\n", mMssFix)); + else + cfg.append(String.format(Locale.US, "mssfix %d\n", mMssFix)); } else cfg.append("mssfix\n"); } diff --git a/main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java b/main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java index 6b633c34..4e22189a 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java +++ b/main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java @@ -26,6 +26,9 @@ public class NativeUtils { private static native String getJNIAPI(); + public static native String getOpenVPN2GitVersion(); + + public static native String getOpenVPN3GitVersion(); public final static int[] openSSLlengths = { 16, 64, 256, 1024, 8 * 1024, 16 * 1024 @@ -44,4 +47,6 @@ public class NativeUtils { public static boolean isRoboUnitTest() { return "robolectric".equals(Build.FINGERPRINT); } + + } diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/AboutFragment.java b/main/src/main/java/de/blinkt/openvpn/fragments/AboutFragment.java index 4fce6eaa..540f4a9a 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/AboutFragment.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/AboutFragment.java @@ -30,6 +30,7 @@ import android.widget.TextView; import com.android.vending.billing.IInAppBillingService; +import de.blinkt.openvpn.core.NativeUtils; import org.json.JSONException; import org.json.JSONObject; @@ -269,10 +270,13 @@ public class AboutFragment extends Fragment implements View.OnClickListener { version = "error fetching version"; } - ver.setText(getString(R.string.version_info, name, version)); + TextView verO2 = v.findViewById(R.id.version_ovpn2); + TextView verO3 = v.findViewById(R.id.version_ovpn3); + verO2.setText(String.format(Locale.US, "OpenVPN version: %s", NativeUtils.getOpenVPN2GitVersion())); + verO3.setText(String.format(Locale.US, "OpenVPN3 core version: %s", NativeUtils.getOpenVPN3GitVersion())); gmsTextView = (TextView) v.findViewById(R.id.donategms); /* recreating view without onCreate/onDestroy cycle */ diff --git a/main/src/main/res/layout/about.xml b/main/src/main/res/layout/about.xml index 2ab9a4f3..8b40520b 100644 --- a/main/src/main/res/layout/about.xml +++ b/main/src/main/res/layout/about.xml @@ -19,6 +19,7 @@ <TextView android:id="@+id/version" + tools:text="OpenVPN for Anroid 1.2.3" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" @@ -26,7 +27,8 @@ <Space android:layout_width="match_parent" - android:layout_height="12sp" /> + android:layout_height="6sp" /> + <TextView android:layout_width="match_parent" @@ -37,7 +39,20 @@ <Space android:layout_width="match_parent" android:layout_height="12sp" /> + <TextView + android:id="@+id/version_ovpn2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + tools:text="OpenVPN version 874981723" /> + <TextView + android:id="@+id/version_ovpn3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + tools:text="OpenVPN3 core version 8df8718283" /> + <Space + android:layout_width="match_parent" + android:layout_height="12sp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java index 078fa218..08f7a156 100644 --- a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java +++ b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java @@ -1,30 +1,13 @@ package de.blinkt.openvpn.core; -import android.net.*; -import android.os.Build; +import android.content.Context; import de.blinkt.openvpn.R; -import net.openvpn.ovpn3.*; - -import java.lang.Override; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.util.Locale; -import java.util.Vector; - import de.blinkt.openvpn.VpnProfile; - -import android.content.Context; -import net.openvpn.ovpn3.*; -import net.openvpn.ovpn3.*; import net.openvpn.ovpn3.*; -import net.openvpn.ovpn3.*; -import net.openvpn.ovpn3.*; -import net.openvpn.ovpn3.*; -import net.openvpn.ovpn3.*; -import net.openvpn.ovpn3.ClientAPI_Config; -import net.openvpn.ovpn3.ClientAPI_EvalConfig; -import net.openvpn.ovpn3.ClientAPI_Event; -import net.openvpn.ovpn3.ClientAPI_ExternalPKICertRequest; + +import static net.openvpn.ovpn3.ClientAPI_OpenVPNClient.copyright; +import static net.openvpn.ovpn3.ClientAPI_OpenVPNClient.init_process; +import static net.openvpn.ovpn3.ClientAPI_OpenVPNClient.platform; public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable, OpenVPNManagement { @@ -240,8 +223,15 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable @Override public void external_pki_sign_request(ClientAPI_ExternalPKISignRequest signreq) { - VpnStatus.logDebug("Got external PKI signing request from OpenVPN core"); - signreq.setSig(mVp.getSignedData(mService, signreq.getData(),true)); + VpnStatus.logDebug("Got external PKI signing request from OpenVPN core for algorithm " + signreq.getAlgorithm()); + boolean pkcs1padding; + if (signreq.getAlgorithm().equals("RSA_PKCS1_PADDING")) + pkcs1padding = true; + else if (signreq.getAlgorithm().equals("RSA_NO_PADDING")) + pkcs1padding = false; + else + throw new IllegalArgumentException("Illegal padding in sign request" + signreq.getAlgorithm()); + signreq.setSig(mVp.getSignedData(mService, signreq.getData(), pkcs1padding)); } void setUserPW() { @@ -348,4 +338,5 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable super.pause(reason.toString()); } + } |