Adding Android.mk files to build charon and libstrongswan with the Android build system.

This commit is contained in:
Tobias Brunner 2010-03-03 10:18:46 +01:00
parent afb364fff9
commit 1be3298807
7 changed files with 469 additions and 2 deletions

54
Android.mk Normal file
View File

@ -0,0 +1,54 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# this is the list of plugins that are built into libstrongswan and charon
# also these plugins are loaded by default (if not changed in strongswan.conf)
strongswan_PLUGINS := aes des sha1 sha2 md5 fips-prf random x509 pubkey pkcs1 \
pem xcbc hmac gmp kernel-netlink socket-default attr android
# helper macros to only add source files for plugins included in the list above
plugin_enabled = $(findstring $(1), $(strongswan_PLUGINS))
add_plugin = $(if $(call plugin_enabled,$(1)), \
$(addprefix plugins/$(subst -,_,$(strip $(1))/),$(2)))
# includes
libvstr_PATH = external/strongswan-support/vstr/include
libgmp_PATH = external/strongswan-support/gmp
# CFLAGS (partially from a configure run using droid-gcc)
strongswan_CFLAGS := \
-Wno-format \
-Wno-pointer-sign \
-Wno-sign-compare \
-Wno-strict-aliasing \
-DHAVE___BOOL \
-DHAVE_STDBOOL_H \
-DHAVE_ALLOCA_H \
-DHAVE_ALLOCA \
-DHAVE_CLOCK_GETTIME \
-DHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC \
-DHAVE_PRCTL \
-DHAVE_LINUX_UDP_H \
-DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \
-DHAVE_IPSEC_MODE_BEET \
-DHAVE_IPSEC_DIR_FWD \
-DMONOLITHIC \
-DUSE_VSTR \
-DROUTING_TABLE=0 \
-DROUTING_TABLE_PRIO=220 \
-DVERSION=\"4.4.0\" \
-DPLUGINS='"$(strongswan_PLUGINS)"' \
-DIPSEC_DIR=\"/system/bin\" \
-DIPSEC_PIDDIR=\"/data/misc/vpn\" \
-DSTRONGSWAN_CONF=\"/system/etc/strongswan.conf\" \
-DDEV_RANDOM=\"/dev/random\" \
-DDEV_URANDOM=\"/dev/urandom\"
# only for Android 2.0+
strongswan_CFLAGS += \
-DHAVE_IN6ADDR_ANY
include $(addprefix $(LOCAL_PATH)/src/,$(addsuffix /Android.mk, \
charon \
libstrongswan \
))

View File

@ -6,7 +6,7 @@ endif
ACLOCAL_AMFLAGS = -I m4/config
EXTRA_DIST = Doxyfile.in CREDITS
EXTRA_DIST = Doxyfile.in CREDITS Android.mk
CLEANFILES = apidoc Doxyfile
Doxyfile : Doxyfile.in

234
src/charon/Android.mk Normal file
View File

