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