xref: /freebsd/secure/lib/libcrypto/Makefile (revision 78ee8d1c4cdad7a56dbf50f1c8ade75531ce620c)
1# $FreeBSD$
2
3SHLIBDIR?=	/lib
4SUBDIR=		engines
5
6.include <bsd.own.mk>
7.include <src.opts.mk>
8
9PACKAGE=	openssl
10LIB=		crypto
11SHLIB_MAJOR=	111
12VERSION_MAP=	${.CURDIR}/Version.map
13
14NO_LINT=
15
16.include "Makefile.man"
17.include "Makefile.inc"
18
19SRCS=	cpt_err.c cryptlib.c ctype.c cversion.c ex_data.c getenv.c init.c
20SRCS+=	mem.c mem_dbg.c mem_sec.c o_dir.c o_fips.c o_fopen.c o_init.c
21SRCS+=	o_str.c o_time.c threads_pthread.c uid.c
22.if defined(ASM_aarch64)
23SRCS+=	arm64cpuid.S armcap.c
24ACFLAGS.arm64cpuid.S=	-march=armv8-a+crypto
25.elif defined(ASM_amd64)
26SRCS+=	x86_64cpuid.S
27.elif defined(ASM_arm)
28SRCS+=	armv4cpuid.S armcap.c
29.elif defined(ASM_i386)
30SRCS+=	x86cpuid.S
31.elif defined(ASM_powerpc)
32SRCS+=	ppccpuid.S ppccap.c
33.elif defined(ASM_powerpc64)
34SRCS+=	ppccpuid.S ppccap.c
35.elif defined(ASM_powerpc64le)
36SRCS+=	ppccpuid.S ppccap.c
37.else
38SRCS+=	mem_clr.c
39.endif
40
41# aes
42SRCS+=	aes_cbc.c aes_cfb.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c
43.if defined(ASM_aarch64)
44SRCS+=	aes_core.c aesv8-armx.S vpaes-armv8.S
45ACFLAGS.aesv8-armx.S=	-march=armv8-a+crypto
46.elif defined(ASM_amd64)
47SRCS+=	aes_core.c aesni-mb-x86_64.S aesni-sha1-x86_64.S aesni-sha256-x86_64.S
48SRCS+=	aesni-x86_64.S vpaes-x86_64.S
49.elif defined(ASM_arm)
50SRCS+=	aes-armv4.S aesv8-armx.S bsaes-armv7.S
51.elif defined(ASM_i386)
52SRCS+=	aes_core.c aesni-x86.S vpaes-x86.S
53.elif defined(ASM_powerpc)
54SRCS+=	aes_core.c aes-ppc.S vpaes-ppc.S aesp8-ppc.S
55.elif defined(ASM_powerpc64)
56SRCS+=	aes_core.c aes-ppc.S vpaes-ppc.S aesp8-ppc.S
57.elif defined(ASM_powerpc64le)
58SRCS+=	aes_core.c aes-ppc.S vpaes-ppc.S aesp8-ppc.S
59.else
60SRCS+=	aes_core.c
61.endif
62
63# aria
64SRCS+=	aria.c
65
66# asn1
67SRCS+=	a_bitstr.c a_d2i_fp.c a_digest.c a_dup.c a_gentm.c a_i2d_fp.c
68SRCS+=	a_int.c a_mbstr.c a_object.c a_octet.c a_print.c a_sign.c a_strex.c
69SRCS+=	a_strnid.c a_time.c a_type.c a_utctm.c a_utf8.c a_verify.c
70SRCS+=	ameth_lib.c asn1_err.c asn1_gen.c asn1_item_list.c asn1_lib.c
71SRCS+=	asn1_par.c asn_mime.c asn_moid.c asn_mstbl.c asn_pack.c bio_asn1.c
72SRCS+=	bio_ndef.c d2i_pr.c d2i_pu.c evp_asn1.c f_int.c f_string.c i2d_pr.c
73SRCS+=	i2d_pu.c n_pkey.c nsseq.c p5_pbe.c p5_pbev2.c p5_scrypt.c p8_pkey.c
74SRCS+=	t_bitst.c t_pkey.c t_spki.c tasn_dec.c tasn_enc.c tasn_fre.c
75SRCS+=	tasn_new.c tasn_prn.c tasn_scn.c tasn_typ.c tasn_utl.c x_algor.c
76SRCS+=	x_bignum.c x_info.c x_int64.c x_long.c x_pkey.c x_sig.c x_spki.c
77SRCS+=	x_val.c
78
79# async
80SRCS+=	async.c async_err.c async_posix.c async_wait.c
81
82# bf
83SRCS+=	bf_cfb64.c bf_ecb.c bf_ofb64.c bf_skey.c
84.if defined(ASM_i386)
85SRCS+=	bf-586.S
86.else
87SRCS+=	bf_enc.c
88.endif
89
90# bio
91SRCS+=	b_addr.c b_dump.c b_print.c b_sock.c b_sock2.c bf_buff.c bf_lbuf.c
92SRCS+=	bf_nbio.c bf_null.c bio_cb.c bio_err.c bio_lib.c bio_meth.c
93SRCS+=	bss_acpt.c bss_bio.c bss_conn.c bss_dgram.c bss_fd.c bss_file.c
94SRCS+=	bss_log.c bss_mem.c bss_null.c bss_sock.c
95
96# blake2
97SRCS+=	blake2b.c blake2s.c m_blake2b.c m_blake2s.c
98
99# bn
100SRCS+=	bn_add.c bn_blind.c bn_const.c bn_ctx.c bn_depr.c bn_dh.c bn_div.c
101SRCS+=	bn_err.c bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_intern.c bn_kron.c
102SRCS+=	bn_lib.c bn_mod.c bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c
103SRCS+=	bn_print.c bn_rand.c bn_recp.c bn_shift.c bn_sqr.c bn_sqrt.c
104SRCS+=	bn_srp.c bn_word.c bn_x931p.c
105.if defined(ASM_aarch64)
106SRCS+=	armv8-mont.S bn_asm.c
107.elif defined(ASM_amd64)
108SRCS+=	rsaz-avx2.S rsaz-x86_64.S rsaz_exp.c x86_64-gcc.c x86_64-gf2m.S
109SRCS+=	x86_64-mont.S x86_64-mont5.S
110.elif defined(ASM_arm)
111SRCS+=	armv4-gf2m.S armv4-mont.S bn_asm.c
112.elif defined(ASM_i386)
113SRCS+=	bn-586.S co-586.S x86-gf2m.S x86-mont.S
114.elif defined(ASM_powerpc)
115SRCS+=	ppc.S ppc-mont.S
116.elif defined(ASM_powerpc64)
117SRCS+=	ppc.S ppc-mont.S
118.elif defined(ASM_powerpc64le)
119SRCS+=	ppc.S ppc-mont.S
120.else
121SRCS+=	bn_asm.c
122.endif
123
124# Full of strict aliasing violations that LLVM has been seen to break with
125# optimisations, which can lead to ECDSA signatures not working. See
126# https://github.com/openssl/openssl/issues/12247 for the upstream bug report.
127CFLAGS.bn_nist.c+=	-fno-strict-aliasing
128
129# buffer
130SRCS+=	buf_err.c buffer.c
131
132# camellia
133SRCS+=	cmll_cfb.c cmll_ctr.c cmll_ecb.c cmll_ofb.c
134.if defined(ASM_amd64)
135SRCS+=	cmll-x86_64.S cmll_misc.c
136.elif defined(ASM_i386)
137SRCS+=	cmll-x86.S
138.else
139SRCS+=	camellia.c cmll_cbc.c cmll_misc.c
140.endif
141
142# cast
143SRCS+=	c_cfb64.c c_ecb.c c_enc.c c_ofb64.c c_skey.c
144
145# chacha
146.if defined(ASM_aarch64)
147SRCS+=	chacha-armv8.S
148.elif defined(ASM_amd64)
149SRCS+=	chacha-x86_64.S
150.elif defined(ASM_arm)
151SRCS+=	chacha-armv4.S
152.elif defined(ASM_i386)
153SRCS+=	chacha-x86.S
154.elif defined(ASM_powerpc)
155SRCS+=	chacha-ppc.S
156.elif defined(ASM_powerpc64)
157SRCS+=	chacha-ppc.S
158.elif defined(ASM_powerpc64le)
159SRCS+=	chacha-ppc.S
160.else
161SRCS+=	chacha_enc.c
162.endif
163
164# cmac
165SRCS+=	cm_ameth.c cm_pmeth.c cmac.c
166
167# cms
168SRCS+=	cms_asn1.c cms_att.c cms_dd.c cms_enc.c cms_env.c cms_err.c
169SRCS+=	cms_ess.c cms_io.c cms_kari.c cms_lib.c cms_pwri.c cms_sd.c
170SRCS+=	cms_smime.c
171
172# comp
173SRCS+=	c_zlib.c comp_err.c comp_lib.c
174
175# conf
176SRCS+=	conf_api.c conf_def.c conf_err.c conf_lib.c conf_mall.c conf_mod.c
177SRCS+=	conf_sap.c conf_ssl.c
178
179# ct
180SRCS+=	ct_b64.c ct_err.c ct_log.c ct_oct.c ct_policy.c ct_prn.c ct_sct.c
181SRCS+=	ct_sct_ctx.c ct_vfy.c ct_x509v3.c
182
183# des
184SRCS+=	cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c
185SRCS+=	ecb_enc.c fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c
186SRCS+=	qud_cksm.c rand_key.c set_key.c str2key.c xcbc_enc.c
187.if defined(ASM_i386)
188SRCS+=	crypt586.S des-586.S
189.else
190SRCS+=	des_enc.c fcrypt_b.c
191.endif
192
193# dh
194SRCS+=	dh_ameth.c dh_asn1.c dh_check.c dh_depr.c dh_err.c dh_gen.c dh_kdf.c
195SRCS+=	dh_key.c dh_lib.c dh_meth.c dh_pmeth.c dh_prn.c dh_rfc5114.c
196SRCS+=	dh_rfc7919.c
197
198# dsa
199SRCS+=	dsa_ameth.c dsa_asn1.c dsa_depr.c dsa_err.c dsa_gen.c dsa_key.c
200SRCS+=	dsa_lib.c dsa_meth.c dsa_ossl.c dsa_pmeth.c dsa_prn.c dsa_sign.c
201SRCS+=	dsa_vrf.c
202
203# dso
204SRCS+=	dso_dlfcn.c dso_err.c dso_lib.c
205
206# ec
207SRCS+=	curve25519.c curve448.c curve448_tables.c ec2_oct.c ec2_smpl.c
208SRCS+=	ec_ameth.c ec_asn1.c ec_check.c ec_curve.c ec_cvt.c ec_err.c
209SRCS+=	ec_key.c ec_kmeth.c ec_lib.c ec_mult.c ec_oct.c ec_pmeth.c
210SRCS+=	ec_print.c ecdh_kdf.c ecdh_ossl.c ecdsa_ossl.c ecdsa_sign.c
211SRCS+=	ecdsa_vrf.c eck_prn.c ecp_mont.c ecp_nist.c ecp_oct.c ecp_smpl.c
212SRCS+=	ecx_meth.c eddsa.c f_generic.c f_impl.c scalar.c
213.if defined(ASM_aarch64)
214SRCS+=	ecp_nistz256-armv8.S ecp_nistz256.c
215.elif defined(ASM_amd64)
216SRCS+=	ecp_nistz256-x86_64.S ecp_nistz256.c x25519-x86_64.S
217.elif defined(ASM_arm)
218SRCS+=	ecp_nistz256-armv4.S ecp_nistz256.c
219.elif defined(ASM_i386)
220SRCS+=	ecp_nistz256-x86.S ecp_nistz256.c
221.elif defined(ASM_powerpc64)
222SRCS+=	ecp_nistz256-ppc64.S ecp_nistz256.c x25519-ppc64.S
223.elif defined(ASM_powerpc64le)
224SRCS+=	ecp_nistz256-ppc64.S ecp_nistz256.c x25519-ppc64.S
225.endif
226
227# engine
228SRCS+=	eng_all.c eng_cnf.c eng_ctrl.c eng_devcrypto.c eng_dyn.c eng_err.c
229SRCS+=	eng_fat.c eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c
230SRCS+=	eng_rdrand.c eng_table.c tb_asnmth.c tb_cipher.c tb_dh.c tb_digest.c
231SRCS+=	tb_dsa.c tb_eckey.c tb_pkmeth.c tb_rand.c tb_rsa.c
232
233# err
234SRCS+=	err.c err_all.c err_prn.c
235
236# evp
237SRCS+=	bio_b64.c bio_enc.c bio_md.c bio_ok.c c_allc.c c_alld.c cmeth_lib.c
238SRCS+=	digest.c e_aes.c e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha256.c
239SRCS+=	e_aria.c e_bf.c e_camellia.c e_cast.c e_chacha20_poly1305.c e_des.c
240SRCS+=	e_des3.c e_idea.c e_null.c e_old.c e_rc2.c e_rc4.c e_rc4_hmac_md5.c
241SRCS+=	e_rc5.c e_seed.c e_sm4.c e_xcbc_d.c encode.c evp_cnf.c evp_enc.c
242SRCS+=	evp_err.c evp_key.c evp_lib.c evp_pbe.c evp_pkey.c m_md4.c m_md5.c
243SRCS+=	m_md5_sha1.c m_mdc2.c m_null.c m_ripemd.c m_sha1.c m_sha3.c
244SRCS+=	m_sigver.c m_wp.c names.c p5_crpt.c p5_crpt2.c p_dec.c p_enc.c
245SRCS+=	p_lib.c p_open.c p_seal.c p_sign.c p_verify.c pbe_scrypt.c
246SRCS+=	pmeth_fn.c pmeth_gn.c pmeth_lib.c
247
248# hmac
249SRCS+=	hm_ameth.c hm_pmeth.c hmac.c
250
251# idea
252SRCS+=	i_cbc.c i_cfb64.c i_ecb.c i_ofb64.c i_skey.c
253
254# kdf
255SRCS+=	hkdf.c kdf_err.c scrypt.c tls1_prf.c
256
257# lhash
258SRCS+=	lh_stats.c lhash.c
259
260# md4
261SRCS+=	md4_dgst.c md4_one.c
262
263# md5
264SRCS+=	md5_dgst.c md5_one.c
265.if defined(ASM_amd64)
266SRCS+=	md5-x86_64.S
267.elif defined(ASM_i386)
268SRCS+=	md5-586.S
269.endif
270
271# mdc2
272SRCS+=	mdc2_one.c mdc2dgst.c
273
274# modes
275SRCS+=	cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ocb128.c
276SRCS+=	ofb128.c wrap128.c xts128.c
277.if defined(ASM_aarch64)
278SRCS+=	ghashv8-armx.S
279ACFLAGS.ghashv8-armx.S=	-march=armv8-a+crypto
280.elif defined(ASM_amd64)
281SRCS+=	aesni-gcm-x86_64.S ghash-x86_64.S
282.elif defined(ASM_arm)
283SRCS+=	ghash-armv4.S ghashv8-armx.S
284.elif defined(ASM_i386)
285SRCS+=	ghash-x86.S
286.elif defined(ASM_powerpc)
287SRCS+=	ghashp8-ppc.S
288.elif defined(ASM_powerpc64)
289SRCS+=	ghashp8-ppc.S
290.elif defined(ASM_powerpc64le)
291SRCS+=	ghashp8-ppc.S
292.endif
293
294# objects
295SRCS+=	o_names.c obj_dat.c obj_err.c obj_lib.c obj_xref.c
296
297# ocsp
298SRCS+=	ocsp_asn.c ocsp_cl.c ocsp_err.c ocsp_ext.c ocsp_ht.c ocsp_lib.c
299SRCS+=	ocsp_prn.c ocsp_srv.c ocsp_vfy.c v3_ocsp.c
300
301# pem
302SRCS+=	pem_all.c pem_err.c pem_info.c pem_lib.c pem_oth.c pem_pk8.c
303SRCS+=	pem_pkey.c pem_sign.c pem_x509.c pem_xaux.c pvkfmt.c
304
305# pkcs12
306SRCS+=	p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c
307SRCS+=	p12_init.c p12_key.c p12_kiss.c p12_mutl.c p12_npas.c p12_p8d.c
308SRCS+=	p12_p8e.c p12_sbag.c p12_utl.c pk12err.c
309
310# pkcs7
311SRCS+=	bio_pk7.c pk7_asn1.c pk7_attr.c pk7_doit.c pk7_lib.c pk7_mime.c
312SRCS+=	pk7_smime.c pkcs7err.c
313
314# poly1305
315SRCS+=	poly1305.c poly1305_ameth.c poly1305_pmeth.c
316.if defined(ASM_aarch64)
317SRCS+=	poly1305-armv8.S
318.elif defined(ASM_amd64)
319SRCS+=	poly1305-x86_64.S
320.elif defined(ASM_arm)
321SRCS+=	poly1305-armv4.S
322.elif defined(ASM_i386)
323SRCS+=	poly1305-x86.S
324.elif defined(ASM_powerpc)
325SRCS+=	poly1305-ppc.S poly1305-ppcfp.S
326.elif defined(ASM_powerpc64)
327SRCS+=	poly1305-ppc.S poly1305-ppcfp.S
328.elif defined(ASM_powerpc64le)
329SRCS+=	poly1305-ppc.S poly1305-ppcfp.S
330.endif
331
332# rand
333SRCS+=	drbg_ctr.c drbg_lib.c rand_err.c rand_lib.c rand_unix.c randfile.c
334
335# rc2
336SRCS+=	rc2_cbc.c rc2_ecb.c rc2_skey.c rc2cfb64.c rc2ofb64.c
337
338# rc4
339.if defined(ASM_amd64)
340SRCS+=	rc4-md5-x86_64.S rc4-x86_64.S
341.elif defined(ASM_i386)
342SRCS+=	rc4-586.S
343.else
344SRCS+=	rc4_enc.c rc4_skey.c
345.endif
346
347# rc5
348SRCS+=	rc5_ecb.c rc5_skey.c rc5cfb64.c rc5ofb64.c
349.if defined(ASM_i386)
350SRCS+=	rc5-586.S
351.else
352SRCS+=	rc5_enc.c
353.endif
354
355# ripemd
356SRCS+=	rmd_dgst.c rmd_one.c
357.if defined(ASM_i386)
358SRCS+=	rmd-586.S
359.endif
360
361# rsa
362SRCS+=	rsa_ameth.c rsa_asn1.c rsa_chk.c rsa_crpt.c rsa_depr.c rsa_err.c
363SRCS+=	rsa_gen.c rsa_lib.c rsa_meth.c rsa_mp.c rsa_none.c rsa_oaep.c
364SRCS+=	rsa_ossl.c rsa_pk1.c rsa_pmeth.c rsa_prn.c rsa_pss.c rsa_saos.c
365SRCS+=	rsa_sign.c rsa_ssl.c rsa_x931.c rsa_x931g.c
366
367# seed
368SRCS+=	seed.c seed_cbc.c seed_cfb.c seed_ecb.c seed_ofb.c
369
370# sha
371SRCS+=	sha1_one.c sha1dgst.c sha256.c sha512.c
372.if defined(ASM_aarch64)
373SRCS+=	keccak1600-armv8.S sha1-armv8.S sha256-armv8.S sha512-armv8.S
374.elif defined(ASM_amd64)
375SRCS+=	keccak1600-x86_64.S sha1-mb-x86_64.S sha1-x86_64.S
376SRCS+=	sha256-mb-x86_64.S sha256-x86_64.S sha512-x86_64.S
377.elif defined(ASM_arm)
378SRCS+=	keccak1600-armv4.S sha1-armv4-large.S sha256-armv4.S sha512-armv4.S
379.elif defined(ASM_i386)
380SRCS+=	keccak1600.c sha1-586.S sha256-586.S sha512-586.S
381.elif defined(ASM_powerpc)
382SRCS+=	keccak1600.c sha1-ppc.S sha256-ppc.S sha512-ppc.S sha256p8-ppc.S sha512p8-ppc.S
383.elif defined(ASM_powerpc64)
384SRCS+=	keccak1600-ppc64.S sha1-ppc.S sha256-ppc.S sha512-ppc.S sha256p8-ppc.S sha512p8-ppc.S
385.elif defined(ASM_powerpc64le)
386SRCS+=	keccak1600-ppc64.S sha1-ppc.S sha256-ppc.S sha512-ppc.S sha256p8-ppc.S sha512p8-ppc.S
387.else
388SRCS+=	keccak1600.c
389.endif
390
391# siphash
392SRCS+=	siphash.c siphash_ameth.c siphash_pmeth.c
393
394# sm2
395SRCS+=	sm2_crypt.c sm2_err.c sm2_pmeth.c sm2_sign.c
396
397# sm3
398SRCS+=	m_sm3.c sm3.c
399
400# sm4
401SRCS+=	sm4.c
402
403# srp
404SRCS+=	srp_lib.c srp_vfy.c
405
406# stack
407SRCS+=	stack.c
408
409# store
410SRCS+=	loader_file.c store_err.c store_init.c store_lib.c store_register.c
411SRCS+=	store_strings.c
412
413# ts
414SRCS+=	ts_asn1.c ts_conf.c ts_err.c ts_lib.c ts_req_print.c ts_req_utils.c
415SRCS+=	ts_rsp_print.c ts_rsp_sign.c ts_rsp_utils.c ts_rsp_verify.c
416SRCS+=	ts_verify_ctx.c
417
418# txt_db
419SRCS+=	txt_db.c
420
421# ui
422SRCS+=	ui_err.c ui_lib.c ui_null.c ui_openssl.c ui_util.c
423
424# whrlpool
425SRCS+=	wp_dgst.c
426.if defined(ASM_amd64)
427SRCS+=	wp-x86_64.S
428.elif defined(ASM_i386)
429SRCS+=	wp-mmx.S wp_block.c
430.else
431SRCS+=	wp_block.c
432.endif
433
434# x509
435SRCS+=	by_dir.c by_file.c t_crl.c t_req.c t_x509.c x509_att.c x509_cmp.c
436SRCS+=	x509_d2.c x509_def.c x509_err.c x509_ext.c x509_lu.c x509_meth.c
437SRCS+=	x509_obj.c x509_r2x.c x509_req.c x509_set.c x509_trs.c x509_txt.c
438SRCS+=	x509_v3.c x509_vfy.c x509_vpm.c x509cset.c x509name.c x509rset.c
439SRCS+=	x509spki.c x509type.c x_all.c x_attrib.c x_crl.c x_exten.c x_name.c
440SRCS+=	x_pubkey.c x_req.c x_x509.c x_x509a.c
441
442# x509v3
443SRCS+=	pcy_cache.c pcy_data.c pcy_lib.c pcy_map.c pcy_node.c pcy_tree.c
444SRCS+=	v3_addr.c v3_admis.c v3_akey.c v3_akeya.c v3_alt.c v3_asid.c
445SRCS+=	v3_bcons.c v3_bitst.c v3_conf.c v3_cpols.c v3_crld.c v3_enum.c
446SRCS+=	v3_extku.c v3_genn.c v3_ia5.c v3_info.c v3_int.c v3_lib.c v3_ncons.c
447SRCS+=	v3_pci.c v3_pcia.c v3_pcons.c v3_pku.c v3_pmaps.c v3_prn.c v3_purp.c
448SRCS+=	v3_skey.c v3_sxnet.c v3_tlsf.c v3_utl.c v3err.c
449
450INCS=	aes.h asn1.h asn1_mac.h asn1err.h asn1t.h async.h asyncerr.h bio.h
451INCS+=	bioerr.h blowfish.h bn.h bnerr.h buffer.h buffererr.h camellia.h
452INCS+=	cast.h cmac.h cms.h cmserr.h comp.h comperr.h conf.h conf_api.h
453INCS+=	conferr.h crypto.h cryptoerr.h ct.h cterr.h des.h dh.h dherr.h dsa.h
454INCS+=	dsaerr.h dtls1.h e_os2.h ebcdic.h ec.h ecdh.h ecdsa.h ecerr.h
455INCS+=	engine.h engineerr.h err.h evp.h evperr.h hmac.h idea.h kdf.h
456INCS+=	kdferr.h lhash.h md2.h md4.h md5.h mdc2.h modes.h obj_mac.h
457INCS+=	objects.h objectserr.h ocsp.h ocsperr.h opensslconf.h opensslv.h
458INCS+=	ossl_typ.h pem.h pem2.h pemerr.h pkcs12.h pkcs12err.h pkcs7.h
459INCS+=	pkcs7err.h rand.h rand_drbg.h randerr.h rc2.h rc4.h rc5.h ripemd.h
460INCS+=	rsa.h rsaerr.h safestack.h seed.h sha.h srp.h srtp.h ssl.h ssl2.h
461INCS+=	ssl3.h sslerr.h stack.h store.h storeerr.h symhacks.h tls1.h ts.h
462INCS+=	tserr.h txt_db.h ui.h uierr.h whrlpool.h x509.h x509_vfy.h x509err.h
463INCS+=	x509v3.h x509v3err.h
464
465INCSDIR=	${INCLUDEDIR}/openssl
466
467LIBADD=	pthread
468
469CFLAGS+=	-I${LCRYPTO_SRC}/crypto
470CFLAGS+=	-I${LCRYPTO_SRC}/crypto/ec/curve448
471CFLAGS+=	-I${LCRYPTO_SRC}/crypto/ec/curve448/arch_32
472CFLAGS+=	-I${LCRYPTO_SRC}/crypto/modes
473CFLAGS+=	-I${.OBJDIR}
474
475.if !empty(SRCS:M*.S)
476ACFLAGS+=	-Wa,--noexecstack
477.endif
478
479SRCS+=	buildinf.h
480
481CLEANDIRS=	openssl
482CLEANFILES=	buildinf.h opensslconf.h opensslconf.h.tmp
483
484.if defined(ASM_${MACHINE_CPUARCH}) || defined(ASM_${MACHINE_ARCH})
485_cmd1=/%%NO_ASM%%/d
486.else
487_cmd1=s/%%NO_ASM%%//
488.endif
489.if ${MK_OPENSSL_KTLS} != "no"
490_cmd2=/%%NO_KTLS%%/d
491.else
492_cmd2=s/%%NO_KTLS%%//
493.endif
494
495buildinf.h: Makefile
496	( echo "/*"; \
497	echo " * WARNING: do not edit!"; \
498	echo " * Generated by ${.ALLSRC}"; \
499	echo " */"; \
500	echo "#define PLATFORM \"platform: FreeBSD-${MACHINE_ARCH}\""; \
501	echo "#define DATE \"built on: reproducible build, date unspecified\""; \
502	echo "static const char compiler_flags[] = \"compiler: ${COMPILER_TYPE}\";" ) \
503	> ${.TARGET}
504
505beforedepend: openssl_opensslconf.h
506beforebuild: openssl_opensslconf.h
507
508openssl_opensslconf.h: opensslconf.h
509	mkdir -p openssl
510	ln -fs ${.OBJDIR}/${.ALLSRC} openssl/${.ALLSRC}
511
512opensslconf.h: opensslconf.h.in
513	sed '${_cmd1}; ${_cmd2}' ${.ALLSRC} > ${.TARGET}.tmp
514	mv -f ${.TARGET}.tmp ${.TARGET}
515
516.include <bsd.lib.mk>
517
518PICFLAG+=	-DOPENSSL_PIC
519
520.if defined(ASM_${MACHINE_CPUARCH})
521.PATH:	${SRCTOP}/sys/crypto/openssl/${MACHINE_CPUARCH}
522.if defined(ASM_amd64)
523.PATH:	${LCRYPTO_SRC}/crypto/bn/asm
524.endif
525.elif defined(ASM_${MACHINE_ARCH})
526.PATH:	${SRCTOP}/sys/crypto/openssl/${MACHINE_ARCH}
527.endif
528
529.PATH:	${LCRYPTO_SRC}/crypto \
530	${LCRYPTO_SRC}/crypto/aes \
531	${LCRYPTO_SRC}/crypto/aria \
532	${LCRYPTO_SRC}/crypto/asn1 \
533	${LCRYPTO_SRC}/crypto/async \
534	${LCRYPTO_SRC}/crypto/async/arch \
535	${LCRYPTO_SRC}/crypto/bf \
536	${LCRYPTO_SRC}/crypto/bio \
537	${LCRYPTO_SRC}/crypto/blake2 \
538	${LCRYPTO_SRC}/crypto/bn \
539	${LCRYPTO_SRC}/crypto/buffer \
540	${LCRYPTO_SRC}/crypto/camellia \
541	${LCRYPTO_SRC}/crypto/cast \
542	${LCRYPTO_SRC}/crypto/chacha \
543	${LCRYPTO_SRC}/crypto/cmac \
544	${LCRYPTO_SRC}/crypto/cms \
545	${LCRYPTO_SRC}/crypto/comp \
546	${LCRYPTO_SRC}/crypto/conf \
547	${LCRYPTO_SRC}/crypto/ct \
548	${LCRYPTO_SRC}/crypto/des \
549	${LCRYPTO_SRC}/crypto/dh \
550	${LCRYPTO_SRC}/crypto/dsa \
551	${LCRYPTO_SRC}/crypto/dso \
552	${LCRYPTO_SRC}/crypto/ec \
553	${LCRYPTO_SRC}/crypto/ec/curve448 \
554	${LCRYPTO_SRC}/crypto/ec/curve448/arch_32 \
555	${LCRYPTO_SRC}/crypto/engine \
556	${LCRYPTO_SRC}/crypto/err \
557	${LCRYPTO_SRC}/crypto/evp \
558	${LCRYPTO_SRC}/crypto/hmac \
559	${LCRYPTO_SRC}/crypto/idea \
560	${LCRYPTO_SRC}/crypto/kdf \
561	${LCRYPTO_SRC}/crypto/lhash \
562	${LCRYPTO_SRC}/crypto/md4 \
563	${LCRYPTO_SRC}/crypto/md5 \
564	${LCRYPTO_SRC}/crypto/mdc2 \
565	${LCRYPTO_SRC}/crypto/modes \
566	${LCRYPTO_SRC}/crypto/objects \
567	${LCRYPTO_SRC}/crypto/ocsp \
568	${LCRYPTO_SRC}/crypto/pem \
569	${LCRYPTO_SRC}/crypto/pkcs12 \
570	${LCRYPTO_SRC}/crypto/pkcs7 \
571	${LCRYPTO_SRC}/crypto/poly1305 \
572	${LCRYPTO_SRC}/crypto/rand \
573	${LCRYPTO_SRC}/crypto/rc2 \
574	${LCRYPTO_SRC}/crypto/rc4 \
575	${LCRYPTO_SRC}/crypto/rc5 \
576	${LCRYPTO_SRC}/crypto/ripemd \
577	${LCRYPTO_SRC}/crypto/rsa \
578	${LCRYPTO_SRC}/crypto/seed \
579	${LCRYPTO_SRC}/crypto/sha \
580	${LCRYPTO_SRC}/crypto/siphash \
581	${LCRYPTO_SRC}/crypto/sm2 \
582	${LCRYPTO_SRC}/crypto/sm3 \
583	${LCRYPTO_SRC}/crypto/sm4 \
584	${LCRYPTO_SRC}/crypto/srp \
585	${LCRYPTO_SRC}/crypto/stack \
586	${LCRYPTO_SRC}/crypto/store \
587	${LCRYPTO_SRC}/crypto/ts \
588	${LCRYPTO_SRC}/crypto/txt_db \
589	${LCRYPTO_SRC}/crypto/ui \
590	${LCRYPTO_SRC}/crypto/whrlpool \
591	${LCRYPTO_SRC}/crypto/x509 \
592	${LCRYPTO_SRC}/crypto/x509v3 \
593	${LCRYPTO_SRC}/include/openssl
594