summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgignore3
-rwxr-xr-xbuild-native.sh2
-rw-r--r--jni/Android.mk5
-rw-r--r--openvpn/Android.mk14
-rw-r--r--openvpn/config.h5
-rw-r--r--openvpn/src/compat/compat-rsa_generate_key.c2
6 files changed, 26 insertions, 5 deletions
diff --git a/.hgignore b/.hgignore
index e6d2de68..a2699faa 100644
--- a/.hgignore
+++ b/.hgignore
@@ -63,4 +63,5 @@ zh-CN.zip
zh-TW.zip
google-breakpad/
id.zip
-ovpn3/boost \ No newline at end of file
+ovpn3/boost
+polarssl \ No newline at end of file
diff --git a/build-native.sh b/build-native.sh
index 06466925..4e93e928 100755
--- a/build-native.sh
+++ b/build-native.sh
@@ -8,5 +8,5 @@ if [ $? = 0 ]; then
done
# Removed compiled openssl libs, will use platform so libs
# Reduces size of apk
- rm -v */libcrypto.so */libssl.so
+ rm -v */libcrypto.so */libssl.so
fi
diff --git a/jni/Android.mk b/jni/Android.mk
index faeedd44..094f6d5f 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -1,6 +1,8 @@
# Path of the sources
JNI_DIR := $(call my-dir)
+#USE_POLAR=1
+
include lzo/Android.mk
include openssl/Android.mk
@@ -12,6 +14,9 @@ else
WITH_BREAKPAD=0
endif
+
+#include polarssl/Android.mk
+
include openvpn/Android.mk
diff --git a/openvpn/Android.mk b/openvpn/Android.mk
index 23e24448..5659b607 100644
--- a/openvpn/Android.mk
+++ b/openvpn/Android.mk
@@ -3,14 +3,22 @@ LOCAL_PATH:= $(call my-dir)/
include $(CLEAR_VARS)
LOCAL_LDLIBS := -lz
-LOCAL_C_INCLUDES := openssl/include lzo/include openssl/crypto openssl openvpn/src/compat openvpn/src/openvpn openvpn/include google-breakpad/src google-breakpad/src/common/android/include
+LOCAL_C_INCLUDES := openssl/include lzo/include openssl/crypto openssl openvpn/src/compat openvpn/src/openvpn openvpn/include google-breakpad/src google-breakpad/src/common/android/include polarssl/include
+
-LOCAL_SHARED_LIBRARIES := libssl libcrypto
#LOCAL_STATIC_LIBRARIES := libssl_static libcrypto_static liblzo-static
LOCAL_CFLAGS= -DHAVE_CONFIG_H -DTARGET_ABI=\"${TARGET_ABI}\"
LOCAL_STATIC_LIBRARIES := liblzo-static
+ifeq ($(USE_POLAR),1)
+LOCAL_STATIC_LIBRARIES += polarssl-static
+LOCAL_CFLAGS += -DENABLE_CRYPTO_POLARSSL=1
+else
+LOCAL_SHARED_LIBRARIES := libssl libcrypto
+LOCAL_CFLAGS += -DENABLE_CRYPTO_OPENSSL=1
+endif
+
ifeq ($(WITH_BREAKPAD),1)
LOCAL_STATIC_LIBRARIES += breakpad_client
LOCAL_CFLAGS += -DGOOGLE_BREAKPAD=1
@@ -32,6 +40,7 @@ LOCAL_SRC_FILES:= \
src/openvpn/console.c \
src/openvpn/crypto.c \
src/openvpn/crypto_openssl.c \
+ src/openvpn/crypto_polarssl.c \
src/openvpn/cryptoapi.c \
src/openvpn/dhcp.c \
src/openvpn/error.c \
@@ -85,6 +94,7 @@ LOCAL_SRC_FILES:= \
src/openvpn/socks.c \
src/openvpn/ssl.c \
src/openvpn/ssl_openssl.c \
+ src/openvpn/ssl_polarssl.c \
src/openvpn/ssl_verify.c \
src/openvpn/ssl_verify_openssl.c \
src/openvpn/ssl_verify_polarssl.c \
diff --git a/openvpn/config.h b/openvpn/config.h
index 4dfd7bc5..8e738f37 100644
--- a/openvpn/config.h
+++ b/openvpn/config.h
@@ -550,7 +550,10 @@
#define ENABLE_SSL 1
#define USE_SSL 1
#define ENABLE_CRYPTO 1
-#define ENABLE_CRYPTO_OPENSSL 1
+
+/* via android.mk */
+/*#define ENABLE_CRYPTO_OPENSSL 1*/
+/* #define ENABLE_CRYPTO_POLARSSL 1 */
/* Use valgrind memory debugging library */
/* #undef USE_VALGRIND */
diff --git a/openvpn/src/compat/compat-rsa_generate_key.c b/openvpn/src/compat/compat-rsa_generate_key.c
index 99725da1..87dd1ccb 100644
--- a/openvpn/src/compat/compat-rsa_generate_key.c
+++ b/openvpn/src/compat/compat-rsa_generate_key.c
@@ -4,6 +4,7 @@
#include <openssl/bn.h>
#include <openssl/rsa.h>
+#ifdef ENABLE_CRYPTO_OPENSSL
RSA *RSA_generate_key(int bits, unsigned long e_value,
void (*callback)(int,int,void *), void *cb_arg)
{
@@ -45,3 +46,4 @@ getpass (prompt)
return "";
}
+#endif