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)/confsubst
66 EXTRA_DIST += confsubst
69 prefix=$(prefix) exec_prefix=$(exec_prefix) \
70 libdir=$(libdir) includedir=$(includedir) \
71 PACKAGE=$(PACKAGE) VERSION=$(VERSION)
73 V_SUBST = $(V_SUBST_$(V))
74 V_SUBST_ = $(V_SUBST_$(AM_DEFAULT_VERBOSITY))
75 V_SUBST_0 = @echo " SUBST $@";
76 SUBST = $(V_SUBST)$(confsubst)
78 ###--------------------------------------------------------------------------
81 lib_LTLIBRARIES += libcatacomb.la
82 libcatacomb_la_LIBADD = $(CATACOMB_LIBS)
83 libcatacomb_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO)
84 libcatacomb_la_SOURCES =
85 nodist_libcatacomb_la_SOURCES =
87 ###--------------------------------------------------------------------------
90 ## The locked-memory arena.
91 pkginclude_HEADERS += arena.h
92 libcatacomb_la_SOURCES += arena.c
94 ## Constant-type operations.
95 pkginclude_HEADERS += ct.h
96 libcatacomb_la_SOURCES += ct.c
98 ## Acceptable key-size descriptions.
99 pkginclude_HEADERS += keysz.h
100 libcatacomb_la_SOURCES += keysz.c keysz-conv.c
102 ## System-level memory locking.
103 pkginclude_HEADERS += lmem.h
104 libcatacomb_la_SOURCES += lmem.c
106 ## Clearing secrets from memory.
107 pkginclude_HEADERS += paranoia.h
109 ###--------------------------------------------------------------------------
110 ### Main multiprecision integer library.
112 ## This library is unfortunately intertwined with some of the code generation
113 ## programs, so we must be rather careful. The important bits of the maths
114 ## library needed by these programs is separated out into `libmpbase'. There
115 ## is work going on to fix this unpleasant situation by generating the
116 ## relevant files from Python scripts rather than C programs, using
117 ## information gathered by `configure'.
118 noinst_LTLIBRARIES += libmpbase.la
119 libcatacomb_la_LIBADD += libmpbase.la
120 libmpbase_la_SOURCES =
121 $(libmpbase_la_OBJECTS): mptypes.h
123 ## Additional buffer I/O functions for mathematical objects.
124 pkginclude_HEADERS += buf.h
125 libcatacomb_la_SOURCES += buf.c
127 ## Infrastructure for fast exponentiation.
128 pkginclude_HEADERS += exp.h
129 libcatacomb_la_SOURCES += exp.c
131 ## Main user-visible multiprecision arithmetic.
132 pkginclude_HEADERS += mp.h
133 libmpbase_la_SOURCES += mp-arith.c
135 libmpbase_la_SOURCES += mp-const.c
136 libcatacomb_la_SOURCES += mp-exp.c mp-exp.h
137 libcatacomb_la_SOURCES += mp-gcd.c
139 libmpbase_la_SOURCES += mp-io.c
140 libcatacomb_la_SOURCES += mp-jacobi.c
141 TESTS += mp-jacobi.$t
142 libmpbase_la_SOURCES += mp-mem.c
143 libmpbase_la_SOURCES += mp-misc.c
144 libcatacomb_la_SOURCES += mp-modexp.c
145 TESTS += mp-modexp.$t
146 libcatacomb_la_SOURCES += mp-modsqrt.c
147 TESTS += mp-modsqrt.$t
148 libcatacomb_la_SOURCES += mp-sqrt.c
150 libcatacomb_la_SOURCES += mp-test.c
151 EXTRA_DIST += tests/mp
153 ## Computing Fibonacci numbers.
154 pkginclude_HEADERS += mp-fibonacci.h
155 libcatacomb_la_SOURCES += mp-fibonacci.c
156 TESTS += mp-fibonacci.$t
158 ## Special memory allocation for multiprecision integers.
159 pkginclude_HEADERS += mparena.h
160 libmpbase_la_SOURCES += mparena.c
162 ## Barrett reduction, an efficient method for modular reduction.
163 pkginclude_HEADERS += mpbarrett.h
164 libcatacomb_la_SOURCES += mpbarrett.c
165 TESTS += mpbarrett.$t
166 libcatacomb_la_SOURCES += mpbarrett-exp.c mpbarrett-mexp.c mpbarrett-exp.h
167 TESTS += mpbarrett-exp.$t mpbarrett-mexp.$t
168 EXTRA_DIST += tests/mpbarrett
170 ## Solving congruences using the Chinese Remainder Theorem.
171 pkginclude_HEADERS += mpcrt.h
172 libcatacomb_la_SOURCES += mpcrt.c
174 EXTRA_DIST += tests/mpcrt
176 ## Conversions between machine-native and multiprecision integers.
177 pkginclude_HEADERS += mpint.h
178 libcatacomb_la_SOURCES += mpint.c
180 EXTRA_DIST += tests/mpint
182 ## Table of upper and lower limits of various types of machine integers, as
183 ## multiprecision integers.
184 nodist_archinclude_HEADERS += mplimits.h
185 nodist_libcatacomb_la_SOURCES += mplimits.c
186 CLEANFILES += mplimits.h mplimits.c
187 noinst_PROGRAMS += genlimits
188 genlimits_LDADD = libmpbase.la
189 mplimits.c: genlimits$e
190 $(AM_V_GEN)./genlimits c >mplimits.c.new && \
191 mv mplimits.c.new mplimits.c
192 mplimits.h: genlimits$e
193 $(AM_V_GEN)./genlimits h >mplimits.h.new && \
194 mv mplimits.h.new mplimits.h
195 $(genlimits_OBJECTS): mptypes.h
196 mplimits.lo: mplimits.h
198 ## Montgomery reduction, a clever method for modular arithmetic.
199 pkginclude_HEADERS += mpmont.h
200 libcatacomb_la_SOURCES += mpmont.c
202 libcatacomb_la_SOURCES += mpmont-exp.c mpmont-mexp.c mpmont-exp.h
203 TESTS += mpmont-exp.$t mpmont-mexp.$t
204 EXTRA_DIST += tests/mpmont
206 ## Efficient multiplication of many small numbers.
207 pkginclude_HEADERS += mpmul.h
208 libcatacomb_la_SOURCES += mpmul.c
211 ## Generating random numbers.
212 pkginclude_HEADERS += mprand.h
213 libcatacomb_la_SOURCES += mprand.c
215 ## Efficient reduction modulo numbers with conveninent binary
217 pkginclude_HEADERS += mpreduce.h
218 libcatacomb_la_SOURCES += mpreduce.c mpreduce-exp.h
220 EXTRA_DIST += tests/mpreduce
222 ## Iteratiion over the bianry representation of multiprecision integers.
223 pkginclude_HEADERS += mpscan.h
224 libmpbase_la_SOURCES += mpscan.c
226 ## Conversion between multiprecision integers and their textual
228 pkginclude_HEADERS += mptext.h
229 libmpbase_la_SOURCES += mptext.c
231 libcatacomb_la_SOURCES += mptext-dstr.c
232 libcatacomb_la_SOURCES += mptext-file.c
233 libcatacomb_la_SOURCES += mptext-len.c
234 libmpbase_la_SOURCES += mptext-string.c
235 EXTRA_DIST += tests/mptext
237 ## Basic types used in the representation of multiprecision integers.
238 nodist_archinclude_HEADERS += mptypes.h
239 BUILT_SOURCES += mptypes.h
240 CLEANFILES += mptypes.h
241 noinst_PROGRAMS += mptypes
243 $(AM_V_GEN)./mptypes >mptypes.h.new && mv mptypes.h.new mptypes.h
245 ## Low-level multiprecision arithmetic.
246 pkginclude_HEADERS += mpx.h bitops.h mpw.h
247 libmpbase_la_SOURCES += mpx.c
249 libmpbase_la_SOURCES += karatsuba.h mpx-kmul.c mpx-ksqr.c
250 TESTS += mpx-kmul.$t mpx-ksqr.$t
251 noinst_PROGRAMS += bittest
253 EXTRA_DIST += tests/mpx
255 ## A quick-and-dirty parser, used for parsing descriptions of groups, fields,
257 pkginclude_HEADERS += rho.h
258 libcatacomb_la_SOURCES += rho.c
261 ## Pollard's `rho' algorithm for determining discrete logarithms.
262 pkginclude_HEADERS += qdparse.h
263 libcatacomb_la_SOURCES += qdparse.c
265 ###--------------------------------------------------------------------------
266 ### Prime number checking, searching, and related jobs.
268 ## Generating Lim--Lee groups, i.e., unit groups of finite fields without
269 ## small subgroups (except for the obvious ones).
270 pkginclude_HEADERS += limlee.h
271 libcatacomb_la_SOURCES += limlee.c
273 ## A table of small prime numbers.
274 nodist_pkginclude_HEADERS += primetab.h
275 nodist_libcatacomb_la_SOURCES += primetab.c
276 CLEANFILES += primetab.h primetab.c
277 BUILT_SOURCES += primetab.h primetab.c
278 noinst_PROGRAMS += genprimes
279 primetab.h: primetab.c
280 primetab.c: genprimes$e
281 $(AM_V_GEN)./genprimes -hprimetab.h -cprimetab.c \
282 -sCATACOMB_PRIMETAB_H \
283 -n256 -t"unsigned short" -iprimetab
285 ## Filtering candidate prime numbers by checking for small factors
287 pkginclude_HEADERS += pfilt.h
288 libcatacomb_la_SOURCES += pfilt.c
290 ## Generating prime numbers (and other kinds of numbers which need searching
292 pkginclude_HEADERS += pgen.h
293 libcatacomb_la_SOURCES += pgen.c
294 libcatacomb_la_SOURCES += pgen-gcd.c
295 libcatacomb_la_SOURCES += pgen-simul.c
296 libcatacomb_la_SOURCES += pgen-stdev.c
298 EXTRA_DIST += tests/pgen
300 ## Finding primitive elements in finite fields.
301 pkginclude_HEADERS += prim.h
302 libcatacomb_la_SOURCES += prim.c
304 ## Iterating over all prime numbers from a given starting point.
305 pkginclude_HEADERS += primeiter.h
306 libcatacomb_la_SOURCES += primeiter.c
307 TESTS += primeiter.$t
308 primeiter.lo: wheel.h
310 ## The Miller--Rabin primality test.
311 pkginclude_HEADERS += rabin.h
312 libcatacomb_la_SOURCES += rabin.c
314 ## Finding `strong' primes, using Gordon's algorithm. Once upon a time,
315 ## products of these kinds of numbers were harder to factor.
316 pkginclude_HEADERS += strongprime.h
317 libcatacomb_la_SOURCES += strongprime.c
319 ## A `wheel', used by the prime iteration machinery.
320 nodist_pkginclude_HEADERS += wheel.h
321 nodist_libcatacomb_la_SOURCES += wheel.c
322 CLEANFILES += wheel.h wheel.c
323 noinst_PROGRAMS += genwheel
326 $(AM_V_GEN)./genwheel -hwheel.h -cwheel.c \
328 -n5 -t"unsigned char" -iwheel
330 ###--------------------------------------------------------------------------
331 ### Binary polynomial arithmetic.
333 ## User-visible binary polynomial arithmetic.
334 pkginclude_HEADERS += gf.h
335 libcatacomb_la_SOURCES += gf-arith.c
337 libcatacomb_la_SOURCES += gf-exp.c gf-exp.h
338 libcatacomb_la_SOURCES += gf-gcd.c
340 EXTRA_DIST += tests/gf
342 ## Low-level binary polynomial arithmetic.
343 pkginclude_HEADERS += gfx.h
344 libcatacomb_la_SOURCES += gfx.c
346 libcatacomb_la_SOURCES += gfx-kmul.c
348 libcatacomb_la_SOURCES += gfx-sqr.c
349 gfx-sqr.lo: gfx-sqr-tab.h
351 CLEANFILES += gfx-sqr-tab.h
352 noinst_PROGRAMS += gfx-sqr-mktab
353 gfx-sqr-tab.h: gfx-sqr-mktab$e
354 $(AM_V_GEN)./gfx-sqr-mktab >gfx-sqr-tab.h.in && \
355 mv gfx-sqr-tab.h.in gfx-sqr-tab.h
356 EXTRA_DIST += tests/gfx
358 ## Conversions between normal and polynomial basis representations for binary
360 pkginclude_HEADERS += gfn.h
361 libcatacomb_la_SOURCES += gfn.c
363 EXTRA_DIST += tests/gfn
365 ## Efficient reduction modulo sparse polynomials.
366 pkginclude_HEADERS += gfreduce.h
367 libcatacomb_la_SOURCES += gfreduce.c gfreduce-exp.h
369 EXTRA_DIST += tests/gfreduce
371 ###--------------------------------------------------------------------------
372 ### Abstractions for various kinds of algebraic objects.
374 ## Abstract cyclic groups.
375 pkginclude_HEADERS += group.h group-guts.h
376 libcatacomb_la_SOURCES += group-dstr.c
377 libcatacomb_la_SOURCES += group-exp.c group-exp.h
378 libcatacomb_la_SOURCES += group-file.c
379 libcatacomb_la_SOURCES += group-parse.c
380 libcatacomb_la_SOURCES += group-stdops.c
381 libcatacomb_la_SOURCES += group-string.c
382 libcatacomb_la_SOURCES += g-bin.c
383 libcatacomb_la_SOURCES += g-prime.c
384 libcatacomb_la_SOURCES += g-ec.c
385 EXTRA_DIST += group-test.c
386 TESTS += group-test.$t
387 EXTRA_DIST += tests/group
389 ## Abstract finite fields.
390 pkginclude_HEADERS += field.h field-guts.h
391 libcatacomb_la_SOURCES += field.c
392 libcatacomb_la_SOURCES += field-exp.c field-exp.h
393 libcatacomb_la_SOURCES += field-parse.c
394 libcatacomb_la_SOURCES += f-binpoly.c
395 libcatacomb_la_SOURCES += f-niceprime.c
396 libcatacomb_la_SOURCES += f-prime.c
398 ## Table of built-in binary fields.
399 pkginclude_HEADERS += bintab.h
400 libcatacomb_la_SOURCES += bintab.c
401 CLEANFILES += bintab.c
402 EXTRA_DIST += bintab.in bin-gentab.awk
403 bintab.c: bintab.in bin-gentab.awk mpdump$e
404 $(AM_V_GEN)awk -f $(srcdir)/bin-gentab.awk \
405 <$(srcdir)/bintab.in >bintab.c.new && \
406 mv bintab.c.new bintab.c
408 ## Table of built-in prime fields.
409 pkginclude_HEADERS += ptab.h
410 libcatacomb_la_SOURCES += ptab.c
412 EXTRA_DIST += ptab.in p-gentab.awk
413 ptab.c: ptab.in p-gentab.awk mpdump$e
414 $(AM_V_GEN)awk -f $(srcdir)/p-gentab.awk \
415 <$(srcdir)/ptab.in >ptab.c.new && \
418 ## A utility for building multiprecision integer constants.
419 noinst_PROGRAMS += mpdump
420 mpdump_LDADD = libmpbase.la
421 $(mpdump_OBJECTS): mptypes.h
423 ###--------------------------------------------------------------------------
424 ### Elliptic curve arithmetic.
426 ## Basic elliptic curve arithmetic.
427 pkginclude_HEADERS += ec.h ec-guts.h
428 libcatacomb_la_SOURCES += ec.c
429 libcatacomb_la_SOURCES += ec-exp.c ec-exp.h
430 libcatacomb_la_SOURCES += ec-info.c
432 libcatacomb_la_SOURCES += ec-bin.c
434 libcatacomb_la_SOURCES += ec-prime.c
436 EXTRA_DIST += tests/ec
438 ## The standard `raw' encoding (`EC2OSP') of elliptic curve points.
439 pkginclude_HEADERS += ec-raw.h
440 libcatacomb_la_SOURCES += ec-raw.c
442 ## Test infrastructure for elliptic curves.
443 pkginclude_HEADERS += ec-test.h
444 libcatacomb_la_SOURCES += ec-test.c
447 ## A table of built-in elliptic curves.
448 pkginclude_HEADERS += ectab.h
449 libcatacomb_la_SOURCES += ectab.c
450 CLEANFILES += ectab.c
451 EXTRA_DIST += ectab.in ec-gentab.awk
452 ectab.c: ectab.in ec-gentab.awk mpdump$e
453 $(AM_V_GEN)awk -f $(srcdir)/ec-gentab.awk \
454 <$(srcdir)/ectab.in >ectab.c.new && \
455 mv ectab.c.new ectab.c
457 ###--------------------------------------------------------------------------
458 ### Autogenerated lists.
460 ## Fancy template substitutions.
461 multigen = python $(srcdir)/multigen
462 EXTRA_DIST += multigen
464 ## The heart of this is an enormous cross-product of crypto primitives and
465 ## the corresponding modes of operation. Rather than write it out longhand,
466 ## we generate it using `multigen'. Unfortunately, this needs to be done
467 ## at the Automake level, which causes some interesting bootstrapping
471 EXTRA_DIST += modes.am.in modes.am
472 MAINTAINERCLEANFILES += $(srcdir)/modes.am
474 ## Generate the lists.
475 $(srcdir)/modes.am: modes.am.in
476 $(AM_V_GEN)$(multigen) -g $(srcdir)/modes.am.in $(srcdir)/modes.am \
478 blkcmode="$(BLKCMODES)" \
479 blkcciphermode="$(BLKCCIPHERMODES)" \
481 hashmode="$(HASHMODES)" \
482 hashciphermode="$(HASHCIPHERMODES)" \
483 hashmacmode="$(HASHMACMODES)"
485 ## Initialize lists of known classes.
486 ALL_CIPHERS = $(CIPHER_MODES)
487 ALL_HASHES = $(HASHES)
488 ALL_MACS = $(MAC_MODES)
490 ###--------------------------------------------------------------------------
497 BLKCMODES += $(BLKCCIPHERMODES)
499 ## A tool for translating the AES-contest test vectors into a form our test
501 EXTRA_DIST += tests/aes-trans
503 ## Block cipher utility macros, mainly used in mode implementations.
504 pkginclude_HEADERS += blkc.h
506 ## Source code and headers for the block ciphers.
507 libcatacomb_la_SOURCES += $(BLKC_C)
508 pkginclude_HEADERS += $(BLKC_H)
510 ## Schneier's `Blowfish' block cipher.
512 blowfish.lo: blowfish-tab.h
513 CLEANFILES += blowfish-tab.h
514 noinst_PROGRAMS += blowfish-mktab
515 blowfish-tab.h: blowfish-mktab$e
516 $(AM_V_GEN)./blowfish-mktab >blowfish-tab.h.new && \
517 mv blowfish-tab.h.new blowfish-tab.h
519 ## Adams and Tavares' `CAST' block ciphers.
520 BLKCS += cast128 cast256
521 libcatacomb_la_SOURCES += cast-s.c cast-sk.c cast-base.h cast-tab.h
522 cast256.$t: tests/cast256
523 EXTRA_DIST += tests/cast256.aes
524 MAINTAINERCLEANFILES += $(srcdir)/tests/cast256
525 tests/cast256: tests/cast256.aes
526 $(AM_V_GEN)$(srcdir)/tests/aes-trans CAST256 \
527 <$(srcdir)/tests/cast256.aes \
528 >$(srcdir)/tests/cast256.new && \
529 mv $(srcdir)/tests/cast256.new $(srcdir)/tests/cast256
531 ## IBM's `DES' block cipher, by Feistel, Coppersmith, and others.
533 libcatacomb_la_SOURCES += des-base.h des-base.c desx-tab.h
534 des-base.lo: des-tab.h
535 CLEANFILES += des-tab.h
536 noinst_PROGRAMS += des-mktab
537 des-tab.h: des-mktab$e
538 $(AM_V_GEN)./des-mktab >des-tab.h.new && \
539 mv des-tab.h.new des-tab.h
541 ## Rivest's `DESX' variant, with pre- and post-whitening.
543 libcatacomb_la_SOURCES += desx-tab.h
545 ## Lai and Massey's IDEA.
548 ## IBM's `MARS' block cipher.
551 CLEANFILES += mars-tab.h
552 noinst_PROGRAMS += mars-mktab
553 mars-tab.h: mars-mktab$e
554 $(AM_V_GEN)./mars-mktab >mars-tab.h.new && \
555 mv mars-tab.h.new mars-tab.h
557 EXTRA_DIST += tests/mars.aes
558 MAINTAINERCLEANFILES += $(srcdir)/tests/mars
559 tests/mars: tests/mars.aes
560 $(AM_V_GEN)$(srcdir)/tests/aes-trans Mars \
561 <$(srcdir)/tests/mars.aes \
562 >$(srcdir)/tests/mars.new && \
563 mv $(srcdir)/tests/mars.new $(srcdir)/tests/mars
565 ## Daemen, Peeters, Van Assche and Rijmen's `Noekeon'.
568 ## Rivest's `RC2' block cipher.
570 libcatacomb_la_SOURCES += rc2-tab.h
575 ## Daemen and Rijmen's `Rijndael' block cipher, selected as AES.
576 BLKCS += rijndael rijndael192 rijndael256
577 libcatacomb_la_SOURCES += rijndael-base.h rijndael-base.c
578 rijndael-base.lo: rijndael-tab.h
579 CLEANFILES += rijndael-tab.h
580 noinst_PROGRAMS += rijndael-mktab
581 rijndael-tab.h: rijndael-mktab$e
582 $(AM_V_GEN)./rijndael-mktab >rijndael-tab.h.new && \
583 mv rijndael-tab.h.new rijndael-tab.h
584 rijndael.$t: tests/rijndael
585 EXTRA_DIST += tests/rijndael.aes
586 MAINTAINERCLEANFILES += $(srcdir)/tests/rijndael
587 tests/rijndael: tests/rijndael.aes
588 $(AM_V_GEN)$(srcdir)/tests/aes-trans Rijndael \
589 <$(srcdir)/tests/rijndael.aes \
590 >$(srcdir)/tests/rijndael.new && \
591 mv $(srcdir)/tests/rijndael.new $(srcdir)/tests/rijndael
593 ## Massey's `SAFER' block ciphers.
594 BLKCS += safer safersk
595 safer.lo: safer-tab.h
596 CLEANFILES += safer-tab.h
597 noinst_PROGRAMS += safer-mktab
598 safer-tab.h: safer-mktab$e
599 $(AM_V_GEN)./safer-mktab >safer-tab.h.new && \
600 mv safer-tab.h.new safer-tab.h
602 ## Anderson, Biham and Knudsen's `Serpent' block cipher.
604 libcatacomb_la_SOURCES += serpent-sbox.h
605 noinst_PROGRAMS += serpent-check
606 TESTS += serpent-check
607 serpent.$t: tests/serpent
608 EXTRA_DIST += tests/serpent.aes
609 MAINTAINERCLEANFILES += $(srcdir)/tests/serpent
610 tests/serpent: tests/serpent.aes
611 $(AM_V_GEN)$(srcdir)/tests/aes-trans Serpent -v rev=1 \
612 <$(srcdir)/tests/serpent.aes \
613 >$(srcdir)/tests/serpent.new && \
614 mv $(srcdir)/tests/serpent.new $(srcdir)/tests/serpent
616 ## The National Security Agency's `Skipjack' block cipher. You don't want to
619 libcatacomb_la_SOURCES += skipjack-tab.h
621 ## Daemen and Rijmen's `Square' block cipher.
623 square.lo: square-tab.h
624 CLEANFILES += square-tab.h
625 noinst_PROGRAMS += square-mktab
626 square-tab.h: square-mktab$e
627 $(AM_V_GEN)./square-mktab >square-tab.h.new && \
628 mv square-tab.h.new square-tab.h
630 ## Wheeler and Needham's `TEA' and `XTEA' block ciphers.
633 ## Schneier, Kelsey, Whiting, Wagner, Hall and Ferguson's `Twofish' block
636 twofish.lo: twofish-tab.h
637 CLEANFILES += twofish-tab.h
638 noinst_PROGRAMS += twofish-mktab
639 twofish-tab.h: twofish-mktab$e
640 $(AM_V_GEN)./twofish-mktab >twofish-tab.h.new && \
641 mv twofish-tab.h.new twofish-tab.h
642 twofish.$t: tests/twofish
643 EXTRA_DIST += tests/twofish.aes
644 MAINTAINERCLEANFILES += $(srcdir)/tests/twofish
645 tests/twofish: tests/twofish.aes
646 $(AM_V_GEN)$(srcdir)/tests/aes-trans Twofish \
647 <$(srcdir)/tests/twofish.aes \
648 >$(srcdir)/tests/twofish.new && \
649 mv $(srcdir)/tests/twofish.new $(srcdir)/tests/twofish
651 ## The old NIST modes for DES.
652 BLKCCIPHERMODES += cbc cfb ecb ofb
655 BLKCCIPHERMODES += counter
657 ###--------------------------------------------------------------------------
664 HASHMODES += $(HASHCIPHERMODES)
667 HASHMODES += $(HASHMACMODES)
669 ## Common definitions for hash functions.
670 pkginclude_HEADERS += hash.h
672 ## Source code and headers for the hash functions.
673 libcatacomb_la_SOURCES += $(HASH_C)
674 pkginclude_HEADERS += $(HASH_H)
676 ## Lim and KISA's `HAS-160', recommended for use with KCDSA.
679 ## Rivest's `MD' series of hash functions
680 HASHES += md2 md4 md5
681 libcatacomb_la_SOURCES += md2-tab.h
683 ## Dobbertin, Bosselaers and Preneel's `RIPEMD' suite.
684 HASHES += rmd128 rmd160 rmd256 rmd320
686 ## The National Security Agency's `SHA-1' hash function.
689 ## The National Security Agency's `SHA-2' suite.
690 HASHES += sha224 sha256
691 HASHES += sha384 sha512
693 ## Anderson and Biham's `Tiger' hash function.
695 libcatacomb_la_SOURCES += tiger-base.h
696 tiger.lo: tiger-tab.h
697 CLEANFILES += tiger-tab.h
698 noinst_PROGRAMS += tiger-mktab
699 tiger-tab.h: tiger-mktab$e
700 $(AM_V_GEN)./tiger-mktab >tiger-tab.h.new && \
701 mv tiger-tab.h.new tiger-tab.h
703 ## Barreto and Rijmen's `Whirlpool' hash function.
704 HASHES += whirlpool whirlpool256
705 whirlpool.lo: whirlpool-tab.h
706 CLEANFILES += whirlpool-tab.h
707 noinst_PROGRAMS += whirlpool-mktab
708 whirlpool-tab.h: whirlpool-mktab$e
709 $(AM_V_GEN)./whirlpool-mktab >whirlpool-tab.h.new && \
710 mv whirlpool-tab.h.new whirlpool-tab.h
712 ## Bellare, Canetti and Krawczyk's `HMAC' mode for message authentication.
715 ## MGF1, used in OAEP and PSS.
716 HASHCIPHERMODES += mgf
718 ###--------------------------------------------------------------------------
719 ### Other symmetric primitives.
721 ## The CRC32 algorithm, which is useful, but has no worthwhile security.
722 pkginclude_HEADERS += crc32.h
723 libcatacomb_la_SOURCES += crc32.c
724 ALL_HASHES += crc32=gcrc32
726 ## Rivest's `RC4' stream cipher.
727 pkginclude_HEADERS += rc4.h
728 libcatacomb_la_SOURCES += rc4.c
730 EXTRA_DIST += tests/rc4
733 ## Coppersmith and Rogaway's `SEAL' pseudorandom function.
734 pkginclude_HEADERS += seal.h
735 libcatacomb_la_SOURCES += seal.c
737 EXTRA_DIST += tests/seal
739 ###--------------------------------------------------------------------------
740 ### Autogenerated mode implementations.
742 ## The master stamp file, indicating that we generated all of the sources.
743 CLEANFILES += modes-gen-stamp
744 EXTRA_DIST += mode.h.in mode.c.in
746 $(AM_V_at)touch modes-gen-stamp
747 $(AM_V_GEN)$(multigen) -g $(srcdir)/mode.c.in \
749 base="$(BLKCS)" mode="$(BLKCMODES)"
750 $(AM_V_at)$(multigen) -g $(srcdir)/mode.c.in \
752 base="$(HASHES)" mode="$(HASHMODES)"
753 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
755 base="$(BLKCS)" mode="$(BLKCMODES)"
756 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
758 base="$(HASHES)" mode="$(HASHMODES)"
759 $(AM_V_at)touch modes-gen-stamp
761 ## The individual mode interfaces and implementations.
762 pkginclude_HEADERS += $(MODE_H)
764 ## Generated implementations.
765 BUILT_SOURCES += $(GENMODES_C)
766 CLEANFILES += $(GENMODES_C)
767 nodist_libcatacomb_la_SOURCES += $(GENMODES_C)
768 $(GENMODES_C): modes-gen-stamp
770 ## Generated interfaces.
771 BUILT_SOURCES += $(GENMODES_H)
772 CLEANFILES += $(GENMODES_H)
773 nodist_pkginclude_HEADERS += $(GENMODES_H)
774 $(GENMODES_H): modes-gen-stamp
776 ###--------------------------------------------------------------------------
777 ### Tables of classes for encryption, hashing, and message authentication.
779 ## The skeleton for the class tables.
780 EXTRA_DIST += gthingtab.c.in
782 ## Table of cipher classes.
783 pkginclude_HEADERS += gcipher.h
784 CLEANFILES += gciphertab.c
785 nodist_libcatacomb_la_SOURCES += gciphertab.c
786 gciphertab.c: gthingtab.c.in
787 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gciphertab.c \
788 what=gcipher cls=gccipher thing="$(ALL_CIPHERS)"
790 ## Table of hash classes.
791 pkginclude_HEADERS += ghash.h ghash-def.h
792 CLEANFILES += ghashtab.c
793 nodist_libcatacomb_la_SOURCES += ghashtab.c
794 ghashtab.c: gthingtab.c.in
795 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in ghashtab.c \
796 what=ghash cls=gchash thing="$(ALL_HASHES)"
798 ## Table of MAC classes.
799 pkginclude_HEADERS += gmac.h
800 CLEANFILES += gmactab.c
801 nodist_libcatacomb_la_SOURCES += gmactab.c
802 gmactab.c: gthingtab.c.in
803 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gmactab.c \
804 what=gmac cls=gcmac thing="$(ALL_MACS)"
806 ###--------------------------------------------------------------------------
807 ### Testing for symmetric crypto things.
809 ## Run the test programs.
810 TESTS += $(SYMM_TESTS)
811 EXTRA_DIST += $(SYMM_TEST_FILES)
813 ## A piece of sample text for round-trip testing encryption modes.
814 EXTRA_DIST += daftstory.h
816 ###--------------------------------------------------------------------------
819 ## Assistance for elliptic-curve keys.
820 pkginclude_HEADERS += ec-keys.h
821 libcatacomb_la_SOURCES += ec-fetch.c
823 ## Managing keys and keyring files.
824 pkginclude_HEADERS += key.h
825 libcatacomb_la_SOURCES += key-attr.c
826 libcatacomb_la_SOURCES += key-fetch.c
827 libcatacomb_la_SOURCES += key-file.c
828 libcatacomb_la_SOURCES += key-io.c
829 libcatacomb_la_SOURCES += key-misc.c
830 libcatacomb_la_SOURCES += key-moan.c
832 ## Managing key data.
833 pkginclude_HEADERS += key-data.h
834 libcatacomb_la_SOURCES += key-binary.c
835 libcatacomb_la_SOURCES += key-data.c
836 libcatacomb_la_SOURCES += key-flags.c
837 libcatacomb_la_SOURCES += key-pack.c
838 libcatacomb_la_SOURCES += key-pass.c
839 libcatacomb_la_SOURCES += key-text.c
842 pkginclude_HEADERS += key-error.h
843 libcatacomb_la_SOURCES += key-error.c
845 ## Reading passphrases.
846 pkginclude_HEADERS += passphrase.h
847 libcatacomb_la_SOURCES += passphrase.c
849 ## Interfacing with the passphrase pixie.
850 pkginclude_HEADERS += pixie.h
851 libcatacomb_la_SOURCES += pixie-common.c
853 ###--------------------------------------------------------------------------
856 ## Efficient sharing over GF(2^8).
857 pkginclude_HEADERS += gfshare.h
858 libcatacomb_la_SOURCES += gfshare.c
859 gfshare.lo: gfshare-tab.h
860 CLEANFILES += gfshare-tab.h
861 noinst_PROGRAMS += gfshare-mktab
862 gfshare-tab.h: gfshare-mktab$e
863 $(AM_V_GEN)./gfshare-mktab >gfshare-tab.h.new && \
864 mv gfshare-tab.h.new gfshare-tab.h
867 ## Number-theoretic sharing over GF(p).
868 pkginclude_HEADERS += share.h
869 libcatacomb_la_SOURCES += share.c
872 ###--------------------------------------------------------------------------
873 ### Public-key cryptography.
875 ## The Blum--Blum--Shub random-bit generator.
876 pkginclude_HEADERS += bbs.h
877 libcatacomb_la_SOURCES += bbs-fetch.c
878 libcatacomb_la_SOURCES += bbs-gen.c
879 libcatacomb_la_SOURCES += bbs-jump.c
881 libcatacomb_la_SOURCES += bbs-rand.c
883 EXTRA_DIST += tests/bbs
885 ## Plain Diffie--Hellman, in Schorr groups.
886 pkginclude_HEADERS += dh.h
887 libcatacomb_la_SOURCES += dh-check.c
888 libcatacomb_la_SOURCES += dh-fetch.c
889 libcatacomb_la_SOURCES += dh-gen.c
890 libcatacomb_la_SOURCES += dh-kcdsa.c
891 libcatacomb_la_SOURCES += dh-limlee.c
892 libcatacomb_la_SOURCES += dh-param.c
895 ## The National Security Agency's Digital Signature Algorithm.
896 pkginclude_HEADERS += dsa.h
897 libcatacomb_la_SOURCES += dsa-gen.c
899 libcatacomb_la_SOURCES += dsa-misc.c
900 libcatacomb_la_SOURCES += dsa-sign.c
902 libcatacomb_la_SOURCES += dsa-verify.c
903 TESTS += dsa-verify.$t
904 libcatacomb_la_SOURCES += dsa-check.c
905 EXTRA_DIST += tests/dsa
907 ## Generalization of DSA to arbitrary cyclic groups.
908 pkginclude_HEADERS += gdsa.h
909 libcatacomb_la_SOURCES += gdsa.c
911 EXTRA_DIST += tests/gdsa
913 ## KISA `KCDSA', generalized to arbitrary cyclic groups.
914 pkginclude_HEADERS += gkcdsa.h
915 libcatacomb_la_SOURCES += gkcdsa.c
917 EXTRA_DIST += tests/gkcdsa
919 ## General key validity checking machinery.
920 pkginclude_HEADERS += keycheck.h
921 libcatacomb_la_SOURCES += keycheck.c
922 libcatacomb_la_SOURCES += keycheck-mp.c
923 libcatacomb_la_SOURCES += keycheck-report.c
925 ## The Rivest--Shamir--Adleman trapdoor one-way function.
926 pkginclude_HEADERS += rsa.h
927 libcatacomb_la_SOURCES += rsa-fetch.c
928 libcatacomb_la_SOURCES += rsa-gen.c
929 libcatacomb_la_SOURCES += rsa-priv.c
930 libcatacomb_la_SOURCES += rsa-pub.c
931 libcatacomb_la_SOURCES += rsa-recover.c
932 libcatacomb_la_SOURCES += oaep.c
933 libcatacomb_la_SOURCES += pkcs1.c
934 libcatacomb_la_SOURCES += pss.c
935 EXTRA_DIST += rsa-test.c
937 EXTRA_DIST += tests/rsa
939 ###--------------------------------------------------------------------------
940 ### Random number generators.
942 ## The FIPS186 generator used to generate DSA domain parameters.
943 pkginclude_HEADERS += dsarand.h
944 libcatacomb_la_SOURCES += dsarand.c
946 ## Knuth's lagged-Fibonacci generator.
947 pkginclude_HEADERS += fibrand.h
948 libcatacomb_la_SOURCES += fibrand.c
950 ## The FIPS 140--2 random number generator tests.
951 pkginclude_HEADERS += fipstest.h
952 libcatacomb_la_SOURCES += fipstest.c
954 ## Interface for generic random number sources.
955 pkginclude_HEADERS += grand.h
956 libcatacomb_la_SOURCES += grand.c
958 ## A simple linear-congruential generator.
959 pkginclude_HEADERS += lcrand.h
960 libcatacomb_la_SOURCES += lcrand.c
962 EXTRA_DIST += tests/lcrand
964 ## Maurer's universal statistical test.
965 pkginclude_HEADERS += maurer.h
966 libcatacomb_la_SOURCES += maurer.c
968 ## System-specific noise acquisition.
969 pkginclude_HEADERS += noise.h
970 libcatacomb_la_SOURCES += noise.c
972 ## Cryptographic laundering for true random data generation.
973 pkginclude_HEADERS += rand.h
974 libcatacomb_la_SOURCES += rand.c
976 ## The SSL v3 pseudorandom function.
977 pkginclude_HEADERS += sslprf.h
978 libcatacomb_la_SOURCES += sslprf.c
980 EXTRA_DIST += tests/sslprf
982 ## The TLS v1 pseudorandom function.
983 pkginclude_HEADERS += tlsprf.h
984 libcatacomb_la_SOURCES += tlsprf.c
986 EXTRA_DIST += tests/tlsprf
988 ###--------------------------------------------------------------------------
989 ### The `catcrypt' library.
991 noinst_LTLIBRARIES += libcatcrypt.la
992 libcatcrypt_la_SOURCES =
995 libcatcrypt_la_SOURCES += cc.h
996 libcatcrypt_la_SOURCES += cc-enc.c
997 libcatcrypt_la_SOURCES += cc-hash.c
998 libcatcrypt_la_SOURCES += cc-kem.c
999 libcatcrypt_la_SOURCES += cc-list.c
1000 libcatcrypt_la_SOURCES += cc-progress.c
1001 libcatcrypt_la_SOURCES += cc-sig.c
1002 libcatcrypt_la_SOURCES += cc-subcmd.c
1005 libcatcrypt_la_SOURCES += getdate.h
1006 libcatcrypt_la_SOURCES += getdate.y
1008 ###--------------------------------------------------------------------------
1009 ### Utility programs.
1011 UTILS_LIBS = libcatcrypt.la libcatacomb.la $(LIBS)
1013 ## Generate and verify datestamped cookies.
1014 bin_PROGRAMS += cookie
1015 cookie_LDADD = $(UTILS_LIBS)
1016 dist_man_MANS += cookie.1
1018 ## Asymmetric message encryption and decryption with deniable authentication.
1019 bin_PROGRAMS += catcrypt
1020 catcrypt_LDADD = $(UTILS_LIBS)
1021 dist_man_MANS += catcrypt.1
1023 ## Signing and verifying files.
1024 bin_PROGRAMS += catsign
1025 catsign_LDADD = $(UTILS_LIBS)
1026 dist_man_MANS += catsign.1
1028 ## Issue and verify signatures on directory trees.
1029 bin_PROGRAMS += dsig
1030 dsig_LDADD = $(UTILS_LIBS)
1031 dist_man_MANS += dsig.1
1033 ## Compute factorials to arbitrary precision.
1034 bin_PROGRAMS += factorial
1035 factorial_LDADD = $(UTILS_LIBS)
1037 ## Compute Fibonacci numbers to arbitrary precision.
1038 bin_PROGRAMS += fibonacci
1039 fibonacci_LDADD = $(UTILS_LIBS)
1041 ## Compute hashes of files.
1042 bin_PROGRAMS += hashsum
1043 hashsum_LDADD = $(UTILS_LIBS)
1044 dist_man_MANS += hashsum.1
1046 ## Key management utility.
1048 key_SOURCES = keyutil.c
1049 key_LDADD = $(UTILS_LIBS)
1050 dist_man_MANS += key.1 keyring.5
1052 ## Generate passphrases with given entropy using wordlists and Markov models.
1053 bin_PROGRAMS += mkphrase
1054 mkphrase_LDADD = $(UTILS_LIBS)
1055 dist_man_MANS += mkphrase.1
1057 ## Performance testing.
1058 bin_PROGRAMS += perftest
1059 perftest_LDADD = $(UTILS_LIBS)
1061 ## Remember passphrases for limited periods of time.
1062 bin_PROGRAMS += pixie
1063 pixie_SOURCES = pixie.c
1064 pixie_LDADD = libcatacomb.la
1065 dist_man_MANS += pixie.1
1066 EXTRA_DIST += xpixie
1068 ## Generate random data.
1069 bin_PROGRAMS += rspit
1070 rspit_LDADD = $(UTILS_LIBS)
1072 ###--------------------------------------------------------------------------
1075 SUFFIXES += .c .$t .to
1077 $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@
1078 .to.$t: libcatacomb.la
1079 $(AM_V_CCLD)$(LINK) $< libcatacomb.la $(LIBS)
1081 CLEANFILES += *.to *.$t
1083 ###--------------------------------------------------------------------------
1084 ### The pkg-config file.
1086 pkgconfigdir = $(libdir)/pkgconfig
1087 pkgconfig_DATA = catacomb.pc
1088 EXTRA_DIST += catacomb.pc.in
1089 CLEANFILES += catacomb.pc
1091 catacomb.pc: catacomb.pc.in Makefile
1092 $(SUBST) $(srcdir)/catacomb.pc.in >$@.new $(SUBSTITUTIONS) && \
1095 ###--------------------------------------------------------------------------
1096 ### Release tweaking.
1100 echo $(VERSION) >$(distdir)/RELEASE
1102 ## Additional build tools.
1103 EXTRA_DIST += auto-version
1105 ###--------------------------------------------------------------------------
1109 EXTRA_DIST += debian/rules
1110 EXTRA_DIST += debian/control
1111 EXTRA_DIST += debian/changelog
1112 EXTRA_DIST += debian/copyright
1115 EXTRA_DIST += debian/catacomb-bin.prerm
1116 EXTRA_DIST += debian/catacomb-bin.postinst
1117 EXTRA_DIST += debian/catacomb-bin.config
1118 EXTRA_DIST += debian/catacomb-bin.templates
1120 ###----- That's all, folks --------------------------------------------------