1# $FreeBSD$ 2 3SHLIBDIR?= /lib 4SUBDIR= engines 5 6.include <bsd.own.mk> 7 8LIB= crypto 9SHLIB_MAJOR= 7 10ALLOW_SHARED_TEXTREL= 11 12NO_LINT= 13 14.if exists(Makefile.man) 15.include "Makefile.man" 16.endif 17.if defined(NOTYET) 18MAN+= config.5 des_modes.7 19.endif 20 21.include "Makefile.inc" 22 23# base sources 24SRCS= cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \ 25 o_fips.c o_init.c o_str.c o_time.c uid.c 26.if ${MACHINE_CPUARCH} == "amd64" 27SRCS+= x86_64cpuid.S 28.elif ${MACHINE_CPUARCH} == "i386" 29SRCS+= x86cpuid.s 30.else 31SRCS+= mem_clr.c 32.endif 33INCS+= crypto.h ebcdic.h opensslv.h ossl_typ.h symhacks.h ../e_os2.h 34 35# aes 36SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c 37.if ${MACHINE_CPUARCH} == "amd64" 38SRCS+= aes-x86_64.S aesni-sha1-x86_64.S aesni-x86_64.S bsaes-x86_64.S \ 39 vpaes-x86_64.S 40.elif ${MACHINE_CPUARCH} == "i386" 41SRCS+= aes-586.s aesni-x86.s vpaes-x86.s 42.else 43SRCS+= aes_cbc.c aes_core.c 44.endif 45INCS+= aes.h 46 47# asn1 48SRCS+= a_bitstr.c a_bool.c a_bytes.c a_d2i_fp.c a_digest.c a_dup.c a_enum.c \ 49 a_gentm.c a_i2d_fp.c a_int.c a_mbstr.c a_object.c a_octet.c a_print.c \ 50 a_set.c a_sign.c a_strex.c a_strnid.c a_time.c a_type.c a_utctm.c \ 51 a_utf8.c a_verify.c ameth_lib.c asn1_err.c asn1_gen.c asn1_lib.c \ 52 asn1_par.c asn_mime.c asn_moid.c asn_pack.c bio_asn1.c bio_ndef.c \ 53 d2i_pr.c d2i_pu.c evp_asn1.c f_enum.c f_int.c f_string.c i2d_pr.c \ 54 i2d_pu.c n_pkey.c nsseq.c p5_pbe.c p5_pbev2.c p8_pkey.c t_bitst.c \ 55 t_crl.c t_pkey.c t_req.c t_spki.c t_x509.c t_x509a.c tasn_dec.c \ 56 tasn_enc.c tasn_fre.c tasn_new.c tasn_prn.c tasn_typ.c tasn_utl.c \ 57 x_algor.c x_attrib.c x_bignum.c x_crl.c x_exten.c x_info.c x_long.c \ 58 x_name.c x_nx509.c x_pkey.c x_pubkey.c x_req.c x_sig.c x_spki.c \ 59 x_val.c x_x509.c x_x509a.c 60INCS+= asn1.h asn1_mac.h asn1t.h 61 62# bf 63SRCS+= bf_cfb64.c bf_ecb.c bf_ofb64.c bf_skey.c 64.if ${MACHINE_CPUARCH} == "i386" 65.if ${MACHINE_CPU:Mi686} 66SRCS+= bf-686.s 67.else 68SRCS+= bf-586.s 69.endif 70.else 71SRCS+= bf_enc.c 72.endif 73INCS+= blowfish.h 74 75# bio 76SRCS+= b_dump.c b_print.c b_sock.c bf_buff.c bf_nbio.c bf_null.c bio_cb.c \ 77 bio_err.c bio_lib.c bss_acpt.c bss_bio.c bss_conn.c bss_dgram.c \ 78 bss_fd.c bss_file.c bss_log.c bss_mem.c bss_null.c bss_sock.c 79INCS+= bio.h 80 81# bn 82SRCS+= bn_add.c bn_blind.c bn_const.c bn_ctx.c bn_depr.c bn_div.c bn_err.c \ 83 bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_kron.c bn_lib.c bn_mod.c \ 84 bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c bn_print.c bn_rand.c \ 85 bn_recp.c bn_shift.c bn_sqr.c bn_sqrt.c bn_word.c bn_x931p.c 86.if ${MACHINE_CPUARCH} == "amd64" 87SRCS+= modexp512-x86_64.S x86_64-gcc.c x86_64-gf2m.S x86_64-mont.S \ 88 x86_64-mont5.S 89.elif ${MACHINE_CPUARCH} == "i386" 90SRCS+= bn-586.s co-586.s x86-gf2m.s x86-mont.s 91.else 92SRCS+= bn_asm.c 93.endif 94INCS+= bn.h 95 96# buffer 97SRCS+= buf_err.c buf_str.c buffer.c 98INCS+= buffer.h 99 100# camellia 101SRCS+= cmll_cfb.c cmll_ctr.c cmll_ecb.c cmll_ofb.c cmll_utl.c 102.if ${MACHINE_CPUARCH} == "amd64" 103SRCS+= cmll_misc.c cmll-x86_64.S 104.elif ${MACHINE_CPUARCH} == "i386" 105SRCS+= cmll-x86.s 106.else 107SRCS+= camellia.c cmll_cbc.c cmll_misc.c 108.endif 109INCS+= camellia.h 110 111# cast 112SRCS+= c_cfb64.c c_ecb.c c_enc.c c_ofb64.c c_skey.c 113INCS+= cast.h 114 115# cmac 116SRCS+= cm_ameth.c cm_pmeth.c cmac.c 117INCS+= cmac.h 118 119# cms 120SRCS+= cms_asn1.c cms_att.c cms_dd.c cms_enc.c cms_env.c cms_err.c \ 121 cms_ess.c cms_io.c cms_lib.c cms_pwri.c cms_sd.c cms_smime.c 122INCS+= cms.h 123 124# comp 125SRCS+= c_rle.c c_zlib.c comp_err.c comp_lib.c 126INCS+= comp.h 127 128# conf 129SRCS+= conf_api.c conf_def.c conf_err.c conf_lib.c conf_mall.c conf_mod.c \ 130 conf_sap.c 131INCS+= conf.h conf_api.h 132 133# des 134SRCS+= cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c des_old.c \ 135 des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c enc_read.c enc_writ.c \ 136 fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c \ 137 rand_key.c read2pwd.c rpc_enc.c set_key.c str2key.c xcbc_enc.c 138.if ${MACHINE_CPUARCH} == "i386" 139SRCS+= crypt586.s des-586.s 140.else 141SRCS+= des_enc.c fcrypt_b.c 142.endif 143INCS+= des.h des_old.h 144 145# dh 146SRCS+= dh_ameth.c dh_asn1.c dh_check.c dh_depr.c dh_err.c dh_gen.c dh_key.c \ 147 dh_lib.c dh_pmeth.c dh_prn.c 148INCS+= dh.h 149 150# dsa 151SRCS+= dsa_ameth.c dsa_asn1.c dsa_depr.c dsa_err.c dsa_gen.c dsa_key.c \ 152 dsa_lib.c dsa_ossl.c dsa_pmeth.c dsa_prn.c dsa_sign.c dsa_vrf.c 153INCS+= dsa.h 154 155# dso 156SRCS+= dso_dlfcn.c dso_err.c dso_lib.c dso_openssl.c 157INCS+= dso.h 158 159# ec 160SRCS+= ec2_mult.c ec2_oct.c ec2_smpl.c ec_ameth.c ec_asn1.c ec_check.c \ 161 ec_curve.c ec_cvt.c ec_err.c ec_key.c ec_lib.c ec_mult.c ec_oct.c \ 162 ec_pmeth.c ec_print.c eck_prn.c ecp_mont.c ecp_nist.c ecp_oct.c \ 163 ecp_smpl.c 164INCS+= ec.h 165 166# ecdh 167SRCS+= ech_err.c ech_key.c ech_lib.c ech_ossl.c 168INCS+= ecdh.h 169 170# ecdsa 171SRCS+= ecs_asn1.c ecs_err.c ecs_lib.c ecs_ossl.c ecs_sign.c ecs_vrf.c 172INCS+= ecdsa.h 173 174# engine 175SRCS+= eng_all.c eng_cnf.c eng_cryptodev.c eng_ctrl.c eng_dyn.c eng_err.c \ 176 eng_fat.c eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c \ 177 eng_rdrand.c eng_rsax.c eng_table.c tb_asnmth.c tb_cipher.c tb_dh.c \ 178 tb_digest.c tb_dsa.c tb_ecdh.c tb_ecdsa.c tb_pkmeth.c tb_rand.c \ 179 tb_rsa.c tb_store.c 180INCS+= engine.h 181 182# err 183SRCS+= err.c err_all.c err_prn.c 184INCS+= err.h 185 186# evp 187SRCS+= bio_b64.c bio_enc.c bio_md.c bio_ok.c c_all.c c_allc.c c_alld.c \ 188 digest.c e_aes.c e_aes_cbc_hmac_sha1.c e_bf.c e_camellia.c e_cast.c \ 189 e_des.c e_des3.c e_idea.c e_null.c e_old.c e_rc2.c e_rc4.c \ 190 e_rc4_hmac_md5.c e_rc5.c e_seed.c e_xcbc_d.c encode.c evp_acnf.c \ 191 evp_cnf.c evp_enc.c evp_err.c evp_key.c evp_lib.c evp_pbe.c \ 192 evp_pkey.c m_dss.c m_dss1.c m_ecdsa.c m_md4.c m_md5.c m_mdc2.c \ 193 m_null.c m_ripemd.c m_sha.c m_sha1.c m_sigver.c m_wp.c names.c \ 194 p5_crpt.c p5_crpt2.c p_dec.c p_enc.c p_lib.c p_open.c p_seal.c \ 195 p_sign.c p_verify.c pmeth_fn.c pmeth_gn.c pmeth_lib.c 196INCS+= evp.h 197 198# hmac 199SRCS+= hm_ameth.c hm_pmeth.c hmac.c 200INCS+= hmac.h 201 202# idea 203SRCS+= i_cbc.c i_cfb64.c i_ecb.c i_ofb64.c i_skey.c 204INCS+= idea.h 205 206# krb5 207INCS+= krb5_asn.h 208 209# lhash 210SRCS+= lh_stats.c lhash.c 211INCS+= lhash.h 212 213# md4 214SRCS+= md4_dgst.c md4_one.c 215INCS+= md4.h 216 217# md5 218SRCS+= md5_dgst.c md5_one.c 219.if ${MACHINE_CPUARCH} == "amd64" 220SRCS+= md5-x86_64.S 221.elif ${MACHINE_CPUARCH} == "i386" 222SRCS+= md5-586.s 223.endif 224INCS+= md5.h 225 226# mdc2 227SRCS+= mdc2_one.c mdc2dgst.c 228INCS+= mdc2.h 229 230# modes 231SRCS+= cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c xts128.c 232.if ${MACHINE_CPUARCH} == "amd64" 233SRCS+= ghash-x86_64.S 234.elif ${MACHINE_CPUARCH} == "i386" 235SRCS+= ghash-x86.s 236.endif 237INCS+= modes.h 238 239# objects 240SRCS+= o_names.c obj_dat.c obj_err.c obj_lib.c obj_xref.c 241INCS+= obj_mac.h objects.h 242 243# ocsp 244SRCS+= ocsp_asn.c ocsp_cl.c ocsp_err.c ocsp_ext.c ocsp_ht.c ocsp_lib.c \ 245 ocsp_prn.c ocsp_srv.c ocsp_vfy.c 246INCS+= ocsp.h 247 248# pem 249SRCS+= pem_all.c pem_err.c pem_info.c pem_lib.c pem_oth.c pem_pk8.c \ 250 pem_pkey.c pem_seal.c pem_sign.c pem_x509.c pem_xaux.c pvkfmt.c 251INCS+= pem.h pem2.h 252 253# pkcs12 254SRCS+= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \ 255 p12_init.c p12_key.c p12_kiss.c p12_mutl.c p12_npas.c p12_p8d.c \ 256 p12_p8e.c p12_utl.c pk12err.c 257INCS+= pkcs12.h 258 259# pkcs7 260SRCS+= bio_pk7.c pk7_asn1.c pk7_attr.c pk7_doit.c pk7_lib.c pk7_mime.c \ 261 pk7_smime.c pkcs7err.c 262INCS+= pkcs7.h 263 264# pqueue 265SRCS+= pqueue.c 266INCS+= pqueue.h 267 268# rand 269SRCS+= md_rand.c rand_egd.c rand_err.c rand_lib.c rand_unix.c randfile.c 270INCS+= rand.h 271 272# rc2 273SRCS+= rc2_cbc.c rc2_ecb.c rc2_skey.c rc2cfb64.c rc2ofb64.c 274INCS+= rc2.h 275 276# rc4 277SRCS+= rc4_utl.c 278.if ${MACHINE_CPUARCH} == "amd64" 279SRCS+= rc4-md5-x86_64.S rc4-x86_64.S 280.elif ${MACHINE_CPUARCH} == "i386" 281SRCS+= rc4-586.s 282.else 283SRCS+= rc4_enc.c rc4_skey.c 284.endif 285INCS+= rc4.h 286 287# rc5 288SRCS+= rc5_ecb.c rc5_skey.c rc5cfb64.c rc5ofb64.c 289.if ${MACHINE_CPUARCH} == "i386" 290SRCS+= rc5-586.s 291.else 292SRCS+= rc5_enc.c 293.endif 294INCS+= rc5.h 295 296# ripemd 297SRCS+= rmd_dgst.c rmd_one.c 298.if ${MACHINE_CPUARCH} == "i386" 299SRCS+= rmd-586.s 300.endif 301INCS+= ripemd.h 302 303# rsa 304SRCS+= rsa_ameth.c rsa_asn1.c rsa_chk.c rsa_crpt.c rsa_depr.c rsa_eay.c \ 305 rsa_err.c rsa_gen.c rsa_lib.c rsa_none.c rsa_null.c rsa_oaep.c \ 306 rsa_pk1.c rsa_pmeth.c rsa_prn.c rsa_pss.c rsa_saos.c rsa_sign.c \ 307 rsa_ssl.c rsa_x931.c 308INCS+= rsa.h 309 310# seed 311SRCS+= seed.c seed_cbc.c seed_cfb.c seed_ecb.c seed_ofb.c 312INCS+= seed.h 313 314# sha 315SRCS+= sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c 316.if ${MACHINE_CPUARCH} == "amd64" 317SRCS+= sha1-x86_64.S sha256-x86_64.S sha512-x86_64.S 318.elif ${MACHINE_CPUARCH} == "i386" 319SRCS+= sha1-586.s sha256-586.s sha512-586.s 320.endif 321INCS+= sha.h 322 323# srp 324SRCS+= srp_lib.c srp_vfy.c 325INCS+= srp.h 326 327# stack 328SRCS+= stack.c 329INCS+= safestack.h stack.h 330 331# ts 332SRCS+= ts_asn1.c ts_conf.c ts_err.c ts_lib.c ts_req_print.c ts_req_utils.c \ 333 ts_rsp_print.c ts_rsp_sign.c ts_rsp_utils.c ts_rsp_verify.c \ 334 ts_verify_ctx.c 335INCS+= ts.h 336 337# txt_db 338SRCS+= txt_db.c 339INCS+= txt_db.h 340 341# ui 342SRCS+= ui_compat.c ui_err.c ui_lib.c ui_openssl.c ui_util.c 343INCS+= ui.h ui_compat.h 344 345# whrlpool 346SRCS+= wp_dgst.c 347.if ${MACHINE_CPUARCH} == "amd64" 348SRCS+= wp-x86_64.S 349.elif ${MACHINE_CPUARCH} == "i386" 350SRCS+= wp-mmx.s wp_block.c 351.else 352SRCS+= wp_block.c 353.endif 354INCS+= whrlpool.h 355 356# x509 357SRCS+= by_dir.c by_file.c x509_att.c x509_cmp.c x509_d2.c x509_def.c \ 358 x509_err.c x509_ext.c x509_lu.c x509_obj.c x509_r2x.c x509_req.c \ 359 x509_set.c x509_trs.c x509_txt.c x509_v3.c x509_vfy.c x509_vpm.c \ 360 x509cset.c x509name.c x509rset.c x509spki.c x509type.c x_all.c 361INCS+= x509.h x509_vfy.h 362 363# x509v3 364SRCS+= pcy_cache.c pcy_data.c pcy_lib.c pcy_map.c pcy_node.c pcy_tree.c \ 365 v3_addr.c v3_akey.c v3_akeya.c v3_alt.c v3_asid.c v3_bcons.c \ 366 v3_bitst.c v3_conf.c v3_cpols.c v3_crld.c v3_enum.c v3_extku.c \ 367 v3_genn.c v3_ia5.c v3_info.c v3_int.c v3_lib.c v3_ncons.c v3_ocsp.c \ 368 v3_pci.c v3_pcia.c v3_pcons.c v3_pku.c v3_pmaps.c v3_prn.c v3_purp.c \ 369 v3_skey.c v3_sxnet.c v3_utl.c v3err.c 370INCS+= x509v3.h 371 372SRCS+= buildinf.h 373INCS+= opensslconf.h 374INCSDIR= ${INCLUDEDIR}/openssl 375 376CSTD= gnu89 377 378CFLAGS+= -I${LCRYPTO_SRC}/crypto/asn1 379CFLAGS+= -I${LCRYPTO_SRC}/crypto/evp 380CFLAGS+= -I${LCRYPTO_SRC}/crypto/modes 381 382.if !empty(SRCS:M*.s) 383AFLAGS+= --noexecstack 384.endif 385.if !empty(SRCS:M*.S) 386ACFLAGS+= -Wa,--noexecstack 387.endif 388 389CLEANFILES= buildinf.h opensslconf.h 390 391buildinf.h: ${.CURDIR}/Makefile 392 ( echo "#ifndef MK1MF_BUILD"; \ 393 echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \ 394 echo " #define CFLAGS \"$(CC)\""; \ 395 echo " #define PLATFORM \"FreeBSD-${MACHINE_ARCH}\""; \ 396 echo "#endif" ) > ${.TARGET} 397 398.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 399opensslconf.h: opensslconf-x86.h 400.else 401opensslconf.h: opensslconf-${MACHINE_CPUARCH}.h 402.endif 403 cp -f ${.ALLSRC} ${.TARGET} 404 405OLDSYMLINKS+= libdes.a libdes.so libdes.so.3 libdes_p.a 406afterinstall: 407 @${ECHO} "Removing stale symlinks." 408 rm -f ${DESTDIR}${INCLUDEDIR}/des.h 409.for symlink in ${OLDSYMLINKS} 410 rm -f ${DESTDIR}${LIBDIR}/${symlink} 411.endfor 412 413.include <bsd.lib.mk> 414 415.if ${MACHINE_CPUARCH} == "amd64" 416.PATH: ${.CURDIR}/amd64 417.elif ${MACHINE_CPUARCH} == "i386" 418.PATH: ${.CURDIR}/i386 419.endif 420 421.if ${MACHINE_CPUARCH} == "amd64" 422_bn_asmpath= ${LCRYPTO_SRC}/crypto/bn/asm 423.endif 424 425.PATH: ${LCRYPTO_SRC}/crypto \ 426 ${LCRYPTO_SRC}/crypto/aes \ 427 ${LCRYPTO_SRC}/crypto/asn1 \ 428 ${LCRYPTO_SRC}/crypto/bf \ 429 ${LCRYPTO_SRC}/crypto/bio \ 430 ${LCRYPTO_SRC}/crypto/bn \ 431 ${_bn_asmpath} \ 432 ${LCRYPTO_SRC}/crypto/buffer \ 433 ${LCRYPTO_SRC}/crypto/camellia \ 434 ${LCRYPTO_SRC}/crypto/cast \ 435 ${LCRYPTO_SRC}/crypto/cmac \ 436 ${LCRYPTO_SRC}/crypto/cms \ 437 ${LCRYPTO_SRC}/crypto/comp \ 438 ${LCRYPTO_SRC}/crypto/conf \ 439 ${LCRYPTO_SRC}/crypto/des \ 440 ${LCRYPTO_SRC}/crypto/dh \ 441 ${LCRYPTO_SRC}/crypto/dsa \ 442 ${LCRYPTO_SRC}/crypto/dso \ 443 ${LCRYPTO_SRC}/crypto/ec \ 444 ${LCRYPTO_SRC}/crypto/ecdh \ 445 ${LCRYPTO_SRC}/crypto/ecdsa \ 446 ${LCRYPTO_SRC}/crypto/engine \ 447 ${LCRYPTO_SRC}/crypto/err \ 448 ${LCRYPTO_SRC}/crypto/evp \ 449 ${LCRYPTO_SRC}/crypto/hmac \ 450 ${LCRYPTO_SRC}/crypto/idea \ 451 ${LCRYPTO_SRC}/crypto/krb5 \ 452 ${LCRYPTO_SRC}/crypto/lhash \ 453 ${LCRYPTO_SRC}/crypto/md4 \ 454 ${LCRYPTO_SRC}/crypto/md5 \ 455 ${LCRYPTO_SRC}/crypto/mdc2 \ 456 ${LCRYPTO_SRC}/crypto/modes \ 457 ${LCRYPTO_SRC}/crypto/objects \ 458 ${LCRYPTO_SRC}/crypto/ocsp \ 459 ${LCRYPTO_SRC}/crypto/pem \ 460 ${LCRYPTO_SRC}/crypto/pkcs12 \ 461 ${LCRYPTO_SRC}/crypto/pkcs7 \ 462 ${LCRYPTO_SRC}/crypto/pqueue \ 463 ${LCRYPTO_SRC}/crypto/rand \ 464 ${LCRYPTO_SRC}/crypto/rc2 \ 465 ${LCRYPTO_SRC}/crypto/rc4 \ 466 ${LCRYPTO_SRC}/crypto/rc5 \ 467 ${LCRYPTO_SRC}/crypto/ripemd \ 468 ${LCRYPTO_SRC}/crypto/rsa \ 469 ${LCRYPTO_SRC}/crypto/seed \ 470 ${LCRYPTO_SRC}/crypto/sha \ 471 ${LCRYPTO_SRC}/crypto/srp \ 472 ${LCRYPTO_SRC}/crypto/stack \ 473 ${LCRYPTO_SRC}/crypto/ts \ 474 ${LCRYPTO_SRC}/crypto/txt_db \ 475 ${LCRYPTO_SRC}/crypto/ui \ 476 ${LCRYPTO_SRC}/crypto/whrlpool \ 477 ${LCRYPTO_SRC}/crypto/x509 \ 478 ${LCRYPTO_SRC}/crypto/x509v3 \ 479 ${.CURDIR}/man 480