@ -0,0 +1,234 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# copy-n-paste from Makefile.am
LOCAL_SRC_FILES := \
bus/bus.c bus/bus.h \
bus/listeners/listener.h \
bus/listeners/file_logger.c bus/listeners/file_logger.h \
bus/listeners/sys_logger.c bus/listeners/sys_logger.h \
config/backend_manager.c config/backend_manager.h config/backend.h \
config/child_cfg.c config/child_cfg.h \
config/ike_cfg.c config/ike_cfg.h \
config/peer_cfg.c config/peer_cfg.h \
config/proposal.c config/proposal.h \
config/auth_cfg.c config/auth_cfg.h \
control/controller.c control/controller.h \
daemon.c daemon.h \
encoding/generator.c encoding/generator.h \
encoding/message.c encoding/message.h \
encoding/parser.c encoding/parser.h \
encoding/payloads/auth_payload.c encoding/payloads/auth_payload.h \
encoding/payloads/cert_payload.c encoding/payloads/cert_payload.h \
encoding/payloads/certreq_payload.c encoding/payloads/certreq_payload.h \
encoding/payloads/configuration_attribute.c encoding/payloads/configuration_attribute.h \
encoding/payloads/cp_payload.c encoding/payloads/cp_payload.h \
encoding/payloads/delete_payload.c encoding/payloads/delete_payload.h \
encoding/payloads/eap_payload.c encoding/payloads/eap_payload.h \
encoding/payloads/encodings.c encoding/payloads/encodings.h \
encoding/payloads/encryption_payload.c encoding/payloads/encryption_payload.h \
encoding/payloads/id_payload.c encoding/payloads/id_payload.h \
encoding/payloads/ike_header.c encoding/payloads/ike_header.h \
encoding/payloads/ke_payload.c encoding/payloads/ke_payload.h \
encoding/payloads/nonce_payload.c encoding/payloads/nonce_payload.h \
encoding/payloads/notify_payload.c encoding/payloads/notify_payload.h \
encoding/payloads/payload.c encoding/payloads/payload.h \
encoding/payloads/proposal_substructure.c encoding/payloads/proposal_substructure.h \
encoding/payloads/sa_payload.c encoding/payloads/sa_payload.h \
encoding/payloads/traffic_selector_substructure.c encoding/payloads/traffic_selector_substructure.h \
encoding/payloads/transform_attribute.c encoding/payloads/transform_attribute.h \
encoding/payloads/transform_substructure.c encoding/payloads/transform_substructure.h \
encoding/payloads/ts_payload.c encoding/payloads/ts_payload.h \
encoding/payloads/unknown_payload.c encoding/payloads/unknown_payload.h \
encoding/payloads/vendor_id_payload.c encoding/payloads/vendor_id_payload.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.h \
network/packet.c network/packet.h \
network/receiver.c network/receiver.h \
network/sender.c network/sender.h \
network/socket_manager.c network/socket_manager.h network/socket.h \
processing/jobs/job.h \
processing/jobs/acquire_job.c processing/jobs/acquire_job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/jobs/delete_child_sa_job.c processing/jobs/delete_child_sa_job.h \
processing/jobs/delete_ike_sa_job.c processing/jobs/delete_ike_sa_job.h \
processing/jobs/migrate_job.c processing/jobs/migrate_job.h \
processing/jobs/process_message_job.c processing/jobs/process_message_job.h \
processing/jobs/rekey_child_sa_job.c processing/jobs/rekey_child_sa_job.h \
processing/jobs/rekey_ike_sa_job.c processing/jobs/rekey_ike_sa_job.h \
processing/jobs/retransmit_job.c processing/jobs/retransmit_job.h \
processing/jobs/send_dpd_job.c processing/jobs/send_dpd_job.h \
processing/jobs/send_keepalive_job.c processing/jobs/send_keepalive_job.h \
processing/jobs/roam_job.c processing/jobs/roam_job.h \
processing/jobs/update_sa_job.c processing/jobs/update_sa_job.h \
processing/jobs/inactivity_job.c processing/jobs/inactivity_job.h \
processing/scheduler.c processing/scheduler.h \
processing/processor.c processing/processor.h \
sa/authenticators/authenticator.c sa/authenticators/authenticator.h \
sa/authenticators/eap_authenticator.c sa/authenticators/eap_authenticator.h \
sa/authenticators/eap/eap_method.c sa/authenticators/eap/eap_method.h \
sa/authenticators/eap/eap_manager.c sa/authenticators/eap/eap_manager.h \
sa/authenticators/eap/sim_manager.c sa/authenticators/eap/sim_manager.h \
sa/authenticators/psk_authenticator.c sa/authenticators/psk_authenticator.h \
sa/authenticators/pubkey_authenticator.c sa/authenticators/pubkey_authenticator.h \
sa/child_sa.c sa/child_sa.h \
sa/ike_sa.c sa/ike_sa.h \
sa/ike_sa_id.c sa/ike_sa_id.h \
sa/ike_sa_manager.c sa/ike_sa_manager.h \
sa/task_manager.c sa/task_manager.h \
sa/keymat.c sa/keymat.h \
sa/trap_manager.c sa/trap_manager.h \
sa/tasks/child_create.c sa/tasks/child_create.h \
sa/tasks/child_delete.c sa/tasks/child_delete.h \
sa/tasks/child_rekey.c sa/tasks/child_rekey.h \
sa/tasks/ike_auth.c sa/tasks/ike_auth.h \
sa/tasks/ike_cert_pre.c sa/tasks/ike_cert_pre.h \
sa/tasks/ike_cert_post.c sa/tasks/ike_cert_post.h \
sa/tasks/ike_config.c sa/tasks/ike_config.h \
sa/tasks/ike_delete.c sa/tasks/ike_delete.h \
sa/tasks/ike_dpd.c sa/tasks/ike_dpd.h \
sa/tasks/ike_init.c sa/tasks/ike_init.h \
sa/tasks/ike_natd.c sa/tasks/ike_natd.h \
sa/tasks/ike_mobike.c sa/tasks/ike_mobike.h \
sa/tasks/ike_rekey.c sa/tasks/ike_rekey.h \
sa/tasks/ike_reauth.c sa/tasks/ike_reauth.h \
sa/tasks/ike_auth_lifetime.c sa/tasks/ike_auth_lifetime.h \
sa/tasks/ike_vendor.c sa/tasks/ike_vendor.h \
sa/tasks/task.c sa/tasks/task.h \
credentials/credential_manager.c credentials/credential_manager.h \
credentials/sets/auth_cfg_wrapper.c credentials/sets/auth_cfg_wrapper.h \
credentials/sets/ocsp_response_wrapper.c credentials/sets/ocsp_response_wrapper.h \
credentials/sets/cert_cache.c credentials/sets/cert_cache.h \
credentials/credential_set.h
# adding the plugin source files (copy-n-paste from Makefile.am)
LOCAL_SRC_FILES += $(call add_plugin, android, \
android_plugin.c android_plugin.h \
android_handler.c android_handler.h \
)
ifneq ($(call plugin_enabled, android)),)
LOCAL_SHARED_LIBRARIES += libcutils
endif
LOCAL_SRC_FILES += $(call add_plugin, attr, \
attr_plugin.h attr_plugin.c \
attr_provider.h attr_provider.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-aka, \
eap_aka_plugin.h eap_aka_plugin.c \
eap_aka_peer.h eap_aka_peer.c \
eap_aka_server.h eap_aka_server.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-aka-3gpp2, \
eap_aka_3gpp2_plugin.h eap_aka_3gpp2_plugin.c \
eap_aka_3gpp2_card.h eap_aka_3gpp2_card.c \
eap_aka_3gpp2_provider.h eap_aka_3gpp2_provider.c \
eap_aka_3gpp2_functions.h eap_aka_3gpp2_functions.c \
)
ifneq ($(call plugin_enabled, eap-aka-3gpp2)),)
LOCAL_C_INCLUDES += $(libgmp_PATH)
LOCAL_STATIC_LIBRARIES += libgmp
endif
LOCAL_SRC_FILES += $(call add_plugin, eap-gtc, \
eap_gtc_plugin.h eap_gtc_plugin.c eap_gtc.h eap_gtc.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-identity, \
eap_identity_plugin.h eap_identity_plugin.c eap_identity.h eap_identity.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-md5, \
eap_md5_plugin.h eap_md5_plugin.c eap_md5.h eap_md5.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-mschapv2, \
eap_mschapv2_plugin.h eap_mschapv2_plugin.c \
eap_mschapv2.h eap_mschapv2.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-sim, \
eap_sim_plugin.h eap_sim_plugin.c \
eap_sim_peer.h eap_sim_peer.c \
eap_sim_server.h eap_sim_server.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-simaka-pseudonym, \
eap_simaka_pseudonym_plugin.h eap_simaka_pseudonym_plugin.c \
eap_simaka_pseudonym_card.h eap_simaka_pseudonym_card.c \
eap_simaka_pseudonym_provider.h eap_simaka_pseudonym_provider.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-simaka-reauth, \
eap_simaka_reauth_plugin.h eap_simaka_reauth_plugin.c \
eap_simaka_reauth_card.h eap_simaka_reauth_card.c \
eap_simaka_reauth_provider.h eap_simaka_reauth_provider.c \
)
LOCAL_SRC_FILES += $(call add_plugin, eap-sim-file, \
eap_sim_file_plugin.h eap_sim_file_plugin.c \
eap_sim_file_card.h eap_sim_file_card.c \
eap_sim_file_provider.h eap_sim_file_provider.c \
eap_sim_file_triplets.h eap_sim_file_triplets.c \
)
# adding libakasim if either eap-aka or eap-sim is enabled
ifneq ($(or $(call plugin_enabled, eap-aka), $(call plugin_enabled, eap-sim)),)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../libsimaka/
LOCAL_SRC_FILES += $(addprefix ../libsimaka/, \
simaka_message.h simaka_message.c \
simaka_crypto.h simaka_crypto.c \
)
endif
LOCAL_SRC_FILES += $(call add_plugin, kernel-netlink, \
kernel_netlink_plugin.h kernel_netlink_plugin.c \
kernel_netlink_ipsec.h kernel_netlink_ipsec.c kernel_netlink_net.h kernel_netlink_net.c \
kernel_netlink_shared.h kernel_netlink_shared.c \
)
LOCAL_SRC_FILES += $(call add_plugin, load-tester, \
load_tester_plugin.c load_tester_plugin.h \
load_tester_config.c load_tester_config.h \
load_tester_creds.c load_tester_creds.h \
load_tester_ipsec.c load_tester_ipsec.h \
load_tester_listener.c load_tester_listener.h \
load_tester_diffie_hellman.c load_tester_diffie_hellman.h \
)
LOCAL_SRC_FILES += $(call add_plugin, socket-default, \
socket_default_socket.h socket_default_socket.c \
socket_default_plugin.h socket_default_plugin.c \
)
LOCAL_SRC_FILES += $(call add_plugin, socket-dynamic, \
socket_dynamic_plugin.h socket_dynamic_plugin.c \
socket_dynamic_socket.h socket_dynamic_socket.c \
)
# build charon -----------------------------------------------------------------
LOCAL_C_INCLUDES += \
$(libvstr_PATH) \
external/strongswan/src/include \
external/strongswan/src/libstrongswan
LOCAL_CFLAGS := $(strongswan_CFLAGS)
# this is required to be able load the plugins
LOCAL_LDFLAGS := -Wl,--export-dynamic
LOCAL_MODULE := charon
LOCAL_ARM_MODE := arm
LOCAL_PRELINK_MODULE := false
LOCAL_SHARED_LIBRARIES += libstrongswan
include $(BUILD_EXECUTABLE)

