xref: /freebsd/secure/lib/libcrypto/Makefile (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
1# $FreeBSD$
2
3SHLIBDIR?=	/lib
4SUBDIR=		engines
5
6.include <bsd.own.mk>
7
8LIB=		crypto
9SHLIB_MAJOR=	8
10ALLOW_SHARED_TEXTREL=
11
12NO_LINT=
13
14.if exists(Makefile.man)
15.include "Makefile.man"
16.endif
17.include "Makefile.inc"
18
19.if defined(NOTYET)
20MAN+=	config.5 des_modes.7
21.endif
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-mb-x86_64.S aesni-sha1-x86_64.S \
39	aesni-sha256-x86_64.S aesni-x86_64.S bsaes-x86_64.S 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+=	rsaz-avx2.S rsaz-x86_64.S rsaz_exp.c x86_64-gcc.c x86_64-gf2m.S \
88	x86_64-mont.S 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_kari.c cms_lib.c cms_pwri.c cms_sd.c \
122	cms_smime.c
123INCS+=	cms.h
124
125# comp
126SRCS+=	c_rle.c c_zlib.c comp_err.c comp_lib.c
127INCS+=	comp.h
128
129# conf
130SRCS+=	conf_api.c conf_def.c conf_err.c conf_lib.c conf_mall.c conf_mod.c \
131	conf_sap.c
132INCS+=	conf.h conf_api.h
133
134# des
135SRCS+=	cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c des_old.c \
136	des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c enc_read.c enc_writ.c \
137	fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c \
138	rand_key.c read2pwd.c rpc_enc.c set_key.c str2key.c xcbc_enc.c
139.if ${MACHINE_CPUARCH} == "i386"
140SRCS+=	crypt586.s des-586.s
141.else
142SRCS+=	des_enc.c fcrypt_b.c
143.endif
144INCS+=	des.h des_old.h
145
146# dh
147SRCS+=	dh_ameth.c dh_asn1.c dh_check.c dh_depr.c dh_err.c dh_gen.c dh_kdf.c \
148	dh_key.c dh_lib.c dh_pmeth.c dh_prn.c dh_rfc5114.c
149INCS+=	dh.h
150
151# dsa
152SRCS+=	dsa_ameth.c dsa_asn1.c dsa_depr.c dsa_err.c dsa_gen.c dsa_key.c \
153	dsa_lib.c dsa_ossl.c dsa_pmeth.c dsa_prn.c dsa_sign.c dsa_vrf.c
154INCS+=	dsa.h
155
156# dso
157SRCS+=	dso_dlfcn.c dso_err.c dso_lib.c dso_openssl.c
158INCS+=	dso.h
159
160# ec
161SRCS+=	ec2_mult.c ec2_oct.c ec2_smpl.c ec_ameth.c ec_asn1.c ec_check.c \
162	ec_curve.c ec_cvt.c ec_err.c ec_key.c ec_lib.c ec_mult.c ec_oct.c \
163	ec_pmeth.c ec_print.c eck_prn.c ecp_mont.c ecp_nist.c ecp_oct.c \
164	ecp_smpl.c
165.if ${MACHINE_CPUARCH} == "amd64"
166SRCS+=	ecp_nistz256.c ecp_nistz256-x86_64.S
167.endif
168INCS+=	ec.h
169
170# ecdh
171SRCS+=	ech_err.c ech_kdf.c ech_key.c ech_lib.c ech_ossl.c
172INCS+=	ecdh.h
173
174# ecdsa
175SRCS+=	ecs_asn1.c ecs_err.c ecs_lib.c ecs_ossl.c ecs_sign.c ecs_vrf.c
176INCS+=	ecdsa.h
177
178# engine
179SRCS+=	eng_all.c eng_cnf.c eng_cryptodev.c eng_ctrl.c eng_dyn.c eng_err.c \
180	eng_fat.c eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c \
181	eng_rdrand.c eng_table.c tb_asnmth.c tb_cipher.c tb_dh.c tb_digest.c \
182	tb_dsa.c tb_ecdh.c tb_ecdsa.c tb_pkmeth.c tb_rand.c tb_rsa.c tb_store.c
183INCS+=	engine.h
184
185# err
186SRCS+=	err.c err_all.c err_prn.c
187INCS+=	err.h
188
189# evp
190SRCS+=	bio_b64.c bio_enc.c bio_md.c bio_ok.c c_all.c c_allc.c c_alld.c \
191	digest.c e_aes.c e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha256.c e_bf.c \
192	e_camellia.c e_cast.c e_des.c e_des3.c e_idea.c e_null.c e_old.c \
193	e_rc2.c e_rc4.c e_rc4_hmac_md5.c e_rc5.c e_seed.c e_xcbc_d.c encode.c \
194	evp_acnf.c evp_cnf.c evp_enc.c evp_err.c evp_key.c evp_lib.c \
195	evp_pbe.c evp_pkey.c m_dss.c m_dss1.c m_ecdsa.c m_md4.c m_md5.c \
196	m_mdc2.c m_null.c m_ripemd.c m_sha.c m_sha1.c m_sigver.c m_wp.c \
197	names.c p5_crpt.c p5_crpt2.c p_dec.c p_enc.c p_lib.c p_open.c \
198	p_seal.c p_sign.c p_verify.c pmeth_fn.c pmeth_gn.c pmeth_lib.c
199INCS+=	evp.h
200
201# hmac
202SRCS+=	hm_ameth.c hm_pmeth.c hmac.c
203INCS+=	hmac.h
204
205# idea
206SRCS+=	i_cbc.c i_cfb64.c i_ecb.c i_ofb64.c i_skey.c
207INCS+=	idea.h
208
209# krb5
210INCS+=	krb5_asn.h
211
212# lhash
213SRCS+=	lh_stats.c lhash.c
214INCS+=	lhash.h
215
216# md4
217SRCS+=	md4_dgst.c md4_one.c
218INCS+=	md4.h
219
220# md5
221SRCS+=	md5_dgst.c md5_one.c
222.if ${MACHINE_CPUARCH} == "amd64"
223SRCS+=	md5-x86_64.S
224.elif ${MACHINE_CPUARCH} == "i386"
225SRCS+=	md5-586.s
226.endif
227INCS+=	md5.h
228
229# mdc2
230SRCS+=	mdc2_one.c mdc2dgst.c
231INCS+=	mdc2.h
232
233# modes
234SRCS+=	cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c \
235	wrap128.c xts128.c
236.if ${MACHINE_CPUARCH} == "amd64"
237SRCS+=	aesni-gcm-x86_64.S ghash-x86_64.S
238.elif ${MACHINE_CPUARCH} == "i386"
239SRCS+=	ghash-x86.s
240.endif
241INCS+=	modes.h
242
243# objects
244SRCS+=	o_names.c obj_dat.c obj_err.c obj_lib.c obj_xref.c
245INCS+=	obj_mac.h objects.h
246
247# ocsp
248SRCS+=	ocsp_asn.c ocsp_cl.c ocsp_err.c ocsp_ext.c ocsp_ht.c ocsp_lib.c \
249	ocsp_prn.c ocsp_srv.c ocsp_vfy.c
250INCS+=	ocsp.h
251
252# pem
253SRCS+=	pem_all.c pem_err.c pem_info.c pem_lib.c pem_oth.c pem_pk8.c \
254	pem_pkey.c pem_seal.c pem_sign.c pem_x509.c pem_xaux.c pvkfmt.c
255INCS+=	pem.h pem2.h
256
257# pkcs12
258SRCS+=	p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \
259	p12_init.c p12_key.c p12_kiss.c p12_mutl.c p12_npas.c p12_p8d.c \
260	p12_p8e.c p12_utl.c pk12err.c
261INCS+=	pkcs12.h
262
263# pkcs7
264SRCS+=	bio_pk7.c pk7_asn1.c pk7_attr.c pk7_doit.c pk7_lib.c pk7_mime.c \
265	pk7_smime.c pkcs7err.c
266INCS+=	pkcs7.h
267
268# pqueue
269SRCS+=	pqueue.c
270INCS+=	pqueue.h
271
272# rand
273SRCS+=	md_rand.c rand_egd.c rand_err.c rand_lib.c rand_unix.c randfile.c
274INCS+=	rand.h
275
276# rc2
277SRCS+=	rc2_cbc.c rc2_ecb.c rc2_skey.c rc2cfb64.c rc2ofb64.c
278INCS+=	rc2.h
279
280# rc4
281SRCS+=	rc4_utl.c
282.if ${MACHINE_CPUARCH} == "amd64"
283SRCS+=	rc4-md5-x86_64.S rc4-x86_64.S
284.elif ${MACHINE_CPUARCH} == "i386"
285SRCS+=	rc4-586.s
286.else
287SRCS+=	rc4_enc.c rc4_skey.c
288.endif
289INCS+=	rc4.h
290
291# rc5
292SRCS+=	rc5_ecb.c rc5_skey.c rc5cfb64.c rc5ofb64.c
293.if ${MACHINE_CPUARCH} == "i386"
294SRCS+=	rc5-586.s
295.else
296SRCS+=	rc5_enc.c
297.endif
298INCS+=	rc5.h
299
300# ripemd
301SRCS+=	rmd_dgst.c rmd_one.c
302.if ${MACHINE_CPUARCH} == "i386"
303SRCS+=	rmd-586.s
304.endif
305INCS+=	ripemd.h
306
307# rsa
308SRCS+=	rsa_ameth.c rsa_asn1.c rsa_chk.c rsa_crpt.c rsa_depr.c rsa_eay.c \
309	rsa_err.c rsa_gen.c rsa_lib.c rsa_none.c rsa_null.c rsa_oaep.c \
310	rsa_pk1.c rsa_pmeth.c rsa_prn.c rsa_pss.c rsa_saos.c rsa_sign.c \
311	rsa_ssl.c rsa_x931.c
312INCS+=	rsa.h
313
314# seed
315SRCS+=	seed.c seed_cbc.c seed_cfb.c seed_ecb.c seed_ofb.c
316INCS+=	seed.h
317
318# sha
319SRCS+=	sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c
320.if ${MACHINE_CPUARCH} == "amd64"
321SRCS+=	sha1-mb-x86_64.S sha1-x86_64.S sha256-mb-x86_64.S sha256-x86_64.S \
322	sha512-x86_64.S
323.elif ${MACHINE_CPUARCH} == "i386"
324SRCS+=	sha1-586.s sha256-586.s sha512-586.s
325.endif
326INCS+=	sha.h
327
328# srp
329SRCS+=	srp_lib.c srp_vfy.c
330INCS+=	srp.h
331
332# stack
333SRCS+=	stack.c
334INCS+=	safestack.h stack.h
335
336# ts
337SRCS+=	ts_asn1.c ts_conf.c ts_err.c ts_lib.c ts_req_print.c ts_req_utils.c \
338	ts_rsp_print.c ts_rsp_sign.c ts_rsp_utils.c ts_rsp_verify.c \
339	ts_verify_ctx.c
340INCS+=	ts.h
341
342# txt_db
343SRCS+=	txt_db.c
344INCS+=	txt_db.h
345
346# ui
347SRCS+=	ui_compat.c ui_err.c ui_lib.c ui_openssl.c ui_util.c
348INCS+=	ui.h ui_compat.h
349
350# whrlpool
351SRCS+=	wp_dgst.c
352.if ${MACHINE_CPUARCH} == "amd64"
353SRCS+=	wp-x86_64.S
354.elif ${MACHINE_CPUARCH} == "i386"
355SRCS+=	wp-mmx.s wp_block.c
356.else
357SRCS+=	wp_block.c
358.endif
359INCS+=	whrlpool.h
360
361# x509
362SRCS+=	by_dir.c by_file.c x509_att.c x509_cmp.c x509_d2.c x509_def.c \
363	x509_err.c x509_ext.c x509_lu.c x509_obj.c x509_r2x.c x509_req.c \
364	x509_set.c x509_trs.c x509_txt.c x509_v3.c x509_vfy.c x509_vpm.c \
365	x509cset.c x509name.c x509rset.c x509spki.c x509type.c x_all.c
366INCS+=	x509.h x509_vfy.h
367
368# x509v3
369SRCS+=	pcy_cache.c pcy_data.c pcy_lib.c pcy_map.c pcy_node.c pcy_tree.c \
370	v3_addr.c v3_akey.c v3_akeya.c v3_alt.c v3_asid.c v3_bcons.c \
371	v3_bitst.c v3_conf.c v3_cpols.c v3_crld.c v3_enum.c v3_extku.c \
372	v3_genn.c v3_ia5.c v3_info.c v3_int.c v3_lib.c v3_ncons.c v3_ocsp.c \
373	v3_pci.c v3_pcia.c v3_pcons.c v3_pku.c v3_pmaps.c v3_prn.c v3_purp.c \
374	v3_scts.c v3_skey.c v3_sxnet.c v3_utl.c v3err.c
375INCS+=	x509v3.h
376
377SRCS+=	buildinf.h
378INCS+=	opensslconf.h
379INCSDIR=	${INCLUDEDIR}/openssl
380
381CSTD=	gnu89
382
383CFLAGS+=	-I${.OBJDIR}
384CFLAGS+=	-I${LCRYPTO_SRC}/crypto
385CFLAGS+=	-I${LCRYPTO_SRC}/crypto/asn1
386CFLAGS+=	-I${LCRYPTO_SRC}/crypto/evp
387CFLAGS+=	-I${LCRYPTO_SRC}/crypto/modes
388
389.if !empty(SRCS:M*.s)
390AFLAGS+=	--noexecstack
391.endif
392.if !empty(SRCS:M*.S)
393ACFLAGS+=	-Wa,--noexecstack
394.endif
395
396.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
397OPENSSLCONF_H=	opensslconf-x86.h
398.else
399OPENSSLCONF_H=	opensslconf-${MACHINE_CPUARCH}.h
400.endif
401
402CLEANFILES=	buildinf.h opensslconf.h
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_H}
412	${CP} ${.ALLSRC} ${.TARGET}
413
414.include <bsd.lib.mk>
415
416.if ${MACHINE_CPUARCH} == "amd64"
417_bn_asmpath=	${LCRYPTO_SRC}/crypto/bn/asm
418.endif
419
420.if exists(${.CURDIR}/${MACHINE_CPUARCH})
421.PATH:	${.CURDIR}/${MACHINE_CPUARCH}
422.endif
423
424.PATH:	${LCRYPTO_SRC}/crypto \
425	${LCRYPTO_SRC}/crypto/aes \
426	${LCRYPTO_SRC}/crypto/asn1 \
427	${LCRYPTO_SRC}/crypto/bf \
428	${LCRYPTO_SRC}/crypto/bio \
429	${LCRYPTO_SRC}/crypto/bn \
430	${_bn_asmpath} \
431	${LCRYPTO_SRC}/crypto/buffer \
432	${LCRYPTO_SRC}/crypto/camellia \
433	${LCRYPTO_SRC}/crypto/cast \
434	${LCRYPTO_SRC}/crypto/cmac \
435	${LCRYPTO_SRC}/crypto/cms \
436	${LCRYPTO_SRC}/crypto/comp \
437	${LCRYPTO_SRC}/crypto/conf \
438	${LCRYPTO_SRC}/crypto/des \
439	${LCRYPTO_SRC}/crypto/dh \
440	${LCRYPTO_SRC}/crypto/dsa \
441	${LCRYPTO_SRC}/crypto/dso \
442	${LCRYPTO_SRC}/crypto/ec \
443	${LCRYPTO_SRC}/crypto/ecdh \
444	${LCRYPTO_SRC}/crypto/ecdsa \
445	${LCRYPTO_SRC}/crypto/engine \
446	${LCRYPTO_SRC}/crypto/err \
447	${LCRYPTO_SRC}/crypto/evp \
448	${LCRYPTO_SRC}/crypto/hmac \
449	${LCRYPTO_SRC}/crypto/idea \
450	${LCRYPTO_SRC}/crypto/krb5 \
451	${LCRYPTO_SRC}/crypto/lhash \
452	${LCRYPTO_SRC}/crypto/md4 \
453	${LCRYPTO_SRC}/crypto/md5 \
454	${LCRYPTO_SRC}/crypto/mdc2 \
455	${LCRYPTO_SRC}/crypto/modes \
456	${LCRYPTO_SRC}/crypto/objects \
457	${LCRYPTO_SRC}/crypto/ocsp \
458	${LCRYPTO_SRC}/crypto/pem \
459	${LCRYPTO_SRC}/crypto/pkcs12 \
460	${LCRYPTO_SRC}/crypto/pkcs7 \
461	${LCRYPTO_SRC}/crypto/pqueue \
462	${LCRYPTO_SRC}/crypto/rand \
463	${LCRYPTO_SRC}/crypto/rc2 \
464	${LCRYPTO_SRC}/crypto/rc4 \
465	${LCRYPTO_SRC}/crypto/rc5 \
466	${LCRYPTO_SRC}/crypto/ripemd \
467	${LCRYPTO_SRC}/crypto/rsa \
468	${LCRYPTO_SRC}/crypto/seed \
469	${LCRYPTO_SRC}/crypto/sha \
470	${LCRYPTO_SRC}/crypto/srp \
471	${LCRYPTO_SRC}/crypto/stack \
472	${LCRYPTO_SRC}/crypto/ts \
473	${LCRYPTO_SRC}/crypto/txt_db \
474	${LCRYPTO_SRC}/crypto/ui \
475	${LCRYPTO_SRC}/crypto/whrlpool \
476	${LCRYPTO_SRC}/crypto/x509 \
477	${LCRYPTO_SRC}/crypto/x509v3 \
478	${.CURDIR}/man
479