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