Move OpenSSL makefiles to one directory to avoid future patching issues

Change-Id: I39f6cfc61f484f4457bda3003e5992dfc7e20186
diff --git a/Android.mk b/Android.mk
index 741123b..0cd36d7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,9 +1,8 @@
 LOCAL_PATH := $(call my-dir)
 
-subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
-		crypto \
-		ssl \
-		apps \
-	))
-
-include $(subdirs)
+# These makefiles are here instead of being Android.mk files in the
+# respective crypto, ssl, and apps directories so
+# that import_openssl.sh import won't remove them.
+include $(LOCAL_PATH)/Crypto.mk
+include $(LOCAL_PATH)/Ssl.mk
+include $(LOCAL_PATH)/Apps.mk
diff --git a/Apps.mk b/Apps.mk
new file mode 100644
index 0000000..e78395e
--- /dev/null
+++ b/Apps.mk
@@ -0,0 +1,84 @@
+# Copyright 2006 The Android Open Source Project
+
+LOCAL_PATH:= $(call my-dir)
+
+local_src_files:= \
+	apps/app_rand.c \
+	apps/apps.c \
+	apps/asn1pars.c \
+	apps/ca.c \
+	apps/ciphers.c \
+	apps/crl.c \
+	apps/crl2p7.c \
+	apps/dgst.c \
+	apps/dh.c \
+	apps/dhparam.c \
+	apps/dsa.c \
+	apps/dsaparam.c \
+	apps/ecparam.c \
+	apps/ec.c \
+	apps/enc.c \
+	apps/engine.c \
+	apps/errstr.c \
+	apps/gendh.c \
+	apps/gendsa.c \
+	apps/genpkey.c \
+	apps/genrsa.c \
+	apps/nseq.c \
+	apps/ocsp.c \
+	apps/openssl.c \
+	apps/passwd.c \
+	apps/pkcs12.c \
+	apps/pkcs7.c \
+	apps/pkcs8.c \
+	apps/pkey.c \
+	apps/pkeyparam.c \
+	apps/pkeyutl.c \
+	apps/prime.c \
+	apps/rand.c \
+	apps/req.c \
+	apps/rsa.c \
+	apps/rsautl.c \
+	apps/s_cb.c \
+	apps/s_client.c \
+	apps/s_server.c \
+	apps/s_socket.c \
+	apps/s_time.c \
+	apps/sess_id.c \
+	apps/smime.c \
+	apps/speed.c \
+	apps/spkac.c \
+	apps/srp.c \
+	apps/verify.c \
+	apps/version.c \
+	apps/x509.c
+
+local_shared_libraries := \
+	libssl \
+	libcrypto
+
+local_c_includes := \
+	external/openssl \
+	external/openssl/include
+
+local_cflags := -DMONOLITH
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= openssl
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(local_src_files)
+LOCAL_SHARED_LIBRARIES := $(local_shared_libraries)
+LOCAL_C_INCLUDES := $(local_c_includes)
+LOCAL_CFLAGS := $(local_cflags)
+include $(LOCAL_PATH)/android-config.mk
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= openssl
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(local_src_files)
+LOCAL_SHARED_LIBRARIES := $(local_shared_libraries)
+LOCAL_C_INCLUDES := $(local_c_includes)
+LOCAL_CFLAGS := $(local_cflags)
+include $(LOCAL_PATH)/android-config.mk
+include $(BUILD_HOST_EXECUTABLE)
diff --git a/Crypto.mk b/Crypto.mk
new file mode 100644
index 0000000..622c8fb
--- /dev/null
+++ b/Crypto.mk
@@ -0,0 +1,637 @@
+arm_cflags := -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DGHASH_ASM -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
+mips_cflags := -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM
+
+arm_src_files := \
+	crypto/aes/asm/aes-armv4.s \
+	crypto/bn/asm/armv4-gf2m.s \
+	crypto/bn/asm/armv4-mont.s \
+	crypto/bn/bn_asm.c \
+	crypto/modes/asm/ghash-armv4.s \
+	crypto/sha/asm/sha1-armv4-large.s \
+	crypto/sha/asm/sha256-armv4.s \
+	crypto/sha/asm/sha512-armv4.s
+
+mips_src_files := \
+	crypto/aes/asm/aes-mips.s \
+	crypto/bn/asm/bn-mips.s \
+	crypto/bn/asm/mips-mont.s \
+	crypto/sha/asm/sha1-mips.s \
+	crypto/sha/asm/sha256-mips.s
+
+other_arch_src_files := \
+	crypto/aes/aes_core.c \
+	crypto/bn/bn_asm.c
+
+local_src_files := \
+	crypto/cryptlib.c \
+	crypto/mem.c \
+	crypto/mem_clr.c \
+	crypto/mem_dbg.c \
+	crypto/cversion.c \
+	crypto/ex_data.c \
+	crypto/cpt_err.c \
+	crypto/ebcdic.c \
+	crypto/uid.c \
+	crypto/o_time.c \
+	crypto/o_str.c \
+	crypto/o_dir.c \
+	crypto/aes/aes_cbc.c \
+	crypto/aes/aes_cfb.c \
+	crypto/aes/aes_ctr.c \
+	crypto/aes/aes_ecb.c \
+	crypto/aes/aes_misc.c \
+	crypto/aes/aes_ofb.c \
+	crypto/aes/aes_wrap.c \
+	crypto/asn1/a_bitstr.c \
+	crypto/asn1/a_bool.c \
+	crypto/asn1/a_bytes.c \
+	crypto/asn1/a_d2i_fp.c \
+	crypto/asn1/a_digest.c \
+	crypto/asn1/a_dup.c \
+	crypto/asn1/a_enum.c \
+	crypto/asn1/a_gentm.c \
+	crypto/asn1/a_i2d_fp.c \
+	crypto/asn1/a_int.c \
+	crypto/asn1/a_mbstr.c \
+	crypto/asn1/a_object.c \
+	crypto/asn1/a_octet.c \
+	crypto/asn1/a_print.c \
+	crypto/asn1/a_set.c \
+	crypto/asn1/a_sign.c \
+	crypto/asn1/a_strex.c \
+	crypto/asn1/a_strnid.c \
+	crypto/asn1/a_time.c \
+	crypto/asn1/a_type.c \
+	crypto/asn1/a_utctm.c \
+	crypto/asn1/a_utf8.c \
+	crypto/asn1/a_verify.c \
+	crypto/asn1/ameth_lib.c \
+	crypto/asn1/asn1_err.c \
+	crypto/asn1/asn1_gen.c \
+	crypto/asn1/asn1_lib.c \
+	crypto/asn1/asn1_par.c \
+	crypto/asn1/asn_mime.c \
+	crypto/asn1/asn_moid.c \
+	crypto/asn1/asn_pack.c \
+	crypto/asn1/bio_asn1.c \
+	crypto/asn1/bio_ndef.c \
+	crypto/asn1/d2i_pr.c \
+	crypto/asn1/d2i_pu.c \
+	crypto/asn1/evp_asn1.c \
+	crypto/asn1/f_enum.c \
+	crypto/asn1/f_int.c \
+	crypto/asn1/f_string.c \
+	crypto/asn1/i2d_pr.c \
+	crypto/asn1/i2d_pu.c \
+	crypto/asn1/n_pkey.c \
+	crypto/asn1/nsseq.c \
+	crypto/asn1/p5_pbe.c \
+	crypto/asn1/p5_pbev2.c \
+	crypto/asn1/p8_pkey.c \
+	crypto/asn1/t_bitst.c \
+	crypto/asn1/t_crl.c \
+	crypto/asn1/t_pkey.c \
+	crypto/asn1/t_req.c \
+	crypto/asn1/t_spki.c \
+	crypto/asn1/t_x509.c \
+	crypto/asn1/t_x509a.c \
+	crypto/asn1/tasn_dec.c \
+	crypto/asn1/tasn_enc.c \
+	crypto/asn1/tasn_fre.c \
+	crypto/asn1/tasn_new.c \
+	crypto/asn1/tasn_prn.c \
+	crypto/asn1/tasn_typ.c \
+	crypto/asn1/tasn_utl.c \
+	crypto/asn1/x_algor.c \
+	crypto/asn1/x_attrib.c \
+	crypto/asn1/x_bignum.c \
+	crypto/asn1/x_crl.c \
+	crypto/asn1/x_exten.c \
+	crypto/asn1/x_info.c \
+	crypto/asn1/x_long.c \
+	crypto/asn1/x_name.c \
+	crypto/asn1/x_nx509.c \
+	crypto/asn1/x_pkey.c \
+	crypto/asn1/x_pubkey.c \
+	crypto/asn1/x_req.c \
+	crypto/asn1/x_sig.c \
+	crypto/asn1/x_spki.c \
+	crypto/asn1/x_val.c \
+	crypto/asn1/x_x509.c \
+	crypto/asn1/x_x509a.c \
+	crypto/bf/bf_cfb64.c \
+	crypto/bf/bf_ecb.c \
+	crypto/bf/bf_enc.c \
+	crypto/bf/bf_ofb64.c \
+	crypto/bf/bf_skey.c \
+	crypto/bio/b_dump.c \
+	crypto/bio/b_print.c \
+	crypto/bio/b_sock.c \
+	crypto/bio/bf_buff.c \
+	crypto/bio/bf_nbio.c \
+	crypto/bio/bf_null.c \
+	crypto/bio/bio_cb.c \
+	crypto/bio/bio_err.c \
+	crypto/bio/bio_lib.c \
+	crypto/bio/bss_acpt.c \
+	crypto/bio/bss_bio.c \
+	crypto/bio/bss_conn.c \
+	crypto/bio/bss_dgram.c \
+	crypto/bio/bss_fd.c \
+	crypto/bio/bss_file.c \
+	crypto/bio/bss_log.c \
+	crypto/bio/bss_mem.c \
+	crypto/bio/bss_null.c \
+	crypto/bio/bss_sock.c \
+	crypto/bn/bn_add.c \
+	crypto/bn/bn_blind.c \
+	crypto/bn/bn_const.c \
+	crypto/bn/bn_ctx.c \
+	crypto/bn/bn_div.c \
+	crypto/bn/bn_err.c \
+	crypto/bn/bn_exp.c \
+	crypto/bn/bn_exp2.c \
+	crypto/bn/bn_gcd.c \
+	crypto/bn/bn_gf2m.c \
+	crypto/bn/bn_kron.c \
+	crypto/bn/bn_lib.c \
+	crypto/bn/bn_mod.c \
+	crypto/bn/bn_mont.c \
+	crypto/bn/bn_mpi.c \
+	crypto/bn/bn_mul.c \
+	crypto/bn/bn_nist.c \
+	crypto/bn/bn_prime.c \
+	crypto/bn/bn_print.c \
+	crypto/bn/bn_rand.c \
+	crypto/bn/bn_recp.c \
+	crypto/bn/bn_shift.c \
+	crypto/bn/bn_sqr.c \
+	crypto/bn/bn_sqrt.c \
+	crypto/bn/bn_word.c \
+	crypto/buffer/buf_err.c \
+	crypto/buffer/buf_str.c \
+	crypto/buffer/buffer.c \
+	crypto/cmac/cm_ameth.c \
+	crypto/cmac/cm_pmeth.c \
+	crypto/cmac/cmac.c \
+	crypto/comp/c_rle.c \
+	crypto/comp/c_zlib.c \
+	crypto/comp/comp_err.c \
+	crypto/comp/comp_lib.c \
+	crypto/conf/conf_api.c \
+	crypto/conf/conf_def.c \
+	crypto/conf/conf_err.c \
+	crypto/conf/conf_lib.c \
+	crypto/conf/conf_mall.c \
+	crypto/conf/conf_mod.c \
+	crypto/conf/conf_sap.c \
+	crypto/des/cbc_cksm.c \
+	crypto/des/cbc_enc.c \
+	crypto/des/cfb64ede.c \
+	crypto/des/cfb64enc.c \
+	crypto/des/cfb_enc.c \
+	crypto/des/des_enc.c \
+	crypto/des/des_old.c \
+	crypto/des/des_old2.c \
+	crypto/des/ecb3_enc.c \
+	crypto/des/ecb_enc.c \
+	crypto/des/ede_cbcm_enc.c \
+	crypto/des/enc_read.c \
+	crypto/des/enc_writ.c \
+	crypto/des/fcrypt.c \
+	crypto/des/fcrypt_b.c \
+	crypto/des/ofb64ede.c \
+	crypto/des/ofb64enc.c \
+	crypto/des/ofb_enc.c \
+	crypto/des/pcbc_enc.c \
+	crypto/des/qud_cksm.c \
+	crypto/des/rand_key.c \
+	crypto/des/read2pwd.c \
+	crypto/des/rpc_enc.c \
+	crypto/des/set_key.c \
+	crypto/des/str2key.c \
+	crypto/des/xcbc_enc.c \
+	crypto/dh/dh_ameth.c \
+	crypto/dh/dh_asn1.c \
+	crypto/dh/dh_check.c \
+	crypto/dh/dh_depr.c \
+	crypto/dh/dh_err.c \
+	crypto/dh/dh_gen.c \
+	crypto/dh/dh_key.c \
+	crypto/dh/dh_lib.c \
+	crypto/dh/dh_pmeth.c \
+	crypto/dsa/dsa_ameth.c \
+	crypto/dsa/dsa_asn1.c \
+	crypto/dsa/dsa_depr.c \
+	crypto/dsa/dsa_err.c \
+	crypto/dsa/dsa_gen.c \
+	crypto/dsa/dsa_key.c \
+	crypto/dsa/dsa_lib.c \
+	crypto/dsa/dsa_ossl.c \
+	crypto/dsa/dsa_pmeth.c \
+	crypto/dsa/dsa_prn.c \
+	crypto/dsa/dsa_sign.c \
+	crypto/dsa/dsa_vrf.c \
+	crypto/dso/dso_dl.c \
+	crypto/dso/dso_dlfcn.c \
+	crypto/dso/dso_err.c \
+	crypto/dso/dso_lib.c \
+	crypto/dso/dso_null.c \
+	crypto/dso/dso_openssl.c \
+	crypto/ec/ec2_mult.c \
+	crypto/ec/ec2_oct.c \
+	crypto/ec/ec2_smpl.c \
+	crypto/ec/ec_ameth.c \
+	crypto/ec/ec_asn1.c \
+	crypto/ec/ec_check.c \
+	crypto/ec/ec_curve.c \
+	crypto/ec/ec_cvt.c \
+	crypto/ec/ec_err.c \
+	crypto/ec/ec_key.c \
+	crypto/ec/ec_lib.c \
+	crypto/ec/ec_mult.c \
+	crypto/ec/ec_oct.c \
+	crypto/ec/ec_pmeth.c \
+	crypto/ec/ec_print.c \
+	crypto/ec/eck_prn.c \
+	crypto/ec/ecp_mont.c \
+	crypto/ec/ecp_nist.c \
+	crypto/ec/ecp_oct.c \
+	crypto/ec/ecp_smpl.c \
+	crypto/ecdh/ech_err.c \
+	crypto/ecdh/ech_key.c \
+	crypto/ecdh/ech_lib.c \
+	crypto/ecdh/ech_ossl.c \
+	crypto/ecdsa/ecs_asn1.c \
+	crypto/ecdsa/ecs_err.c \
+	crypto/ecdsa/ecs_lib.c \
+	crypto/ecdsa/ecs_ossl.c \
+	crypto/ecdsa/ecs_sign.c \
+	crypto/ecdsa/ecs_vrf.c \
+	crypto/engine/eng_all.c \
+	crypto/engine/eng_cnf.c \
+	crypto/engine/eng_ctrl.c \
+	crypto/engine/eng_dyn.c \
+	crypto/engine/eng_err.c \
+	crypto/engine/eng_fat.c \
+	crypto/engine/eng_init.c \
+	crypto/engine/eng_lib.c \
+	crypto/engine/eng_list.c \
+	crypto/engine/eng_pkey.c \
+	crypto/engine/eng_table.c \
+	crypto/engine/tb_asnmth.c \
+	crypto/engine/tb_cipher.c \
+	crypto/engine/tb_dh.c \
+	crypto/engine/tb_digest.c \
+	crypto/engine/tb_dsa.c \
+	crypto/engine/tb_ecdh.c \
+	crypto/engine/tb_ecdsa.c \
+	crypto/engine/tb_pkmeth.c \
+	crypto/engine/tb_rand.c \
+	crypto/engine/tb_rsa.c \
+	crypto/engine/tb_store.c \
+	crypto/err/err.c \
+	crypto/err/err_all.c \
+	crypto/err/err_prn.c \
+	crypto/evp/bio_b64.c \
+	crypto/evp/bio_enc.c \
+	crypto/evp/bio_md.c \
+	crypto/evp/bio_ok.c \
+	crypto/evp/c_all.c \
+	crypto/evp/c_allc.c \
+	crypto/evp/c_alld.c \
+	crypto/evp/digest.c \
+	crypto/evp/e_aes.c \
+	crypto/evp/e_aes_cbc_hmac_sha1.c \
+	crypto/evp/e_bf.c \
+	crypto/evp/e_des.c \
+	crypto/evp/e_des3.c \
+	crypto/evp/e_null.c \
+	crypto/evp/e_old.c \
+	crypto/evp/e_rc2.c \
+	crypto/evp/e_rc4.c \
+	crypto/evp/e_rc4_hmac_md5.c \
+	crypto/evp/e_rc5.c \
+	crypto/evp/e_xcbc_d.c \
+	crypto/evp/encode.c \
+	crypto/evp/evp_acnf.c \
+	crypto/evp/evp_enc.c \
+	crypto/evp/evp_err.c \
+	crypto/evp/evp_key.c \
+	crypto/evp/evp_lib.c \
+	crypto/evp/evp_pbe.c \
+	crypto/evp/evp_pkey.c \
+	crypto/evp/m_dss.c \
+	crypto/evp/m_dss1.c \
+	crypto/evp/m_ecdsa.c \
+	crypto/evp/m_md4.c \
+	crypto/evp/m_md5.c \
+	crypto/evp/m_mdc2.c \
+	crypto/evp/m_null.c \
+	crypto/evp/m_ripemd.c \
+	crypto/evp/m_sha1.c \
+	crypto/evp/m_sigver.c \
+	crypto/evp/m_wp.c \
+	crypto/evp/names.c \
+	crypto/evp/p5_crpt.c \
+	crypto/evp/p5_crpt2.c \
+	crypto/evp/p_dec.c \
+	crypto/evp/p_enc.c \
+	crypto/evp/p_lib.c \
+	crypto/evp/p_open.c \
+	crypto/evp/p_seal.c \
+	crypto/evp/p_sign.c \
+	crypto/evp/p_verify.c \
+	crypto/evp/pmeth_fn.c \
+	crypto/evp/pmeth_gn.c \
+	crypto/evp/pmeth_lib.c \
+	crypto/hmac/hm_ameth.c \
+	crypto/hmac/hm_pmeth.c \
+	crypto/hmac/hmac.c \
+	crypto/krb5/krb5_asn.c \
+	crypto/lhash/lh_stats.c \
+	crypto/lhash/lhash.c \
+	crypto/md4/md4_dgst.c \
+	crypto/md4/md4_one.c \
+	crypto/md5/md5_dgst.c \
+	crypto/md5/md5_one.c \
+	crypto/modes/cbc128.c \
+	crypto/modes/ccm128.c \
+	crypto/modes/cfb128.c \
+	crypto/modes/ctr128.c \
+	crypto/modes/gcm128.c \
+	crypto/modes/ofb128.c \
+	crypto/modes/xts128.c \
+	crypto/o_init.c \
+	crypto/objects/o_names.c \
+	crypto/objects/obj_dat.c \
+	crypto/objects/obj_err.c \
+	crypto/objects/obj_lib.c \
+	crypto/objects/obj_xref.c \
+	crypto/ocsp/ocsp_asn.c \
+	crypto/ocsp/ocsp_cl.c \
+	crypto/ocsp/ocsp_err.c \
+	crypto/ocsp/ocsp_ext.c \
+	crypto/ocsp/ocsp_ht.c \
+	crypto/ocsp/ocsp_lib.c \
+	crypto/ocsp/ocsp_prn.c \
+	crypto/ocsp/ocsp_srv.c \
+	crypto/ocsp/ocsp_vfy.c \
+	crypto/pem/pem_all.c \
+	crypto/pem/pem_err.c \
+	crypto/pem/pem_info.c \
+	crypto/pem/pem_lib.c \
+	crypto/pem/pem_oth.c \
+	crypto/pem/pem_pk8.c \
+	crypto/pem/pem_pkey.c \
+	crypto/pem/pem_seal.c \
+	crypto/pem/pem_sign.c \
+	crypto/pem/pem_x509.c \
+	crypto/pem/pem_xaux.c \
+	crypto/pem/pvkfmt.c \
+	crypto/pkcs12/p12_add.c \
+	crypto/pkcs12/p12_asn.c \
+	crypto/pkcs12/p12_attr.c \
+	crypto/pkcs12/p12_crpt.c \
+	crypto/pkcs12/p12_crt.c \
+	crypto/pkcs12/p12_decr.c \
+	crypto/pkcs12/p12_init.c \
+	crypto/pkcs12/p12_key.c \
+	crypto/pkcs12/p12_kiss.c \
+	crypto/pkcs12/p12_mutl.c \
+	crypto/pkcs12/p12_npas.c \
+	crypto/pkcs12/p12_p8d.c \
+	crypto/pkcs12/p12_p8e.c \
+	crypto/pkcs12/p12_utl.c \
+	crypto/pkcs12/pk12err.c \
+	crypto/pkcs7/pk7_asn1.c \
+	crypto/pkcs7/pk7_attr.c \
+	crypto/pkcs7/pk7_doit.c \
+	crypto/pkcs7/pk7_lib.c	crypto/\
+	crypto/pkcs7/pk7_mime.c \
+	crypto/pkcs7/pk7_smime.c \
+	crypto/pkcs7/pkcs7err.c \
+	crypto/pqueue/pqueue.c \
+	crypto/rand/md_rand.c \
+	crypto/rand/rand_egd.c \
+	crypto/rand/rand_err.c \
+	crypto/rand/rand_lib.c \
+	crypto/rand/rand_unix.c \
+	crypto/rand/randfile.c \
+	crypto/rc2/rc2_cbc.c \
+	crypto/rc2/rc2_ecb.c \
+	crypto/rc2/rc2_skey.c \
+	crypto/rc2/rc2cfb64.c \
+	crypto/rc2/rc2ofb64.c \
+	crypto/rc4/rc4_enc.c \
+	crypto/rc4/rc4_skey.c \
+	crypto/rc4/rc4_utl.c \
+	crypto/ripemd/rmd_dgst.c \
+	crypto/ripemd/rmd_one.c \
+	crypto/rsa/rsa_ameth.c \
+	crypto/rsa/rsa_asn1.c \
+	crypto/rsa/rsa_chk.c \
+	crypto/rsa/rsa_crpt.c \
+	crypto/rsa/rsa_eay.c \
+	crypto/rsa/rsa_err.c \
+	crypto/rsa/rsa_gen.c \
+	crypto/rsa/rsa_lib.c \
+	crypto/rsa/rsa_none.c \
+	crypto/rsa/rsa_null.c \
+	crypto/rsa/rsa_oaep.c \
+	crypto/rsa/rsa_pk1.c \
+	crypto/rsa/rsa_pmeth.c \
+	crypto/rsa/rsa_prn.c \
+	crypto/rsa/rsa_pss.c \
+	crypto/rsa/rsa_saos.c \
+	crypto/rsa/rsa_sign.c \
+	crypto/rsa/rsa_ssl.c \
+	crypto/rsa/rsa_x931.c \
+	crypto/sha/sha1_one.c \
+	crypto/sha/sha1dgst.c \
+	crypto/sha/sha256.c \
+	crypto/sha/sha512.c \
+	crypto/sha/sha_dgst.c \
+	crypto/srp/srp_lib.c \
+	crypto/srp/srp_vfy.c \
+	crypto/stack/stack.c \
+	crypto/ts/ts_err.c \
+	crypto/txt_db/txt_db.c \
+	crypto/ui/ui_compat.c \
+	crypto/ui/ui_err.c \
+	crypto/ui/ui_lib.c \
+	crypto/ui/ui_openssl.c \
+	crypto/ui/ui_util.c \
+	crypto/x509/by_dir.c \
+	crypto/x509/by_file.c \
+	crypto/x509/x509_att.c \
+	crypto/x509/x509_cmp.c \
+	crypto/x509/x509_d2.c \
+	crypto/x509/x509_def.c \
+	crypto/x509/x509_err.c \
+	crypto/x509/x509_ext.c \
+	crypto/x509/x509_lu.c \
+	crypto/x509/x509_obj.c \
+	crypto/x509/x509_r2x.c \
+	crypto/x509/x509_req.c \
+	crypto/x509/x509_set.c \
+	crypto/x509/x509_trs.c \
+	crypto/x509/x509_txt.c \
+	crypto/x509/x509_v3.c \
+	crypto/x509/x509_vfy.c \
+	crypto/x509/x509_vpm.c \
+	crypto/x509/x509cset.c \
+	crypto/x509/x509name.c \
+	crypto/x509/x509rset.c \
+	crypto/x509/x509spki.c \
+	crypto/x509/x509type.c \
+	crypto/x509/x_all.c \
+	crypto/x509v3/pcy_cache.c \
+	crypto/x509v3/pcy_data.c \
+	crypto/x509v3/pcy_lib.c \
+	crypto/x509v3/pcy_map.c \
+	crypto/x509v3/pcy_node.c \
+	crypto/x509v3/pcy_tree.c \
+	crypto/x509v3/v3_akey.c \
+	crypto/x509v3/v3_akeya.c \
+	crypto/x509v3/v3_alt.c \
+	crypto/x509v3/v3_bcons.c \
+	crypto/x509v3/v3_bitst.c \
+	crypto/x509v3/v3_conf.c \
+	crypto/x509v3/v3_cpols.c \
+	crypto/x509v3/v3_crld.c \
+	crypto/x509v3/v3_enum.c \
+	crypto/x509v3/v3_extku.c \
+	crypto/x509v3/v3_genn.c \
+	crypto/x509v3/v3_ia5.c \
+	crypto/x509v3/v3_info.c \
+	crypto/x509v3/v3_int.c \
+	crypto/x509v3/v3_lib.c \
+	crypto/x509v3/v3_ncons.c \
+	crypto/x509v3/v3_ocsp.c \
+	crypto/x509v3/v3_pci.c \
+	crypto/x509v3/v3_pcia.c \
+	crypto/x509v3/v3_pcons.c \
+	crypto/x509v3/v3_pku.c \
+	crypto/x509v3/v3_pmaps.c \
+	crypto/x509v3/v3_prn.c \
+	crypto/x509v3/v3_purp.c \
+	crypto/x509v3/v3_skey.c \
+	crypto/x509v3/v3_sxnet.c \
+	crypto/x509v3/v3_utl.c \
+	crypto/x509v3/v3err.c
+
+local_c_includes := \
+	external/openssl \
+	external/openssl/crypto \
+	external/openssl/crypto/asn1 \
+	external/openssl/crypto/evp \
+	external/openssl/crypto/modes \
+	external/openssl/include \
+	external/openssl/include/openssl \
+	external/zlib
+
+local_c_flags := -DNO_WINDOWS_BRAINDEATH
+
+local_as_flags := -x assembler-with-cpp
+
+#######################################
+# target static library
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+
+ifeq ($(TARGET_ARCH),arm)
+LOCAL_NDK_VERSION := 5
+LOCAL_SDK_VERSION := 9
+endif
+
+LOCAL_SRC_FILES += $(local_src_files)
+LOCAL_CFLAGS += $(local_c_flags)
+LOCAL_ASFLAGS += $(local_as_flags)
+LOCAL_C_INCLUDES += $(local_c_includes)
+ifeq ($(TARGET_ARCH),arm)
+	LOCAL_SRC_FILES += $(arm_src_files)
+	LOCAL_CFLAGS += $(arm_cflags)
+endif
+ifeq ($(TARGET_ARCH),mips)
+    ifneq (($TARGET_HAS_BIGENDIAN),true)
+      LOCAL_SRC_FILES += $(mips_src_files)
+      LOCAL_CFLAGS += $(mips_cflags)
+    else
+      LOCAL_SRC_FILES += $(other_arch_src_files)
+    endif
+endif
+ifeq ($(TARGET_ARCH),x86)
+	LOCAL_SRC_FILES += $(other_arch_src_files)
+endif
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= libcrypto_static
+include $(BUILD_STATIC_LIBRARY)
+
+#######################################
+# target shared library
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+
+ifeq ($(TARGET_ARCH),arm)
+LOCAL_NDK_VERSION := 5
+LOCAL_SDK_VERSION := 9
+# Use the NDK prebuilt libz and libdl.
+LOCAL_LDFLAGS += -lz -ldl
+else
+LOCAL_SHARED_LIBRARIES += libz libdl
+endif
+
+LOCAL_SRC_FILES += $(local_src_files)
+LOCAL_CFLAGS += $(local_c_flags)
+LOCAL_ASFLAGS += $(local_as_flags)
+LOCAL_C_INCLUDES += $(local_c_includes)
+ifeq ($(TARGET_ARCH),arm)
+	LOCAL_SRC_FILES += $(arm_src_files)
+	LOCAL_CFLAGS += $(arm_cflags)
+endif
+ifeq ($(TARGET_ARCH),mips)
+    ifneq (($TARGET_HAS_BIGENDIAN),true)
+      LOCAL_SRC_FILES += $(mips_src_files)
+      LOCAL_CFLAGS += $(mips_cflags)
+    else
+      LOCAL_SRC_FILES += $(other_arch_src_files)
+    endif
+endif
+ifeq ($(TARGET_ARCH),x86)
+	LOCAL_SRC_FILES += $(other_arch_src_files)
+endif
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= libcrypto
+include $(BUILD_SHARED_LIBRARY)
+
+#######################################
+# host shared library
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+LOCAL_SRC_FILES += $(local_src_files)
+LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
+LOCAL_ASFLAGS += $(local_as_flags)
+LOCAL_C_INCLUDES += $(local_c_includes)
+LOCAL_SRC_FILES += $(other_arch_src_files)
+LOCAL_STATIC_LIBRARIES += libz
+LOCAL_LDLIBS += -ldl
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= libcrypto
+include $(BUILD_HOST_SHARED_LIBRARY)
+
+########################################
+# host static library, which is used by some SDK tools.
+
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+LOCAL_SRC_FILES += $(local_src_files)
+LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
+LOCAL_ASFLAGS += $(local_as_flags)
+LOCAL_C_INCLUDES += $(local_c_includes)
+LOCAL_SRC_FILES += $(other_arch_src_files)
+LOCAL_STATIC_LIBRARIES += libz
+LOCAL_LDLIBS += -ldl
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= libcrypto_static
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/Ssl.mk b/Ssl.mk
new file mode 100644
index 0000000..c839a29
--- /dev/null
+++ b/Ssl.mk
@@ -0,0 +1,102 @@
+local_c_includes := \
+	external/openssl \
+	external/openssl/include \
+	external/openssl/crypto
+
+local_src_files:= \
+	ssl/bio_ssl.c \
+	ssl/d1_both.c \
+	ssl/d1_enc.c \
+	ssl/d1_lib.c \
+	ssl/d1_pkt.c \
+	ssl/d1_srtp.c \
+	ssl/kssl.c \
+	ssl/s23_clnt.c \
+	ssl/s23_lib.c \
+	ssl/s23_meth.c \
+	ssl/s23_pkt.c \
+	ssl/s23_srvr.c \
+	ssl/s2_clnt.c \
+	ssl/s2_enc.c \
+	ssl/s2_lib.c \
+	ssl/s2_meth.c \
+	ssl/s2_pkt.c \
+	ssl/s2_srvr.c \
+	ssl/s3_both.c \
+	ssl/s3_clnt.c \
+	ssl/s3_enc.c \
+	ssl/s3_lib.c \
+	ssl/s3_meth.c \
+	ssl/s3_pkt.c \
+	ssl/s3_srvr.c \
+	ssl/ssl_algs.c \
+	ssl/ssl_asn1.c \
+	ssl/ssl_cert.c \
+	ssl/ssl_ciph.c \
+	ssl/ssl_err.c \
+	ssl/ssl_err2.c \
+	ssl/ssl_lib.c \
+	ssl/ssl_rsa.c \
+	ssl/ssl_sess.c \
+	ssl/ssl_stat.c \
+	ssl/ssl_txt.c \
+	ssl/t1_clnt.c \
+	ssl/t1_enc.c \
+	ssl/t1_lib.c \
+	ssl/t1_meth.c \
+	ssl/t1_reneg.c \
+	ssl/t1_srvr.c \
+	ssl/tls_srp.c
+
+#######################################
+# target static library
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+
+ifeq ($(TARGET_ARCH),arm)
+LOCAL_NDK_VERSION := 5
+LOCAL_SDK_VERSION := 9
+endif
+LOCAL_SRC_FILES += $(local_src_files)
+LOCAL_C_INCLUDES += $(local_c_includes)
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= libssl_static
+include $(BUILD_STATIC_LIBRARY)
+
+#######################################
+# target shared library
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+
+ifeq ($(TARGET_ARCH),arm)
+LOCAL_NDK_VERSION := 5
+LOCAL_SDK_VERSION := 9
+endif
+LOCAL_SRC_FILES += $(local_src_files)
+LOCAL_C_INCLUDES += $(local_c_includes)
+LOCAL_SHARED_LIBRARIES += libcrypto
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= libssl
+include $(BUILD_SHARED_LIBRARY)
+
+#######################################
+# host shared library
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+LOCAL_SRC_FILES += $(local_src_files)
+LOCAL_C_INCLUDES += $(local_c_includes)
+LOCAL_SHARED_LIBRARIES += libcrypto
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= libssl
+include $(BUILD_HOST_SHARED_LIBRARY)
+
+#######################################
+# ssltest
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/android-config.mk
+LOCAL_SRC_FILES:= ssl/ssltest.c
+LOCAL_C_INCLUDES += $(local_c_includes)
+LOCAL_SHARED_LIBRARIES := libssl libcrypto
+LOCAL_MODULE:= ssltest
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_EXECUTABLE)
diff --git a/apps/Android.mk b/apps/Android.mk
deleted file mode 100644
index 9110490..0000000
--- a/apps/Android.mk
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright 2006 The Android Open Source Project
-
-LOCAL_PATH:= $(call my-dir)
-
-local_src_files:= \
-	app_rand.c \
-	apps.c \
-	asn1pars.c \
-	ca.c \
-	ciphers.c \
-	crl.c \
-	crl2p7.c \
-	dgst.c \
-	dh.c \
-	dhparam.c \
-	dsa.c \
-	dsaparam.c \
-	ecparam.c \
-	ec.c \
-	enc.c \
-	engine.c \
-	errstr.c \
-	gendh.c \
-	gendsa.c \
-	genpkey.c \
-	genrsa.c \
-	nseq.c \
-	ocsp.c \
-	openssl.c \
-	passwd.c \
-	pkcs12.c \
-	pkcs7.c \
-	pkcs8.c \
-	pkey.c \
-	pkeyparam.c \
-	pkeyutl.c \
-	prime.c \
-	rand.c \
-	req.c \
-	rsa.c \
-	rsautl.c \
-	s_cb.c \
-	s_client.c \
-	s_server.c \
-	s_socket.c \
-	s_time.c \
-	sess_id.c \
-	smime.c \
-	speed.c \
-	spkac.c \
-	srp.c \
-	verify.c \
-	version.c \
-	x509.c
-
-local_shared_libraries := \
-	libssl \
-	libcrypto
-
-local_c_includes := \
-	external/openssl \
-	external/openssl/include
-
-local_cflags := -DMONOLITH
-
-include $(CLEAR_VARS)
-LOCAL_MODULE:= openssl
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(local_src_files)
-LOCAL_SHARED_LIBRARIES := $(local_shared_libraries)
-LOCAL_C_INCLUDES := $(local_c_includes)
-LOCAL_CFLAGS := $(local_cflags)
-include $(LOCAL_PATH)/../android-config.mk
-include $(BUILD_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE:= openssl
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(local_src_files)
-LOCAL_SHARED_LIBRARIES := $(local_shared_libraries)
-LOCAL_C_INCLUDES := $(local_c_includes)
-LOCAL_CFLAGS := $(local_cflags)
-include $(LOCAL_PATH)/../android-config.mk
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/crypto/Android.mk b/crypto/Android.mk
deleted file mode 100644
index d53baa9..0000000
--- a/crypto/Android.mk
+++ /dev/null
@@ -1,638 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-arm_cflags := -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DGHASH_ASM -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
-mips_cflags := -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM
-
-arm_src_files := \
-    aes/asm/aes-armv4.s \
-    bn/asm/armv4-gf2m.s \
-    bn/asm/armv4-mont.s \
-    bn/bn_asm.c \
-    modes/asm/ghash-armv4.s \
-    sha/asm/sha1-armv4-large.s \
-    sha/asm/sha256-armv4.s \
-    sha/asm/sha512-armv4.s
-
-mips_src_files := \
-    aes/asm/aes-mips.s \
-    bn/asm/bn-mips.s \
-    bn/asm/mips-mont.s \
-    sha/asm/sha1-mips.s \
-    sha/asm/sha256-mips.s
-
-other_arch_src_files := \
-    aes/aes_core.c \
-    bn/bn_asm.c
-
-local_src_files := \
-	cryptlib.c \
-	mem.c \
-	mem_clr.c \
-	mem_dbg.c \
-	cversion.c \
-	ex_data.c \
-	cpt_err.c \
-	ebcdic.c \
-	uid.c \
-	o_time.c \
-	o_str.c \
-	o_dir.c \
-	aes/aes_cbc.c \
-	aes/aes_cfb.c \
-	aes/aes_ctr.c \
-	aes/aes_ecb.c \
-	aes/aes_misc.c \
-	aes/aes_ofb.c \
-	aes/aes_wrap.c \
-	asn1/a_bitstr.c \
-	asn1/a_bool.c \
-	asn1/a_bytes.c \
-	asn1/a_d2i_fp.c \
-	asn1/a_digest.c \
-	asn1/a_dup.c \
-	asn1/a_enum.c \
-	asn1/a_gentm.c \
-	asn1/a_i2d_fp.c \
-	asn1/a_int.c \
-	asn1/a_mbstr.c \
-	asn1/a_object.c \
-	asn1/a_octet.c \
-	asn1/a_print.c \
-	asn1/a_set.c \
-	asn1/a_sign.c \
-	asn1/a_strex.c \
-	asn1/a_strnid.c \
-	asn1/a_time.c \
-	asn1/a_type.c \
-	asn1/a_utctm.c \
-	asn1/a_utf8.c \
-	asn1/a_verify.c \
-	asn1/ameth_lib.c \
-	asn1/asn1_err.c \
-	asn1/asn1_gen.c \
-	asn1/asn1_lib.c \
-	asn1/asn1_par.c \
-	asn1/asn_mime.c \
-	asn1/asn_moid.c \
-	asn1/asn_pack.c \
-	asn1/bio_asn1.c \
-	asn1/bio_ndef.c \
-	asn1/d2i_pr.c \
-	asn1/d2i_pu.c \
-	asn1/evp_asn1.c \
-	asn1/f_enum.c \
-	asn1/f_int.c \
-	asn1/f_string.c \
-	asn1/i2d_pr.c \
-	asn1/i2d_pu.c \
-	asn1/n_pkey.c \
-	asn1/nsseq.c \
-	asn1/p5_pbe.c \
-	asn1/p5_pbev2.c \
-	asn1/p8_pkey.c \
-	asn1/t_bitst.c \
-	asn1/t_crl.c \
-	asn1/t_pkey.c \
-	asn1/t_req.c \
-	asn1/t_spki.c \
-	asn1/t_x509.c \
-	asn1/t_x509a.c \
-	asn1/tasn_dec.c \
-	asn1/tasn_enc.c \
-	asn1/tasn_fre.c \
-	asn1/tasn_new.c \
-	asn1/tasn_prn.c \
-	asn1/tasn_typ.c \
-	asn1/tasn_utl.c \
-	asn1/x_algor.c \
-	asn1/x_attrib.c \
-	asn1/x_bignum.c \
-	asn1/x_crl.c \
-	asn1/x_exten.c \
-	asn1/x_info.c \
-	asn1/x_long.c \
-	asn1/x_name.c \
-	asn1/x_nx509.c \
-	asn1/x_pkey.c \
-	asn1/x_pubkey.c \
-	asn1/x_req.c \
-	asn1/x_sig.c \
-	asn1/x_spki.c \
-	asn1/x_val.c \
-	asn1/x_x509.c \
-	asn1/x_x509a.c \
-	bf/bf_cfb64.c \
-	bf/bf_ecb.c \
-	bf/bf_enc.c \
-	bf/bf_ofb64.c \
-	bf/bf_skey.c \
-	bio/b_dump.c \
-	bio/b_print.c \
-	bio/b_sock.c \
-	bio/bf_buff.c \
-	bio/bf_nbio.c \
-	bio/bf_null.c \
-	bio/bio_cb.c \
-	bio/bio_err.c \
-	bio/bio_lib.c \
-	bio/bss_acpt.c \
-	bio/bss_bio.c \
-	bio/bss_conn.c \
-	bio/bss_dgram.c \
-	bio/bss_fd.c \
-	bio/bss_file.c \
-	bio/bss_log.c \
-	bio/bss_mem.c \
-	bio/bss_null.c \
-	bio/bss_sock.c \
-	bn/bn_add.c \
-	bn/bn_blind.c \
-	bn/bn_const.c \
-	bn/bn_ctx.c \
-	bn/bn_div.c \
-	bn/bn_err.c \
-	bn/bn_exp.c \
-	bn/bn_exp2.c \
-	bn/bn_gcd.c \
-	bn/bn_gf2m.c \
-	bn/bn_kron.c \
-	bn/bn_lib.c \
-	bn/bn_mod.c \
-	bn/bn_mont.c \
-	bn/bn_mpi.c \
-	bn/bn_mul.c \
-	bn/bn_nist.c \
-	bn/bn_prime.c \
-	bn/bn_print.c \
-	bn/bn_rand.c \
-	bn/bn_recp.c \
-	bn/bn_shift.c \
-	bn/bn_sqr.c \
-	bn/bn_sqrt.c \
-	bn/bn_word.c \
-	buffer/buf_err.c \
-	buffer/buf_str.c \
-	buffer/buffer.c \
-	cmac/cm_ameth.c \
-	cmac/cm_pmeth.c \
-	cmac/cmac.c \
-	comp/c_rle.c \
-	comp/c_zlib.c \
-	comp/comp_err.c \
-	comp/comp_lib.c \
-	conf/conf_api.c \
-	conf/conf_def.c \
-	conf/conf_err.c \
-	conf/conf_lib.c \
-	conf/conf_mall.c \
-	conf/conf_mod.c \
-	conf/conf_sap.c \
-	des/cbc_cksm.c \
-	des/cbc_enc.c \
-	des/cfb64ede.c \
-	des/cfb64enc.c \
-	des/cfb_enc.c \
-	des/des_enc.c \
-	des/des_old.c \
-	des/des_old2.c \
-	des/ecb3_enc.c \
-	des/ecb_enc.c \
-	des/ede_cbcm_enc.c \
-	des/enc_read.c \
-	des/enc_writ.c \
-	des/fcrypt.c \
-	des/fcrypt_b.c \
-	des/ofb64ede.c \
-	des/ofb64enc.c \
-	des/ofb_enc.c \
-	des/pcbc_enc.c \
-	des/qud_cksm.c \
-	des/rand_key.c \
-	des/read2pwd.c \
-	des/rpc_enc.c \
-	des/set_key.c \
-	des/str2key.c \
-	des/xcbc_enc.c \
-	dh/dh_ameth.c \
-	dh/dh_asn1.c \
-	dh/dh_check.c \
-	dh/dh_depr.c \
-	dh/dh_err.c \
-	dh/dh_gen.c \
-	dh/dh_key.c \
-	dh/dh_lib.c \
-	dh/dh_pmeth.c \
-	dsa/dsa_ameth.c \
-	dsa/dsa_asn1.c \
-	dsa/dsa_depr.c \
-	dsa/dsa_err.c \
-	dsa/dsa_gen.c \
-	dsa/dsa_key.c \
-	dsa/dsa_lib.c \
-	dsa/dsa_ossl.c \
-	dsa/dsa_pmeth.c \
-	dsa/dsa_prn.c \
-	dsa/dsa_sign.c \
-	dsa/dsa_vrf.c \
-	dso/dso_dl.c \
-	dso/dso_dlfcn.c \
-	dso/dso_err.c \
-	dso/dso_lib.c \
-	dso/dso_null.c \
-	dso/dso_openssl.c \
-	ec/ec2_mult.c \
-	ec/ec2_oct.c \
-	ec/ec2_smpl.c \
-	ec/ec_ameth.c \
-	ec/ec_asn1.c \
-	ec/ec_check.c \
-	ec/ec_curve.c \
-	ec/ec_cvt.c \
-	ec/ec_err.c \
-	ec/ec_key.c \
-	ec/ec_lib.c \
-	ec/ec_mult.c \
-	ec/ec_oct.c \
-	ec/ec_pmeth.c \
-	ec/ec_print.c \
-	ec/eck_prn.c \
-	ec/ecp_mont.c \
-	ec/ecp_nist.c \
-	ec/ecp_oct.c \
-	ec/ecp_smpl.c \
-	ecdh/ech_err.c \
-	ecdh/ech_key.c \
-	ecdh/ech_lib.c \
-	ecdh/ech_ossl.c \
-	ecdsa/ecs_asn1.c \
-	ecdsa/ecs_err.c \
-	ecdsa/ecs_lib.c \
-	ecdsa/ecs_ossl.c \
-	ecdsa/ecs_sign.c \
-	ecdsa/ecs_vrf.c \
-	engine/eng_all.c \
-	engine/eng_cnf.c \
-	engine/eng_ctrl.c \
-	engine/eng_dyn.c \
-	engine/eng_err.c \
-	engine/eng_fat.c \
-	engine/eng_init.c \
-	engine/eng_lib.c \
-	engine/eng_list.c \
-	engine/eng_pkey.c \
-	engine/eng_table.c \
-	engine/tb_asnmth.c \
-	engine/tb_cipher.c \
-	engine/tb_dh.c \
-	engine/tb_digest.c \
-	engine/tb_dsa.c \
-	engine/tb_ecdh.c \
-	engine/tb_ecdsa.c \
-	engine/tb_pkmeth.c \
-	engine/tb_rand.c \
-	engine/tb_rsa.c \
-	engine/tb_store.c \
-	err/err.c \
-	err/err_all.c \
-	err/err_prn.c \
-	evp/bio_b64.c \
-	evp/bio_enc.c \
-	evp/bio_md.c \
-	evp/bio_ok.c \
-	evp/c_all.c \
-	evp/c_allc.c \
-	evp/c_alld.c \
-	evp/digest.c \
-	evp/e_aes.c \
-	evp/e_aes_cbc_hmac_sha1.c \
-	evp/e_bf.c \
-	evp/e_des.c \
-	evp/e_des3.c \
-	evp/e_null.c \
-	evp/e_old.c \
-	evp/e_rc2.c \
-	evp/e_rc4.c \
-	evp/e_rc4_hmac_md5.c \
-	evp/e_rc5.c \
-	evp/e_xcbc_d.c \
-	evp/encode.c \
-	evp/evp_acnf.c \
-	evp/evp_enc.c \
-	evp/evp_err.c \
-	evp/evp_key.c \
-	evp/evp_lib.c \
-	evp/evp_pbe.c \
-	evp/evp_pkey.c \
-	evp/m_dss.c \
-	evp/m_dss1.c \
-	evp/m_ecdsa.c \
-	evp/m_md4.c \
-	evp/m_md5.c \
-	evp/m_mdc2.c \
-	evp/m_null.c \
-	evp/m_ripemd.c \
-	evp/m_sha1.c \
-	evp/m_sigver.c \
-	evp/m_wp.c \
-	evp/names.c \
-	evp/p5_crpt.c \
-	evp/p5_crpt2.c \
-	evp/p_dec.c \
-	evp/p_enc.c \
-	evp/p_lib.c \
-	evp/p_open.c \
-	evp/p_seal.c \
-	evp/p_sign.c \
-	evp/p_verify.c \
-	evp/pmeth_fn.c \
-	evp/pmeth_gn.c \
-	evp/pmeth_lib.c \
-	hmac/hm_ameth.c \
-	hmac/hm_pmeth.c \
-	hmac/hmac.c \
-	krb5/krb5_asn.c \
-	lhash/lh_stats.c \
-	lhash/lhash.c \
-	md4/md4_dgst.c \
-	md4/md4_one.c \
-	md5/md5_dgst.c \
-	md5/md5_one.c \
-	modes/cbc128.c \
-	modes/ccm128.c \
-	modes/cfb128.c \
-	modes/ctr128.c \
-	modes/gcm128.c \
-	modes/ofb128.c \
-	modes/xts128.c \
-	o_init.c \
-	objects/o_names.c \
-	objects/obj_dat.c \
-	objects/obj_err.c \
-	objects/obj_lib.c \
-	objects/obj_xref.c \
-	ocsp/ocsp_asn.c \
-	ocsp/ocsp_cl.c \
-	ocsp/ocsp_err.c \
-	ocsp/ocsp_ext.c \
-	ocsp/ocsp_ht.c \
-	ocsp/ocsp_lib.c \
-	ocsp/ocsp_prn.c \
-	ocsp/ocsp_srv.c \
-	ocsp/ocsp_vfy.c \
-	pem/pem_all.c \
-	pem/pem_err.c \
-	pem/pem_info.c \
-	pem/pem_lib.c \
-	pem/pem_oth.c \
-	pem/pem_pk8.c \
-	pem/pem_pkey.c \
-	pem/pem_seal.c \
-	pem/pem_sign.c \
-	pem/pem_x509.c \
-	pem/pem_xaux.c \
-	pem/pvkfmt.c \
-	pkcs12/p12_add.c \
-	pkcs12/p12_asn.c \
-	pkcs12/p12_attr.c \
-	pkcs12/p12_crpt.c \
-	pkcs12/p12_crt.c \
-	pkcs12/p12_decr.c \
-	pkcs12/p12_init.c \
-	pkcs12/p12_key.c \
-	pkcs12/p12_kiss.c \
-	pkcs12/p12_mutl.c \
-	pkcs12/p12_npas.c \
-	pkcs12/p12_p8d.c \
-	pkcs12/p12_p8e.c \
-	pkcs12/p12_utl.c \
-	pkcs12/pk12err.c \
-	pkcs7/pk7_asn1.c \
-	pkcs7/pk7_attr.c \
-	pkcs7/pk7_doit.c \
-	pkcs7/pk7_lib.c	\
-	pkcs7/pk7_mime.c \
-	pkcs7/pk7_smime.c \
-	pkcs7/pkcs7err.c \
-	pqueue/pqueue.c \
-	rand/md_rand.c \
-	rand/rand_egd.c \
-	rand/rand_err.c \
-	rand/rand_lib.c \
-	rand/rand_unix.c \
-	rand/randfile.c \
-	rc2/rc2_cbc.c \
-	rc2/rc2_ecb.c \
-	rc2/rc2_skey.c \
-	rc2/rc2cfb64.c \
-	rc2/rc2ofb64.c \
-	rc4/rc4_enc.c \
-	rc4/rc4_skey.c \
-	rc4/rc4_utl.c \
-	ripemd/rmd_dgst.c \
-	ripemd/rmd_one.c \
-	rsa/rsa_ameth.c \
-	rsa/rsa_asn1.c \
-	rsa/rsa_chk.c \
-	rsa/rsa_crpt.c \
-	rsa/rsa_eay.c \
-	rsa/rsa_err.c \
-	rsa/rsa_gen.c \
-	rsa/rsa_lib.c \
-	rsa/rsa_none.c \
-	rsa/rsa_null.c \
-	rsa/rsa_oaep.c \
-	rsa/rsa_pk1.c \
-	rsa/rsa_pmeth.c \
-	rsa/rsa_prn.c \
-	rsa/rsa_pss.c \
-	rsa/rsa_saos.c \
-	rsa/rsa_sign.c \
-	rsa/rsa_ssl.c \
-	rsa/rsa_x931.c \
-	sha/sha1_one.c \
-	sha/sha1dgst.c \
-	sha/sha256.c \
-	sha/sha512.c \
-	sha/sha_dgst.c \
-	srp/srp_lib.c \
-	srp/srp_vfy.c \
-	stack/stack.c \
-	ts/ts_err.c \
-	txt_db/txt_db.c \
-	ui/ui_compat.c \
-	ui/ui_err.c \
-	ui/ui_lib.c \
-	ui/ui_openssl.c \
-	ui/ui_util.c \
-	x509/by_dir.c \
-	x509/by_file.c \
-	x509/x509_att.c \
-	x509/x509_cmp.c \
-	x509/x509_d2.c \
-	x509/x509_def.c \
-	x509/x509_err.c \
-	x509/x509_ext.c \
-	x509/x509_lu.c \
-	x509/x509_obj.c \
-	x509/x509_r2x.c \
-	x509/x509_req.c \
-	x509/x509_set.c \
-	x509/x509_trs.c \
-	x509/x509_txt.c \
-	x509/x509_v3.c \
-	x509/x509_vfy.c \
-	x509/x509_vpm.c \
-	x509/x509cset.c \
-	x509/x509name.c \
-	x509/x509rset.c \
-	x509/x509spki.c \
-	x509/x509type.c \
-	x509/x_all.c \
-	x509v3/pcy_cache.c \
-	x509v3/pcy_data.c \
-	x509v3/pcy_lib.c \
-	x509v3/pcy_map.c \
-	x509v3/pcy_node.c \
-	x509v3/pcy_tree.c \
-	x509v3/v3_akey.c \
-	x509v3/v3_akeya.c \
-	x509v3/v3_alt.c \
-	x509v3/v3_bcons.c \
-	x509v3/v3_bitst.c \
-	x509v3/v3_conf.c \
-	x509v3/v3_cpols.c \
-	x509v3/v3_crld.c \
-	x509v3/v3_enum.c \
-	x509v3/v3_extku.c \
-	x509v3/v3_genn.c \
-	x509v3/v3_ia5.c \
-	x509v3/v3_info.c \
-	x509v3/v3_int.c \
-	x509v3/v3_lib.c \
-	x509v3/v3_ncons.c \
-	x509v3/v3_ocsp.c \
-	x509v3/v3_pci.c \
-	x509v3/v3_pcia.c \
-	x509v3/v3_pcons.c \
-	x509v3/v3_pku.c \
-	x509v3/v3_pmaps.c \
-	x509v3/v3_prn.c \
-	x509v3/v3_purp.c \
-	x509v3/v3_skey.c \
-	x509v3/v3_sxnet.c \
-	x509v3/v3_utl.c \
-	x509v3/v3err.c
-
-local_c_includes := \
-	external/openssl \
-	external/openssl/crypto/asn1 \
-	external/openssl/crypto/evp \
-	external/openssl/crypto/modes \
-	external/openssl/include \
-	external/openssl/include/openssl \
-	external/zlib
-
-local_c_flags := -DNO_WINDOWS_BRAINDEATH
-
-local_as_flags := -x assembler-with-cpp
-
-#######################################
-# target static library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-endif
-
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags)
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-ifeq ($(TARGET_ARCH),arm)
-	LOCAL_SRC_FILES += $(arm_src_files)
-	LOCAL_CFLAGS += $(arm_cflags)
-endif
-ifeq ($(TARGET_ARCH),mips)
-    ifneq (($TARGET_HAS_BIGENDIAN),true)
-      LOCAL_SRC_FILES += $(mips_src_files)
-      LOCAL_CFLAGS += $(mips_cflags)
-    else
-      LOCAL_SRC_FILES += $(other_arch_src_files)
-    endif
-endif
-ifeq ($(TARGET_ARCH),x86)
-	LOCAL_SRC_FILES += $(other_arch_src_files)
-endif
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto_static
-include $(BUILD_STATIC_LIBRARY)
-
-#######################################
-# target shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-# Use the NDK prebuilt libz and libdl.
-LOCAL_LDFLAGS += -lz -ldl
-else
-LOCAL_SHARED_LIBRARIES += libz libdl
-endif
-
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags)
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-ifeq ($(TARGET_ARCH),arm)
-	LOCAL_SRC_FILES += $(arm_src_files)
-	LOCAL_CFLAGS += $(arm_cflags)
-endif
-ifeq ($(TARGET_ARCH),mips)
-    ifneq (($TARGET_HAS_BIGENDIAN),true)
-      LOCAL_SRC_FILES += $(mips_src_files)
-      LOCAL_CFLAGS += $(mips_cflags)
-    else
-      LOCAL_SRC_FILES += $(other_arch_src_files)
-    endif
-endif
-ifeq ($(TARGET_ARCH),x86)
-	LOCAL_SRC_FILES += $(other_arch_src_files)
-endif
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto
-include $(BUILD_SHARED_LIBRARY)
-
-#######################################
-# host shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SRC_FILES += $(other_arch_src_files)
-LOCAL_STATIC_LIBRARIES += libz
-LOCAL_LDLIBS += -ldl
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-########################################
-# host static library, which is used by some SDK tools.
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SRC_FILES += $(other_arch_src_files)
-LOCAL_STATIC_LIBRARIES += libz
-LOCAL_LDLIBS += -ldl
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto_static
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/import_openssl.sh b/import_openssl.sh
index da2f533..59952e1 100755
--- a/import_openssl.sh
+++ b/import_openssl.sh
@@ -129,11 +129,6 @@
     fi
   done
 
