android: Build option added to load BYOD related plugins and libraries in the Android app

This commit is contained in:
Tobias Brunner
2013-07-08 18:49:26 +02:00
parent c9df0f989d
commit 933155fae6
3 changed files with 39 additions and 8 deletions
+29 -8
View File
@@ -1,10 +1,18 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# use "bring your own device" (BYOD) features (also see USE_BYOD in
# MainActivity.java)
strongswan_USE_BYOD := true
strongswan_CHARON_PLUGINS := android-log openssl fips-prf random nonce pubkey \
pkcs1 pkcs8 pem xcbc hmac socket-default kernel-netlink \
eap-identity eap-mschapv2 eap-md5 eap-gtc
ifneq ($(strongswan_USE_BYOD),)
strongswan_CHARON_PLUGINS += eap-ttls eap-tnc tnc-imc tnc-tnccs tnccs-20
endif
strongswan_PLUGINS := $(strongswan_CHARON_PLUGINS)
include $(LOCAL_PATH)/strongswan/Android.common.mk
@@ -52,12 +60,25 @@ strongswan_CFLAGS := \
-DDEV_RANDOM=\"/dev/random\" \
-DDEV_URANDOM=\"/dev/urandom\"
ifneq ($(strongswan_USE_BYOD),)
strongswan_CFLAGS += -DUSE_BYOD
endif
strongswan_BUILD := \
vstr \
openssl \
libandroidbridge \
strongswan/src/libipsec \
strongswan/src/libcharon \
strongswan/src/libhydra \
strongswan/src/libstrongswan
ifneq ($(strongswan_USE_BYOD),)
strongswan_BUILD += \
strongswan/src/libtnccs \
strongswan/src/libtncif \
strongswan/src/libimcv
endif
include $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
vstr \
openssl \
libandroidbridge \
strongswan/src/libipsec \
strongswan/src/libcharon \
strongswan/src/libhydra \
strongswan/src/libstrongswan \
))
$(strongswan_BUILD)))
@@ -600,6 +600,14 @@ public class CharonVpnService extends VpnService implements Runnable
{
System.loadLibrary("crypto");
System.loadLibrary("strongswan");
if (MainActivity.USE_BYOD)
{
System.loadLibrary("tncif");
System.loadLibrary("tnccs");
System.loadLibrary("imcv");
}
System.loadLibrary("hydra");
System.loadLibrary("charon");
System.loadLibrary("ipsec");
@@ -58,6 +58,8 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
public static final String CONTACT_EMAIL = "[email protected]";
public static final String START_PROFILE = "org.strongswan.android.action.START_PROFILE";
public static final String EXTRA_VPN_PROFILE_ID = "org.strongswan.android.VPN_PROFILE_ID";
/** Use "bring your own device" (BYOD) features */
public static final boolean USE_BYOD = true;
private static final int PREPARE_VPN_SERVICE = 0;
private static final String PROFILE_NAME = "org.strongswan.android.MainActivity.PROFILE_NAME";
private static final String PROFILE_REQUIRES_PASSWORD = "org.strongswan.android.MainActivity.REQUIRES_PASSWORD";