android: Build option added to load BYOD related plugins and libraries in the Android app
authorTobias Brunner <tobias@strongswan.org>
Thu, 11 Oct 2012 11:50:18 +0000 (13:50 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 8 Jul 2013 16:49:26 +0000 (18:49 +0200)
src/frontends/android/jni/Android.mk
src/frontends/android/src/org/strongswan/android/logic/CharonVpnService.java
src/frontends/android/src/org/strongswan/android/ui/MainActivity.java

index 0ae18fc..781d8a1 100644 (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)))
index 02db8c4..5670131 100644 (file)
@@ -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");
index d7c1cc4..3cf3950 100644 (file)
@@ -58,6 +58,8 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
        public static final String CONTACT_EMAIL = "android@strongswan.org";
        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";