gdsa: Include "dsa.h" for dsa_h2n.
[u/mdw/catacomb] / Makefile.m4
... / ...
CommitLineData
1## -*-m4-*-
2##
3## $Id$
4##
5## Makefile for Catacomb
6##
7## (c) 1999 Straylight/Edgeware
8##
9
10##----- Licensing notice ----------------------------------------------------
11##
12## This file is part of Catacomb.
13##
14## Catacomb is free software; you can redistribute it and/or modify
15## it under the terms of the GNU Library General Public License as
16## published by the Free Software Foundation; either version 2 of the
17## License, or (at your option) any later version.
18##
19## Catacomb is distributed in the hope that it will be useful,
20## but WITHOUT ANY WARRANTY; without even the implied warranty of
21## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22## GNU Library General Public License for more details.
23##
24## You should have received a copy of the GNU Library General Public
25## License along with Catacomb; if not, write to the Free
26## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27## MA 02111-1307, USA.
28
29AUTOMAKE_OPTIONS = foreign
30
31SUBDIRS = tests
32
33archincludedir = $(libdir)/catacomb/include
34
35## --- List handling macros ---
36##
37## List handling is nice, usually. Unfortunately, I based this design on
38## TeX list macros rather than anything sensible...
39
40define(`_', `define(`_item', $1)define(`_item_2', $2)emit`'')
41define(`adorn', `pushdef(`emit', `$1`'_item`'$3')$2`'popdef(`emit')')
42define(`join',
43`pushdef(`emit', `adorn(``_(''_item`$2', `$3', ``)'')`'')$1`'popdef(`emit')')
44define(`addsuffix', `adorn(`', `$1', `$2')')
45define(`lit', `adorn(`', `$1', `')')
46define(`nl', `
47')
48
49define(`allwithsuffix',
50`addsuffix(`$1', `$3') addsuffix(`$2', `$3') dnl
51addsuffix(join(`$1', `-', `$2'), `$3')')
52
53## --- Autogenerated source files ---
54
55define(`ciphers', `dnl
56_(des) _(desx) _(des3) _(mars) dnl
57_(idea) _(safer) _(safersk) dnl
58_(blowfish) _(twofish) dnl
59_(tea) _(xtea) dnl
60_(rc2) _(rc5) dnl
61_(skipjack) dnl
62_(cast128) _(cast256) dnl
63_(square) _(rijndael) _(rijndael192) _(rijndael256) dnl
64_(serpent) _(noekeon)')
65define(`cipher_modes', `_(ecb) _(cbc) _(cfb) _(ofb) _(counter)')
66
67define(`hashes', `dnl
68_(md5) _(md4) _(md2) _(tiger) _(has160) dnl
69_(sha) _(sha224) _(sha256) _(sha384) _(sha512) dnl
70_(whirlpool) _(whirlpool256) dnl
71_(rmd128) _(rmd160) _(rmd256) _(rmd320)')
72define(`hash_modes', `_(mgf) _(hmac)')
73
74MODES = \
75 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.c') \
76 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.h') \
77 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.c') \
78 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.h')
79
80$(MODES): modes-stamp
81modes-stamp: genmodes
82 cd $(srcdir); ./genmodes "lit(`ciphers')" "lit(`cipher_modes')"
83 cd $(srcdir); ./genmodes "lit(`hashes')" "lit(`hash_modes')"
84 echo datestamp >modes-stamp
85
86define(`gen_tables', `dnl
87_(des) _(blowfish) _(twofish) dnl
88_(square) _(rijndael) _(whirlpool) dnl
89_(safer) _(mars) _(tiger) dnl
90_(gfshare) _(gfx-sqr)')
91
92autoheaders: \
93 addsuffix(`gen_tables', `-tab.h') \
94 primetab.h wheel.h mptypes.h mplimits.h
95define(`emit', `
96_item`'-tab.h: _item`'-mktab$(EXEEXT)
97 ./_item`'-mktab >_item`'-tab.h.new
98 mv _item`'-tab.h.new _item`'-tab.h')dnl
99gen_tables
100
101primetab.h: primetab.c
102primetab.c: genprimes$(EXEEXT)
103 ./genprimes -h primetab.h -c primetab.c \
104 -s CATACOMB_PRIMETAB_H -n 256 \
105 -t "unsigned short" -i primetab
106
107wheel.h: wheel.c
108wheel.c: genwheel$(EXEEXT)
109 ./genwheel -h wheel.h -c wheel.c \
110 -s CATACOMB_WHEEL_H -n 5 \
111 -t "unsigned char" -i wheel
112
113archinclude_HEADERS = mptypes.h mplimits.h
114mptypes.h: mptypes$(EXEEXT)
115 ./mptypes >mptypes.h.new
116 mv mptypes.h.new mptypes.h
117
118mplimits.h: genlimits$(EXEEXT)
119 ./genlimits h >mplimits.h.new
120 mv mplimits.h.new mplimits.h
121mplimits.c: genlimits$(EXEEXT)
122 ./genlimits c >mplimits.c.new
123 mv mplimits.c.new mplimits.c
124
125ectab.c: ectab.in ec-gentab.awk mpdump$(EXEEXT)
126 $(srcdir)/ec-gentab.awk <$(srcdir)/ectab.in >ectab.c.new
127 mv ectab.c.new ectab.c
128
129ptab.c: ptab.in p-gentab.awk mpdump$(EXEEXT)
130 $(srcdir)/p-gentab.awk <$(srcdir)/ptab.in >ptab.c.new
131 mv ptab.c.new ptab.c
132
133bintab.c: bintab.in bin-gentab.awk mpdump$(EXEEXT)
134 $(srcdir)/bin-gentab.awk <$(srcdir)/bintab.in >bintab.c.new
135 mv bintab.c.new bintab.c
136
137gciphertab.c: gengctab
138 $(srcdir)/gengctab gccipher gcipher >gciphertab.c.new \
139 "lit(join(`ciphers', `-', `cipher_modes')) \
140 lit(join(`hashes', `-', `_(mgf)')) \
141 rc4 seal"
142 mv gciphertab.c.new gciphertab.c
143
144gmactab.c: gengctab
145 $(srcdir)/gengctab gcmac gmac >gmactab.c.new \
146 "lit(join(`hashes', `-', `_(hmac)'))"
147 mv gmactab.c.new gmactab.c
148
149ghashtab.c: gengctab
150 $(srcdir)/gengctab gchash ghash >ghashtab.c.new \
151 "lit(`hashes') \
152 crc32=gcrc32"
153 mv ghashtab.c.new ghashtab.c
154
155BUILT_SOURCES = \
156 getdate.c modes-stamp gciphertab.c gmactab.c ghashtab.c \
157 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
158 addsuffix(join(`ciphers', `-', `cipher_modes'), `.h') \
159 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
160 addsuffix(join(`hashes', `-', `hash_modes'), `.h')
161
162## --- Building the main library ---
163
164lib_LTLIBRARIES = libcatacomb.la
165
166libcatacomb_la_LIBADD = $(CATACOMB_LIBS)
167libcatacomb_la_LDFLAGS = -version-info 3:1:1
168## Middle number is the patchlevel. Final number is the minor version. The
169## difference between the first and last numbers is major version.
170
171pkginclude_HEADERS = \
172 arena.h paranoia.h buf.h qdparse.h keysz.h \
173 blkc.h hash.h gcipher.h ghash.h gmac.h grand.h ghash-def.h \
174 lcrand.h fibrand.h rc4.h seal.h rand.h noise.h fipstest.h maurer.h \
175 key.h key-error.h key-data.h passphrase.h pixie.h lmem.h \
176 mpx.h bitops.h mpw.h mpscan.h mparena.h mp.h mptext.h mpint.h \
177 exp.h mpbarrett.h mpmont.h mpreduce.h mp-exp.h \
178 mpcrt.h mprand.h mpmul.h \
179 gfx.h gf.h gfreduce.h gfn.h gf-exp.h \
180 primetab.h wheel.h pfilt.h rabin.h \
181 pgen.h primeiter.h prim.h strongprime.h limlee.h keycheck.h \
182 bbs.h rsa.h dh.h dsarand.h dsa.h gdsa.h gkcdsa.h \
183 tlsprf.h sslprf.h \
184 gfshare.h share.h \
185 rho.h \
186 field.h field-guts.h field-exp.h \
187 ec.h ec-guts.h ec-exp.h ec-test.h ectab.h ec-keys.h ec-raw.h \
188 ptab.h bintab.h group.h group-guts.h \
189 allwithsuffix(`ciphers', `cipher_modes', `.h') \
190 allwithsuffix(`hashes', `hash_modes', `.h') \
191 addsuffix(`cipher_modes', `-def.h') \
192 addsuffix(`hash_modes', `-def.h') crc32.h
193
194define(`MP_BASE',
195 `mpx.c mpx-kmul.c mpx-ksqr.c mpscan.c mparena.c \
196 mp-misc.c mp-mem.c mp-const.c mp-arith.c mp-io.c \
197 mptext.c mptext-string.c')
198
199define(`MP_SOURCES',
200 `qdparse.c \
201 mp-test.c mplimits.c \
202 mp-sqrt.c mp-gcd.c mp-jacobi.c mp-modsqrt.c mp-exp.c mp-modexp.c \
203 mpint.c mptext-file.c mptext-dstr.c \
204 mptext-len.c \
205 exp.c mpcrt.c mpmul.c mprand.c \
206 mpbarrett.c mpbarrett-exp.c mpbarrett-mexp.c mpbarrett-exp.h \
207 mpmont.c mpmont-exp.c mpmont-mexp.c mpmont-exp.h \
208 mpreduce.c mpreduce-exp.h \
209 group-stdops.c group-exp.c group-exp.h g-prime.c g-bin.c \
210 group-parse.c \
211 group-string.c group-file.c group-dstr.c \
212 rho.c buf.c ptab.c bintab.c \
213 GF_SOURCES PGEN_SOURCES EC_SOURCES')
214
215define(`GF_SOURCES',
216 `gfx.c gfx-kmul.c gfx-sqr.c gf-arith.c gf-exp.c gf-gcd.c \
217 gfreduce.c gfreduce-exp.h gfn.c')
218
219define(`EC_SOURCES',
220 `field.c field-parse.c field-exp.c \
221 f-prime.c f-niceprime.c f-binpoly.c \
222 ec.c ec-exp.c ec-prime.c ec-bin.c ec-test.c ec-info.c ectab.c \
223 ec-fetch.c ec-raw.c g-ec.c')
224
225define(`PGEN_SOURCES',
226 `pfilt.c primeiter.c rabin.c \
227 pgen.c pgen-stdev.c pgen-gcd.c pgen-simul.c \
228 prim.c strongprime.c limlee.c \
229 keycheck.c keycheck-mp.c keycheck-report.c \
230 bbs-rand.c bbs-gen.c bbs-jump.c bbs-fetch.c \
231 rsa-priv.c rsa-pub.c rsa-gen.c rsa-recover.c rsa-fetch.c \
232 oaep.c pkcs1.c pss.c \
233 dh-gen.c dh-limlee.c dh-kcdsa.c dh-check.c dh-fetch.c dh-param.c \
234 dsarand.c dsa-misc.c dsa-sign.c dsa-verify.c dsa-gen.c dsa-check.c \
235 gdsa.c gkcdsa.c \
236 key-data.c key-flags.c key-text.c key-binary.c key-pass.c \
237 key-pack.c key-misc.c key-file.c key-attr.c key-io.c key-moan.c \
238 key-error.c key-fetch.c \
239 primetab.c wheel.c share.c')
240
241libcatacomb_la_SOURCES = \
242 grand.c keysz.c keysz-conv.c \
243 lcrand.c fibrand.c rc4.c seal.c rand.c noise.c fipstest.c maurer.c \
244 arena.c \
245 passphrase.c pixie-common.c lmem.c \
246 tlsprf.c sslprf.c \
247 gfshare.c \
248 MP_BASE MP_SOURCES karatsuba.h \
249 gciphertab.c ghashtab.c gmactab.c \
250 des-base.c des-base.h \
251 desx-tab.h \
252 rc2-tab.h \
253 skipjack-tab.h \
254 cast-s.c cast-sk.c cast-base.h cast-tab.h \
255 rijndael-base.c rijndael-base.h \
256 md2-tab.h \
257 serpent-sbox.h skipjack-tab.h tiger-base.h \
258 daftstory.h \
259 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
260 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
261 addsuffix(`ciphers', `.c') addsuffix(`hashes', `.c') crc32.c
262
263des-base.lo: des-tab.h
264blowfish.lo: blowfish-tab.h
265twofish.lo: twofish-tab.h
266square.lo: square-tab.h
267rijndael-base.lo: rijndael-tab.h
268whirlpool.lo: whirlpool-tab.h
269safer.lo: safer-tab.h
270mars.lo: mars-tab.h
271tiger.lo: tiger-tab.h
272gfshare.lo: gfshare-tab.h
273gfx-sqr.lo: gfx-sqr-tab.h
274
275## --- Utility programs ---
276
277bin_PROGRAMS = \
278 dsig key pixie cookie rspit factorial hashsum mkphrase \
279 catcrypt catsign
280noinst_LIBRARIES = libcatcrypt.a
281pkgconfigdir = $(libdir)/pkgconfig
282pkgconfig_DATA = catacomb.pc
283noinst_PROGRAMS = \
284 genprimes genwheel mptypes genlimits serpent-check bittest mpdump \
285 perftest \
286 addsuffix(`gen_tables', `-mktab')
287LDADD = libcatcrypt.a libcatacomb.la
288
289define(`LIBCAT_SRC', `cc.h getdate.h dnl
290 cc-sig.c cc-subcmd.c cc-enc.c cc-kem.c cc-list.c')
291libcatcrypt_a_SOURCES = LIBCAT_SRC getdate.y
292
293patsubst(MP_BASE MP_SOURCES, `\.c\>', `.lo') dsig.o keyutil.o rspit.o \
294 patsubst(LIBCAT_SRC, `\.c\>', `.o'): \
295 mptypes.h primetab.h wheel.h
296patsubst(MP_SOURCES, `\.c\>', `.lo'): mplimits.h
297
298dsig_SOURCES = dsig.c
299cookie_SOURCES = cookie.c
300catcrypt_SOURCES = catcrypt.c
301catsign_SOURCES = catsign.c
302key_SOURCES = keyutil.c
303hashsum_SOURCES = hashsum.c
304rspit_SOURCES = rspit.c
305factorial_SOURCES = factorial.c
306perftest_SOURCES = perftest.c
307pixie_SOURCES = pixie.c pixie-common.c lmem.c arena.c passphrase.c
308pixie_LDADD = $(PIXIE_LIBS)
309pixie_CFLAGS = $(AM_CFLAGS)
310mkphrase_SOURCES = mkphrase.c
311bittest_SOURCES = bittest.c
312bittest_LDADD =
313
314define(`emit', `
315patsubst(_item, `[^a-zA-Z0-9]', `_')_mktab_SOURCES = _item`'-mktab.c
316patsubst(_item, `[^a-zA-Z0-9]', `_')_mktab_LDADD =')dnl
317gen_tables
318
319serpent_check_SOURCES = serpent-check.c
320serpent_check_LDADD =
321
322genprimes_SOURCES = genprimes.c
323genprimes_LDADD =
324
325genwheel_SOURCES = genwheel.c
326genwheel_LDADD =
327
328mptypes_SOURCES = mptypes.c
329mptypes_LDADD =
330
331genlimits_SOURCES = genlimits.c MP_BASE mptypes.h
332genlimits_LDADD =
333genlimits_CFLAGS = $(AM_CFLAGS)
334
335mpdump_SOURCES = mpdump.c MP_BASE
336mpdump_LDADD =
337mpdump_CFLAGS = $(AM_CFLAGS)
338
339## --- Install the pixie setuid-root if we can ---
340##
341## Bodge around a bug in Automake: it doesn't call `install-exec-hook' from
342## `install' if there are subdirectories.
343
344changequote(<, >)
345# install: install-exec-hook
346install-exec-hook:
347 @pixie="$(DESTDIR)$(bindir)/`echo pixie|sed $(transform)`"; \
348 if chown root $$pixie && chmod 4755 $$pixie; then \
349 echo "chown root $$pixie"; \
350 echo "chmod 4755 $$pixie"; \
351 else \
352 echo "***"; \
353 echo "*** You should probably install $$pixie setuid-root."; \
354 echo "***"; \
355 fi
356changequote(`, ')
357
358## --- Documentation ---
359
360man_MANS = \
361 key.1 dsig.1 cookie.1 catcrypt.1 catsign.1 hashsum.1 mkphrase.1 \
362 keyring.5 pixie.1
363
364## --- Prime group keyring ---
365
366pkgdata_DATA = pgroups.kr
367
368$(srcdir)/pgroups.kr: ptab.in mkpgroups
369 cd $(srcdir) && rm -f pgroups.kr && ./mkpgroups <ptab.in
370
371## --- Other handy definitions ---
372
373EXTRA_DIST = \
374 Makefile.m4 genmodes gengctab $(man_MANS) xpixie \
375 group-test.c rsa-test.c \
376 ectab.in ec-gentab.awk \
377 ptab.in p-gentab.awk mkpgroups pgroups.kr \
378 bintab.in bin-gentab.awk \
379 README.cipher README.hash README.random README.mp \
380 debian/rules debian/copyright debian/control debian/changelog \
381 debian/catacomb-bin.postinst debian/catacomb-bin.config \
382 debian/catacomb-bin.prerm debian/catacomb-bin.templates
383
384dist-hook:
385 @for i in getdate.c gciphertab.c ghashtab.c gmactab.c; do \
386 ln $$i $(distdir) || ln $(srcdir)/$$i $(distdir) || true; \
387 done
388 @echo datestamp >$(distdir)/modes-stamp || true
389 @for i in calc tests; do \
390 mkdir $(distdir)/$$i; \
391 ln $(srcdir)/$$i/*[!~] $(distdir)/$$i; \
392 done || true
393# kr=$$HOME/.catacomb/dsig-keyring; \
394# if [ -r $$kr ]; then \
395# cd $(distdir); \
396# ../key -k $$kr extract -f -secret KEYRING; \
397# find . -type f -print0 | ../dsig -k $$kr sign -0 -oMANIFEST; \
398# fi
399
400## --- Testing ---
401
402define(`testprogs', `')
403
404define(`CTESTRIG',
405`define(`testprogs', testprogs \
406 $1.t$(EXEEXT))dnl
407$1.to: $1.c
408 $(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $(srcdir)/$1.c -o $1.to
409$1.t$(EXEEXT): $1.to libcatacomb.la
410 $(CC) $(CFLAGS) $(LDFLAGS) $1.to .libs/libcatacomb.a $(CATACOMB_LIBS) $(LIBS) -o $1.t$(EXEEXT)')
411
412CTESTRIG(rc4)
413CTESTRIG(seal)
414adorn(`nl`'CTESTRIG(', `ciphers', `)')
415adorn(`nl`'CTESTRIG(', `hashes', `)')
416adorn(`nl`'CTESTRIG(', join(`ciphers', `-', `cipher_modes'), `)')
417adorn(`nl`'CTESTRIG(', join(`hashes', `-', `hash_modes'), `)')
418CTESTRIG(lcrand)
419CTESTRIG(tlsprf)
420CTESTRIG(sslprf)
421CTESTRIG(mpx)
422CTESTRIG(mpx-kmul)
423CTESTRIG(mpx-ksqr)
424CTESTRIG(mp-arith)
425CTESTRIG(mp-modsqrt)
426CTESTRIG(mp-gcd)
427CTESTRIG(mp-jacobi)
428CTESTRIG(mp-sqrt)
429CTESTRIG(mp-modexp)
430CTESTRIG(mptext)
431CTESTRIG(mpint)
432CTESTRIG(mpbarrett)
433CTESTRIG(mpbarrett-exp)
434CTESTRIG(mpbarrett-mexp)
435CTESTRIG(mpmont)
436CTESTRIG(mpmont-exp)
437CTESTRIG(mpmont-mexp)
438CTESTRIG(mpreduce)
439CTESTRIG(mpcrt)
440CTESTRIG(mpmul)
441CTESTRIG(rsa-test)
442CTESTRIG(gfx)
443CTESTRIG(gfx-sqr)
444CTESTRIG(gfx-kmul)
445CTESTRIG(gf-arith)
446CTESTRIG(gf-gcd)
447CTESTRIG(gfreduce)
448CTESTRIG(gfn)
449CTESTRIG(ec-prime)
450CTESTRIG(ec-bin)
451CTESTRIG(ec-test)
452CTESTRIG(ec-info)
453CTESTRIG(dh-param)
454CTESTRIG(group-test)
455CTESTRIG(gdsa)
456CTESTRIG(gkcdsa)
457CTESTRIG(pgen)
458CTESTRIG(primeiter)
459CTESTRIG(dsa-gen)
460CTESTRIG(dsa-sign)
461CTESTRIG(dsa-verify)
462CTESTRIG(bbs-rand)
463CTESTRIG(bbs-jump)
464CTESTRIG(gfshare)
465CTESTRIG(share)
466CTESTRIG(rho)
467
468TESTS = serpent-check bittest testprogs
469
470CLEANFILES = \
471 *.t$(EXEEXT) *.to *.kr.old \
472 mptypes.h primetab.c primetab.h wheel.c wheel.h \
473 ectab.c ptab.c bintab.c \
474 addsuffix(`gen_tables', `-tab.h')
475
476## --- Makefile building (haha!) ---
477
478$(srcdir)/Makefile.am: $(srcdir)/Makefile.m4
479 m4 $(srcdir)/Makefile.m4 >$(srcdir)/Makefile.am.new
480 mv $(srcdir)/Makefile.am.new $(srcdir)/Makefile.am
481
482DISTCLEANFILES = libtool
483
484MAINTAINERCLEANFILES = \
485 $(srcdir)/Makefile.am \
486 $(srcdir)/getdate.c getdate.c \
487 $(srcdir)/pgroups.kr \
488 $(MODES) modes-stamp $(srcdir)/modes-stamp
489
490##----- That's all, folks ---------------------------------------------------