summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2022-11-01 18:35:16 +0100
committerArne Schwabe <arne@rfc2549.org>2022-11-01 18:37:25 +0100
commitea13917b41ed161f8a385ed438ee8fd3742f557b (patch)
tree1261fc5b383ce41a3d256012a03aecd7d71573c5
parentc71db5fc5a9715490a69ef8ef248668883bf5a13 (diff)
Add OpenSSL version in about screen
-rw-r--r--main/src/main/cpp/CMakeLists.txt4
-rw-r--r--main/src/main/cpp/ovpnutil/jniglue.c3
-rw-r--r--main/src/main/cpp/ovpnutil/osslutil.cpp (renamed from main/src/main/cpp/ovpnutil/rsapss.cpp)7
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java22
-rw-r--r--main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java4
-rw-r--r--main/src/ui/res/layout/about.xml8
6 files changed, 36 insertions, 12 deletions
diff --git a/main/src/main/cpp/CMakeLists.txt b/main/src/main/cpp/CMakeLists.txt
index 3ffdc4c2..3dc1370f 100644
--- a/main/src/main/cpp/CMakeLists.txt
+++ b/main/src/main/cpp/CMakeLists.txt
@@ -109,8 +109,8 @@ target_compile_definitions(ovpnutil PRIVATE -DTARGET_ARCH_ABI=\"${ANDROID_ABI}\"
)
target_link_libraries(ovpnutil log)
-add_library(rsapss SHARED ovpnutil/rsapss.cpp)
-target_link_libraries(rsapss log crypto ssl)
+add_library(osslutil SHARED ovpnutil/osslutil.cpp)
+target_link_libraries(osslutil log crypto ssl)
if (NOT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} MATCHES "build/intermediates/cmake/.*skeleton.*/")
add_library(osslspeedtest SHARED ovpnutil/sslspeed.c)
diff --git a/main/src/main/cpp/ovpnutil/jniglue.c b/main/src/main/cpp/ovpnutil/jniglue.c
index 65a13406..b70deac0 100644
--- a/main/src/main/cpp/ovpnutil/jniglue.c
+++ b/main/src/main/cpp/ovpnutil/jniglue.c
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <unistd.h>
-
#include "jniglue.h"
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
@@ -37,4 +36,4 @@ jstring Java_de_blinkt_openvpn_core_NativeUtils_getOpenVPN3GitVersion(JNIEnv *en
{
return (*env)->NewStringUTF(env, OPENVPN3_GIT_REVISION);
-}
+} \ No newline at end of file
diff --git a/main/src/main/cpp/ovpnutil/rsapss.cpp b/main/src/main/cpp/ovpnutil/osslutil.cpp
index 112c2fe4..6a33338e 100644
--- a/main/src/main/cpp/ovpnutil/rsapss.cpp
+++ b/main/src/main/cpp/ovpnutil/osslutil.cpp
@@ -13,9 +13,16 @@
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
+#include <openssl/opensslv.h>
#include <array>
+
+extern "C" jstring Java_de_blinkt_openvpn_core_NativeUtils_getOpenSSLVersionString(JNIEnv *env, jclass jo)
+{
+ return env->NewStringUTF(OPENSSL_VERSION_TEXT);
+}
+
static const unsigned char zeroes[] = {0, 0, 0, 0, 0, 0, 0, 0};
static char opensslerr[1024];
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 72b2b784..9bfa5e67 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/NativeUtils.java
@@ -30,18 +30,28 @@ public class NativeUtils {
public static native String getOpenVPN3GitVersion();
- static boolean rsspssloaded = false;
+ private static native String getOpenSSLVersionString();
+
+ public static String getOpenSSLVersion() {
+ loadOsslUtil();
+ return getOpenSSLVersionString();
+ }
+
+ static boolean osslutilloaded = false;
public static byte[] addRssPssPadding(int hashtype, int MSBits, int rsa_size, byte[] from)
{
- if (!rsspssloaded) {
- rsspssloaded = true;
- System.loadLibrary("rsapss");
- }
-
+ loadOsslUtil();
return rsapss(hashtype, MSBits, rsa_size, from);
}
+ private static void loadOsslUtil() {
+ if (!osslutilloaded) {
+ osslutilloaded = true;
+ System.loadLibrary("osslutil");
+ }
+ }
+
private static native byte[] rsapss(int hashtype, int MSBits, int rsa_size, byte[] from);
public final static int[] openSSLlengths = {
diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java b/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java
index 240fbe06..182c1a56 100644
--- a/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java
+++ b/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java
@@ -83,9 +83,13 @@ public class AboutFragment extends Fragment implements View.OnClickListener {
TextView verO2 = v.findViewById(R.id.version_ovpn2);
TextView verO3 = v.findViewById(R.id.version_ovpn3);
+ TextView osslVer = v.findViewById(R.id.openssl_version);
verO2.setText(String.format(Locale.US, "OpenVPN version: %s", NativeUtils.getOpenVPN2GitVersion()));
verO3.setText(String.format(Locale.US, "OpenVPN3 core version: %s", NativeUtils.getOpenVPN3GitVersion()));
+ osslVer.setText(String.format(Locale.US, "OpenSSL version: %s", NativeUtils.getOpenSSLVersion()));
+
+
/* recreating view without onCreate/onDestroy cycle */
TextView translation = (TextView) v.findViewById(R.id.translation);
diff --git a/main/src/ui/res/layout/about.xml b/main/src/ui/res/layout/about.xml
index fb2497ff..cd482996 100644
--- a/main/src/ui/res/layout/about.xml
+++ b/main/src/ui/res/layout/about.xml
@@ -45,9 +45,13 @@
android:id="@+id/version_ovpn3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="12sp"
tools:text="OpenVPN3 core version 8df8718283" />
-
+ <TextView
+ android:id="@+id/openssl_version"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12sp"
+ tools:text="OpenSSL version 8df8718283" />
<TextView
android:layout_width="match_parent"