3 ### Build script for Catacomb
5 ### (c) 2013 Straylight/Edgeware
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of Catacomb.
12 ### Catacomb is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU Library General Public License as
14 ### published by the Free Software Foundation; either version 2 of the
15 ### License, or (at your option) any later version.
17 ### Catacomb is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ### GNU Library General Public License for more details.
22 ### You should have received a copy of the GNU Library General Public
23 ### License along with Catacomb; if not, write to the Free
24 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 ### MA 02111-1307, USA.
27 ###--------------------------------------------------------------------------
28 ### Miscellaneous useful definitions.
30 ## Some convenient abbreviations for file suffixes.
35 ## Installation directories.
36 archincludedir = $(pkglibdir)/include
38 ###--------------------------------------------------------------------------
39 ### Initial values of common variables.
46 MAINTAINERCLEANFILES =
56 nodist_pkginclude_HEADERS =
58 nodist_archinclude_HEADERS =
61 ###--------------------------------------------------------------------------
62 ### Standard configuration substitutions.
64 ## Substitute tags in files.
65 confsubst = $(top_srcdir)/config/confsubst
66 EXTRA_DIST += config/confsubst
69 prefix=$(prefix) exec_prefix=$(exec_prefix) \
70 libdir=$(libdir) includedir=$(includedir) \
71 PACKAGE=$(PACKAGE) VERSION=$(VERSION) \
72 CATACOMB_LIBS="$(CATACOMB_LIBS)"
74 V_SUBST = $(V_SUBST_$(V))
75 V_SUBST_ = $(V_SUBST_$(AM_DEFAULT_VERBOSITY))
76 V_SUBST_0 = @echo " SUBST $@";
77 SUBST = $(V_SUBST)$(confsubst)
79 ###--------------------------------------------------------------------------
82 lib_LTLIBRARIES += libcatacomb.la
83 libcatacomb_la_LIBADD = $(CATACOMB_LIBS) $(mLib_LIBS)
84 libcatacomb_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO)
85 libcatacomb_la_SOURCES =
86 nodist_libcatacomb_la_SOURCES =
88 ###--------------------------------------------------------------------------
91 ## The locked-memory arena.
92 pkginclude_HEADERS += arena.h
93 libcatacomb_la_SOURCES += arena.c
95 ## Constant-type operations.
96 pkginclude_HEADERS += ct.h
97 libcatacomb_la_SOURCES += ct.c
99 ## Acceptable key-size descriptions.
100 pkginclude_HEADERS += keysz.h
101 libcatacomb_la_SOURCES += keysz.c keysz-conv.c
103 ## System-level memory locking.
104 pkginclude_HEADERS += lmem.h
105 libcatacomb_la_SOURCES += lmem.c
107 ## Clearing secrets from memory.
108 pkginclude_HEADERS += paranoia.h
110 ###--------------------------------------------------------------------------
111 ### Main multiprecision integer library.
113 ## This library is unfortunately intertwined with some of the code generation
114 ## programs, so we must be rather careful. The important bits of the maths
115 ## library needed by these programs is separated out into `libmpbase'. There
116 ## is work going on to fix this unpleasant situation by generating the
117 ## relevant files from Python scripts rather than C programs, using
118 ## information gathered by `configure'.
119 noinst_LTLIBRARIES += libmpbase.la
120 libcatacomb_la_LIBADD += libmpbase.la
121 libmpbase_la_LIBADD = $(mLib_LIBS)
122 libmpbase_la_SOURCES =
123 $(libmpbase_la_OBJECTS): mptypes.h
125 ## Additional buffer I/O functions for mathematical objects.
126 pkginclude_HEADERS += buf.h
127 libcatacomb_la_SOURCES += buf.c
129 ## Infrastructure for fast exponentiation.
130 pkginclude_HEADERS += exp.h
131 libcatacomb_la_SOURCES += exp.c
133 ## Main user-visible multiprecision arithmetic.
134 pkginclude_HEADERS += mp.h
135 libmpbase_la_SOURCES += mp-arith.c
137 libmpbase_la_SOURCES += mp-const.c
138 libcatacomb_la_SOURCES += mp-exp.c mp-exp.h
139 libcatacomb_la_SOURCES += mp-gcd.c
141 libmpbase_la_SOURCES += mp-io.c
142 libcatacomb_la_SOURCES += mp-jacobi.c
143 TESTS += mp-jacobi.$t
144 libmpbase_la_SOURCES += mp-mem.c
145 libmpbase_la_SOURCES += mp-misc.c
146 libcatacomb_la_SOURCES += mp-modexp.c
147 TESTS += mp-modexp.$t
148 libcatacomb_la_SOURCES += mp-modsqrt.c
149 TESTS += mp-modsqrt.$t
150 libcatacomb_la_SOURCES += mp-sqrt.c
152 libcatacomb_la_SOURCES += mp-test.c
153 EXTRA_DIST += tests/mp
155 ## Computing Fibonacci numbers.
156 pkginclude_HEADERS += mp-fibonacci.h
157 libcatacomb_la_SOURCES += mp-fibonacci.c
158 TESTS += mp-fibonacci.$t
160 ## Special memory allocation for multiprecision integers.
161 pkginclude_HEADERS += mparena.h
162 libmpbase_la_SOURCES += mparena.c
164 ## Barrett reduction, an efficient method for modular reduction.
165 pkginclude_HEADERS += mpbarrett.h
166 libcatacomb_la_SOURCES += mpbarrett.c
167 TESTS += mpbarrett.$t
168 libcatacomb_la_SOURCES += mpbarrett-exp.c mpbarrett-mexp.c mpbarrett-exp.h
169 TESTS += mpbarrett-exp.$t mpbarrett-mexp.$t
170 EXTRA_DIST += tests/mpbarrett
172 ## Solving congruences using the Chinese Remainder Theorem.
173 pkginclude_HEADERS += mpcrt.h
174 libcatacomb_la_SOURCES += mpcrt.c
176 EXTRA_DIST += tests/mpcrt
178 ## Conversions between machine-native and multiprecision integers.
179 pkginclude_HEADERS += mpint.h
180 libcatacomb_la_SOURCES += mpint.c
182 EXTRA_DIST += tests/mpint
184 ## Table of upper and lower limits of various types of machine integers, as
185 ## multiprecision integers.
186 nodist_archinclude_HEADERS += mplimits.h
187 nodist_libcatacomb_la_SOURCES += mplimits.c
188 CLEANFILES += mplimits.h mplimits.c
189 noinst_PROGRAMS += genlimits
190 genlimits_LDADD = libmpbase.la
191 mplimits.c: genlimits$e
192 $(AM_V_GEN)./genlimits c >mplimits.c.new && \
193 mv mplimits.c.new mplimits.c
194 mplimits.h: genlimits$e
195 $(AM_V_GEN)./genlimits h >mplimits.h.new && \
196 mv mplimits.h.new mplimits.h
197 $(genlimits_OBJECTS): mptypes.h
198 mplimits.lo: mplimits.h
200 ## Montgomery reduction, a clever method for modular arithmetic.
201 pkginclude_HEADERS += mpmont.h
202 libcatacomb_la_SOURCES += mpmont.c
204 libcatacomb_la_SOURCES += mpmont-exp.c mpmont-mexp.c mpmont-exp.h
205 TESTS += mpmont-exp.$t mpmont-mexp.$t
206 EXTRA_DIST += tests/mpmont
208 ## Efficient multiplication of many small numbers.
209 pkginclude_HEADERS += mpmul.h
210 libcatacomb_la_SOURCES += mpmul.c
213 ## Generating random numbers.
214 pkginclude_HEADERS += mprand.h
215 libcatacomb_la_SOURCES += mprand.c
217 ## Efficient reduction modulo numbers with conveninent binary
219 pkginclude_HEADERS += mpreduce.h
220 libcatacomb_la_SOURCES += mpreduce.c mpreduce-exp.h
222 EXTRA_DIST += tests/mpreduce
224 ## Iteratiion over the bianry representation of multiprecision integers.
225 pkginclude_HEADERS += mpscan.h
226 libmpbase_la_SOURCES += mpscan.c
228 ## Conversion between multiprecision integers and their textual
230 pkginclude_HEADERS += mptext.h
231 libmpbase_la_SOURCES += mptext.c
233 libcatacomb_la_SOURCES += mptext-dstr.c
234 libcatacomb_la_SOURCES += mptext-file.c
235 libcatacomb_la_SOURCES += mptext-len.c
236 libmpbase_la_SOURCES += mptext-string.c
237 EXTRA_DIST += tests/mptext
239 ## Basic types used in the representation of multiprecision integers.
240 nodist_archinclude_HEADERS += mptypes.h
241 BUILT_SOURCES += mptypes.h
242 CLEANFILES += mptypes.h
243 noinst_PROGRAMS += mptypes
245 $(AM_V_GEN)./mptypes >mptypes.h.new && mv mptypes.h.new mptypes.h
247 ## Low-level multiprecision arithmetic.
248 pkginclude_HEADERS += mpx.h bitops.h mpw.h
249 libmpbase_la_SOURCES += mpx.c
251 libmpbase_la_SOURCES += karatsuba.h mpx-kmul.c mpx-ksqr.c
252 TESTS += mpx-kmul.$t mpx-ksqr.$t
253 noinst_PROGRAMS += bittest
255 EXTRA_DIST += tests/mpx
257 ## A quick-and-dirty parser, used for parsing descriptions of groups, fields,
259 pkginclude_HEADERS += rho.h
260 libcatacomb_la_SOURCES += rho.c
263 ## Pollard's `rho' algorithm for determining discrete logarithms.
264 pkginclude_HEADERS += qdparse.h
265 libcatacomb_la_SOURCES += qdparse.c
267 ###--------------------------------------------------------------------------
268 ### Prime number checking, searching, and related jobs.
270 ## Generating Lim--Lee groups, i.e., unit groups of finite fields without
271 ## small subgroups (except for the obvious ones).
272 pkginclude_HEADERS += limlee.h
273 libcatacomb_la_SOURCES += limlee.c
275 ## A table of small prime numbers.
276 nodist_pkginclude_HEADERS += primetab.h
277 nodist_libcatacomb_la_SOURCES += primetab.c
278 CLEANFILES += primetab.h primetab.c
279 BUILT_SOURCES += primetab.h primetab.c
280 noinst_PROGRAMS += genprimes
281 genprimes_LDADD = $(mLib_LIBS)
282 primetab.h: primetab.c
283 primetab.c: genprimes$e
284 $(AM_V_GEN)./genprimes -hprimetab.h -cprimetab.c \
285 -sCATACOMB_PRIMETAB_H \
286 -n256 -t"unsigned short" -iprimetab
288 ## Filtering candidate prime numbers by checking for small factors
290 pkginclude_HEADERS += pfilt.h
291 libcatacomb_la_SOURCES += pfilt.c
293 ## Generating prime numbers (and other kinds of numbers which need searching
295 pkginclude_HEADERS += pgen.h
296 libcatacomb_la_SOURCES += pgen.c
297 libcatacomb_la_SOURCES += pgen-gcd.c
298 libcatacomb_la_SOURCES += pgen-simul.c
299 libcatacomb_la_SOURCES += pgen-stdev.c
301 EXTRA_DIST += tests/pgen
303 ## Finding primitive elements in finite fields.
304 pkginclude_HEADERS += prim.h
305 libcatacomb_la_SOURCES += prim.c
307 ## Iterating over all prime numbers from a given starting point.
308 pkginclude_HEADERS += primeiter.h
309 libcatacomb_la_SOURCES += primeiter.c
310 TESTS += primeiter.$t
311 primeiter.lo: wheel.h
313 ## The Miller--Rabin primality test.
314 pkginclude_HEADERS += rabin.h
315 libcatacomb_la_SOURCES += rabin.c
317 ## Finding `strong' primes, using Gordon's algorithm. Once upon a time,
318 ## products of these kinds of numbers were harder to factor.
319 pkginclude_HEADERS += strongprime.h
320 libcatacomb_la_SOURCES += strongprime.c
322 ## A `wheel', used by the prime iteration machinery.
323 nodist_pkginclude_HEADERS += wheel.h
324 nodist_libcatacomb_la_SOURCES += wheel.c
325 CLEANFILES += wheel.h wheel.c
326 noinst_PROGRAMS += genwheel
327 genwheel_LDADD = $(mLib_LIBS)
330 $(AM_V_GEN)./genwheel -hwheel.h -cwheel.c \
332 -n5 -t"unsigned char" -iwheel
334 ###--------------------------------------------------------------------------
335 ### Binary polynomial arithmetic.
337 ## User-visible binary polynomial arithmetic.
338 pkginclude_HEADERS += gf.h
339 libcatacomb_la_SOURCES += gf-arith.c
341 libcatacomb_la_SOURCES += gf-exp.c gf-exp.h
342 libcatacomb_la_SOURCES += gf-gcd.c
344 EXTRA_DIST += tests/gf
346 ## Low-level binary polynomial arithmetic.
347 pkginclude_HEADERS += gfx.h
348 libcatacomb_la_SOURCES += gfx.c
350 libcatacomb_la_SOURCES += gfx-kmul.c
352 libcatacomb_la_SOURCES += gfx-sqr.c
353 gfx-sqr.lo: gfx-sqr-tab.h
355 CLEANFILES += gfx-sqr-tab.h
356 noinst_PROGRAMS += gfx-sqr-mktab
357 gfx-sqr-tab.h: gfx-sqr-mktab$e
358 $(AM_V_GEN)./gfx-sqr-mktab >gfx-sqr-tab.h.in && \
359 mv gfx-sqr-tab.h.in gfx-sqr-tab.h
360 EXTRA_DIST += tests/gfx
362 ## Conversions between normal and polynomial basis representations for binary
364 pkginclude_HEADERS += gfn.h
365 libcatacomb_la_SOURCES += gfn.c
367 EXTRA_DIST += tests/gfn
369 ## Efficient reduction modulo sparse polynomials.
370 pkginclude_HEADERS += gfreduce.h
371 libcatacomb_la_SOURCES += gfreduce.c gfreduce-exp.h
373 EXTRA_DIST += tests/gfreduce
375 ###--------------------------------------------------------------------------
376 ### Abstractions for various kinds of algebraic objects.
378 ## Abstract cyclic groups.
379 pkginclude_HEADERS += group.h group-guts.h
380 libcatacomb_la_SOURCES += group-dstr.c
381 libcatacomb_la_SOURCES += group-exp.c group-exp.h
382 libcatacomb_la_SOURCES += group-file.c
383 libcatacomb_la_SOURCES += group-parse.c
384 libcatacomb_la_SOURCES += group-stdops.c
385 libcatacomb_la_SOURCES += group-string.c
386 libcatacomb_la_SOURCES += g-bin.c
387 libcatacomb_la_SOURCES += g-prime.c
388 libcatacomb_la_SOURCES += g-ec.c
389 EXTRA_DIST += group-test.c
390 TESTS += group-test.$t
391 EXTRA_DIST += tests/group
393 ## Abstract finite fields.
394 pkginclude_HEADERS += field.h field-guts.h
395 libcatacomb_la_SOURCES += field.c
396 libcatacomb_la_SOURCES += field-exp.c field-exp.h
397 libcatacomb_la_SOURCES += field-parse.c
398 libcatacomb_la_SOURCES += f-binpoly.c
399 libcatacomb_la_SOURCES += f-niceprime.c
400 libcatacomb_la_SOURCES += f-prime.c
402 ## Table of built-in binary fields.
403 pkginclude_HEADERS += bintab.h
404 libcatacomb_la_SOURCES += bintab.c
405 CLEANFILES += bintab.c
406 EXTRA_DIST += bintab.in bin-gentab.awk
407 bintab.c: bintab.in bin-gentab.awk mpdump$e
408 $(AM_V_GEN)awk -f $(srcdir)/bin-gentab.awk \
409 <$(srcdir)/bintab.in >bintab.c.new && \
410 mv bintab.c.new bintab.c
412 ## Table of built-in prime fields.
413 pkginclude_HEADERS += ptab.h
414 libcatacomb_la_SOURCES += ptab.c
416 EXTRA_DIST += ptab.in p-gentab.awk
417 ptab.c: ptab.in p-gentab.awk mpdump$e
418 $(AM_V_GEN)awk -f $(srcdir)/p-gentab.awk \
419 <$(srcdir)/ptab.in >ptab.c.new && \
422 ## A utility for building multiprecision integer constants.
423 noinst_PROGRAMS += mpdump
424 mpdump_LDADD = libmpbase.la
425 $(mpdump_OBJECTS): mptypes.h
427 ###--------------------------------------------------------------------------
428 ### Elliptic curve arithmetic.
430 ## Basic elliptic curve arithmetic.
431 pkginclude_HEADERS += ec.h ec-guts.h
432 libcatacomb_la_SOURCES += ec.c
433 libcatacomb_la_SOURCES += ec-exp.c ec-exp.h
434 libcatacomb_la_SOURCES += ec-info.c
436 libcatacomb_la_SOURCES += ec-bin.c
438 libcatacomb_la_SOURCES += ec-prime.c
440 EXTRA_DIST += tests/ec
442 ## The standard `raw' encoding (`EC2OSP') of elliptic curve points.
443 pkginclude_HEADERS += ec-raw.h
444 libcatacomb_la_SOURCES += ec-raw.c
446 ## Test infrastructure for elliptic curves.
447 pkginclude_HEADERS += ec-test.h
448 libcatacomb_la_SOURCES += ec-test.c
451 ## A table of built-in elliptic curves.
452 pkginclude_HEADERS += ectab.h
453 libcatacomb_la_SOURCES += ectab.c
454 CLEANFILES += ectab.c
455 EXTRA_DIST += ectab.in ec-gentab.awk
456 ectab.c: ectab.in ec-gentab.awk mpdump$e
457 $(AM_V_GEN)awk -f $(srcdir)/ec-gentab.awk \
458 <$(srcdir)/ectab.in >ectab.c.new && \
459 mv ectab.c.new ectab.c
461 ###--------------------------------------------------------------------------
462 ### Autogenerated lists.
464 ## Fancy template substitutions.
465 multigen = python $(srcdir)/multigen
466 EXTRA_DIST += multigen
468 ## The heart of this is an enormous cross-product of crypto primitives and
469 ## the corresponding modes of operation. Rather than write it out longhand,
470 ## we generate it using `multigen'. Unfortunately, this needs to be done
471 ## at the Automake level, which causes some interesting bootstrapping
475 EXTRA_DIST += modes.am.in modes.am
476 MAINTAINERCLEANFILES += $(srcdir)/modes.am
478 ## Generate the lists.
479 $(srcdir)/modes.am: modes.am.in
480 $(AM_V_GEN)$(multigen) -g $(srcdir)/modes.am.in $(srcdir)/modes.am \
482 blkcmode="$(BLKCMODES)" \
483 blkcciphermode="$(BLKCCIPHERMODES)" \
485 hashmode="$(HASHMODES)" \
486 hashciphermode="$(HASHCIPHERMODES)" \
487 hashmacmode="$(HASHMACMODES)"
489 ## Initialize lists of known classes.
490 ALL_CIPHERS = $(CIPHER_MODES)
491 ALL_HASHES = $(HASHES)
492 ALL_MACS = $(MAC_MODES)
494 ###--------------------------------------------------------------------------
501 BLKCMODES += $(BLKCCIPHERMODES)
503 ## A tool for translating the AES-contest test vectors into a form our test
505 EXTRA_DIST += tests/aes-trans
507 ## Block cipher utility macros, mainly used in mode implementations.
508 pkginclude_HEADERS += blkc.h
510 ## Source code and headers for the block ciphers.
511 libcatacomb_la_SOURCES += $(BLKC_C)
512 pkginclude_HEADERS += $(BLKC_H)
514 ## Schneier's `Blowfish' block cipher.
516 blowfish.lo: blowfish-tab.h
517 CLEANFILES += blowfish-tab.h
518 noinst_PROGRAMS += blowfish-mktab
519 blowfish_mktab_CPPFLAGS = $(AM_CPPFLAGS) -DQUIET
520 blowfish-tab.h: blowfish-mktab$e
521 $(AM_V_GEN)./blowfish-mktab >blowfish-tab.h.new && \
522 mv blowfish-tab.h.new blowfish-tab.h
524 ## Adams and Tavares' `CAST' block ciphers.
525 BLKCS += cast128 cast256
526 libcatacomb_la_SOURCES += cast-s.c cast-sk.c cast-base.h cast-tab.h
527 cast256.$t: tests/cast256
528 EXTRA_DIST += tests/cast256.aes
529 MAINTAINERCLEANFILES += $(srcdir)/tests/cast256
530 tests/cast256: tests/cast256.aes
531 $(AM_V_GEN)$(srcdir)/tests/aes-trans CAST256 \
532 <$(srcdir)/tests/cast256.aes \
533 >$(srcdir)/tests/cast256.new && \
534 mv $(srcdir)/tests/cast256.new $(srcdir)/tests/cast256
536 ## IBM's `DES' block cipher, by Feistel, Coppersmith, and others.
538 libcatacomb_la_SOURCES += des-base.h des-base.c desx-tab.h
539 des-base.lo: des-tab.h
540 CLEANFILES += des-tab.h
541 noinst_PROGRAMS += des-mktab
542 des-tab.h: des-mktab$e
543 $(AM_V_GEN)./des-mktab >des-tab.h.new && \
544 mv des-tab.h.new des-tab.h
546 ## Rivest's `DESX' variant, with pre- and post-whitening.
548 libcatacomb_la_SOURCES += desx-tab.h
550 ## Lai and Massey's IDEA.
553 ## IBM's `MARS' block cipher.
556 CLEANFILES += mars-tab.h
557 noinst_PROGRAMS += mars-mktab
558 mars-tab.h: mars-mktab$e
559 $(AM_V_GEN)./mars-mktab >mars-tab.h.new && \
560 mv mars-tab.h.new mars-tab.h
562 EXTRA_DIST += tests/mars.aes
563 MAINTAINERCLEANFILES += $(srcdir)/tests/mars
564 tests/mars: tests/mars.aes
565 $(AM_V_GEN)$(srcdir)/tests/aes-trans Mars \
566 <$(srcdir)/tests/mars.aes \
567 >$(srcdir)/tests/mars.new && \
568 mv $(srcdir)/tests/mars.new $(srcdir)/tests/mars
570 ## Daemen, Peeters, Van Assche and Rijmen's `Noekeon'.
573 ## Rivest's `RC2' block cipher.
575 libcatacomb_la_SOURCES += rc2-tab.h
580 ## Daemen and Rijmen's `Rijndael' block cipher, selected as AES.
581 BLKCS += rijndael rijndael192 rijndael256
582 libcatacomb_la_SOURCES += rijndael-base.h rijndael-base.c
583 rijndael-base.lo: rijndael-tab.h
584 CLEANFILES += rijndael-tab.h
585 noinst_PROGRAMS += rijndael-mktab
586 rijndael-tab.h: rijndael-mktab$e
587 $(AM_V_GEN)./rijndael-mktab >rijndael-tab.h.new && \
588 mv rijndael-tab.h.new rijndael-tab.h
589 rijndael.$t: tests/rijndael
590 EXTRA_DIST += tests/rijndael.aes
591 MAINTAINERCLEANFILES += $(srcdir)/tests/rijndael
592 tests/rijndael: tests/rijndael.aes
593 $(AM_V_GEN)$(srcdir)/tests/aes-trans Rijndael \
594 <$(srcdir)/tests/rijndael.aes \
595 >$(srcdir)/tests/rijndael.new && \
596 mv $(srcdir)/tests/rijndael.new $(srcdir)/tests/rijndael
598 ## Massey's `SAFER' block ciphers.
599 BLKCS += safer safersk
600 safer.lo: safer-tab.h
601 CLEANFILES += safer-tab.h
602 noinst_PROGRAMS += safer-mktab
603 safer-tab.h: safer-mktab$e
604 $(AM_V_GEN)./safer-mktab >safer-tab.h.new && \
605 mv safer-tab.h.new safer-tab.h
607 ## Anderson, Biham and Knudsen's `Serpent' block cipher.
609 libcatacomb_la_SOURCES += serpent-sbox.h
610 noinst_PROGRAMS += serpent-check
611 TESTS += serpent-check
612 serpent.$t: tests/serpent
613 EXTRA_DIST += tests/serpent.aes
614 MAINTAINERCLEANFILES += $(srcdir)/tests/serpent
615 tests/serpent: tests/serpent.aes
616 $(AM_V_GEN)$(srcdir)/tests/aes-trans Serpent -v rev=1 \
617 <$(srcdir)/tests/serpent.aes \
618 >$(srcdir)/tests/serpent.new && \
619 mv $(srcdir)/tests/serpent.new $(srcdir)/tests/serpent
621 ## The National Security Agency's `Skipjack' block cipher. You don't want to
624 libcatacomb_la_SOURCES += skipjack-tab.h
626 ## Daemen and Rijmen's `Square' block cipher.
628 square.lo: square-tab.h
629 CLEANFILES += square-tab.h
630 noinst_PROGRAMS += square-mktab
631 square-tab.h: square-mktab$e
632 $(AM_V_GEN)./square-mktab >square-tab.h.new && \
633 mv square-tab.h.new square-tab.h
635 ## Wheeler and Needham's `TEA' and `XTEA' block ciphers.
638 ## Schneier, Kelsey, Whiting, Wagner, Hall and Ferguson's `Twofish' block
641 twofish.lo: twofish-tab.h
642 CLEANFILES += twofish-tab.h
643 noinst_PROGRAMS += twofish-mktab
644 twofish-tab.h: twofish-mktab$e
645 $(AM_V_GEN)./twofish-mktab >twofish-tab.h.new && \
646 mv twofish-tab.h.new twofish-tab.h
647 twofish.$t: tests/twofish
648 EXTRA_DIST += tests/twofish.aes
649 MAINTAINERCLEANFILES += $(srcdir)/tests/twofish
650 tests/twofish: tests/twofish.aes
651 $(AM_V_GEN)$(srcdir)/tests/aes-trans Twofish \
652 <$(srcdir)/tests/twofish.aes \
653 >$(srcdir)/tests/twofish.new && \
654 mv $(srcdir)/tests/twofish.new $(srcdir)/tests/twofish
656 ## The old NIST modes for DES.
657 BLKCCIPHERMODES += cbc cfb ecb ofb
660 BLKCCIPHERMODES += counter
662 ###--------------------------------------------------------------------------
669 HASHMODES += $(HASHCIPHERMODES)
672 HASHMODES += $(HASHMACMODES)
674 ## Common definitions for hash functions.
675 pkginclude_HEADERS += hash.h
677 ## Source code and headers for the hash functions.
678 libcatacomb_la_SOURCES += $(HASH_C)
679 pkginclude_HEADERS += $(HASH_H)
681 ## Lim and KISA's `HAS-160', recommended for use with KCDSA.
684 ## Rivest's `MD' series of hash functions
685 HASHES += md2 md4 md5
686 libcatacomb_la_SOURCES += md2-tab.h
688 ## Dobbertin, Bosselaers and Preneel's `RIPEMD' suite.
689 HASHES += rmd128 rmd160 rmd256 rmd320
691 ## The National Security Agency's `SHA-1' hash function.
694 ## The National Security Agency's `SHA-2' suite.
695 HASHES += sha224 sha256
696 HASHES += sha384 sha512
698 ## Anderson and Biham's `Tiger' hash function.
700 libcatacomb_la_SOURCES += tiger-base.h
701 tiger.lo: tiger-tab.h
702 CLEANFILES += tiger-tab.h
703 noinst_PROGRAMS += tiger-mktab
704 tiger-tab.h: tiger-mktab$e
705 $(AM_V_GEN)./tiger-mktab >tiger-tab.h.new && \
706 mv tiger-tab.h.new tiger-tab.h
708 ## Barreto and Rijmen's `Whirlpool' hash function.
709 HASHES += whirlpool whirlpool256
710 whirlpool.lo: whirlpool-tab.h
711 CLEANFILES += whirlpool-tab.h
712 noinst_PROGRAMS += whirlpool-mktab
713 whirlpool-tab.h: whirlpool-mktab$e
714 $(AM_V_GEN)./whirlpool-mktab >whirlpool-tab.h.new && \
715 mv whirlpool-tab.h.new whirlpool-tab.h
717 ## Bellare, Canetti and Krawczyk's `HMAC' mode for message authentication.
720 ## MGF1, used in OAEP and PSS.
721 HASHCIPHERMODES += mgf
723 ###--------------------------------------------------------------------------
724 ### Other symmetric primitives.
726 ## The CRC32 algorithm, which is useful, but has no worthwhile security.
727 pkginclude_HEADERS += crc32.h
728 libcatacomb_la_SOURCES += crc32.c
729 ALL_HASHES += crc32=gcrc32
731 ## Rivest's `RC4' stream cipher.
732 pkginclude_HEADERS += rc4.h
733 libcatacomb_la_SOURCES += rc4.c
735 EXTRA_DIST += tests/rc4
738 ## Coppersmith and Rogaway's `SEAL' pseudorandom function.
739 pkginclude_HEADERS += seal.h
740 libcatacomb_la_SOURCES += seal.c
742 EXTRA_DIST += tests/seal
744 ###--------------------------------------------------------------------------
745 ### Autogenerated mode implementations.
747 ## The master stamp file, indicating that we generated all of the sources.
748 CLEANFILES += modes-gen-stamp
749 EXTRA_DIST += mode.h.in mode.c.in
751 $(AM_V_at)touch modes-gen-stamp
752 $(AM_V_GEN)$(multigen) -g $(srcdir)/mode.c.in \
754 base="$(BLKCS)" mode="$(BLKCMODES)"
755 $(AM_V_at)$(multigen) -g $(srcdir)/mode.c.in \
757 base="$(HASHES)" mode="$(HASHMODES)"
758 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
760 base="$(BLKCS)" mode="$(BLKCMODES)"
761 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
763 base="$(HASHES)" mode="$(HASHMODES)"
764 $(AM_V_at)touch modes-gen-stamp
766 ## The individual mode interfaces and implementations.
767 pkginclude_HEADERS += $(MODE_H)
769 ## Generated implementations.
770 BUILT_SOURCES += $(GENMODES_C)
771 CLEANFILES += $(GENMODES_C)
772 nodist_libcatacomb_la_SOURCES += $(GENMODES_C)
773 $(GENMODES_C): modes-gen-stamp
775 ## Generated interfaces.
776 BUILT_SOURCES += $(GENMODES_H)
777 CLEANFILES += $(GENMODES_H)
778 nodist_pkginclude_HEADERS += $(GENMODES_H)
779 $(GENMODES_H): modes-gen-stamp
781 ###--------------------------------------------------------------------------
782 ### Tables of classes for encryption, hashing, and message authentication.
784 ## The skeleton for the class tables.
785 EXTRA_DIST += gthingtab.c.in
787 ## Table of cipher classes.
788 pkginclude_HEADERS += gcipher.h
789 CLEANFILES += gciphertab.c
790 nodist_libcatacomb_la_SOURCES += gciphertab.c
791 gciphertab.c: gthingtab.c.in
792 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gciphertab.c \
793 what=gcipher cls=gccipher thing="$(ALL_CIPHERS)"
795 ## Table of hash classes.
796 pkginclude_HEADERS += ghash.h ghash-def.h
797 CLEANFILES += ghashtab.c
798 nodist_libcatacomb_la_SOURCES += ghashtab.c
799 ghashtab.c: gthingtab.c.in
800 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in ghashtab.c \
801 what=ghash cls=gchash thing="$(ALL_HASHES)"
803 ## Table of MAC classes.
804 pkginclude_HEADERS += gmac.h
805 CLEANFILES += gmactab.c
806 nodist_libcatacomb_la_SOURCES += gmactab.c
807 gmactab.c: gthingtab.c.in
808 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gmactab.c \
809 what=gmac cls=gcmac thing="$(ALL_MACS)"
811 ###--------------------------------------------------------------------------
812 ### Testing for symmetric crypto things.
814 ## Run the test programs.
815 TESTS += $(SYMM_TESTS)
816 EXTRA_DIST += $(SYMM_TEST_FILES)
818 ## A piece of sample text for round-trip testing encryption modes.
819 EXTRA_DIST += daftstory.h
821 ###--------------------------------------------------------------------------
824 ## Assistance for elliptic-curve keys.
825 pkginclude_HEADERS += ec-keys.h
826 libcatacomb_la_SOURCES += ec-fetch.c
828 ## Managing keys and keyring files.
829 pkginclude_HEADERS += key.h
830 libcatacomb_la_SOURCES += key-attr.c
831 libcatacomb_la_SOURCES += key-fetch.c
832 libcatacomb_la_SOURCES += key-file.c
833 libcatacomb_la_SOURCES += key-io.c
834 libcatacomb_la_SOURCES += key-misc.c
835 libcatacomb_la_SOURCES += key-moan.c
837 ## Managing key data.
838 pkginclude_HEADERS += key-data.h
839 libcatacomb_la_SOURCES += key-binary.c
840 libcatacomb_la_SOURCES += key-data.c
841 libcatacomb_la_SOURCES += key-flags.c
842 libcatacomb_la_SOURCES += key-pack.c
843 libcatacomb_la_SOURCES += key-pass.c
844 libcatacomb_la_SOURCES += key-text.c
847 pkginclude_HEADERS += key-error.h
848 libcatacomb_la_SOURCES += key-error.c
850 ## Reading passphrases.
851 pkginclude_HEADERS += passphrase.h
852 libcatacomb_la_SOURCES += passphrase.c
854 ## Interfacing with the passphrase pixie.
855 pkginclude_HEADERS += pixie.h
856 libcatacomb_la_SOURCES += pixie-common.c
858 ###--------------------------------------------------------------------------
861 ## Efficient sharing over GF(2^8).
862 pkginclude_HEADERS += gfshare.h
863 libcatacomb_la_SOURCES += gfshare.c
864 gfshare.lo: gfshare-tab.h
865 CLEANFILES += gfshare-tab.h
866 noinst_PROGRAMS += gfshare-mktab
867 gfshare-tab.h: gfshare-mktab$e
868 $(AM_V_GEN)./gfshare-mktab >gfshare-tab.h.new && \
869 mv gfshare-tab.h.new gfshare-tab.h
872 ## Number-theoretic sharing over GF(p).
873 pkginclude_HEADERS += share.h
874 libcatacomb_la_SOURCES += share.c
877 ###--------------------------------------------------------------------------
878 ### Public-key cryptography.
880 ## The Blum--Blum--Shub random-bit generator.
881 pkginclude_HEADERS += bbs.h
882 libcatacomb_la_SOURCES += bbs-fetch.c
883 libcatacomb_la_SOURCES += bbs-gen.c
884 libcatacomb_la_SOURCES += bbs-jump.c
886 libcatacomb_la_SOURCES += bbs-rand.c
888 EXTRA_DIST += tests/bbs
890 ## Plain Diffie--Hellman, in Schorr groups.
891 pkginclude_HEADERS += dh.h
892 libcatacomb_la_SOURCES += dh-check.c
893 libcatacomb_la_SOURCES += dh-fetch.c
894 libcatacomb_la_SOURCES += dh-gen.c
895 libcatacomb_la_SOURCES += dh-kcdsa.c
896 libcatacomb_la_SOURCES += dh-limlee.c
897 libcatacomb_la_SOURCES += dh-param.c
900 ## The National Security Agency's Digital Signature Algorithm.
901 pkginclude_HEADERS += dsa.h
902 libcatacomb_la_SOURCES += dsa-gen.c
904 libcatacomb_la_SOURCES += dsa-misc.c
905 libcatacomb_la_SOURCES += dsa-sign.c
907 libcatacomb_la_SOURCES += dsa-verify.c
908 TESTS += dsa-verify.$t
909 libcatacomb_la_SOURCES += dsa-check.c
910 EXTRA_DIST += tests/dsa
912 ## Generalization of DSA to arbitrary cyclic groups.
913 pkginclude_HEADERS += gdsa.h
914 libcatacomb_la_SOURCES += gdsa.c
916 EXTRA_DIST += tests/gdsa
918 ## KISA `KCDSA', generalized to arbitrary cyclic groups.
919 pkginclude_HEADERS += gkcdsa.h
920 libcatacomb_la_SOURCES += gkcdsa.c
922 EXTRA_DIST += tests/gkcdsa
924 ## General key validity checking machinery.
925 pkginclude_HEADERS += keycheck.h
926 libcatacomb_la_SOURCES += keycheck.c
927 libcatacomb_la_SOURCES += keycheck-mp.c
928 libcatacomb_la_SOURCES += keycheck-report.c
930 ## The Rivest--Shamir--Adleman trapdoor one-way function.
931 pkginclude_HEADERS += rsa.h
932 libcatacomb_la_SOURCES += rsa-fetch.c
933 libcatacomb_la_SOURCES += rsa-gen.c
934 libcatacomb_la_SOURCES += rsa-priv.c
935 libcatacomb_la_SOURCES += rsa-pub.c
936 libcatacomb_la_SOURCES += rsa-recover.c
937 libcatacomb_la_SOURCES += oaep.c
938 libcatacomb_la_SOURCES += pkcs1.c
939 libcatacomb_la_SOURCES += pss.c
940 EXTRA_DIST += rsa-test.c
942 EXTRA_DIST += tests/rsa
944 ###--------------------------------------------------------------------------
945 ### Random number generators.
947 ## The FIPS186 generator used to generate DSA domain parameters.
948 pkginclude_HEADERS += dsarand.h
949 libcatacomb_la_SOURCES += dsarand.c
951 ## Knuth's lagged-Fibonacci generator.
952 pkginclude_HEADERS += fibrand.h
953 libcatacomb_la_SOURCES += fibrand.c
955 ## The FIPS 140--2 random number generator tests.
956 pkginclude_HEADERS += fipstest.h
957 libcatacomb_la_SOURCES += fipstest.c
959 ## Interface for generic random number sources.
960 pkginclude_HEADERS += grand.h
961 libcatacomb_la_SOURCES += grand.c
963 ## A simple linear-congruential generator.
964 pkginclude_HEADERS += lcrand.h
965 libcatacomb_la_SOURCES += lcrand.c
967 EXTRA_DIST += tests/lcrand
969 ## Maurer's universal statistical test.
970 pkginclude_HEADERS += maurer.h
971 libcatacomb_la_SOURCES += maurer.c
973 ## System-specific noise acquisition.
974 pkginclude_HEADERS += noise.h
975 libcatacomb_la_SOURCES += noise.c
977 ## Cryptographic laundering for true random data generation.
978 pkginclude_HEADERS += rand.h
979 libcatacomb_la_SOURCES += rand.c
981 ## The SSL v3 pseudorandom function.
982 pkginclude_HEADERS += sslprf.h
983 libcatacomb_la_SOURCES += sslprf.c
985 EXTRA_DIST += tests/sslprf
987 ## The TLS v1 pseudorandom function.
988 pkginclude_HEADERS += tlsprf.h
989 libcatacomb_la_SOURCES += tlsprf.c
991 EXTRA_DIST += tests/tlsprf
993 ###--------------------------------------------------------------------------
994 ### The `catcrypt' library.
996 noinst_LTLIBRARIES += libcatcrypt.la
997 libcatcrypt_la_SOURCES =
1000 libcatcrypt_la_SOURCES += cc.h
1001 libcatcrypt_la_SOURCES += cc-enc.c
1002 libcatcrypt_la_SOURCES += cc-hash.c
1003 libcatcrypt_la_SOURCES += cc-kem.c
1004 libcatcrypt_la_SOURCES += cc-list.c
1005 libcatcrypt_la_SOURCES += cc-progress.c
1006 libcatcrypt_la_SOURCES += cc-sig.c
1007 libcatcrypt_la_SOURCES += cc-subcmd.c
1010 libcatcrypt_la_SOURCES += getdate.h
1011 libcatcrypt_la_SOURCES += getdate.y
1013 ###--------------------------------------------------------------------------
1014 ### Utility programs.
1016 UTILS_LIBS = libcatcrypt.la libcatacomb.la $(mLib_LIBS) $(LIBS)
1018 ## Generate and verify datestamped cookies.
1019 bin_PROGRAMS += cookie
1020 cookie_LDADD = $(UTILS_LIBS)
1021 dist_man_MANS += cookie.1
1023 ## Asymmetric message encryption and decryption with deniable authentication.
1024 bin_PROGRAMS += catcrypt
1025 catcrypt_LDADD = $(UTILS_LIBS)
1026 dist_man_MANS += catcrypt.1
1028 ## Signing and verifying files.
1029 bin_PROGRAMS += catsign
1030 catsign_LDADD = $(UTILS_LIBS)
1031 dist_man_MANS += catsign.1
1033 ## Issue and verify signatures on directory trees.
1034 bin_PROGRAMS += dsig
1035 dsig_LDADD = $(UTILS_LIBS)
1036 dist_man_MANS += dsig.1
1038 ## Compute factorials to arbitrary precision.
1039 bin_PROGRAMS += factorial
1040 factorial_LDADD = $(UTILS_LIBS)
1042 ## Compute Fibonacci numbers to arbitrary precision.
1043 bin_PROGRAMS += fibonacci
1044 fibonacci_LDADD = $(UTILS_LIBS)
1046 ## Compute hashes of files.
1047 bin_PROGRAMS += hashsum
1048 hashsum_LDADD = $(UTILS_LIBS)
1049 dist_man_MANS += hashsum.1
1051 ## Key management utility.
1053 key_SOURCES = keyutil.c
1054 key_LDADD = $(UTILS_LIBS)
1055 dist_man_MANS += key.1 keyring.5
1057 ## Generate passphrases with given entropy using wordlists and Markov models.
1058 bin_PROGRAMS += mkphrase
1059 mkphrase_LDADD = $(UTILS_LIBS)
1060 dist_man_MANS += mkphrase.1
1062 ## Performance testing.
1063 bin_PROGRAMS += perftest
1064 perftest_LDADD = $(UTILS_LIBS)
1066 ## Remember passphrases for limited periods of time.
1067 bin_PROGRAMS += pixie
1068 pixie_SOURCES = pixie.c
1069 pixie_LDADD = libcatacomb.la $(mLib_LIBS) $(PIXIE_LIBS)
1070 dist_man_MANS += pixie.1
1071 EXTRA_DIST += xpixie
1073 ## Generate random data.
1074 bin_PROGRAMS += rspit
1075 rspit_LDADD = $(UTILS_LIBS)
1077 ###--------------------------------------------------------------------------
1080 SUFFIXES += .c .$t .to
1082 $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@
1083 .to.$t: libcatacomb.la
1084 $(AM_V_CCLD)$(LINK) $< libcatacomb.la $(mLib_LIBS) $(LIBS)
1086 CLEANFILES += *.to *.$t
1088 ###--------------------------------------------------------------------------
1089 ### The pkg-config file.
1091 pkgconfigdir = $(libdir)/pkgconfig
1092 pkgconfig_DATA = catacomb.pc
1093 EXTRA_DIST += catacomb.pc.in
1094 CLEANFILES += catacomb.pc
1096 catacomb.pc: catacomb.pc.in Makefile
1097 $(SUBST) $(srcdir)/catacomb.pc.in >$@.new $(SUBSTITUTIONS) && \
1100 ###--------------------------------------------------------------------------
1101 ### Release tweaking.
1105 echo $(VERSION) >$(distdir)/RELEASE
1107 ## Additional build tools.
1108 EXTRA_DIST += config/auto-version
1110 ###--------------------------------------------------------------------------
1114 EXTRA_DIST += debian/rules
1115 EXTRA_DIST += debian/control
1116 EXTRA_DIST += debian/changelog
1117 EXTRA_DIST += debian/copyright
1120 EXTRA_DIST += debian/catacomb-bin.prerm
1121 EXTRA_DIST += debian/catacomb-bin.postinst
1122 EXTRA_DIST += debian/catacomb-bin.config
1123 EXTRA_DIST += debian/catacomb-bin.templates
1125 ###----- That's all, folks --------------------------------------------------