-  # Copy Makefiles
-  cp ../patches/apps_Android.mk apps/Android.mk
-  cp ../patches/crypto_Android.mk crypto/Android.mk
-  cp ../patches/ssl_Android.mk ssl/Android.mk
-
   # Generate arm asm
   perl crypto/aes/asm/aes-armv4.pl         > crypto/aes/asm/aes-armv4.s
   perl crypto/bn/asm/armv4-gf2m.pl         > crypto/bn/asm/armv4-gf2m.s
diff --git a/patches/apps_Android.mk b/patches/apps_Android.mk
deleted file mode 100644
index 9110490..0000000
--- a/patches/apps_Android.mk
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright 2006 The Android Open Source Project
-
-LOCAL_PATH:= $(call my-dir)
-
-local_src_files:= \
-	app_rand.c \
-	apps.c \
-	asn1pars.c \
-	ca.c \
-	ciphers.c \
-	crl.c \
-	crl2p7.c \
-	dgst.c \
-	dh.c \
-	dhparam.c \
-	dsa.c \
-	dsaparam.c \
-	ecparam.c \
-	ec.c \
-	enc.c \
-	engine.c \
-	errstr.c \
-	gendh.c \
-	gendsa.c \
-	genpkey.c \
-	genrsa.c \
-	nseq.c \
-	ocsp.c \
-	openssl.c \
-	passwd.c \
-	pkcs12.c \
-	pkcs7.c \
-	pkcs8.c \
-	pkey.c \
-	pkeyparam.c \
-	pkeyutl.c \
-	prime.c \
-	rand.c \
-	req.c \
-	rsa.c \
-	rsautl.c \
-	s_cb.c \
-	s_client.c \
-	s_server.c \
-	s_socket.c \
-	s_time.c \
-	sess_id.c \
-	smime.c \
-	speed.c \
-	spkac.c \
-	srp.c \
-	verify.c \
-	version.c \
-	x509.c
-
-local_shared_libraries := \
-	libssl \
-	libcrypto
-
-local_c_includes := \
-	external/openssl \
-	external/openssl/include
-
-local_cflags := -DMONOLITH
-
-include $(CLEAR_VARS)
-LOCAL_MODULE:= openssl
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(local_src_files)
-LOCAL_SHARED_LIBRARIES := $(local_shared_libraries)
-LOCAL_C_INCLUDES := $(local_c_includes)
-LOCAL_CFLAGS := $(local_cflags)
-include $(LOCAL_PATH)/../android-config.mk
-include $(BUILD_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE:= openssl
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(local_src_files)
-LOCAL_SHARED_LIBRARIES := $(local_shared_libraries)
-LOCAL_C_INCLUDES := $(local_c_includes)
-LOCAL_CFLAGS := $(local_cflags)
-include $(LOCAL_PATH)/../android-config.mk
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/patches/crypto_Android.mk b/patches/crypto_Android.mk
deleted file mode 100644
index d53baa9..0000000
--- a/patches/crypto_Android.mk
+++ /dev/null
@@ -1,638 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-arm_cflags := -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DGHASH_ASM -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
-mips_cflags := -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM
-
-arm_src_files := \
-    aes/asm/aes-armv4.s \
-    bn/asm/armv4-gf2m.s \
-    bn/asm/armv4-mont.s \
-    bn/bn_asm.c \
-    modes/asm/ghash-armv4.s \
-    sha/asm/sha1-armv4-large.s \
-    sha/asm/sha256-armv4.s \
-    sha/asm/sha512-armv4.s
-
-mips_src_files := \
-    aes/asm/aes-mips.s \
-    bn/asm/bn-mips.s \
-    bn/asm/mips-mont.s \
-    sha/asm/sha1-mips.s \
-    sha/asm/sha256-mips.s
-
-other_arch_src_files := \
-    aes/aes_core.c \
-    bn/bn_asm.c
-
-local_src_files := \
-	cryptlib.c \
-	mem.c \
-	mem_clr.c \
-	mem_dbg.c \
-	cversion.c \
-	ex_data.c \
-	cpt_err.c \
-	ebcdic.c \
-	uid.c \
-	o_time.c \
-	o_str.c \
-	o_dir.c \
-	aes/aes_cbc.c \
-	aes/aes_cfb.c \
-	aes/aes_ctr.c \
-	aes/aes_ecb.c \
-	aes/aes_misc.c \
-	aes/aes_ofb.c \
-	aes/aes_wrap.c \
-	asn1/a_bitstr.c \
-	asn1/a_bool.c \
-	asn1/a_bytes.c \
-	asn1/a_d2i_fp.c \
-	asn1/a_digest.c \
-	asn1/a_dup.c \
-	asn1/a_enum.c \
-	asn1/a_gentm.c \
-	asn1/a_i2d_fp.c \
-	asn1/a_int.c \
-	asn1/a_mbstr.c \
-	asn1/a_object.c \
-	asn1/a_octet.c \
-	asn1/a_print.c \
-	asn1/a_set.c \
-	asn1/a_sign.c \
-	asn1/a_strex.c \
-	asn1/a_strnid.c \
-	asn1/a_time.c \
-	asn1/a_type.c \
-	asn1/a_utctm.c \
-	asn1/a_utf8.c \
-	asn1/a_verify.c \
-	asn1/ameth_lib.c \
-	asn1/asn1_err.c \
-	asn1/asn1_gen.c \
-	asn1/asn1_lib.c \
-	asn1/asn1_par.c \
-	asn1/asn_mime.c \
-	asn1/asn_moid.c \
-	asn1/asn_pack.c \
-	asn1/bio_asn1.c \
-	asn1/bio_ndef.c \
-	asn1/d2i_pr.c \
-	asn1/d2i_pu.c \
-	asn1/evp_asn1.c \
-	asn1/f_enum.c \
-	asn1/f_int.c \
-	asn1/f_string.c \
-	asn1/i2d_pr.c \
-	asn1/i2d_pu.c \
-	asn1/n_pkey.c \
-	asn1/nsseq.c \
-	asn1/p5_pbe.c \
-	asn1/p5_pbev2.c \
-	asn1/p8_pkey.c \
-	asn1/t_bitst.c \
-	asn1/t_crl.c \
-	asn1/t_pkey.c \
-	asn1/t_req.c \
-	asn1/t_spki.c \
-	asn1/t_x509.c \
-	asn1/t_x509a.c \
-	asn1/tasn_dec.c \
-	asn1/tasn_enc.c \
-	asn1/tasn_fre.c \
-	asn1/tasn_new.c \
-	asn1/tasn_prn.c \
-	asn1/tasn_typ.c \
-	asn1/tasn_utl.c \
-	asn1/x_algor.c \
-	asn1/x_attrib.c \
-	asn1/x_bignum.c \
-	asn1/x_crl.c \
-	asn1/x_exten.c \
-	asn1/x_info.c \
-	asn1/x_long.c \
-	asn1/x_name.c \
-	asn1/x_nx509.c \
-	asn1/x_pkey.c \
-	asn1/x_pubkey.c \
-	asn1/x_req.c \
-	asn1/x_sig.c \
-	asn1/x_spki.c \
-	asn1/x_val.c \
-	asn1/x_x509.c \
-	asn1/x_x509a.c \
-	bf/bf_cfb64.c \
-	bf/bf_ecb.c \
-	bf/bf_enc.c \
-	bf/bf_ofb64.c \
-	bf/bf_skey.c \
-	bio/b_dump.c \
-	bio/b_print.c \
-	bio/b_sock.c \
-	bio/bf_buff.c \
-	bio/bf_nbio.c \
-	bio/bf_null.c \
-	bio/bio_cb.c \
-	bio/bio_err.c \
-	bio/bio_lib.c \
-	bio/bss_acpt.c \
-	bio/bss_bio.c \
-	bio/bss_conn.c \
-	bio/bss_dgram.c \
-	bio/bss_fd.c \
-	bio/bss_file.c \
-	bio/bss_log.c \
-	bio/bss_mem.c \
-	bio/bss_null.c \
-	bio/bss_sock.c \
-	bn/bn_add.c \
-	bn/bn_blind.c \
-	bn/bn_const.c \
-	bn/bn_ctx.c \
-	bn/bn_div.c \
-	bn/bn_err.c \
-	bn/bn_exp.c \
-	bn/bn_exp2.c \
-	bn/bn_gcd.c \
-	bn/bn_gf2m.c \
-	bn/bn_kron.c \
-	bn/bn_lib.c \
-	bn/bn_mod.c \
-	bn/bn_mont.c \
-	bn/bn_mpi.c \
-	bn/bn_mul.c \
-	bn/bn_nist.c \
-	bn/bn_prime.c \
-	bn/bn_print.c \
-	bn/bn_rand.c \
-	bn/bn_recp.c \
-	bn/bn_shift.c \
-	bn/bn_sqr.c \
-	bn/bn_sqrt.c \
-	bn/bn_word.c \
-	buffer/buf_err.c \
-	buffer/buf_str.c \
-	buffer/buffer.c \
-	cmac/cm_ameth.c \
-	cmac/cm_pmeth.c \
-	cmac/cmac.c \
-	comp/c_rle.c \
-	comp/c_zlib.c \
-	comp/comp_err.c \
-	comp/comp_lib.c \
-	conf/conf_api.c \
-	conf/conf_def.c \
-	conf/conf_err.c \
-	conf/conf_lib.c \
-	conf/conf_mall.c \
-	conf/conf_mod.c \
-	conf/conf_sap.c \
-	des/cbc_cksm.c \
-	des/cbc_enc.c \
-	des/cfb64ede.c \
-	des/cfb64enc.c \
-	des/cfb_enc.c \
-	des/des_enc.c \
-	des/des_old.c \
-	des/des_old2.c \
-	des/ecb3_enc.c \
-	des/ecb_enc.c \
-	des/ede_cbcm_enc.c \
-	des/enc_read.c \
-	des/enc_writ.c \
-	des/fcrypt.c \
-	des/fcrypt_b.c \
-	des/ofb64ede.c \
-	des/ofb64enc.c \
-	des/ofb_enc.c \
-	des/pcbc_enc.c \
-	des/qud_cksm.c \
-	des/rand_key.c \
-	des/read2pwd.c \
-	des/rpc_enc.c \
-	des/set_key.c \
-	des/str2key.c \
-	des/xcbc_enc.c \
-	dh/dh_ameth.c \
-	dh/dh_asn1.c \
-	dh/dh_check.c \
-	dh/dh_depr.c \
-	dh/dh_err.c \
-	dh/dh_gen.c \
-	dh/dh_key.c \
-	dh/dh_lib.c \
-	dh/dh_pmeth.c \
-	dsa/dsa_ameth.c \
-	dsa/dsa_asn1.c \
-	dsa/dsa_depr.c \
-	dsa/dsa_err.c \
-	dsa/dsa_gen.c \
-	dsa/dsa_key.c \
-	dsa/dsa_lib.c \
-	dsa/dsa_ossl.c \
-	dsa/dsa_pmeth.c \
-	dsa/dsa_prn.c \
-	dsa/dsa_sign.c \
-	dsa/dsa_vrf.c \
-	dso/dso_dl.c \
-	dso/dso_dlfcn.c \
-	dso/dso_err.c \
-	dso/dso_lib.c \
-	dso/dso_null.c \
-	dso/dso_openssl.c \
-	ec/ec2_mult.c \
-	ec/ec2_oct.c \
-	ec/ec2_smpl.c \
-	ec/ec_ameth.c \
-	ec/ec_asn1.c \
-	ec/ec_check.c \
-	ec/ec_curve.c \
-	ec/ec_cvt.c \
-	ec/ec_err.c \
-	ec/ec_key.c \
-	ec/ec_lib.c \
-	ec/ec_mult.c \
-	ec/ec_oct.c \
-	ec/ec_pmeth.c \
-	ec/ec_print.c \
-	ec/eck_prn.c \
-	ec/ecp_mont.c \
-	ec/ecp_nist.c \
-	ec/ecp_oct.c \
-	ec/ecp_smpl.c \
-	ecdh/ech_err.c \
-	ecdh/ech_key.c \
-	ecdh/ech_lib.c \
-	ecdh/ech_ossl.c \
-	ecdsa/ecs_asn1.c \
-	ecdsa/ecs_err.c \
-	ecdsa/ecs_lib.c \
-	ecdsa/ecs_ossl.c \
-	ecdsa/ecs_sign.c \
-	ecdsa/ecs_vrf.c \
-	engine/eng_all.c \
-	engine/eng_cnf.c \
-	engine/eng_ctrl.c \
-	engine/eng_dyn.c \
-	engine/eng_err.c \
-	engine/eng_fat.c \
-	engine/eng_init.c \
-	engine/eng_lib.c \
-	engine/eng_list.c \
-	engine/eng_pkey.c \
-	engine/eng_table.c \
-	engine/tb_asnmth.c \
-	engine/tb_cipher.c \
-	engine/tb_dh.c \
-	engine/tb_digest.c \
-	engine/tb_dsa.c \
-	engine/tb_ecdh.c \
-	engine/tb_ecdsa.c \
-	engine/tb_pkmeth.c \
-	engine/tb_rand.c \
-	engine/tb_rsa.c \
-	engine/tb_store.c \
-	err/err.c \
-	err/err_all.c \
-	err/err_prn.c \
-	evp/bio_b64.c \
-	evp/bio_enc.c \
-	evp/bio_md.c \
-	evp/bio_ok.c \
-	evp/c_all.c \
-	evp/c_allc.c \
-	evp/c_alld.c \
-	evp/digest.c \
-	evp/e_aes.c \
-	evp/e_aes_cbc_hmac_sha1.c \
-	evp/e_bf.c \
-	evp/e_des.c \
-	evp/e_des3.c \
-	evp/e_null.c \
-	evp/e_old.c \
-	evp/e_rc2.c \
-	evp/e_rc4.c \
-	evp/e_rc4_hmac_md5.c \
-	evp/e_rc5.c \
-	evp/e_xcbc_d.c \
-	evp/encode.c \
-	evp/evp_acnf.c \
-	evp/evp_enc.c \
-	evp/evp_err.c \
-	evp/evp_key.c \
-	evp/evp_lib.c \
-	evp/evp_pbe.c \
-	evp/evp_pkey.c \
-	evp/m_dss.c \
-	evp/m_dss1.c \
-	evp/m_ecdsa.c \
-	evp/m_md4.c \
-	evp/m_md5.c \
-	evp/m_mdc2.c \
-	evp/m_null.c \
-	evp/m_ripemd.c \
-	evp/m_sha1.c \
-	evp/m_sigver.c \
-	evp/m_wp.c \
-	evp/names.c \
-	evp/p5_crpt.c \
-	evp/p5_crpt2.c \
-	evp/p_dec.c \
-	evp/p_enc.c \
-	evp/p_lib.c \
-	evp/p_open.c \
-	evp/p_seal.c \
-	evp/p_sign.c \
-	evp/p_verify.c \
-	evp/pmeth_fn.c \
-	evp/pmeth_gn.c \
-	evp/pmeth_lib.c \
-	hmac/hm_ameth.c \
-	hmac/hm_pmeth.c \
-	hmac/hmac.c \
-	krb5/krb5_asn.c \
-	lhash/lh_stats.c \
-	lhash/lhash.c \
-	md4/md4_dgst.c \
-	md4/md4_one.c \
-	md5/md5_dgst.c \
-	md5/md5_one.c \
-	modes/cbc128.c \
-	modes/ccm128.c \
-	modes/cfb128.c \
-	modes/ctr128.c \
-	modes/gcm128.c \
-	modes/ofb128.c \
-	modes/xts128.c \
-	o_init.c \
-	objects/o_names.c \
-	objects/obj_dat.c \
-	objects/obj_err.c \
-	objects/obj_lib.c \
-	objects/obj_xref.c \
-	ocsp/ocsp_asn.c \
-	ocsp/ocsp_cl.c \
-	ocsp/ocsp_err.c \
-	ocsp/ocsp_ext.c \
-	ocsp/ocsp_ht.c \
-	ocsp/ocsp_lib.c \
-	ocsp/ocsp_prn.c \
-	ocsp/ocsp_srv.c \
-	ocsp/ocsp_vfy.c \
-	pem/pem_all.c \
-	pem/pem_err.c \
-	pem/pem_info.c \
-	pem/pem_lib.c \
-	pem/pem_oth.c \
-	pem/pem_pk8.c \
-	pem/pem_pkey.c \
-	pem/pem_seal.c \
-	pem/pem_sign.c \
-	pem/pem_x509.c \
-	pem/pem_xaux.c \
-	pem/pvkfmt.c \
-	pkcs12/p12_add.c \
-	pkcs12/p12_asn.c \
-	pkcs12/p12_attr.c \
-	pkcs12/p12_crpt.c \
-	pkcs12/p12_crt.c \
-	pkcs12/p12_decr.c \
-	pkcs12/p12_init.c \
-	pkcs12/p12_key.c \
-	pkcs12/p12_kiss.c \
-	pkcs12/p12_mutl.c \
-	pkcs12/p12_npas.c \
-	pkcs12/p12_p8d.c \
-	pkcs12/p12_p8e.c \
-	pkcs12/p12_utl.c \
-	pkcs12/pk12err.c \
-	pkcs7/pk7_asn1.c \
-	pkcs7/pk7_attr.c \
-	pkcs7/pk7_doit.c \
-	pkcs7/pk7_lib.c	\
-	pkcs7/pk7_mime.c \
-	pkcs7/pk7_smime.c \
-	pkcs7/pkcs7err.c \
-	pqueue/pqueue.c \
-	rand/md_rand.c \
-	rand/rand_egd.c \
-	rand/rand_err.c \
-	rand/rand_lib.c \
-	rand/rand_unix.c \
-	rand/randfile.c \
-	rc2/rc2_cbc.c \
-	rc2/rc2_ecb.c \
-	rc2/rc2_skey.c \
-	rc2/rc2cfb64.c \
-	rc2/rc2ofb64.c \
-	rc4/rc4_enc.c \
-	rc4/rc4_skey.c \
-	rc4/rc4_utl.c \
-	ripemd/rmd_dgst.c \
-	ripemd/rmd_one.c \
-	rsa/rsa_ameth.c \
-	rsa/rsa_asn1.c \
-	rsa/rsa_chk.c \
-	rsa/rsa_crpt.c \
-	rsa/rsa_eay.c \
-	rsa/rsa_err.c \
-	rsa/rsa_gen.c \
-	rsa/rsa_lib.c \
-	rsa/rsa_none.c \
-	rsa/rsa_null.c \
-	rsa/rsa_oaep.c \
-	rsa/rsa_pk1.c \
-	rsa/rsa_pmeth.c \
-	rsa/rsa_prn.c \
-	rsa/rsa_pss.c \
-	rsa/rsa_saos.c \
-	rsa/rsa_sign.c \
-	rsa/rsa_ssl.c \
-	rsa/rsa_x931.c \
-	sha/sha1_one.c \
-	sha/sha1dgst.c \
-	sha/sha256.c \
-	sha/sha512.c \
-	sha/sha_dgst.c \
-	srp/srp_lib.c \
-	srp/srp_vfy.c \
-	stack/stack.c \
-	ts/ts_err.c \
-	txt_db/txt_db.c \
-	ui/ui_compat.c \
-	ui/ui_err.c \
-	ui/ui_lib.c \
-	ui/ui_openssl.c \
-	ui/ui_util.c \
-	x509/by_dir.c \
-	x509/by_file.c \
-	x509/x509_att.c \
-	x509/x509_cmp.c \
-	x509/x509_d2.c \
-	x509/x509_def.c \
-	x509/x509_err.c \
-	x509/x509_ext.c \
-	x509/x509_lu.c \
-	x509/x509_obj.c \
-	x509/x509_r2x.c \
-	x509/x509_req.c \
-	x509/x509_set.c \
-	x509/x509_trs.c \
-	x509/x509_txt.c \
-	x509/x509_v3.c \
-	x509/x509_vfy.c \
-	x509/x509_vpm.c \
-	x509/x509cset.c \
-	x509/x509name.c \
-	x509/x509rset.c \
-	x509/x509spki.c \
-	x509/x509type.c \
-	x509/x_all.c \
-	x509v3/pcy_cache.c \
-	x509v3/pcy_data.c \
-	x509v3/pcy_lib.c \
-	x509v3/pcy_map.c \
-	x509v3/pcy_node.c \
-	x509v3/pcy_tree.c \
-	x509v3/v3_akey.c \
-	x509v3/v3_akeya.c \
-	x509v3/v3_alt.c \
-	x509v3/v3_bcons.c \
-	x509v3/v3_bitst.c \
-	x509v3/v3_conf.c \
-	x509v3/v3_cpols.c \
-	x509v3/v3_crld.c \
-	x509v3/v3_enum.c \
-	x509v3/v3_extku.c \
-	x509v3/v3_genn.c \
-	x509v3/v3_ia5.c \
-	x509v3/v3_info.c \
-	x509v3/v3_int.c \
-	x509v3/v3_lib.c \
-	x509v3/v3_ncons.c \
-	x509v3/v3_ocsp.c \
-	x509v3/v3_pci.c \
-	x509v3/v3_pcia.c \
-	x509v3/v3_pcons.c \
-	x509v3/v3_pku.c \
-	x509v3/v3_pmaps.c \
-	x509v3/v3_prn.c \
-	x509v3/v3_purp.c \
-	x509v3/v3_skey.c \
-	x509v3/v3_sxnet.c \
-	x509v3/v3_utl.c \
-	x509v3/v3err.c
-
-local_c_includes := \
-	external/openssl \
-	external/openssl/crypto/asn1 \
-	external/openssl/crypto/evp \
-	external/openssl/crypto/modes \
-	external/openssl/include \
-	external/openssl/include/openssl \
-	external/zlib
-
-local_c_flags := -DNO_WINDOWS_BRAINDEATH
-
-local_as_flags := -x assembler-with-cpp
-
-#######################################
-# target static library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-endif
-
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags)
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-ifeq ($(TARGET_ARCH),arm)
-	LOCAL_SRC_FILES += $(arm_src_files)
-	LOCAL_CFLAGS += $(arm_cflags)
-endif
-ifeq ($(TARGET_ARCH),mips)
-    ifneq (($TARGET_HAS_BIGENDIAN),true)
-      LOCAL_SRC_FILES += $(mips_src_files)
-      LOCAL_CFLAGS += $(mips_cflags)
-    else
-      LOCAL_SRC_FILES += $(other_arch_src_files)
-    endif
-endif
-ifeq ($(TARGET_ARCH),x86)
-	LOCAL_SRC_FILES += $(other_arch_src_files)
-endif
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto_static
-include $(BUILD_STATIC_LIBRARY)
-
-#######################################
-# target shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-# Use the NDK prebuilt libz and libdl.
-LOCAL_LDFLAGS += -lz -ldl
-else
-LOCAL_SHARED_LIBRARIES += libz libdl
-endif
-
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags)
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-ifeq ($(TARGET_ARCH),arm)
-	LOCAL_SRC_FILES += $(arm_src_files)
-	LOCAL_CFLAGS += $(arm_cflags)
-endif
-ifeq ($(TARGET_ARCH),mips)
-    ifneq (($TARGET_HAS_BIGENDIAN),true)
-      LOCAL_SRC_FILES += $(mips_src_files)
-      LOCAL_CFLAGS += $(mips_cflags)
-    else
-      LOCAL_SRC_FILES += $(other_arch_src_files)
-    endif
-endif
-ifeq ($(TARGET_ARCH),x86)
-	LOCAL_SRC_FILES += $(other_arch_src_files)
-endif
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto
-include $(BUILD_SHARED_LIBRARY)
-
-#######################################
-# host shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SRC_FILES += $(other_arch_src_files)
-LOCAL_STATIC_LIBRARIES += libz
-LOCAL_LDLIBS += -ldl
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-########################################
-# host static library, which is used by some SDK tools.
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_CFLAGS += $(local_c_flags) -DPURIFY
-LOCAL_ASFLAGS += $(local_as_flags)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SRC_FILES += $(other_arch_src_files)
-LOCAL_STATIC_LIBRARIES += libz
-LOCAL_LDLIBS += -ldl
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libcrypto_static
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/patches/ssl_Android.mk b/patches/ssl_Android.mk
deleted file mode 100644
index 619aede..0000000
--- a/patches/ssl_Android.mk
+++ /dev/null
@@ -1,104 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-local_c_includes := \
-	external/openssl \
-	external/openssl/include \
-	external/openssl/crypto
-
-local_src_files:= \
-	bio_ssl.c \
-	d1_both.c \
-	d1_enc.c \
-	d1_lib.c \
-	d1_pkt.c \
-	d1_srtp.c \
-	kssl.c \
-	s23_clnt.c \
-	s23_lib.c \
-	s23_meth.c \
-	s23_pkt.c \
-	s23_srvr.c \
-	s2_clnt.c \
-	s2_enc.c \
-	s2_lib.c \
-	s2_meth.c \
-	s2_pkt.c \
-	s2_srvr.c \
-	s3_both.c \
-	s3_clnt.c \
-	s3_enc.c \
-	s3_lib.c \
-	s3_meth.c \
-	s3_pkt.c \
-	s3_srvr.c \
-	ssl_algs.c \
-	ssl_asn1.c \
-	ssl_cert.c \
-	ssl_ciph.c \
-	ssl_err.c \
-	ssl_err2.c \
-	ssl_lib.c \
-	ssl_rsa.c \
-	ssl_sess.c \
-	ssl_stat.c \
-	ssl_txt.c \
-	t1_clnt.c \
-	t1_enc.c \
-	t1_lib.c \
-	t1_meth.c \
-	t1_reneg.c \
-	t1_srvr.c \
-	tls_srp.c
-
-#######################################
-# target static library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-endif
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libssl_static
-include $(BUILD_STATIC_LIBRARY)
-
-#######################################
-# target shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-endif
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SHARED_LIBRARIES += libcrypto
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libssl
-include $(BUILD_SHARED_LIBRARY)
-
-#######################################
-# host shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SHARED_LIBRARIES += libcrypto
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libssl
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-#######################################
-# ssltest
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES:= ssltest.c
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SHARED_LIBRARIES := libssl libcrypto
-LOCAL_MODULE:= ssltest
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_EXECUTABLE)
diff --git a/ssl/Android.mk b/ssl/Android.mk
deleted file mode 100644
index 619aede..0000000
--- a/ssl/Android.mk
+++ /dev/null
@@ -1,104 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-local_c_includes := \
-	external/openssl \
-	external/openssl/include \
-	external/openssl/crypto
-
-local_src_files:= \
-	bio_ssl.c \
-	d1_both.c \
-	d1_enc.c \
-	d1_lib.c \
-	d1_pkt.c \
-	d1_srtp.c \
-	kssl.c \
-	s23_clnt.c \
-	s23_lib.c \
-	s23_meth.c \
-	s23_pkt.c \
-	s23_srvr.c \
-	s2_clnt.c \
-	s2_enc.c \
-	s2_lib.c \
-	s2_meth.c \
-	s2_pkt.c \
-	s2_srvr.c \
-	s3_both.c \
-	s3_clnt.c \
-	s3_enc.c \
-	s3_lib.c \
-	s3_meth.c \
-	s3_pkt.c \
-	s3_srvr.c \
-	ssl_algs.c \
-	ssl_asn1.c \
-	ssl_cert.c \
-	ssl_ciph.c \
-	ssl_err.c \
-	ssl_err2.c \
-	ssl_lib.c \
-	ssl_rsa.c \
-	ssl_sess.c \
-	ssl_stat.c \
-	ssl_txt.c \
-	t1_clnt.c \
-	t1_enc.c \
-	t1_lib.c \
-	t1_meth.c \
-	t1_reneg.c \
-	t1_srvr.c \
-	tls_srp.c
-
-#######################################
-# target static library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-endif
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libssl_static
-include $(BUILD_STATIC_LIBRARY)
-
-#######################################
-# target shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_NDK_VERSION := 5
-LOCAL_SDK_VERSION := 9
-endif
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SHARED_LIBRARIES += libcrypto
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libssl
-include $(BUILD_SHARED_LIBRARY)
-
-#######################################
-# host shared library
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES += $(local_src_files)
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SHARED_LIBRARIES += libcrypto
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= libssl
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-#######################################
-# ssltest
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/../android-config.mk
-LOCAL_SRC_FILES:= ssltest.c
-LOCAL_C_INCLUDES += $(local_c_includes)
-LOCAL_SHARED_LIBRARIES := libssl libcrypto
-LOCAL_MODULE:= ssltest
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_EXECUTABLE)