HEIMDAL: move code from source4/heimdal* to third_party/heimdal*
[samba.git] / third_party / heimdal / lib / hcrypto / Makefile.am
1 # $Id$
2
3 include $(top_srcdir)/Makefile.am.common
4
5 AUTOMAKE_OPTIONS = subdir-objects
6
7 if HAVE_HCRYPTO_W_OPENSSL
8 AM_CPPFLAGS += $(INCLUDE_openssl_crypto)
9 endif
10
11 AM_CPPFLAGS += -I$(top_srcdir)/lib/hx509 \
12                -I$(srcdir)/libtommath -DUSE_HCRYPTO_LTM=1 \
13                -I$(srcdir)/x25519 \
14                -I$(srcdir)/..
15
16 WFLAGS += $(WFLAGS_LITE) -Wno-error=unused-function
17 # XXX: Make these not necessary:
18 WFLAGS += -Wno-error=unused-result -Wno-error=deprecated-declarations
19
20 lib_LTLIBRARIES = libhcrypto.la
21 check_LTLIBRARIES = libhctest.la
22
23 libhcrypto_la_LDFLAGS = -version-info 5:0:1
24 libhcrypto_la_LIBADD = \
25         $(top_builddir)/lib/asn1/libasn1.la \
26         $(LIB_dlopen) \
27         $(LIB_heimbase) \
28         $(LIBADD_roken)
29
30 if HAVE_HCRYPTO_W_OPENSSL
31 libhcrypto_la_LIBADD += $(LIB_openssl_crypto)
32 endif
33
34 hcryptoincludedir = $(includedir)/hcrypto
35 buildhcryptoinclude = $(buildinclude)/hcrypto
36
37 hcryptoinclude_HEADERS =        \
38         aes.h                   \
39         bn.h                    \
40         des.h                   \
41         dh.h                    \
42         dsa.h                   \
43         ec.h                    \
44         ecdh.h                  \
45         ecdsa.h                 \
46         engine.h                \
47         evp.h                   \
48         evp-hcrypto.h           \
49         evp-cc.h                \
50         evp-openssl.h           \
51         evp-pkcs11.h            \
52         hmac.h                  \
53         md2.h                   \
54         md4.h                   \
55         md5.h                   \
56         pkcs12.h                \
57         rand.h                  \
58         rc2.h                   \
59         rc4.h                   \
60         rsa.h                   \
61         sha.h                   \
62         ui.h                    \
63         undef.h                 \
64         x25519_ref10.h
65
66 install-build-headers:: $(hcryptoinclude_HEADERS) $(x25519include_HEADERS)
67         @foo='$(hcryptoinclude_HEADERS)'; \
68         for f in $$foo; do \
69                 f=`basename $$f`; \
70                 if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
71                 else file="$$f"; fi; \
72                 if cmp -s  $$file $(buildhcryptoinclude)/$$f 2> /dev/null ; then \
73                 : ; else \
74                         echo "cp $$file $(buildhcryptoinclude)/$$f";\
75                         cp $$file $(buildhcryptoinclude)/$$f; \
76                 fi ; \
77         done
78
79 PROGRAM_TESTS = \
80         destest \
81         mdtest \
82         rc2test  \
83         rctest \
84         test_bn \
85         test_bulk \
86         test_cipher \
87         test_engine_dso \
88         test_hmac \
89         test_pkcs12 \
90         test_pkcs5
91
92 libhctest_la_SOURCES = \
93         des-tables.h    \
94         des.c           \
95         des.h           \
96         ui.c            \
97         ui.h
98
99 destest_LDADD = libhctest.la $(LIB_roken)
100
101 SCRIPT_TESTS = \
102         test_crypto
103
104 noinst_PROGRAMS = test_rand
105
106 check_PROGRAMS = $(PROGRAM_TESTS) test_rsa test_dh example_evp_cipher
107 check_SCRIPTS = $(SCRIPT_TESTS)
108
109 TESTS = $(PROGRAM_TESTS) $(SCRIPT_TESTS)
110
111 LDADD = $(lib_LTLIBRARIES) $(LIB_roken) $(LIB_openssl_crypto)
112 test_rand_LDADD = $(LDADD) -lm
113
114 libhcrypto_la_SOURCES = \
115         $(ltmsources)   \
116         $(x25519sources)\
117         aes.c           \
118         aes.h           \
119         bn.c            \
120         bn.h            \
121         common.c        \
122         common.h        \
123         camellia.h      \
124         camellia.c      \
125         camellia-ntt.c  \
126         camellia-ntt.h  \
127         des-tables.h    \
128         des.c           \
129         des.h           \
130         dh.c            \
131         dh.h            \
132         dh-ltm.c        \
133         dsa.c           \
134         dsa.h           \
135         doxygen.c       \
136         evp.c           \
137         evp.h           \
138         evp-hcrypto.c   \
139         evp-cc.c        \
140         evp-openssl.c   \
141         evp-pkcs11.c    \
142         engine.c        \
143         engine.h        \
144         hash.h          \
145         hmac.c          \
146         hmac.h          \
147         md2.c           \
148         md2.h           \
149         md4.c           \
150         md4.h           \
151         md5.c           \
152         md5.h           \
153         pkcs5.c         \
154         pkcs12.c        \
155         rand-fortuna.c  \
156         rand-timer.c    \
157         rand-unix.c     \
158         rand.c          \
159         rand.h          \
160         randi.h         \
161         rc2.c           \
162         rc2.h           \
163         rc4.c           \
164         rc4.h           \
165         rijndael-alg-fst.c \
166         rijndael-alg-fst.h \
167         rnd_keys.c      \
168         rsa.c           \
169         rsa-gmp.c       \
170         rsa-ltm.c       \
171         rsa.h           \
172         sha.c           \
173         sha.h           \
174         sha256.c        \
175         sha512.c        \
176         validate.c      \
177         ui.c            \
178         ui.h            \
179         undef.h
180
181 ltmsources = \
182         libtommath/bn_cutoffs.c \
183         libtommath/bn_deprecated.c \
184         libtommath/bn_mp_2expt.c \
185         libtommath/bn_mp_abs.c \
186         libtommath/bn_mp_add.c \
187         libtommath/bn_mp_add_d.c \
188         libtommath/bn_mp_addmod.c \
189         libtommath/bn_mp_and.c \
190         libtommath/bn_mp_clamp.c \
191         libtommath/bn_mp_clear.c \
192         libtommath/bn_mp_clear_multi.c \
193         libtommath/bn_mp_cmp.c \
194         libtommath/bn_mp_cmp_d.c \
195         libtommath/bn_mp_cmp_mag.c \
196         libtommath/bn_mp_cnt_lsb.c \
197         libtommath/bn_mp_complement.c \
198         libtommath/bn_mp_copy.c \
199         libtommath/bn_mp_count_bits.c \
200         libtommath/bn_mp_decr.c \
201         libtommath/bn_mp_div.c \
202         libtommath/bn_mp_div_2.c \
203         libtommath/bn_mp_div_2d.c \
204         libtommath/bn_mp_div_3.c \
205         libtommath/bn_mp_div_d.c \
206         libtommath/bn_mp_dr_is_modulus.c \
207         libtommath/bn_mp_dr_reduce.c \
208         libtommath/bn_mp_dr_setup.c \
209         libtommath/bn_mp_error_to_string.c \
210         libtommath/bn_mp_exch.c \
211         libtommath/bn_mp_expt_u32.c \
212         libtommath/bn_mp_exptmod.c \
213         libtommath/bn_mp_exteuclid.c \
214         libtommath/bn_mp_fread.c \
215         libtommath/bn_mp_from_sbin.c \
216         libtommath/bn_mp_from_ubin.c \
217         libtommath/bn_mp_fwrite.c \
218         libtommath/bn_mp_gcd.c \
219         libtommath/bn_mp_get_double.c \
220         libtommath/bn_mp_get_i32.c \
221         libtommath/bn_mp_get_i64.c \
222         libtommath/bn_mp_get_l.c \
223         libtommath/bn_mp_get_ll.c \
224         libtommath/bn_mp_get_mag_u32.c \
225         libtommath/bn_mp_get_mag_u64.c \
226         libtommath/bn_mp_get_mag_ul.c \
227         libtommath/bn_mp_get_mag_ull.c \
228         libtommath/bn_mp_grow.c \
229         libtommath/bn_mp_incr.c \
230         libtommath/bn_mp_init.c \
231         libtommath/bn_mp_init_copy.c \
232         libtommath/bn_mp_init_i32.c \
233         libtommath/bn_mp_init_i64.c \
234         libtommath/bn_mp_init_l.c \
235         libtommath/bn_mp_init_ll.c \
236         libtommath/bn_mp_init_multi.c \
237         libtommath/bn_mp_init_set.c \
238         libtommath/bn_mp_init_size.c \
239         libtommath/bn_mp_init_u32.c \
240         libtommath/bn_mp_init_u64.c \
241         libtommath/bn_mp_init_ul.c \
242         libtommath/bn_mp_init_ull.c \
243         libtommath/bn_mp_invmod.c \
244         libtommath/bn_mp_is_square.c \
245         libtommath/bn_mp_iseven.c \
246         libtommath/bn_mp_isodd.c \
247         libtommath/bn_mp_kronecker.c \
248         libtommath/bn_mp_lcm.c \
249         libtommath/bn_mp_log_u32.c \
250         libtommath/bn_mp_lshd.c \
251         libtommath/bn_mp_mod.c \
252         libtommath/bn_mp_mod_2d.c \
253         libtommath/bn_mp_mod_d.c \
254         libtommath/bn_mp_montgomery_calc_normalization.c \
255         libtommath/bn_mp_montgomery_reduce.c \
256         libtommath/bn_mp_montgomery_setup.c \
257         libtommath/bn_mp_mul.c \
258         libtommath/bn_mp_mul_2.c \
259         libtommath/bn_mp_mul_2d.c \
260         libtommath/bn_mp_mul_d.c \
261         libtommath/bn_mp_mulmod.c \
262         libtommath/bn_mp_neg.c \
263         libtommath/bn_mp_or.c \
264         libtommath/bn_mp_pack.c \
265         libtommath/bn_mp_pack_count.c \
266         libtommath/bn_mp_prime_fermat.c \
267         libtommath/bn_mp_prime_frobenius_underwood.c \
268         libtommath/bn_mp_prime_is_prime.c \
269         libtommath/bn_mp_prime_miller_rabin.c \
270         libtommath/bn_mp_prime_next_prime.c \
271         libtommath/bn_mp_prime_rabin_miller_trials.c \
272         libtommath/bn_mp_prime_rand.c \
273         libtommath/bn_mp_prime_strong_lucas_selfridge.c \
274         libtommath/bn_mp_radix_size.c \
275         libtommath/bn_mp_radix_smap.c \
276         libtommath/bn_mp_rand.c \
277         libtommath/bn_mp_read_radix.c \
278         libtommath/bn_mp_reduce.c \
279         libtommath/bn_mp_reduce_2k.c \
280         libtommath/bn_mp_reduce_2k_l.c \
281         libtommath/bn_mp_reduce_2k_setup.c \
282         libtommath/bn_mp_reduce_2k_setup_l.c \
283         libtommath/bn_mp_reduce_is_2k.c \
284         libtommath/bn_mp_reduce_is_2k_l.c \
285         libtommath/bn_mp_reduce_setup.c \
286         libtommath/bn_mp_root_u32.c \
287         libtommath/bn_mp_rshd.c \
288         libtommath/bn_mp_sbin_size.c \
289         libtommath/bn_mp_set.c \
290         libtommath/bn_mp_set_double.c \
291         libtommath/bn_mp_set_i32.c \
292         libtommath/bn_mp_set_i64.c \
293         libtommath/bn_mp_set_l.c \
294         libtommath/bn_mp_set_ll.c \
295         libtommath/bn_mp_set_u32.c \
296         libtommath/bn_mp_set_u64.c \
297         libtommath/bn_mp_set_ul.c \
298         libtommath/bn_mp_set_ull.c \
299         libtommath/bn_mp_shrink.c \
300         libtommath/bn_mp_signed_rsh.c \
301         libtommath/bn_mp_sqr.c \
302         libtommath/bn_mp_sqrmod.c \
303         libtommath/bn_mp_sqrt.c \
304         libtommath/bn_mp_sqrtmod_prime.c \
305         libtommath/bn_mp_sub.c \
306         libtommath/bn_mp_sub_d.c \
307         libtommath/bn_mp_submod.c \
308         libtommath/bn_mp_to_radix.c \
309         libtommath/bn_mp_to_sbin.c \
310         libtommath/bn_mp_to_ubin.c \
311         libtommath/bn_mp_ubin_size.c \
312         libtommath/bn_mp_unpack.c \
313         libtommath/bn_mp_xor.c \
314         libtommath/bn_mp_zero.c \
315         libtommath/bn_prime_tab.c \
316         libtommath/bn_s_mp_add.c \
317         libtommath/bn_s_mp_balance_mul.c \
318         libtommath/bn_s_mp_exptmod.c \
319         libtommath/bn_s_mp_exptmod_fast.c \
320         libtommath/bn_s_mp_get_bit.c \
321         libtommath/bn_s_mp_invmod_fast.c \
322         libtommath/bn_s_mp_invmod_slow.c \
323         libtommath/bn_s_mp_karatsuba_mul.c \
324         libtommath/bn_s_mp_karatsuba_sqr.c \
325         libtommath/bn_s_mp_montgomery_reduce_fast.c \
326         libtommath/bn_s_mp_mul_digs.c \
327         libtommath/bn_s_mp_mul_digs_fast.c \
328         libtommath/bn_s_mp_mul_high_digs.c \
329         libtommath/bn_s_mp_mul_high_digs_fast.c \
330         libtommath/bn_s_mp_prime_is_divisible.c \
331         libtommath/bn_s_mp_rand_jenkins.c \
332         libtommath/bn_s_mp_rand_platform.c \
333         libtommath/bn_s_mp_reverse.c \
334         libtommath/bn_s_mp_sqr.c \
335         libtommath/bn_s_mp_sqr_fast.c \
336         libtommath/bn_s_mp_sub.c \
337         libtommath/bn_s_mp_toom_mul.c \
338         libtommath/bn_s_mp_toom_sqr.c
339
340 x25519sources = \
341         x25519/ed25519_ref10.c \
342         x25519/x25519_ref10.c
343
344 $(libhcrypto_la_OBJECTS) $(test_rand_OBJECTS): hcrypto-link
345
346 libhcrypto_la_CPPFLAGS = -DBUILD_HCRYPTO_LIB $(AM_CPPFLAGS)
347
348 if versionscript
349 libhcrypto_la_LDFLAGS += $(LDFLAGS_VERSION_SCRIPT)$(srcdir)/version-script.map
350 endif
351 $(libhcrypto_la_OBJECTS): $(srcdir)/version-script.map
352
353
354 hcrypto-link:
355         $(LN_S) $(srcdir)/../hcrypto hcrypto
356         touch hcrypto-link
357
358 do_subst = sed -e 's,[@]srcdir[@],$(srcdir),g' -e 's,[@]exeext[@],$(exeext),g'
359
360 test_crypto: test_crypto.in Makefile
361         $(do_subst) < $(srcdir)/test_crypto.in > test_crypto.tmp
362         chmod +x test_crypto.tmp
363         mv test_crypto.tmp test_crypto
364
365 CLEANFILES = \
366         crypto-test \
367         crypto-test2 \
368         error \
369         hcrypto \
370         hcrypto-link \
371         test.file \
372         test_crypto \
373         test-out* \
374         test_crypto.tmp \
375         test_crypto.tmp
376
377 EXTRA_DIST = \
378         NTMakefile \
379         DESperate.txt \
380         passwd_dialog.rc \
381         libhcrypto-exports.def \
382         dh-tfm.c \
383         ec.h \
384         ecdh.h \
385         ecdsa.h \
386         evp-crypt.c \
387         evp-w32.c \
388         evp-w32.h \
389         evp-wincng.c \
390         evp-wincng.h \
391         gen-des.pl \
392         md5crypt_test.c \
393         passwd_dialog.aps \
394         passwd_dialog.clw \
395         passwd_dialog.rc \
396         passwd_dialog.res \
397         passwd_dlg.c \
398         passwd_dlg.h \
399         rand-w32.c \
400         resource.h \
401         rsa-tfm.c \
402         rsakey.der \
403         rsakey2048.der \
404         rsakey4096.der \
405         test_crypto.in \
406         version-script.map