0
0
mirror of https://github.com/schwabe/ics-openvpn.git synced 2024-09-20 03:52:27 +02:00

Add OpenSSL version in about screen

This commit is contained in:
Arne Schwabe 2022-11-01 18:35:16 +01:00
parent c71db5fc5a
commit ea13917b41
6 changed files with 36 additions and 12 deletions

View File

@ -109,8 +109,8 @@ target_compile_definitions(ovpnutil PRIVATE -DTARGET_ARCH_ABI=\"${ANDROID_ABI}\"
) )
target_link_libraries(ovpnutil log) target_link_libraries(ovpnutil log)
add_library(rsapss SHARED ovpnutil/rsapss.cpp) add_library(osslutil SHARED ovpnutil/osslutil.cpp)
target_link_libraries(rsapss log crypto ssl) target_link_libraries(osslutil log crypto ssl)
if (NOT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} MATCHES "build/intermediates/cmake/.*skeleton.*/") if (NOT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} MATCHES "build/intermediates/cmake/.*skeleton.*/")
add_library(osslspeedtest SHARED ovpnutil/sslspeed.c) add_library(osslspeedtest SHARED ovpnutil/sslspeed.c)

View File

@ -3,7 +3,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include "jniglue.h" #include "jniglue.h"
jint JNI_OnLoad(JavaVM *vm, void *reserved) { 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); return (*env)->NewStringUTF(env, OPENVPN3_GIT_REVISION);
} }

View File

@ -13,9 +13,16 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
#include <openssl/opensslv.h>
#include <array> #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 const unsigned char zeroes[] = {0, 0, 0, 0, 0, 0, 0, 0};
static char opensslerr[1024]; static char opensslerr[1024];

View File

@ -30,18 +30,28 @@ public class NativeUtils {
public static native String getOpenVPN3GitVersion(); 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) public static byte[] addRssPssPadding(int hashtype, int MSBits, int rsa_size, byte[] from)
{ {
if (!rsspssloaded) { loadOsslUtil();
rsspssloaded = true;
System.loadLibrary("rsapss");
}
return rsapss(hashtype, MSBits, rsa_size, from); 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); private static native byte[] rsapss(int hashtype, int MSBits, int rsa_size, byte[] from);
public final static int[] openSSLlengths = { public final static int[] openSSLlengths = {

View File

@ -83,9 +83,13 @@ public class AboutFragment extends Fragment implements View.OnClickListener {
TextView verO2 = v.findViewById(R.id.version_ovpn2); TextView verO2 = v.findViewById(R.id.version_ovpn2);
TextView verO3 = v.findViewById(R.id.version_ovpn3); 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())); verO2.setText(String.format(Locale.US, "OpenVPN version: %s", NativeUtils.getOpenVPN2GitVersion()));
verO3.setText(String.format(Locale.US, "OpenVPN3 core version: %s", NativeUtils.getOpenVPN3GitVersion())); 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 */ /* recreating view without onCreate/onDestroy cycle */
TextView translation = (TextView) v.findViewById(R.id.translation); TextView translation = (TextView) v.findViewById(R.id.translation);

View File

@ -45,9 +45,13 @@
android:id="@+id/version_ovpn3" android:id="@+id/version_ovpn3"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="12sp"
tools:text="OpenVPN3 core version 8df8718283" /> 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 <TextView
android:layout_width="match_parent" android:layout_width="match_parent"