Whoops.
[u/mdw/catacomb] / Makefile.m4
... / ...
CommitLineData
1## -*-makefile-*-
2##
3## $Id: Makefile.m4,v 1.52 2001/04/29 17:37:35 mdw Exp $
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
29##----- Revision history ----------------------------------------------------
30##
31## $Log: Makefile.m4,v $
32## Revision 1.52 2001/04/29 17:37:35 mdw
33## Added SAFER block cipher.
34##
35## Revision 1.51 2001/04/19 18:26:32 mdw
36## Add CRC as another hash function.
37##
38## Revision 1.50 2001/04/06 22:05:10 mdw
39## Add support for SSL pseudo-random function.
40##
41## Revision 1.49 2001/04/04 20:10:52 mdw
42## Add support for the TLS pseudo-random function.
43##
44## Revision 1.48 2001/04/03 19:36:50 mdw
45## New block cipher DESX added.
46##
47## Revision 1.47 2001/03/03 13:14:13 mdw
48## Distribute md2-tab.h
49##
50## Revision 1.46 2001/02/21 20:03:22 mdw
51## Added support for MD2 hash function.
52##
53## Revision 1.45 2001/02/03 16:09:41 mdw
54## New files added.
55##
56## Revision 1.44 2000/10/15 17:49:00 mdw
57## New SHA variants with longer outputs.
58##
59## Revision 1.43 2000/10/08 16:01:26 mdw
60## Add binary poly arithmetic. Tidy table generation stuff. Distribute
61## calc prototypes.
62##
63## Revision 1.42 2000/10/08 12:16:06 mdw
64## Remove vestiges of @primorial@.
65##
66## Revision 1.41 2000/08/15 21:46:20 mdw
67## Set up the dependencies on primetab.[ch] and mptypes.h properly.
68## There's some m4 hacking, but it's worth it not to have to recompile all
69## the cipher modes.
70##
71## Revision 1.40 2000/08/06 10:50:55 mdw
72## (mkphrase): New program for generating random passphrases with measured
73## strength.
74##
75## Revision 1.39 2000/07/29 21:55:32 mdw
76## Make sure the pixie is installed setuid-root (workaround for an Automake
77## bug). Install new manpages.
78##
79## Revision 1.38 2000/07/29 10:54:55 mdw
80## Further fixing to support building using normal `make' again. ;-) I
81## think we're there now.
82##
83## Revision 1.37 2000/07/29 10:02:36 mdw
84## Lots of fixing to support `make -j' building.
85##
86## Revision 1.36 2000/07/20 20:13:38 mdw
87## Added Bellare and Rogaway's PSS encoding for RSA signatures.
88##
89## Revision 1.35 2000/07/16 20:00:46 mdw
90## Bug fixes to distribution.
91##
92## Revision 1.34 2000/07/15 20:55:32 mdw
93## More hashes and ciphers. An extra tool.
94##
95## Revision 1.33 2000/07/09 21:34:15 mdw
96## New hash functions and other stuff.
97##
98## Revision 1.32 2000/07/01 11:27:32 mdw
99## Name changes and new files.
100##
101## Revision 1.31 2000/06/25 13:02:07 mdw
102## Fix cleaning of generated files.
103##
104## Revision 1.30 2000/06/22 19:10:33 mdw
105## Fix Makefile to test mp-sqrt.c.
106##
107## Revision 1.29 2000/06/22 19:04:19 mdw
108## More new functions to be added.
109##
110## Revision 1.28 2000/06/18 23:31:18 mdw
111## Rearrange build order to ensure that `mptypes.h' exists by the time it's
112## needed.
113##
114## Revision 1.27 2000/06/17 13:28:50 mdw
115## Minor tidying and fixing.
116##
117## Revision 1.26 2000/06/17 10:33:43 mdw
118## Lots of new ciphers and other files.
119##
120## Revision 1.25 2000/02/12 18:55:40 mdw
121## Make it all compile properly.
122##
123## Revision 1.24 2000/02/12 18:22:26 mdw
124## Missed a file. Whoops.
125##
126## Revision 1.23 2000/02/12 18:21:01 mdw
127## Overhaul of key management (again).
128##
129## Revision 1.22 1999/12/22 16:04:06 mdw
130## Lots of new files.
131##
132## Revision 1.21 1999/12/13 15:47:58 mdw
133## Fix a couple of minor bugs in the distribution set.
134##
135## Revision 1.19 1999/12/11 10:58:24 mdw
136## Fix bug in test rig link flags. Add Karatsuba squaring.
137##
138## Revision 1.18 1999/12/10 23:30:01 mdw
139## Lots of new files.
140##
141## Revision 1.17 1999/11/25 11:38:31 mdw
142## Support for conversions between MPs and C integers.
143##
144## Revision 1.16 1999/11/22 20:51:33 mdw
145## Add yet more source files.
146##
147## Revision 1.15 1999/11/22 14:08:30 mdw
148## Improve dependencies for test programs.
149##
150## Revision 1.14 1999/11/22 00:17:09 mdw
151## Create object files for test programs so that rebuilding doesn't take so
152## long.
153##
154## Revision 1.12 1999/11/20 22:36:26 mdw
155## Improve dependencies. Move mpx testing into mpx.c.
156##
157## Revision 1.11 1999/11/20 22:24:53 mdw
158## Add Diffie-Hellman support.
159##
160## Revision 1.10 1999/11/19 19:28:24 mdw
161## Add DSA files and tests.
162##
163## Revision 1.9 1999/11/17 18:05:35 mdw
164## Many new files and test cases for multiprecision arithmetic.
165##
166## Revision 1.8 1999/11/13 01:56:07 mdw
167## Include multiprecision maths stuff.
168##
169## Revision 1.7 1999/11/11 19:01:02 mdw
170## Use `libtool' to generate a shared library.
171##
172## Revision 1.6 1999/11/11 17:47:34 mdw
173## Updates for new configuration system, and `mptypes' generator.
174##
175## Revision 1.5 1999/11/11 00:59:17 mdw
176## Minor reformatting.
177##
178## Revision 1.4 1999/10/24 10:20:36 mdw
179## Modify for standalone distribution. The library's getting far too large
180## to be sensibly embedded in other programs.
181##
182## Revision 1.3 1999/10/24 10:04:26 mdw
183## Install headers in the right directory.
184##
185## Revision 1.2 1999/10/23 12:55:35 mdw
186## The `CVS' directory can't be hardlinked. Don't worry about this
187## overmuch.
188##
189## Revision 1.1 1999/09/03 08:41:11 mdw
190## Initial import.
191##
192
193AUTOMAKE_OPTIONS = foreign
194
195SUBDIRS = tests
196
197archincludedir = $(libdir)/catacomb/include
198
199## --- List handling macros ---
200##
201## List handling is nice, usually. Unfortunately, I based this design on
202## TeX list macros rather than anything sensible...
203
204define(`_', `define(`_item', $1)define(`_item_2', $2)emit`'')
205define(`adorn', `pushdef(`emit', `$1`'_item`'$3')$2`'popdef(`emit')')
206define(`join',
207`pushdef(`emit', `adorn(``_(''_item`$2', `$3', ``)'')`'')$1`'popdef(`emit')')
208define(`addsuffix', `adorn(`', `$1', `$2')')
209define(`lit', `adorn(`', `$1', `')')
210define(`nl', `
211')
212
213define(`allwithsuffix',
214`addsuffix(`$1', `$3') addsuffix(`$2', `$3') dnl
215addsuffix(join(`$1', `-', `$2'), `$3')')
216
217## --- Autogenerated source files ---
218
219define(`ciphers', `dnl
220_(des) _(desx) _(des3) dnl
221_(idea) _(safer) _(safersk) dnl
222_(blowfish) _(twofish) dnl
223_(tea) _(xtea) dnl
224_(rc2) _(rc5) dnl
225_(skipjack) dnl
226_(cast128) _(cast256) dnl
227_(square) _(rijndael) dnl
228_(serpent)')
229define(`cipher_modes', `_(ecb) _(cbc) _(cfb) _(ofb) _(counter)')
230
231define(`hashes', `dnl
232_(md5) _(md4) _(md2) _(tiger) dnl
233_(sha) _(sha256) _(sha384) _(sha512) dnl
234_(rmd128) _(rmd160) _(rmd256) _(rmd320)')
235define(`hash_modes', `_(mgf) _(hmac)')
236
237MODES = \
238 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.c') \
239 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.h') \
240 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.c') \
241 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.h')
242
243$(MODES): modes-stamp
244modes-stamp: genmodes
245 cd $(srcdir); ./genmodes "lit(`ciphers')" "lit(`cipher_modes')"
246 cd $(srcdir); ./genmodes "lit(`hashes')" "lit(`hash_modes')"
247 echo datestamp >modes-stamp
248
249define(`gen_tables', `dnl
250_(des) _(blowfish) _(twofish) _(square) _(safer) _(rijndael) _(tiger) dnl
251_(gfshare) _(gfx-sqr)')
252
253autoheaders: addsuffix(`gen_tables', `-tab.h') primetab.h mptypes.h
254define(`emit', `
255_item`'-tab.h: _item`'-mktab
256 ./_item`'-mktab >_item`'-tab.h')dnl
257gen_tables
258
259primetab.h: primetab.c
260primetab.c: genprimes
261 ./genprimes -h primetab.h -c primetab.c -n 256 \
262 -t "unsigned short" -i primetab
263archinclude_HEADERS = mptypes.h
264mptypes.h: mptypes
265 ./mptypes >mptypes.h
266
267BUILT_SOURCES = \
268 getdate.c \
269 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
270 addsuffix(join(`ciphers', `-', `cipher_modes'), `.h') \
271 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
272 addsuffix(join(`hashes', `-', `hash_modes'), `.h')
273
274## --- Building the main library ---
275
276lib_LTLIBRARIES = libcatacomb.la
277
278libcatacomb_la_LDFLAGS = -version-info 2:0:0
279## Middle number is the patchlevel. Final number is the minor version. The
280## difference between the first and last numbers is major version.
281
282pkginclude_HEADERS = \
283 arena.h paranoia.h \
284 blkc.h hash.h gcipher.h ghash.h gmac.h grand.h ghash-def.h \
285 lcrand.h fibrand.h rc4.h seal.h rand.h noise.h fipstest.h maurer.h \
286 key.h key-data.h passphrase.h pixie.h lmem.h \
287 mpx.h mpw.h mpscan.h mparena.h mp.h mptext.h mpint.h \
288 mpbarrett.h mpmont.h mpcrt.h mprand.h mpmul.h \
289 gfx.h \
290 primetab.h pfilt.h rabin.h \
291 pgen.h prim.h strongprime.h limlee.h keycheck.h \
292 bbs.h rsa.h dh.h dsarand.h dsa.h \
293 oaep.h pkcs1.h pss.h tlsprf.h sslprf.h \
294 gfshare.h share.h \
295 rho.h \
296 allwithsuffix(`ciphers', `cipher_modes', `.h') \
297 allwithsuffix(`hashes', `hash_modes', `.h') \
298 addsuffix(`cipher_modes', `-def.h') \
299 addsuffix(`hash_modes', `-def.h') crc32.h
300
301define(`MP_SOURCES',
302 `mpx.c mpx-kmul.c mpx-ksqr.c mpscan.c mparena.c \
303 mp-misc.c mp-mem.c mp-const.c mp-io.c mp-arith.c mp-test.c \
304 mp-sqrt.c mp-gcd.c mp-jacobi.c mp-modsqrt.c \
305 mpint.c mptext.c mptext-file.c mptext-string.c mptext-dstr.c \
306 mpbarrett.c mpmont.c mpmont-mexp.c mpcrt.c mpmul.c mprand.c \
307 rho.c \
308 GF_SOURCES PGEN_SOURCES')
309
310define(`GF_SOURCES',
311 `gfx.c gfx-kmul.c gfx-sqr.c')
312
313define(`PGEN_SOURCES',
314 `pfilt.c rabin.c \
315 pgen.c pgen-stdev.c pgen-safe.c pgen-gcd.c prim.c strongprime.c \
316 limlee.c \
317 keycheck.c keycheck-mp.c keycheck-report.c \
318 bbs-rand.c bbs-gen.c bbs-jump.c bbs-fetch.c \
319 rsa-priv.c rsa-pub.c rsa-gen.c rsa-recover.c rsa-fetch.c \
320 dh-gen.c dh-limlee.c dh-check.c dh-fetch.c \
321 dsarand.c dsa-sign.c dsa-verify.c dsa-gen.c dsa-check.c \
322 key-data.c key-flags.c key-text.c key-binary.c key-pass.c \
323 key-pack.c key-misc.c key-file.c key-attr.c key-io.c key-moan.c \
324 key-error.c key-fetch.c \
325 primetab.c share.c')
326
327libcatacomb_la_SOURCES = \
328 grand.c keysz.c \
329 lcrand.c fibrand.c rc4.c seal.c rand.c noise.c fipstest.c maurer.c \
330 arena.c \
331 passphrase.c pixie-client.c pixie-common.c lmem.c \
332 oaep.c pkcs1.c pss.c tlsprf.c sslprf.c \
333 gfshare.c \
334 MP_SOURCES karatsuba.h \
335 des-base.c des-base.h \
336 cast-s.c cast-sk.c cast-base.h cast-tab.h \
337 md2-tab.h \
338 serpent-sbox.h skipjack-tab.h tiger-base.h \
339 daftstory.h \
340 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
341 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
342 addsuffix(`ciphers', `.c') addsuffix(`hashes', `.c') crc32.c
343
344des-base.lo: des-tab.h
345blowfish.lo: blowfish-tab.h
346twofish.lo: twofish-tab.h
347square.lo: square-tab.h
348rijndael.lo: rijndael-tab.h
349tiger.lo: tiger-tab.h
350gfshare.lo: gfshare-tab.h
351gfx-sqr.lo: gfx-sqr-tab.h
352patsubst(MP_SOURCES, `\.c\>', `.lo') dsig.o keyutil.o rspit.o: mptypes.h
353patsubst(PGEN_SOURCES, `\.c\>', `.lo') dsig.o keyutil.o rspit.o: primetab.h
354
355## --- Utility programs ---
356
357bin_PROGRAMS = dsig key pixie rspit factorial hashsum mkphrase
358bin_SCRIPTS = catacomb-config xpixie
359noinst_PROGRAMS = \
360 genprimes mptypes serpent-check \
361 addsuffix(`gen_tables', `-mktab')
362LDADD = libcatacomb.la
363
364dsig_SOURCES = dsig.c getdate.y getdate.h
365key_SOURCES = keyutil.c getdate.y getdate.h
366hashsum_SOURCES = hashsum.c
367rspit_SOURCES = rspit.c
368factorial_SOURCES = factorial.c
369pixie_SOURCES = pixie.c pixie-common.c lmem.c arena.c
370pixie_LDADD =
371mkphrase_SOURCES = mkphrase.c
372
373define(`emit', `
374patsubst(_item, `[^a-zA-Z0-9]', `_')_mktab_SOURCES = _item`'-mktab.c
375patsubst(_item, `[^a-zA-Z0-9]', `_')_mktab_LDADD =')dnl
376gen_tables
377
378serpent_check_SOURCES = serpent-check.c
379serpent_check_LDADD =
380
381genprimes_SOURCES = genprimes.c
382genprimes_LDADD =
383
384mptypes_SOURCES = mptypes.c
385mptypes_LDADD =
386
387## --- Install the pixie setuid-root if we can ---
388##
389## Bodge around a bug in Automake: it doesn't call `install-exec-hook' from
390## `install' if there are subdirectories.
391
392changequote(<, >)
393install: install-exec-hook
394install-exec-hook:
395 @pixie="$(bindir)/`echo pixie|sed $(transform)`"; \
396 if chown root $$pixie && chmod 4755 $$pixie; then \
397 echo "chown root $$pixie"; \
398 echo "chmod 4755 $$pixie"; \
399 else \
400 echo "***"; \
401 echo "*** You should probably install $$pixie setuid-root."; \
402 echo "***"; \
403 fi
404changequote(`, ')
405
406## --- Documentation ---
407
408man_MANS = key.1 hashsum.1 keyring.5 pixie.1
409
410## --- Other handy definitions ---
411
412EXTRA_DIST = \
413 Makefile.m4 genmodes $(man_MANS) xpixie \
414 README.cipher README.hash README.random README.mp
415
416dist-hook:
417 @ln getdate.c $(distdir) || ln $(srcdir)/getdate.c $(distdir) || true
418 @echo datestamp >$(distdir)/modes-stamp || true
419 @for i in calc tests; do \
420 mkdir $(distdir)/$$i; \
421 ln $(srcdir)/$$i/*[!~] $(distdir)/$$i; \
422 done || true
423# kr=$$HOME/.catacomb/dsig-keyring; \
424# if [ -r $$kr ]; then \
425# cd $(distdir); \
426# ../key -k $$kr extract -f -secret KEYRING; \
427# find . -type f -print0 | ../dsig -k $$kr sign -0 -oMANIFEST; \
428# fi
429
430## --- Testing ---
431
432define(`testprogs', `')
433
434define(`CTESTRIG',
435`define(`testprogs', testprogs \
436 $1.t)dnl
437$1.to: $1.c
438 $(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $(srcdir)/$1.c -o $1.to
439$1.t: $1.to $1.o libcatacomb.la
440 $(CC) $(CFLAGS) $(LDFLAGS) $1.to .libs/libcatacomb.a $(LIBS) -o $1.t')
441
442CTESTRIG(rc4)
443CTESTRIG(seal)
444adorn(`nl`'CTESTRIG(', `ciphers', `)')
445adorn(`nl`'CTESTRIG(', `hashes', `)')
446adorn(`nl`'CTESTRIG(', join(`ciphers', `-', `cipher_modes'), `)')
447adorn(`nl`'CTESTRIG(', join(`hashes', `-', `hash_modes'), `)')
448CTESTRIG(lcrand)
449CTESTRIG(oaep)
450CTESTRIG(tlsprf)
451CTESTRIG(sslprf)
452CTESTRIG(mpx)
453CTESTRIG(mpx-kmul)
454CTESTRIG(mpx-ksqr)
455CTESTRIG(mp-arith)
456CTESTRIG(mp-modsqrt)
457CTESTRIG(mp-gcd)
458CTESTRIG(mp-jacobi)
459CTESTRIG(mp-sqrt)
460CTESTRIG(mptext)
461CTESTRIG(mpint)
462CTESTRIG(mpbarrett)
463CTESTRIG(mpmont)
464CTESTRIG(mpmont-mexp)
465CTESTRIG(mpcrt)
466CTESTRIG(mpmul)
467CTESTRIG(gfx)
468CTESTRIG(gfx-kmul)
469CTESTRIG(pgen)
470CTESTRIG(dsa-gen)
471CTESTRIG(dsa-sign)
472CTESTRIG(dsa-verify)
473CTESTRIG(bbs-rand)
474CTESTRIG(bbs-jump)
475CTESTRIG(gfshare)
476CTESTRIG(share)
477CTESTRIG(rho)
478
479TESTS = serpent-check testprogs
480
481CLEANFILES = \
482 *.t *.to \
483 mptypes.h primetab.c primetab.h \
484 addsuffix(`gen_tables', `-tab.h')
485
486## --- Makefile building (haha!) ---
487
488$(srcdir)/Makefile.am: $(srcdir)/Makefile.m4
489 m4 $(srcdir)/Makefile.m4 >$(srcdir)/Makefile.am
490
491DISTCLEANFILES = libtool
492
493MAINTAINERCLEANFILES = \
494 $(srcdir)/Makefile.am \
495 $(srcdir)/getdate.c getdate.c \
496 $(MODES) modes-stamp $(srcdir)/modes-stamp
497
498##----- That's all, folks ---------------------------------------------------