From 2baca9b32aa7d2e14e096b2967322934d35dee4e Mon Sep 17 00:00:00 2001 From: Brian Pellin Date: Wed, 2 Dec 2009 19:54:18 -0600 Subject: [PATCH] Add build tools for native libraries. --- LICENSE | 55 ++++++++ jni_root/README | 8 +- jni_root/build.patch | 302 +++++++++++++++++++++++++++++++++++++++++ jni_root/prep_build.sh | 10 ++ 4 files changed, 369 insertions(+), 6 deletions(-) create mode 100644 jni_root/build.patch create mode 100644 jni_root/prep_build.sh diff --git a/LICENSE b/LICENSE index 0dee0687c..ce4c89cf7 100644 --- a/LICENSE +++ b/LICENSE @@ -64,3 +64,58 @@ Copyright 2009 Brian Pellin . You should have received a copy of the GNU General Public License along with this program. If not, see . +Files under jni/openssl-0.98l/*: +/* ==================================================================== + * Copyright (c) 1998-2008 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + diff --git a/jni_root/README b/jni_root/README index 2a51db4a0..f8a1d48a9 100644 --- a/jni_root/README +++ b/jni_root/README @@ -5,10 +5,6 @@ Build instructions: c. Move the KeePassDroid git root to ${ndk-root}/apps/KeePassDroid/project d. cp -a ${ndk-root}/apps/KeePassDroid/project/jni_root ${ndk-root}/apps/KeePassDroid -2. Run ./configure in ${ndk-root}/apps/KeePassDroid/project/jni/libgpg-error -3. In ${ndk-root}/apps/KeePassDroid/project/jni/libgpg-error/src: - a. Run 'make gpg-error.h code-from-errno.h code-to-errno.h err-sources.h err-codes.h +2. Run prep-build.sh to download, unpack, and patch the openssl sources. -4. Run ./configure in ${ndk-root}/apps/KeePassDroid/project/jni/libgcrypt -5. Add #include to libgcrypt/src/gcrypt.h -6. In config.h make sure HAVE_ULONG_TYPEDEF and HAVE_USHORT_TYPEDEF is commented out +3. At ${ndk-root} run 'make APP=KeePassDroid' to build the native sources. diff --git a/jni_root/build.patch b/jni_root/build.patch new file mode 100644 index 000000000..0c46c00ad --- /dev/null +++ b/jni_root/build.patch @@ -0,0 +1,302 @@ +diff -Nru openssl-0.9.8l.orig/Android.mk openssl-0.9.8l/Android.mk +--- openssl-0.9.8l.orig/Android.mk 1969-12-31 18:00:00.000000000 -0600 ++++ openssl-0.9.8l/Android.mk 2009-12-02 19:19:38.458446809 -0600 +@@ -0,0 +1,3 @@ ++# Recursively sources all Android.mk files in subdirs: ++include $(call all-subdir-makefiles) ++ +diff -Nru openssl-0.9.8l.orig/crypto/Android.mk openssl-0.9.8l/crypto/Android.mk +--- openssl-0.9.8l.orig/crypto/Android.mk 1969-12-31 18:00:00.000000000 -0600 ++++ openssl-0.9.8l/crypto/Android.mk 2009-12-01 21:02:53.490604631 -0600 +@@ -0,0 +1,291 @@ ++LOCAL_PATH := $(call my-dir) ++ ++include $(CLEAR_VARS) ++ ++LOCAL_MODULE := openssl-crypto ++ ++LOCAL_SRC_FILES := \ ++ cryptlib.c \ ++ dyn_lck.c \ ++ mem_clr.c \ ++ mem.c \ ++ mem_dbg.c \ ++ cversion.c \ ++ ex_data.c \ ++ tmdiff.c \ ++ cpt_err.c \ ++ ebcdic.c \ ++ uid.c \ ++ o_time.c \ ++ o_str.c \ ++ o_dir.c \ ++ o_init.c \ ++ fips_err.c \ ++ aes/aes_misc.c \ ++ aes/aes_ecb.c \ ++ aes/aes_cfb.c \ ++ aes/aes_ofb.c \ ++ aes/aes_ctr.c \ ++ aes/aes_ige.c \ ++ aes/aes_wrap.c \ ++ aes/aes_core.c \ ++ aes/aes_cbc.c \ ++ evp/encode.c \ ++ evp/digest.c \ ++ evp/dig_eng.c \ ++ evp/evp_enc.c \ ++ evp/evp_key.c \ ++ evp/evp_acnf.c \ ++ evp/evp_cnf.c \ ++ evp/e_des.c \ ++ evp/e_bf.c \ ++ evp/e_idea.c \ ++ evp/e_des3.c \ ++ evp/e_camellia.c \ ++ evp/e_rc4.c \ ++ evp/e_aes.c \ ++ evp/names.c \ ++ evp/e_seed.c \ ++ evp/e_xcbc_d.c \ ++ evp/e_rc2.c \ ++ evp/e_cast.c \ ++ evp/e_rc5.c \ ++ evp/enc_min.c \ ++ evp/m_null.c \ ++ evp/m_md2.c \ ++ evp/m_md4.c \ ++ evp/m_md5.c \ ++ evp/m_sha.c \ ++ evp/m_sha1.c \ ++ evp/m_dss.c \ ++ evp/m_dss1.c \ ++ evp/m_mdc2.c \ ++ evp/m_ripemd.c \ ++ evp/m_ecdsa.c \ ++ evp/p_open.c \ ++ evp/p_seal.c \ ++ evp/p_sign.c \ ++ evp/p_verify.c \ ++ evp/p_lib.c \ ++ evp/p_enc.c \ ++ evp/p_dec.c \ ++ evp/bio_md.c \ ++ evp/bio_b64.c \ ++ evp/bio_enc.c \ ++ evp/evp_err.c \ ++ evp/e_null.c \ ++ evp/c_all.c \ ++ evp/c_allc.c \ ++ evp/c_alld.c \ ++ evp/evp_lib.c \ ++ evp/bio_ok.c \ ++ evp/evp_pkey.c \ ++ evp/evp_pbe.c \ ++ evp/p5_crpt.c \ ++ evp/p5_crpt2.c \ ++ evp/e_old.c \ ++ engine/eng_err.c \ ++ engine/eng_lib.c \ ++ engine/eng_list.c \ ++ engine/eng_init.c \ ++ engine/eng_ctrl.c \ ++ engine/eng_table.c \ ++ engine/eng_pkey.c \ ++ engine/eng_fat.c \ ++ engine/eng_all.c \ ++ engine/tb_rsa.c \ ++ engine/tb_dsa.c \ ++ engine/tb_ecdsa.c \ ++ engine/tb_dh.c \ ++ engine/tb_ecdh.c \ ++ engine/tb_rand.c \ ++ engine/tb_store.c \ ++ engine/tb_cipher.c \ ++ engine/tb_digest.c \ ++ engine/eng_openssl.c \ ++ engine/eng_cnf.c \ ++ engine/eng_dyn.c \ ++ engine/eng_cryptodev.c \ ++ engine/eng_padlock.c \ ++ err/err.c \ ++ err/err_def.c \ ++ err/err_all.c \ ++ err/err_prn.c \ ++ err/err_str.c \ ++ err/err_bio.c \ ++ stack/stack.c \ ++ lhash/lhash.c \ ++ lhash/lh_stats.c \ ++ buffer/buffer.c \ ++ buffer/buf_str.c \ ++ buffer/buf_err.c \ ++ rand/md_rand.c \ ++ rand/randfile.c \ ++ rand/rand_lib.c \ ++ rand/rand_eng.c \ ++ rand/rand_err.c \ ++ rand/rand_egd.c \ ++ rand/rand_win.c \ ++ rand/rand_unix.c \ ++ rand/rand_os2.c \ ++ rand/rand_nw.c \ ++ bio/bio_lib.c \ ++ bio/bio_cb.c \ ++ bio/bio_err.c \ ++ bio/bss_mem.c \ ++ bio/bss_null.c \ ++ bio/bss_fd.c \ ++ bio/bss_file.c \ ++ bio/bss_sock.c \ ++ bio/bss_conn.c \ ++ bio/bf_null.c \ ++ bio/bf_buff.c \ ++ bio/b_print.c \ ++ bio/b_dump.c \ ++ bio/b_sock.c \ ++ bio/bss_acpt.c \ ++ bio/bf_nbio.c \ ++ bio/bss_log.c \ ++ bio/bss_bio.c \ ++ bio/bss_dgram.c \ ++ objects/o_names.c \ ++ objects/obj_dat.c \ ++ objects/obj_lib.c \ ++ objects/obj_err.c \ ++ sha/sha_dgst.c \ ++ sha/sha1dgst.c \ ++ sha/sha_one.c \ ++ sha/sha1_one.c \ ++ sha/sha256.c \ ++ sha/sha512.c \ ++ rsa/rsa_eay.c \ ++ rsa/rsa_gen.c \ ++ rsa/rsa_lib.c \ ++ rsa/rsa_sign.c \ ++ rsa/rsa_saos.c \ ++ rsa/rsa_err.c \ ++ rsa/rsa_pk1.c \ ++ rsa/rsa_ssl.c \ ++ rsa/rsa_none.c \ ++ rsa/rsa_oaep.c \ ++ rsa/rsa_chk.c \ ++ rsa/rsa_null.c \ ++ rsa/rsa_pss.c \ ++ rsa/rsa_x931.c \ ++ rsa/rsa_x931g.c \ ++ rsa/rsa_asn1.c \ ++ rsa/rsa_depr.c \ ++ rsa/rsa_eng.c \ ++ bn/bn_add.c \ ++ bn/bn_div.c \ ++ bn/bn_exp.c \ ++ bn/bn_lib.c \ ++ bn/bn_ctx.c \ ++ bn/bn_mul.c \ ++ bn/bn_mod.c \ ++ bn/bn_print.c \ ++ bn/bn_rand.c \ ++ bn/bn_shift.c \ ++ bn/bn_word.c \ ++ bn/bn_blind.c \ ++ bn/bn_kron.c \ ++ bn/bn_sqrt.c \ ++ bn/bn_gcd.c \ ++ bn/bn_prime.c \ ++ bn/bn_err.c \ ++ bn/bn_sqr.c \ ++ bn/bn_asm.c \ ++ bn/bn_recp.c \ ++ bn/bn_mont.c \ ++ bn/bn_mpi.c \ ++ bn/bn_exp2.c \ ++ bn/bn_gf2m.c \ ++ bn/bn_nist.c \ ++ bn/bn_depr.c \ ++ bn/bn_x931p.c \ ++ bn/bn_const.c \ ++ bn/bn_opt.c \ ++ asn1/a_object.c \ ++ asn1/a_bitstr.c \ ++ asn1/a_utctm.c \ ++ asn1/a_gentm.c \ ++ asn1/a_time.c \ ++ asn1/a_int.c \ ++ asn1/a_octet.c \ ++ asn1/a_print.c \ ++ asn1/a_type.c \ ++ asn1/a_set.c \ ++ asn1/a_dup.c \ ++ asn1/a_d2i_fp.c \ ++ asn1/a_i2d_fp.c \ ++ asn1/a_enum.c \ ++ asn1/a_utf8.c \ ++ asn1/a_sign.c \ ++ asn1/a_digest.c \ ++ asn1/a_verify.c \ ++ asn1/a_mbstr.c \ ++ asn1/a_strex.c \ ++ asn1/x_algor.c \ ++ asn1/x_val.c \ ++ asn1/x_pubkey.c \ ++ asn1/x_sig.c \ ++ asn1/x_req.c \ ++ asn1/x_attrib.c \ ++ asn1/x_bignum.c \ ++ asn1/x_long.c \ ++ asn1/x_name.c \ ++ asn1/x_x509.c \ ++ asn1/x_x509a.c \ ++ asn1/x_crl.c \ ++ asn1/x_info.c \ ++ asn1/x_spki.c \ ++ asn1/nsseq.c \ ++ asn1/d2i_pu.c \ ++ asn1/d2i_pr.c \ ++ asn1/i2d_pu.c \ ++ asn1/i2d_pr.c \ ++ asn1/t_req.c \ ++ asn1/t_x509.c \ ++ asn1/t_x509a.c \ ++ asn1/t_crl.c \ ++ asn1/t_pkey.c \ ++ asn1/t_spki.c \ ++ asn1/t_bitst.c \ ++ asn1/tasn_new.c \ ++ asn1/tasn_fre.c \ ++ asn1/tasn_enc.c \ ++ asn1/tasn_dec.c \ ++ asn1/tasn_utl.c \ ++ asn1/tasn_typ.c \ ++ asn1/f_int.c \ ++ asn1/f_string.c \ ++ asn1/n_pkey.c \ ++ asn1/f_enum.c \ ++ asn1/a_hdr.c \ ++ asn1/x_pkey.c \ ++ asn1/a_bool.c \ ++ asn1/x_exten.c \ ++ asn1/asn_mime.c \ ++ asn1/asn1_gen.c \ ++ asn1/asn1_par.c \ ++ asn1/asn1_lib.c \ ++ asn1/asn1_err.c \ ++ asn1/a_meth.c \ ++ asn1/a_bytes.c \ ++ asn1/a_strnid.c \ ++ asn1/evp_asn1.c \ ++ asn1/asn_pack.c \ ++ asn1/p5_pbe.c \ ++ asn1/p5_pbev2.c \ ++ asn1/p8_pkey.c \ ++ asn1/asn_moid.c \ ++ ++ ++ ++ ++ ++LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. $(LOCAL_PATH)/../include ++ ++LOCAL_CFLAGS := -DNO_WINDOWS_BRAINDEATH ++ ++include $(BUILD_STATIC_LIBRARY) diff --git a/jni_root/prep_build.sh b/jni_root/prep_build.sh new file mode 100644 index 000000000..0b6ba8d36 --- /dev/null +++ b/jni_root/prep_build.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +FILE="openssl-0.9.8l.tar.gz" +EXTRACT_PATH=project/jni/ +PATCH=build.patch + +ln -s ../ project +curl http://www.openssl.org/source/$FILE > $FILE +tar xzf $FILE -C $EXTRACT_PATH +patch -p1 -d $EXTRACT_PATH/openssl-0.9.8l < $PATCH