1# Id
2
3include $(top_srcdir)/Makefile.am.common
4
5AUTOMAKE_OPTIONS = subdir-objects
6
7if HAVE_HCRYPTO_W_OPENSSL
8AM_CPPFLAGS += $(INCLUDE_openssl_crypto)
9endif
10
11AM_CPPFLAGS += -I$(top_srcdir)/lib/hx509 \
12	       -I$(srcdir)/libtommath -DUSE_HCRYPTO_LTM=1
13
14lib_LTLIBRARIES = libhcrypto.la
15check_LTLIBRARIES = libhctest.la
16
17libhcrypto_la_LDFLAGS = -version-info 5:0:1
18libhcrypto_la_LIBADD = \
19	$(top_builddir)/lib/asn1/libasn1.la \
20	$(LIB_dlopen) \
21	$(LIB_heimbase) \
22	$(LIBADD_roken)
23
24if HAVE_HCRYPTO_W_OPENSSL
25libhcrypto_la_LIBADD += $(LIB_openssl_crypto)
26endif
27
28hcryptoincludedir = $(includedir)/hcrypto
29buildhcryptoinclude = $(buildinclude)/hcrypto
30
31hcryptoinclude_HEADERS =	\
32	aes.h			\
33	bn.h			\
34	des.h			\
35	dh.h			\
36	dsa.h			\
37	ec.h			\
38	ecdh.h			\
39	ecdsa.h			\
40	engine.h		\
41	evp.h			\
42	evp-hcrypto.h		\
43	evp-cc.h		\
44	evp-openssl.h		\
45	evp-pkcs11.h		\
46	hmac.h			\
47	md4.h			\
48	md5.h			\
49	pkcs12.h		\
50	rand.h			\
51	rc2.h			\
52	rc4.h			\
53	rsa.h			\
54	sha.h			\
55	ui.h			\
56	undef.h
57
58install-build-headers:: $(hcryptoinclude_HEADERS)
59	@foo='$(hcryptoinclude_HEADERS)'; \
60	for f in $$foo; do \
61		f=`basename $$f`; \
62		if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
63		else file="$$f"; fi; \
64		if cmp -s  $$file $(buildhcryptoinclude)/$$f 2> /dev/null ; then \
65		: ; else \
66			echo "cp $$file $(buildhcryptoinclude)/$$f";\
67			cp $$file $(buildhcryptoinclude)/$$f; \
68		fi ; \
69	done
70
71PROGRAM_TESTS = \
72	destest \
73	mdtest \
74	rc2test  \
75	rctest \
76	test_bn \
77	test_bulk \
78	test_cipher \
79	test_engine_dso \
80	test_hmac \
81	test_pkcs12 \
82	test_pkcs5
83
84libhctest_la_SOURCES = \
85	des-tables.h	\
86	des.c		\
87	des.h		\
88	ui.c		\
89	ui.h
90
91destest_LDADD = libhctest.la $(LIB_roken)
92
93SCRIPT_TESTS = \
94	test_crypto
95
96noinst_PROGRAMS = test_rand
97
98check_PROGRAMS = $(PROGRAM_TESTS) test_rsa test_dh example_evp_cipher
99check_SCRIPTS = $(SCRIPT_TESTS)
100
101TESTS = $(PROGRAM_TESTS) $(SCRIPT_TESTS)
102
103LDADD = $(lib_LTLIBRARIES) $(LIB_roken) $(LIB_openssl_crypto)
104test_rand_LDADD = $(LDADD) -lm
105
106libhcrypto_la_SOURCES =	\
107	$(ltmsources)	\
108	aes.c		\
109	aes.h		\
110	bn.c		\
111	bn.h		\
112	common.c	\
113	common.h	\
114	camellia.h	\
115	camellia.c	\
116	camellia-ntt.c	\
117	camellia-ntt.h	\
118	des-tables.h	\
119	des.c		\
120	des.h		\
121	dh.c		\
122	dh.h		\
123	dh-ltm.c	\
124	dsa.c		\
125	dsa.h		\
126	doxygen.c	\
127	evp.c		\
128	evp.h		\
129	evp-hcrypto.c	\
130	evp-cc.c	\
131	evp-openssl.c	\
132	evp-pkcs11.c	\
133	engine.c	\
134	engine.h	\
135	hash.h		\
136	hmac.c		\
137	hmac.h		\
138	md4.c		\
139	md4.h		\
140	md5.c		\
141	md5.h		\
142	pkcs5.c		\
143	pkcs12.c	\
144	rand-fortuna.c	\
145	rand-timer.c	\
146	rand-unix.c	\
147	rand.c		\
148	rand.h		\
149	randi.h		\
150	rc2.c		\
151	rc2.h		\
152	rc4.c		\
153	rc4.h		\
154	rijndael-alg-fst.c \
155	rijndael-alg-fst.h \
156	rnd_keys.c	\
157	rsa.c		\
158	rsa-gmp.c	\
159	rsa-ltm.c	\
160	rsa.h		\
161	sha.c		\
162	sha.h		\
163	sha256.c	\
164	sha512.c	\
165	validate.c	\
166	ui.c		\
167	ui.h		\
168	undef.h
169
170ltmsources = \
171	libtommath/tommath.h \
172	libtommath/tommath_class.h \
173	libtommath/tommath_superclass.h \
174	libtommath/bncore.c \
175	libtommath/bn_mp_init.c \
176	libtommath/bn_mp_clear.c \
177	libtommath/bn_mp_exch.c \
178	libtommath/bn_mp_grow.c \
179	libtommath/bn_mp_shrink.c \
180	libtommath/bn_mp_clamp.c \
181	libtommath/bn_mp_zero.c \
182	libtommath/bn_mp_zero_multi.c \
183	libtommath/bn_mp_set.c \
184	libtommath/bn_mp_set_int.c \
185	libtommath/bn_mp_init_size.c \
186	libtommath/bn_mp_copy.c \
187	libtommath/bn_mp_init_copy.c \
188	libtommath/bn_mp_abs.c \
189	libtommath/bn_mp_neg.c \
190	libtommath/bn_mp_cmp_mag.c \
191	libtommath/bn_mp_cmp.c \
192	libtommath/bn_mp_cmp_d.c \
193	libtommath/bn_mp_rshd.c \
194	libtommath/bn_mp_lshd.c \
195	libtommath/bn_mp_mod_2d.c \
196	libtommath/bn_mp_div_2d.c \
197	libtommath/bn_mp_mul_2d.c \
198	libtommath/bn_mp_div_2.c \
199	libtommath/bn_mp_mul_2.c \
200	libtommath/bn_s_mp_add.c \
201	libtommath/bn_s_mp_sub.c \
202	libtommath/bn_fast_s_mp_mul_digs.c \
203	libtommath/bn_s_mp_mul_digs.c \
204	libtommath/bn_fast_s_mp_mul_high_digs.c \
205	libtommath/bn_s_mp_mul_high_digs.c \
206	libtommath/bn_fast_s_mp_sqr.c \
207	libtommath/bn_s_mp_sqr.c \
208	libtommath/bn_mp_add.c \
209	libtommath/bn_mp_sub.c \
210	libtommath/bn_mp_karatsuba_mul.c \
211	libtommath/bn_mp_mul.c \
212	libtommath/bn_mp_karatsuba_sqr.c \
213	libtommath/bn_mp_sqr.c \
214	libtommath/bn_mp_div.c \
215	libtommath/bn_mp_mod.c \
216	libtommath/bn_mp_add_d.c \
217	libtommath/bn_mp_sub_d.c \
218	libtommath/bn_mp_mul_d.c \
219	libtommath/bn_mp_div_d.c \
220	libtommath/bn_mp_mod_d.c \
221	libtommath/bn_mp_expt_d.c \
222	libtommath/bn_mp_addmod.c \
223	libtommath/bn_mp_submod.c \
224	libtommath/bn_mp_mulmod.c \
225	libtommath/bn_mp_sqrmod.c \
226	libtommath/bn_mp_gcd.c \
227	libtommath/bn_mp_lcm.c \
228	libtommath/bn_fast_mp_invmod.c \
229	libtommath/bn_mp_invmod.c \
230	libtommath/bn_mp_reduce.c \
231	libtommath/bn_mp_montgomery_setup.c \
232	libtommath/bn_fast_mp_montgomery_reduce.c \
233	libtommath/bn_mp_montgomery_reduce.c \
234	libtommath/bn_mp_exptmod_fast.c \
235	libtommath/bn_mp_exptmod.c \
236	libtommath/bn_mp_2expt.c \
237	libtommath/bn_mp_n_root.c \
238	libtommath/bn_mp_jacobi.c \
239	libtommath/bn_reverse.c \
240	libtommath/bn_mp_count_bits.c \
241	libtommath/bn_mp_read_unsigned_bin.c \
242	libtommath/bn_mp_read_signed_bin.c \
243	libtommath/bn_mp_to_unsigned_bin.c \
244	libtommath/bn_mp_to_signed_bin.c \
245	libtommath/bn_mp_unsigned_bin_size.c \
246	libtommath/bn_mp_signed_bin_size.c \
247	libtommath/bn_mp_xor.c \
248	libtommath/bn_mp_and.c \
249	libtommath/bn_mp_or.c \
250	libtommath/bn_mp_rand.c \
251	libtommath/bn_mp_montgomery_calc_normalization.c \
252	libtommath/bn_mp_prime_is_divisible.c \
253	libtommath/bn_prime_tab.c \
254	libtommath/bn_mp_prime_fermat.c \
255	libtommath/bn_mp_prime_miller_rabin.c \
256	libtommath/bn_mp_prime_is_prime.c \
257	libtommath/bn_mp_prime_next_prime.c \
258	libtommath/bn_mp_find_prime.c \
259	libtommath/bn_mp_dr_reduce.c \
260	libtommath/bn_mp_dr_is_modulus.c \
261	libtommath/bn_mp_dr_setup.c \
262	libtommath/bn_mp_reduce_setup.c \
263	libtommath/bn_mp_toom_mul.c \
264	libtommath/bn_mp_toom_sqr.c \
265	libtommath/bn_mp_div_3.c \
266	libtommath/bn_s_mp_exptmod.c \
267	libtommath/bn_mp_reduce_2k.c \
268	libtommath/bn_mp_reduce_is_2k.c \
269	libtommath/bn_mp_reduce_2k_setup.c \
270	libtommath/bn_mp_reduce_2k_l.c \
271	libtommath/bn_mp_reduce_is_2k_l.c \
272	libtommath/bn_mp_reduce_2k_setup_l.c \
273	libtommath/bn_mp_radix_smap.c \
274	libtommath/bn_mp_read_radix.c \
275	libtommath/bn_mp_toradix.c \
276	libtommath/bn_mp_radix_size.c \
277	libtommath/bn_mp_fread.c \
278	libtommath/bn_mp_fwrite.c \
279	libtommath/bn_mp_cnt_lsb.c \
280	libtommath/bn_error.c \
281	libtommath/bn_mp_init_multi.c \
282	libtommath/bn_mp_clear_multi.c \
283	libtommath/bn_mp_exteuclid.c \
284	libtommath/bn_mp_toradix_n.c \
285	libtommath/bn_mp_prime_random_ex.c \
286	libtommath/bn_mp_get_int.c \
287	libtommath/bn_mp_sqrt.c \
288	libtommath/bn_mp_is_square.c \
289	libtommath/bn_mp_init_set.c \
290	libtommath/bn_mp_init_set_int.c \
291	libtommath/bn_mp_invmod_slow.c \
292	libtommath/bn_mp_prime_rabin_miller_trials.c \
293	libtommath/bn_mp_to_signed_bin_n.c \
294	libtommath/bn_mp_to_unsigned_bin_n.c
295
296
297$(libhcrypto_la_OBJECTS) $(test_rand_OBJECTS): hcrypto-link
298
299libhcrypto_la_CPPFLAGS = -DBUILD_HCRYPTO_LIB $(AM_CPPFLAGS)
300
301if versionscript
302libhcrypto_la_LDFLAGS += $(LDFLAGS_VERSION_SCRIPT)$(srcdir)/version-script.map
303endif
304$(libhcrypto_la_OBJECTS): $(srcdir)/version-script.map
305
306
307hcrypto-link:
308	$(LN_S) $(srcdir)/../hcrypto hcrypto
309	touch hcrypto-link
310
311do_subst = sed -e 's,[@]srcdir[@],$(srcdir),g' -e 's,[@]exeext[@],$(exeext),g'
312
313test_crypto: test_crypto.in Makefile
314	$(do_subst) < $(srcdir)/test_crypto.in > test_crypto.tmp
315	chmod +x test_crypto.tmp
316	mv test_crypto.tmp test_crypto
317
318CLEANFILES = \
319	crypto-test \
320	crypto-test2 \
321	error \
322	hcrypto \
323	hcrypto-link \
324	test.file \
325	test_crypto \
326	test-out* \
327	test_crypto.tmp \
328	test_crypto.tmp
329
330EXTRA_DIST = \
331	NTMakefile \
332	DESperate.txt \
333	passwd_dialog.rc \
334	libhcrypto-exports.def \
335	dh-tfm.c \
336	ec.h \
337	ecdh.h \
338	ecdsa.h \
339	evp-crypt.c \
340	evp-w32.c \
341	evp-w32.h \
342	evp-wincng.c \
343	evp-wincng.h \
344	gen-des.pl \
345	md5crypt_test.c \
346	passwd_dialog.aps \
347	passwd_dialog.clw \
348	passwd_dialog.rc \
349	passwd_dialog.res \
350	passwd_dlg.c \
351	passwd_dlg.h \
352	rand-w32.c \
353	resource.h \
354	rsa-tfm.c \
355	rsakey.der \
356	rsakey2048.der \
357	rsakey4096.der \
358	test_crypto.in \
359	version-script.map
360