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