xref: /freebsd/secure/lib/libcrypto/Makefile (revision 63518eccca27064285cf2e680510ba9a4c3e2231)
1# $FreeBSD$
2
3SHLIBDIR?=	/lib
4SUBDIR=		engines
5
6.include <bsd.own.mk>
7
8LIB=		crypto
9SHLIB_MAJOR=	5
10
11NO_LINT=
12
13.if exists(Makefile.man)
14.include "Makefile.man"
15.endif
16.if defined(NOTYET)
17MAN+=	config.5 des_modes.7
18.endif
19
20.include "Makefile.inc"
21
22# base sources
23SRCS=	cpt_err.c cryptlib.c cversion.c ebcdic.c ex_data.c mem.c mem_clr.c \
24	mem_dbg.c o_dir.c o_str.c o_time.c tmdiff.c uid.c
25INCS=	crypto.h ebcdic.h opensslv.h ossl_typ.h symhacks.h tmdiff.h \
26	../e_os.h ../e_os2.h
27
28# aes
29SRCS+=	aes_cbc.c aes_cfb.c aes_core.c aes_ctr.c aes_ecb.c aes_ige.c \
30	aes_misc.c aes_ofb.c
31INCS+=	aes.h aes_locl.h
32
33# asn1
34SRCS+=	a_bitstr.c a_bool.c a_bytes.c a_d2i_fp.c a_digest.c a_dup.c \
35	a_enum.c a_gentm.c a_hdr.c a_i2d_fp.c a_int.c a_mbstr.c \
36	a_meth.c a_object.c a_octet.c a_print.c a_set.c a_sign.c \
37	a_strex.c a_strnid.c a_time.c a_type.c a_utctm.c a_utf8.c \
38	a_verify.c asn1_err.c asn1_gen.c asn1_lib.c asn1_par.c \
39	asn_moid.c asn_pack.c d2i_pr.c d2i_pu.c evp_asn1.c f_enum.c \
40	f_int.c f_string.c i2d_pr.c i2d_pu.c n_pkey.c nsseq.c p5_pbe.c \
41	p5_pbev2.c p8_pkey.c t_bitst.c t_crl.c t_pkey.c t_req.c \
42	t_spki.c t_x509.c t_x509a.c tasn_dec.c tasn_enc.c tasn_fre.c \
43	tasn_new.c tasn_typ.c tasn_utl.c x_algor.c x_attrib.c \
44	x_bignum.c x_crl.c x_exten.c x_info.c x_long.c x_name.c \
45	x_pkey.c x_pubkey.c x_req.c x_sig.c x_spki.c x_val.c x_x509.c \
46	x_x509a.c
47INCS+=	asn1.h asn1_mac.h asn1t.h
48
49# bf
50SRCS+=	bf_cfb64.c bf_ecb.c bf_ofb64.c bf_skey.c
51.if ${MACHINE_ARCH} == "i386"
52.if ${MACHINE_CPU:Mi686}
53SRCS+=	bf-686.s
54.else
55SRCS+=	bf-586.s
56.endif
57.else
58SRCS+=	bf_enc.c
59.endif
60INCS+=	blowfish.h
61
62# bio
63SRCS+=	b_dump.c b_print.c b_sock.c bf_buff.c bf_lbuf.c bf_nbio.c \
64	bf_null.c bio_cb.c bio_err.c bio_lib.c bss_acpt.c bss_bio.c \
65	bss_conn.c bss_dgram.c bss_fd.c bss_file.c bss_log.c bss_mem.c \
66	bss_null.c bss_sock.c
67INCS+=	bio.h bio_lcl.h
68
69# bn
70SRCS+=	bn_add.c bn_blind.c bn_const.c bn_ctx.c bn_depr.c bn_div.c \
71	bn_err.c bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_kron.c \
72	bn_lib.c bn_mod.c bn_mont.c bn_mpi.c bn_mul.c bn_nist.c \
73	bn_prime.c bn_print.c bn_rand.c bn_recp.c bn_shift.c bn_sqr.c \
74	bn_sqrt.c bn_word.c
75.if ${MACHINE_ARCH} == "i386"
76SRCS+=	bn-586.s co-586.s
77.elif ${MACHINE_ARCH} == "amd64"
78SRCS+=	x86_64-gcc.c
79.else
80SRCS+=	bn_asm.c
81.endif
82
83INCS+=	bn.h
84
85# buffer
86SRCS+=	buf_err.c buffer.c
87INCS+=	buffer.h
88
89# cast
90SRCS+=	c_cfb64.c c_ecb.c c_ofb64.c c_skey.c
91.if ${MACHINE_ARCH} == "i386"
92SRCS+=	cast-586.s
93.else
94SRCS+=	c_enc.c
95.endif
96INCS+=	cast.h
97
98# comp
99SRCS+=	c_rle.c c_zlib.c comp_err.c comp_lib.c
100INCS+=	comp.h
101
102# conf
103SRCS+=	conf_api.c conf_def.c conf_err.c conf_lib.c conf_mall.c conf_mod.c conf_sap.c
104INCS+=	conf.h conf_api.h
105
106# des
107SRCS+=	cbc3_enc.c cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c \
108	des_old.c des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c \
109	enc_read.c enc_writ.c fcrypt.c ofb64ede.c ofb64enc.c \
110	ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read2pwd.c \
111	rpc_enc.c set_key.c str2key.c xcbc_enc.c
112.if ${MACHINE_ARCH} == "i386"
113SRCS+=	des-586.s crypt586.s
114.else
115SRCS+=	des_enc.c fcrypt_b.c
116.endif
117INCS+=	des.h des_old.h
118
119# dh
120SRCS+=	dh_asn1.c dh_check.c dh_err.c dh_depr.c dh_gen.c dh_key.c dh_lib.c
121INCS+=	dh.h
122
123# dsa
124SRCS+=	dsa_asn1.c dsa_err.c dsa_depr.c dsa_gen.c dsa_key.c dsa_lib.c \
125	dsa_ossl.c dsa_sign.c dsa_vrf.c
126INCS+=	dsa.h
127
128# dso
129SRCS+=	dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c dso_openssl.c
130INCS+=	dso.h
131
132# ec
133SRCS+=	ec_asn1.c ec_check.c ec_curve.c ec_cvt.c ec_err.c ec_key.c \
134	ec_lib.c ec_mult.c ec_print.c ecp_mont.c ecp_nist.c \
135	ecp_smpl.c ec2_mult.c ec2_smpl.c
136INCS+=	ec.h
137
138# ecdh
139SRCS+=	ech_err.c ech_key.c ech_lib.c ech_ossl.c
140INCS+=	ecdh.h
141
142# ecdsa
143SRCS+=	ecs_asn1.c ecs_err.c ecs_lib.c ecs_ossl.c ecs_sign.c ecs_vrf.c
144INCS+=	ecdsa.h
145
146# engine
147SRCS+=	eng_all.c eng_cnf.c eng_cryptodev.c eng_ctrl.c eng_dyn.c \
148	eng_err.c eng_fat.c eng_init.c eng_lib.c eng_list.c \
149	eng_openssl.c eng_padlock.c eng_pkey.c eng_table.c tb_cipher.c \
150	tb_dh.c tb_digest.c tb_dsa.c tb_ecdh.c tb_ecdsa.c tb_rand.c \
151	tb_rsa.c tb_store.c
152INCS+=	engine.h
153
154# err
155SRCS+=	err.c err_all.c err_prn.c
156INCS+=	err.h
157
158# evp
159SRCS+=	bio_b64.c bio_enc.c bio_md.c bio_ok.c c_all.c c_allc.c c_alld.c \
160	digest.c e_aes.c e_bf.c e_cast.c e_des.c e_des3.c e_idea.c \
161	e_null.c e_old.c e_rc2.c e_rc4.c e_rc5.c e_xcbc_d.c encode.c \
162	evp_acnf.c evp_enc.c evp_err.c evp_key.c evp_lib.c evp_pbe.c \
163	evp_pkey.c m_dss.c m_dss1.c m_ecdsa.c m_md2.c m_md4.c m_md5.c \
164	m_mdc2.c m_null.c m_ripemd.c m_sha.c m_sha1.c names.c \
165	openbsd_hw.c p5_crpt.c p5_crpt2.c p_dec.c p_enc.c p_lib.c \
166	p_open.c p_seal.c p_sign.c p_verify.c
167INCS+=	evp.h
168
169# fips
170INCS+=	fips.h fips_rand.h
171
172# hmac
173SRCS+=	hmac.c
174INCS+=	hmac.h
175
176# idea
177.if ${MK_IDEA} != "no"
178SRCS+=	i_cbc.c i_cfb64.c i_ecb.c i_ofb64.c i_skey.c
179INCS+=	idea.h
180.endif
181
182# krb5
183#SRCS+=	krb5_asn.c
184INCS+=	krb5_asn.h
185
186# lhash
187SRCS+=	lh_stats.c lhash.c
188INCS+=	lhash.h
189
190# md2
191SRCS+=	md2_dgst.c md2_one.c
192INCS+=	md2.h
193
194# md4
195SRCS+=	md4_dgst.c md4_one.c
196INCS+=	md4.h
197
198# md5
199SRCS+=	md5_dgst.c md5_one.c
200.if ${MACHINE_ARCH} == "i386"
201SRCS+=	md5-586.s
202.endif
203INCS+=	md5.h
204
205# mdc2
206SRCS+=	mdc2_one.c mdc2dgst.c
207INCS+=	mdc2.h
208
209# objects
210SRCS+=	o_names.c obj_dat.c obj_err.c obj_lib.c
211INCS+=	objects.h obj_mac.h
212
213# ocsp
214SRCS+=	ocsp_asn.c ocsp_cl.c ocsp_err.c ocsp_ext.c ocsp_ht.c \
215	ocsp_lib.c ocsp_prn.c ocsp_srv.c ocsp_vfy.c
216INCS+=	ocsp.h
217
218# pem
219SRCS+=	pem_all.c pem_err.c pem_info.c pem_lib.c pem_oth.c pem_pk8.c \
220	pem_pkey.c pem_seal.c pem_sign.c pem_x509.c pem_xaux.c
221INCS+=	pem.h pem2.h
222
223# pkcs12
224SRCS+=	p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c \
225	p12_decr.c p12_init.c p12_key.c p12_kiss.c p12_mutl.c \
226	p12_npas.c p12_p8d.c p12_p8e.c p12_utl.c pk12err.c
227INCS+=	pkcs12.h pkcs7.h
228
229# pkcs7
230SRCS+=	example.c pk7_asn1.c pk7_attr.c pk7_dgst.c pk7_doit.c \
231	pk7_lib.c pk7_mime.c pk7_smime.c pkcs7err.c
232
233# pqueue
234SRCS+=	pqueue.c
235INCS+=	pqueue.h pq_compat.h
236
237# rand
238SRCS+=	md_rand.c rand_egd.c rand_err.c rand_lib.c rand_unix.c randfile.c
239INCS+=	rand.h
240
241# rc2
242SRCS+=	rc2_cbc.c rc2_ecb.c rc2_skey.c rc2cfb64.c rc2ofb64.c
243INCS+=	rc2.h
244
245# rc4
246SRCS+=	rc4_skey.c
247.if ${MACHINE_ARCH} == "i386"
248SRCS+=	rc4-586.s
249.else
250SRCS+=	rc4_enc.c
251.endif
252INCS+=	rc4.h
253
254# rc5
255SRCS+=	rc5_ecb.c rc5_skey.c rc5cfb64.c rc5ofb64.c
256.if ${MACHINE_ARCH} == "i386"
257SRCS+=	rc5-586.s
258.else
259SRCS+=	rc5_enc.c
260.endif
261INCS+=	rc5.h
262
263# ripemd
264SRCS+=	rmd_dgst.c rmd_one.c
265INCS+=	ripemd.h
266
267# rsa
268SRCS+=	rsa_asn1.c rsa_chk.c rsa_eay.c rsa_err.c rsa_gen.c rsa_lib.c \
269	rsa_none.c rsa_null.c rsa_oaep.c rsa_pk1.c rsa_saos.c \
270	rsa_sign.c rsa_ssl.c rsa_depr.c rsa_pss.c rsa_x931.c
271INCS+=	rsa.h
272
273# sha
274SRCS+=	sha1_one.c sha1dgst.c sha_dgst.c sha_one.c sha256.c sha512.c
275.if ${MACHINE_ARCH} == "i386"
276SRCS+=	sha1-586.s
277.endif
278INCS+=	sha.h
279
280# stack
281SRCS+=	stack.c
282INCS+=	stack.h safestack.h
283
284# store
285SRCS+=	str_err.c str_lib.c str_meth.c str_mem.c
286INCS+=	store.h
287
288# threads
289SRCS+=	th-lock.c
290
291# txt_db
292SRCS+=	txt_db.c
293INCS+=	txt_db.h
294
295# ui
296SRCS+=	ui_compat.c ui_err.c ui_lib.c ui_openssl.c ui_util.c
297INCS+=	ui.h ui_compat.h ui_locl.h
298
299# x509
300SRCS+=	by_dir.c by_file.c x509_att.c x509_cmp.c x509_d2.c \
301	x509_def.c x509_err.c x509_ext.c x509_lu.c x509_obj.c \
302	x509_r2x.c x509_req.c x509_set.c x509_trs.c x509_txt.c \
303	x509_v3.c x509_vfy.c x509cset.c x509name.c x509rset.c \
304	x509spki.c x509type.c x_all.c x509_vpm.c
305INCS+=	x509.h x509_vfy.h
306
307# x509v3
308SRCS+=	pcy_cache.c pcy_data.c pcy_lib.c pcy_map.c pcy_node.c \
309	pcy_tree.c v3_addr.c v3_akey.c v3_akeya.c v3_alt.c v3_asid.c \
310	v3_bcons.c v3_bitst.c \
311	v3_conf.c v3_cpols.c v3_crld.c v3_enum.c v3_extku.c v3_genn.c \
312	v3_ia5.c v3_info.c v3_int.c v3_lib.c v3_ncons.c v3_ocsp.c \
313	v3_pci.c v3_pcia.c v3_pcons.c v3_pku.c v3_pmaps.c v3_prn.c \
314	v3_purp.c v3_skey.c v3_sxnet.c v3_utl.c v3err.c
315INCS+=	x509v3.h
316
317SRCS+=	buildinf.h
318INCS+=	opensslconf.h evp.h
319INCSDIR=	${INCLUDEDIR}/openssl
320
321CSTD=	gnu89
322
323CLEANFILES=	buildinf.h opensslconf.h evp.h
324
325buildinf.h: ${.CURDIR}/Makefile
326	( echo "#ifndef MK1MF_BUILD"; \
327	echo "  /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
328	echo "  #define CFLAGS \"$(CC)\""; \
329	echo "  #define PLATFORM \"FreeBSD-${MACHINE_ARCH}\""; \
330	echo "  #define DATE \"`LC_ALL=C date`\""; \
331	echo "#endif" ) > ${.TARGET}
332
333opensslconf.h: opensslconf-${MACHINE_ARCH}.h
334	cp ${.ALLSRC} ${.TARGET}
335
336evp.h: ${LCRYPTO_SRC}/crypto/evp/evp.h
337.if ${MK_IDEA} == "no"
338	sed '/^#ifndef OPENSSL_NO_IDEA$$/,/^#endif$$/d' ${.ALLSRC} > ${.TARGET}
339.else
340	cp ${.ALLSRC} ${.TARGET}
341.endif
342
343# No FIPS support for now
344fips.h:
345	echo '/* dummy fips.h */' > ${.TARGET}
346
347fips_rand.h:
348	echo '/* dummy fips_rand.h */' > ${.TARGET}
349
350CLEANFILES+=	fips.h fips_rand.h
351
352OLDSYMLINKS+=	libdes.a libdes.so libdes.so.3 libdes_p.a
353afterinstall:
354	@${ECHO} "Removing stale symlinks."
355	rm -f ${DESTDIR}${INCLUDEDIR}/des.h
356.for symlink in ${OLDSYMLINKS}
357	rm -f ${DESTDIR}${LIBDIR}/${symlink}
358.endfor
359
360.include <bsd.lib.mk>
361
362.if ${MACHINE_ARCH} == "i386"
363.PATH: ${.CURDIR}/i386
364.endif
365
366.if ${MACHINE_ARCH} == "amd64"
367_bn_asmpath=	${LCRYPTO_SRC}/crypto/bn/asm
368.endif
369
370.if ${MK_IDEA} != "no"
371_ideapath=	${LCRYPTO_SRC}/crypto/idea
372.endif
373
374.PATH: \
375	${LCRYPTO_SRC}/crypto \
376	${LCRYPTO_SRC}/crypto/aes \
377	${LCRYPTO_SRC}/crypto/asn1 \
378	${LCRYPTO_SRC}/crypto/bf \
379	${LCRYPTO_SRC}/crypto/bio \
380	${_bn_asmpath} \
381	${LCRYPTO_SRC}/crypto/bn \
382	${LCRYPTO_SRC}/crypto/buffer \
383	${LCRYPTO_SRC}/crypto/cast \
384	${LCRYPTO_SRC}/crypto/comp \
385	${LCRYPTO_SRC}/crypto/conf \
386	${LCRYPTO_SRC}/crypto/des \
387	${LCRYPTO_SRC}/crypto/dh \
388	${LCRYPTO_SRC}/crypto/dsa \
389	${LCRYPTO_SRC}/crypto/dso \
390	${LCRYPTO_SRC}/crypto/ec \
391	${LCRYPTO_SRC}/crypto/ecdh \
392	${LCRYPTO_SRC}/crypto/ecdsa \
393	${LCRYPTO_SRC}/crypto/engine \
394	${LCRYPTO_SRC}/crypto/err \
395	${LCRYPTO_SRC}/crypto/evp \
396	${LCRYPTO_SRC}/crypto/hmac \
397	${_ideapath} \
398	${LCRYPTO_SRC}/crypto/krb5 \
399	${LCRYPTO_SRC}/crypto/lhash \
400	${LCRYPTO_SRC}/crypto/md2 \
401	${LCRYPTO_SRC}/crypto/md4 \
402	${LCRYPTO_SRC}/crypto/md5 \
403	${LCRYPTO_SRC}/crypto/mdc2 \
404	${LCRYPTO_SRC}/crypto/objects \
405	${LCRYPTO_SRC}/crypto/ocsp \
406	${LCRYPTO_SRC}/crypto/pem \
407	${LCRYPTO_SRC}/crypto/pkcs12 \
408	${LCRYPTO_SRC}/crypto/pkcs7 \
409	${LCRYPTO_SRC}/crypto/pqueue \
410	${LCRYPTO_SRC}/crypto/rand \
411	${LCRYPTO_SRC}/crypto/rc2 \
412	${LCRYPTO_SRC}/crypto/rc4 \
413	${LCRYPTO_SRC}/crypto/rc5 \
414	${LCRYPTO_SRC}/crypto/ripemd \
415	${LCRYPTO_SRC}/crypto/rsa \
416	${LCRYPTO_SRC}/crypto/sha \
417	${LCRYPTO_SRC}/crypto/stack \
418	${LCRYPTO_SRC}/crypto/store \
419	${LCRYPTO_SRC}/crypto/threads \
420	${LCRYPTO_SRC}/crypto/txt_db \
421	${LCRYPTO_SRC}/crypto/ui \
422	${LCRYPTO_SRC}/crypto/x509 \
423	${LCRYPTO_SRC}/crypto/x509v3 \
424	${LCRYPTO_SRC}/engines \
425	${LCRYPTO_SRC} \
426	${.CURDIR}/man
427