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