View File

@ -106,6 +106,8 @@ AM_CFLAGS = -rdynamic \
-DIPSEC_PIDDIR=\"${piddir}\"
charon_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lm $(PTHREADLIB) $(DLLIB) $(SOCKLIB)
EXTRA_DIST = Android.mk
# compile options
#################

View File

@ -0,0 +1,167 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# copy-n-paste from Makefile.am
LOCAL_SRC_FILES := \
library.c library.h \
chunk.c chunk.h \
debug.c debug.h \
enum.c enum.h \
settings.h settings.c \
printf_hook.c printf_hook.h \
asn1/asn1.c asn1/asn1.h \
asn1/asn1_parser.c asn1/asn1_parser.h \
asn1/oid.c asn1/oid.h \
attributes/attributes.c attributes/attributes.h \
attributes/attribute_provider.h attributes/attribute_handler.h \
attributes/attribute_manager.c attributes/attribute_manager.h \
crypto/crypters/crypter.c crypto/crypters/crypter.h \
crypto/hashers/hasher.h crypto/hashers/hasher.c \
crypto/pkcs9.c crypto/pkcs9.h \
crypto/proposal/proposal_keywords.c crypto/proposal/proposal_keywords.h \
crypto/prfs/prf.c crypto/prfs/prf.h \
crypto/rngs/rng.c crypto/rngs/rng.h \
crypto/prf_plus.h crypto/prf_plus.c \
crypto/signers/signer.c crypto/signers/signer.h \
crypto/crypto_factory.c crypto/crypto_factory.h \
crypto/crypto_tester.c crypto/crypto_tester.h \
crypto/diffie_hellman.c crypto/diffie_hellman.h \
crypto/transform.c crypto/transform.h \
credentials/credential_factory.c credentials/credential_factory.h \
credentials/builder.c credentials/builder.h \
credentials/keys/key_encoding.c credentials/keys/key_encoding.h \
credentials/keys/private_key.c credentials/keys/private_key.h \
credentials/keys/public_key.c credentials/keys/public_key.h \
credentials/keys/shared_key.c credentials/keys/shared_key.h \
credentials/certificates/certificate.c credentials/certificates/certificate.h \
credentials/certificates/x509.h credentials/certificates/x509.c \
credentials/certificates/ac.h \
credentials/certificates/crl.h credentials/certificates/crl.c \
credentials/certificates/pkcs10.h \
credentials/certificates/ocsp_request.h \
credentials/certificates/ocsp_response.h credentials/certificates/ocsp_response.c \
credentials/certificates/pgp_certificate.h \
credentials/ietf_attributes/ietf_attributes.c credentials/ietf_attributes/ietf_attributes.h \
database/database.h database/database_factory.h database/database_factory.c \
fetcher/fetcher.h fetcher/fetcher_manager.h fetcher/fetcher_manager.c \
selectors/traffic_selector.c selectors/traffic_selector.h \
threading/thread.h threading/thread.c \
threading/thread_value.h threading/thread_value.c \
threading/mutex.h threading/mutex.c threading/condvar.h \
threading/rwlock.h threading/rwlock.c \
threading/lock_profiler.h \
utils.h utils.c \
utils/host.c utils/host.h \
utils/identification.c utils/identification.h \
utils/iterator.h \
utils/lexparser.c utils/lexparser.h \
utils/linked_list.c utils/linked_list.h \
utils/hashtable.c utils/hashtable.h \
utils/enumerator.c utils/enumerator.h \
utils/optionsfrom.c utils/optionsfrom.h \
utils/backtrace.c utils/backtrace.h \
plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h
# adding the plugin source files (copy-n-paste from their Makefile.am)
LOCAL_SRC_FILES += $(call add_plugin, aes, \
aes_plugin.h aes_plugin.c aes_crypter.c aes_crypter.h \
)
LOCAL_SRC_FILES += $(call add_plugin, des, \
des_plugin.h des_plugin.c des_crypter.c des_crypter.h \
)
LOCAL_SRC_FILES += $(call add_plugin, fips-prf, \
fips_prf_plugin.h fips_prf_plugin.c fips_prf.c fips_prf.h \
)
LOCAL_SRC_FILES += $(call add_plugin, gmp, \
gmp_plugin.h gmp_plugin.c \
gmp_diffie_hellman.c gmp_diffie_hellman.h \
gmp_rsa_private_key.c gmp_rsa_private_key.h \
gmp_rsa_public_key.c gmp_rsa_public_key.h \
)
ifneq ($(call plugin_enabled, gmp)),)
LOCAL_C_INCLUDES += $(libgmp_PATH)
LOCAL_STATIC_LIBRARIES += libgmp
endif
LOCAL_SRC_FILES += $(call add_plugin, hmac, \
hmac_plugin.h hmac_plugin.c hmac.h hmac.c \
hmac_prf.h hmac_prf.c hmac_signer.h hmac_signer.c \
)
LOCAL_SRC_FILES += $(call add_plugin, md4, \
md4_plugin.h md4_plugin.c md4_hasher.c md4_hasher.h \
)
LOCAL_SRC_FILES += $(call add_plugin, md5, \
md5_plugin.h md5_plugin.c md5_hasher.c md5_hasher.h \
)
LOCAL_SRC_FILES += $(call add_plugin, pem, \
pem_plugin.h pem_plugin.c \
pem_builder.c pem_builder.h \
)
LOCAL_SRC_FILES += $(call add_plugin, pkcs1, \
pkcs1_plugin.h pkcs1_plugin.c \
pkcs1_encoder.h pkcs1_encoder.c \
pkcs1_builder.h pkcs1_builder.c \
)
LOCAL_SRC_FILES += $(call add_plugin, pubkey, \
pubkey_plugin.h pubkey_plugin.c \
pubkey_cert.h pubkey_cert.c \
)
LOCAL_SRC_FILES += $(call add_plugin, random, \
random_plugin.h random_plugin.c \
random_rng.c random_rng.h \
)
LOCAL_SRC_FILES += $(call add_plugin, sha1, \
sha1_plugin.h sha1_plugin.c \
sha1_hasher.c sha1_hasher.h sha1_prf.c sha1_prf.h \
)
LOCAL_SRC_FILES += $(call add_plugin, sha2, \
sha2_plugin.h sha2_plugin.c sha2_hasher.c sha2_hasher.h \
)
LOCAL_SRC_FILES += $(call add_plugin, x509, \
x509_plugin.h x509_plugin.c \
x509_cert.h x509_cert.c \
x509_crl.h x509_crl.c \
x509_ac.h x509_ac.c \
x509_pkcs10.h x509_pkcs10.c \
x509_ocsp_request.h x509_ocsp_request.c \
x509_ocsp_response.h x509_ocsp_response.c \
)
LOCAL_SRC_FILES += $(call add_plugin, xcbc, \
xcbc_plugin.h xcbc_plugin.c xcbc.h xcbc.c \
xcbc_prf.h xcbc_prf.c xcbc_signer.h xcbc_signer.c \
)
# build libstrongswan ----------------------------------------------------------
LOCAL_C_INCLUDES += \
$(libvstr_PATH)
LOCAL_CFLAGS := $(strongswan_CFLAGS) \
-include $(LOCAL_PATH)/AndroidConfigLocal.h
LOCAL_MODULE := libstrongswan
LOCAL_ARM_MODE := arm
LOCAL_PRELINK_MODULE := false
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_STATIC_LIBRARIES += libvstr
include $(BUILD_SHARED_LIBRARY)

View File

@ -0,0 +1,9 @@
/* stuff defined in AndroidConfig.h, which is included using the -include
* command-line option, thus cannot be undefined using -U CFLAGS options.
* the reason we have to undefine these flags in the first place, is that
* AndroidConfig.h defines them as 0, which in turn means that they are
* actually defined. */
#undef HAVE_BACKTRACE
#undef HAVE_DLADDR

View File

@ -90,7 +90,8 @@ endif
EXTRA_DIST = \
asn1/oid.txt asn1/oid.pl \
crypto/proposal/proposal_keywords.txt
crypto/proposal/proposal_keywords.txt \
Android.mk AndroidConfigLocal.h
BUILT_SOURCES = \
$(srcdir)/asn1/oid.c $(srcdir)/asn1/oid.h \