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