From d211007aba2163e47aef499747939bd184fa39e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 24 May 2012 15:34:22 +0200 Subject: [PATCH] Add port of OpenSSL to libports This commit contains the initial port of OpenSSL to Genode. It certainly needs some more work to get things straight - it compiles fine but does not work because of a NULL pointer exception. --- .gitignore | 5 + libports/lib/mk/libcrypto.mk | 225 ++++++++++++++++++ libports/lib/mk/libssl.mk | 36 +++ libports/ports/openssl.mk | 67 ++++++ .../lib/openssl/x86_32/openssl/opensslconf.h | 225 ++++++++++++++++++ .../lib/openssl/x86_64/openssl/opensslconf.h | 225 ++++++++++++++++++ .../src/test/libports/libcrypto/target.mk | 5 + libports/src/test/libports/libssl/target.mk | 5 + 8 files changed, 793 insertions(+) create mode 100644 libports/lib/mk/libcrypto.mk create mode 100644 libports/lib/mk/libssl.mk create mode 100644 libports/ports/openssl.mk create mode 100644 libports/src/lib/openssl/x86_32/openssl/opensslconf.h create mode 100644 libports/src/lib/openssl/x86_64/openssl/opensslconf.h create mode 100644 libports/src/test/libports/libcrypto/target.mk create mode 100644 libports/src/test/libports/libssl/target.mk diff --git a/.gitignore b/.gitignore index dadb3267b0..02a9011b92 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,11 @@ /libports/include/ncurses/tic.h /libports/include/ncurses/unctrl.h /libports/include/openjpeg +/libports/include/openssl +/libports/src/lib/openssl/x86_32/aes_enc.s +/libports/src/lib/openssl/x86_32/cpuid.s +/libports/src/lib/openssl/x86_64/aes_enc.s +/libports/src/lib/openssl/x86_64/cpuid.s /libports/include/python2.6 /libports/include/qoost /libports/include/readline/keymaps.h diff --git a/libports/lib/mk/libcrypto.mk b/libports/lib/mk/libcrypto.mk new file mode 100644 index 0000000000..4612657ce1 --- /dev/null +++ b/libports/lib/mk/libcrypto.mk @@ -0,0 +1,225 @@ +LIBCRYPTO = libcrypto-1.0.0 +LIBCRYPTO_DIR = $(REP_DIR)/contrib/openssl-1.0.1b/crypto + +# +# ARM is not supported currently (needs testing) +# +REQUIRES = x86 + +SHARED_LIB = yes + +LIBS += libc + +CC_OPT += -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DL_ENDIAN -DTERMIOS + +# +# crypto base source +# +# Removed 'mem_clr.c' from the list because this function is provided by +# 'src/lib/openssl/x86_32/cpuid.s'. +# +SRC_C = cryptlib.c mem.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 o_fips.c o_init.c fips_ers.c + +# +# Excluded 'aes_x86core.c' +# +SRC_C_aes = aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c \ + aes_ofb.c aes_ctr.c aes_ige.c aes_wrap.c +SRC_C_asn1 = a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c \ + a_int.c a_octet.c a_print.c a_type.c a_set.c a_dup.c \ + a_d2i_fp.c a_i2d_fp.c a_enum.c a_utf8.c a_sign.c \ + a_digest.c a_verify.c a_mbstr.c a_strex.c x_algor.c \ + x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c \ + x_bignum.c x_long.c x_name.c x_x509.c x_x509a.c \ + x_crl.c x_info.c x_spki.c nsseq.c x_nx509.c d2i_pu.c \ + d2i_pr.c i2d_pu.c i2d_pr.c t_req.c t_x509.c \ + t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \ + tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c \ + tasn_utl.c tasn_typ.c tasn_prn.c ameth_lib.c f_int.c \ + f_string.c n_pkey.c f_enum.c x_pkey.c a_bool.c \ + x_exten.c bio_asn1.c bio_ndef.c asn_mime.c \ + asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c \ + a_bytes.c a_strnid.c evp_asn1.c asn_pack.c p5_pbe.c \ + p5_pbev2.c p8_pkey.c asn_moid.c) +SRC_C_bf = bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c bf_enc.c +SRC_C_bio = bio_lib.c bio_cb.c bio_err.c \ + bss_mem.c bss_null.c bss_fd.c \ + bss_file.c bss_sock.c bss_conn.c \ + bf_null.c bf_buff.c b_print.c b_dump.c \ + b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c \ + bss_dgram.c +SRC_C_bn = bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \ + bn_mod.c bn_print.c bn_rand.c bn_shift.c bn_word.c \ + bn_blind.c bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c \ + bn_err.c bn_sqr.c bn_asm.c bn_recp.c bn_mont.c \ + bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c bn_depr.c \ + bn_const.c bn_x931p.c bn_asm.c +SRC_C_buffer = buffer.c buf_err.c buf_str.c + +# +# camellia (x86 only?) +# +SRC_C_camellia = camellia.c cmll_misc.c cmll_ecb.c cmll_cbc.c \ + cmll_ofb.c cmll_cfb.c cmll_ctr.c cmll_utl.c +SRC_C_cast = c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c +SRC_C_cmac = cm_ameth.c cm_pmeth.c cmac.c +SRC_C_cms = cms_lib.c cms_asn1.c cms_att.c cms_io.c cms_smime.c \ + cms_err.c cms_sd.c cms_dd.c cms_cd.c cms_env.c \ + cms_enc.c cms_ess.c cms_pwri.c +SRC_C_comp = comp_lib.c comp_err.c c_rle.c c_zlib.c +SRC_C_conf = conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c \ + conf_mall.c conf_sap.c +SRC_C_des = cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ + ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c fcrypt.c \ + ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c \ + rpc_enc.c set_key.c des_enc.c fcrypt_b.c xcbc_enc.c \ + str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c \ + des_old.c des_old2.c read2pwd.c +SRC_C_dh = dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c \ + dh_err.c dh_depr.c dh_ameth.c dh_pmeth.c dh_prn.c +SRC_C_dsa = dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c \ + dsa_sign.c dsa_err.c dsa_ossl.c dsa_depr.c \ + dsa_ameth.c dsa_pmeth.c dsa_prn.c +SRC_C_dso = dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \ + dso_openssl.c +SRC_C_ec = ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c \ + ec_mult.c ec_err.c ec_curve.c ec_check.c ec_print.c \ + ec_asn1.c ec_key.c ec2_smpl.c ec2_mult.c ec_ameth.c \ + ec_pmeth.c eck_prn.c ecp_nistp224.c ecp_nistp256.c \ + ecp_nistp521.c ecp_nistputil.c ecp_oct.c ec2_oct.c \ + ec_oct.c +SRC_C_ecdh = ech_lib.c ech_ossl.c ech_key.c ech_err.c +SRC_C_ecdsa = ecs_lib.c ecs_asn1.c ecs_ossl.c ecs_sign.c \ + ecs_vrf.c ecs_err.c +SRC_C_engine = eng_err.c eng_lib.c eng_list.c eng_init.c \ + eng_ctrl.c eng_table.c eng_pkey.c eng_fat.c \ + eng_all.c tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c \ + tb_ecdh.c tb_rand.c tb_store.c tb_cipher.c \ + tb_digest.c tb_pkmeth.c tb_asnmth.c eng_openssl.c \ + eng_cnf.c eng_dyn.c eng_cryptodev.c eng_rsax.c \ + eng_rdrand.c +SRC_C_err = err.c err_all.c err_prn.c + +# +# evp (e_camellia.c x86 only?) +# +SRC_C_evp = encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ + e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c e_rc4.c \ + e_aes.c names.c e_seed.c e_xcbc_d.c e_rc2.c e_cast.c \ + e_rc5.c m_null.c m_md2.c m_md4.c m_md5.c m_sha.c \ + m_sha1.c m_wp.c m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \ + m_ecdsa.c p_open.c p_seal.c p_sign.c p_verify.c \ + p_lib.c p_enc.c p_dec.c bio_md.c bio_b64.c bio_enc.c \ + evp_err.c e_null.c c_all.c c_allc.c c_alld.c \ + evp_lib.c bio_ok.c evp_pkey.c evp_pbe.c p5_crpt.c \ + p5_crpt2.c e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c \ + m_sigver.c evp_fips.c e_aes_cbc_hmac_sha1.c \ + e_rc4_hmac_md5.c + +SRC_C_hmac = hmac.c hm_ameth.c hm_pmeth.c +SRC_C_idea = i_cbc.c i_cfb64.c i_ecb.c i_ofb64.c i_skey.c +SRC_C_krb5 = krb5_asn.c +SRC_C_lhash = lhash.c lh_stats.c +SRC_C_md2 = md2_dgst.c md2_one.c +SRC_C_md4 = md4_dgst.c md4_one.c +SRC_C_md5 = md5_dgst.c md5_one.c +SRC_C_mdc2 = mdc2_one.c mdc2dgst.c +SRC_C_objects = o_names.c obj_dat.c obj_err.c obj_lib.c obj_xref.c +SRC_C_modes = cbc128.c ctr128.c cts128.c cfb128.c ofb128.c \ + gcm128.c ccm128.c xts128.c +SRC_C_ocsp = ocsp_asn.c ocsp_ext.c ocsp_ht.c ocsp_lib.c \ + ocsp_cl.c ocsp_srv.c ocsp_prn.c ocsp_vfy.c \ + ocsp_err.c +SRC_C_pem = pem_sign.c pem_seal.c pem_info.c pem_lib.c \ + pem_all.c pem_err.c pem_x509.c pem_xaux.c \ + pem_oth.c pem_pk8.c pem_pkey.c pvkfmt.c +SRC_C_pkcs12 = p12_add.c p12_asn.c p12_attr.c p12_crpt.c \ + p12_crt.c p12_decr.c p12_init.c p12_key.c \ + p12_kiss.c p12_mutl.c p12_utl.c p12_npas.c \ + pk12err.c p12_p8d.c p12_p8e.c +SRC_C_pkcs7 = pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c \ + pk7_smime.c pk7_attr.c pk7_mime.c bio_pk7.c +SRC_C_pqueue = pqueue.c +SRC_C_rand = md_rand.c randfile.c rand_lib.c rand_err.c \ + rand_egd.c rand_win.c rand_unix.c rand_os2.c \ + rand_nw.c +SRC_C_rc2 = rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c +SRC_C_rc4 = rc4_skey.c rc4_enc.c rc4_utl.c +SRC_C_rc5 = rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c +SRC_C_ripemd = rmd_dgst.c rmd_one.c +SRC_C_rsa = rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c \ + rsa_err.c rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c \ + rsa_chk.c rsa_null.c rsa_pss.c rsa_x931.c rsa_asn1.c \ + rsa_depr.c rsa_ameth.c rsa_prn.c rsa_pmeth.c \ + rsa_crpt.c +SRC_C_seed = seed.c seed_ecb.c seed_cbc.c seed_cfb.c seed_ofb.c +SRC_C_sha = sha_dgst.c sha1dgst.c sha_one.c sha1_one.c sha256.c \ + sha512.c +SRC_C_srp = srp_lib.c srp_vfy.c +SRC_C_stack = stack.c +SRC_C_store = str_err.c str_lib.c str_meth.c str_mem.c +#SRC_C_threads = th-lock.c +SRC_C_ts = ts_err.c ts_req_utils.c ts_req_print.c ts_rsp_utils.c \ + ts_rsp_print.c ts_rsp_sign.c ts_rsp_verify.c \ + ts_verify_ctx.c ts_lib.c ts_conf.c ts_asn1.c +SRC_C_txt_db = txt_db.c +SRC_C_ui = ui_err.c ui_lib.c ui_openssl.c ui_util.c ui_compat.c +SRC_C_whrlpool = wp_dgst.c wp_block.c +SRC_C_x509 = x509_def.c x509_d2.c x509_r2x.c x509_cmp.c \ + x509_obj.c x509_req.c x509spki.c x509_vfy.c \ + x509_set.c x509cset.c x509rset.c x509_err.c \ + x509name.c x509_v3.c x509_ext.c x509_att.c \ + x509type.c x509_lu.c x_all.c x509_txt.c x509_trs.c \ + by_file.c by_dir.c x509_vpm.c +SRC_C_x509v3 = v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c \ + v3_ia5.c v3_lib.c v3_prn.c v3_utl.c v3err.c \ + v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c \ + v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c \ + v3_purp.c v3_info.c v3_ocsp.c v3_akeya.c \ + v3_pmaps.c v3_pcons.c v3_ncons.c v3_pcia.c \ + v3_pci.c pcy_cache.c pcy_node.c pcy_data.c \ + pcy_map.c pcy_tree.c pcy_lib.c v3_asid.c \ + v3_addr.c + +SRC_DIR = aes asn1 bf bio bn buffer camellia cast cmac cms comp conf des dh \ + dsa dso ec ecdh ecdsa engine err evp hmac idea krb5 lhash md2 md4 md5 \ + mdc2 objects modes ocsp pem pkcs12 pkcs7 pqueue rand rc2 rc4 rc5 \ + ripemd rsa seed sha srp stack store ts txt_db ui whrlpool x509 x509v3 + +SRC_C += $(foreach dir,$(SRC_DIR),$(addprefix $(dir)/,$(SRC_C_$(dir)))) + +INC_DIR += $(LIBCRYPTO_DIR)/asn1 +INC_DIR += $(LIBCRYPTO_DIR)/evp +INC_DIR += $(LIBCRYPTO_DIR)/modes +INC_DIR += $(LIBCRYPTO_DIR) +INC_DIR += $(LIBCRYPTO_DIR)/../ + +CC_OPTS += -DL_ENDIAN + +ifeq ($(filter-out $(SPECS),x86_32),) +TARGET_CPUARCH=x86_32 +else ifeq ($(filter-out $(SPECS),x86_64),) +TARGET_CPUARCH=x86_64 +endif + +INC_DIR += $(REP_DIR)/src/lib/openssl/$(TARGET_CPUARCH)/ + +#SRC_S += $(REP_DIR)/src/lib/openssl/$(TARGET_CPUARCH)/aes_enc.s +SRC_S += cpuid.s + +# +# Generate buildinf.h +# +$(SRC_C:.c=.o): buildinf.h + +# Rules taken from FreeBSDs libcrypto/Makefile +buildinf.h: + $(VERBOSE)( echo "#ifndef MK1MF_BUILD"; \ + echo " /* auto-generated by libcrypto.mk for crypto/cversion.c */"; \ + echo " #define CFLAGS \"$(CC)\""; \ + echo " #define PLATFORM \"FreeBSD-$(TARGET_CPUARCH)\""; \ + echo "#endif" ) > $@ + +vpath %.s $(REP_DIR)/src/lib/openssl/$(TARGET_CPUARCH) +vpath %.c $(LIBCRYPTO_DIR) diff --git a/libports/lib/mk/libssl.mk b/libports/lib/mk/libssl.mk new file mode 100644 index 0000000000..0f2f979e9a --- /dev/null +++ b/libports/lib/mk/libssl.mk @@ -0,0 +1,36 @@ +LIBSSL = libssl-1.0.0 +LIBSSL_DIR = $(REP_DIR)/contrib/openssl-1.0.1b + +# +# ARM is not supported currently (needs testing) +# +REQUIRES = x86 + +LIBS += libc libcrypto + +SRC_C = s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c \ + s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c \ + s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c \ + t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c \ + d1_meth.c d1_srvr.c d1_clnt.c d1_lib.c d1_pkt.c \ + d1_both.c d1_enc.c d1_srtp.c \ + ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c \ + ssl_ciph.c ssl_stat.c ssl_rsa.c \ + ssl_asn1.c ssl_txt.c ssl_algs.c \ + bio_ssl.c ssl_err.c kssl.c tls_srp.c t1_reneg.c + +INC_DIR += $(LIBSSL_DIR)/ +INC_DIR += $(LIBSSL_DIR)/crypto + +ifeq ($(filter-out $(SPECS),x86_32),) +TARGET_CPUARCH=x86_32 +else ifeq ($(filter-out $(SPECS),x86_64),) +TARGET_CPUARCH=x86_64 +endif + +INC_DIR += $(REP_DIR)/src/lib/openssl/$(TARGET_CPUARCH)/ + + +vpath %.c $(LIBSSL_DIR)/ssl + +SHARED_LIB = yes diff --git a/libports/ports/openssl.mk b/libports/ports/openssl.mk new file mode 100644 index 0000000000..f24089ae8a --- /dev/null +++ b/libports/ports/openssl.mk @@ -0,0 +1,67 @@ +OPENSSL_VERSION = 1.0.1b +OPENSSL = openssl-$(OPENSSL_VERSION) +OPENSSL_TGZ = $(OPENSSL).tar.gz +OPENSSL_URL = https://www.openssl.org/source/$(OPENSSL_TGZ) + +# local openssl src +OPENSSL_SRC = src/lib/openssl + +# +# Interface to top-level prepare Makefile +# +PORTS += $(OPENSSL) + +prepare-openssl: $(CONTRIB_DIR)/$(OPENSSL) include/openssl generate_asm + +#$(CONTRIB_DIR)/$(OPENSSL): + +# +# Port-specific local rules +# +$(DOWNLOAD_DIR)/$(OPENSSL_TGZ): + $(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(OPENSSL_URL) && touch $@ + +$(CONTRIB_DIR)/$(OPENSSL): $(DOWNLOAD_DIR)/$(OPENSSL_TGZ) + $(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@ + +# +# Generate ASM codes +# + +generate_asm: $(OPENSSL_SRC)/x86_32/cpuid.s $(OPENSSL_SRC)/x86_64/cpuid.s \ + $(OPENSSL_SRC)/x86_32/aes_enc.s $(OPENSSL_SRC)/x86_64/aes_enc.s + +$(OPENSSL_SRC)/x86_32/cpuid.s: + $(VERBOSE)perl $(CONTRIB_DIR)/$(OPENSSL)/crypto/x86cpuid.pl elf \ + $(CONTRIB_DIR)/$(OPENSSEL)/crypto/perlasm/x86asm.pl elf > $@ + +$(OPENSSL_SRC)/x86_64/cpuid.s: + $(VERBOSE)perl $(CONTRIB_DIR)/$(OPENSSL)/crypto/x86_64cpuid.pl elf \ + $(CONTRIB_DIR)/$(OPENSSEL)/crypto/perlasm/x86asm.pl elf > $@ + +$(OPENSSL_SRC)/x86_32/aes_enc.s: + $(VERBOSE)perl $(CONTRIB_DIR)/$(OPENSSL)/crypto/aes/asm/aes-586.pl elf \ + $(CONTRIB_DIR)/$(OPENSSEL)/crypto/perlasm/x86asm.pl elf > $@ + +$(OPENSSL_SRC)/x86_64/aes_enc.s: + $(VERBOSE)perl $(CONTRIB_DIR)/$(OPENSSL)/crypto/aes/asm/aes-x86_64.pl elf \ + $(CONTRIB_DIR)/$(OPENSSEL)/crypto/perlasm/x86asm.pl elf > $@ + + +# +# Install openssl headers +# +include/openssl: + $(VERBOSE)mkdir -p $@ + $(VERBOSE)for i in `find $(CONTRIB_DIR)/$(OPENSSL)/include -name *.h`; do \ + ln -fs ../../$$i include/openssl/; done + $(VERBOSE)rm include/openssl/opensslconf.h + $(VERBOSE)ln -fs ../../$(CONTRIB_DIR)/$(OPENSSL)/e_os.h include/openssl/ + $(VERBOSE)ln -fs ../../$(CONTRIB_DIR)/$(OPENSSL)/crypto/md2/md2.h include/openssl/ + $(VERBOSE)ln -fs ../../$(CONTRIB_DIR)/$(OPENSSL)/crypto/rc5/rc5.h include/openssl/ + $(VERBOSE)ln -fs ../../$(CONTRIB_DIR)/$(OPENSSL)/crypto/store/store.h include/openssl/ + +clean-openssl: + $(VERBOSE)rm -rf include/OPENSSL + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(OPENSSL) + $(VERBOSE)rm -rf $(OPENSSL_SRC)/x86_32/*.s $(OPENSSL_SRC)/x86_64/*.s diff --git a/libports/src/lib/openssl/x86_32/openssl/opensslconf.h b/libports/src/lib/openssl/x86_32/openssl/opensslconf.h new file mode 100644 index 0000000000..351277af73 --- /dev/null +++ b/libports/src/lib/openssl/x86_32/openssl/opensslconf.h @@ -0,0 +1,225 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_DOING_MAKEDEPEND + + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_GMP +# define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_JPAKE +# define OPENSSL_NO_JPAKE +#endif +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_RFC3779 +# define OPENSSL_NO_RFC3779 +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_NO_STATIC_ENGINE +# define OPENSSL_NO_STATIC_ENGINE +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) +# define NO_EC_NISTP_64_GCC_128 +# endif +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +# define NO_GMP +# endif +# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) +# define NO_JPAKE +# endif +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) +# define NO_MD2 +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) +# define NO_RFC3779 +# endif +# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) +# define NO_SCTP +# endif +# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) +# define NO_STORE +# endif +#endif + +#define OPENSSL_CPUID_OBJ + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR "/usr/lib/engines" +#define OPENSSLDIR "/etc/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#undef RC4_CHUNK +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned long +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#define BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#define RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#define DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#define DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#define DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ diff --git a/libports/src/lib/openssl/x86_64/openssl/opensslconf.h b/libports/src/lib/openssl/x86_64/openssl/opensslconf.h new file mode 100644 index 0000000000..1dbcd76b85 --- /dev/null +++ b/libports/src/lib/openssl/x86_64/openssl/opensslconf.h @@ -0,0 +1,225 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_DOING_MAKEDEPEND + + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_GMP +# define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_JPAKE +# define OPENSSL_NO_JPAKE +#endif +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_RFC3779 +# define OPENSSL_NO_RFC3779 +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_NO_STATIC_ENGINE +# define OPENSSL_NO_STATIC_ENGINE +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) +# define NO_EC_NISTP_64_GCC_128 +# endif +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +# define NO_GMP +# endif +# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) +# define NO_JPAKE +# endif +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) +# define NO_MD2 +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) +# define NO_RFC3779 +# endif +# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) +# define NO_SCTP +# endif +# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) +# define NO_STORE +# endif +#endif + +#define OPENSSL_CPUID_OBJ + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR "/usr/lib/engines" +#define OPENSSLDIR "/etc/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#define RC4_CHUNK unsigned long +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned int +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#undef BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +#define SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#undef THIRTY_TWO_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#define DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ diff --git a/libports/src/test/libports/libcrypto/target.mk b/libports/src/test/libports/libcrypto/target.mk new file mode 100644 index 0000000000..6264e1648e --- /dev/null +++ b/libports/src/test/libports/libcrypto/target.mk @@ -0,0 +1,5 @@ +TARGET = test-libcrypto +LIBS = cxx env libcrypto +SRC_CC = main.cc + +vpath main.cc $(PRG_DIR)/.. diff --git a/libports/src/test/libports/libssl/target.mk b/libports/src/test/libports/libssl/target.mk new file mode 100644 index 0000000000..b64b57834c --- /dev/null +++ b/libports/src/test/libports/libssl/target.mk @@ -0,0 +1,5 @@ +TARGET = test-libssl +LIBS = cxx env libcrypto libssl +SRC_CC = main.cc + +vpath main.cc $(PRG_DIR)/..