From e792f2d04614dbcbd27076a042c28f6fb20d7abd Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 23 Mar 2013 22:42:46 +0100 Subject: Allow building with polarssl Not very useful at the moment since pkcs12 and external key management are not supported but might be useful one day --- openvpn/Android.mk | 14 ++++++++++++-- openvpn/config.h | 5 ++++- openvpn/src/compat/compat-rsa_generate_key.c | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-) (limited to 'openvpn') 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 #include +#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 -- cgit v1.2.3