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_mktab_CPPFLAGS = $(AM_CPPFLAGS) -DQUIET
516 blowfish-tab.h: blowfish-mktab$e
517 $(AM_V_GEN)./blowfish-mktab >blowfish-tab.h.new && \
518 mv blowfish-tab.h.new blowfish-tab.h
520 ## Adams and Tavares' `CAST' block ciphers.
521 BLKCS += cast128 cast256
522 libcatacomb_la_SOURCES += cast-s.c cast-sk.c cast-base.h cast-tab.h
523 cast256.$t: tests/cast256
524 EXTRA_DIST += tests/cast256.aes
525 MAINTAINERCLEANFILES += $(srcdir)/tests/cast256
526 tests/cast256: tests/cast256.aes
527 $(AM_V_GEN)$(srcdir)/tests/aes-trans CAST256 \
528 <$(srcdir)/tests/cast256.aes \
529 >$(srcdir)/tests/cast256.new && \
530 mv $(srcdir)/tests/cast256.new $(srcdir)/tests/cast256
532 ## IBM's `DES' block cipher, by Feistel, Coppersmith, and others.
534 libcatacomb_la_SOURCES += des-base.h des-base.c desx-tab.h
535 des-base.lo: des-tab.h
536 CLEANFILES += des-tab.h
537 noinst_PROGRAMS += des-mktab
538 des-tab.h: des-mktab$e
539 $(AM_V_GEN)./des-mktab >des-tab.h.new && \
540 mv des-tab.h.new des-tab.h
542 ## Rivest's `DESX' variant, with pre- and post-whitening.
544 libcatacomb_la_SOURCES += desx-tab.h
546 ## Lai and Massey's IDEA.
549 ## IBM's `MARS' block cipher.
552 CLEANFILES += mars-tab.h
553 noinst_PROGRAMS += mars-mktab
554 mars-tab.h: mars-mktab$e
555 $(AM_V_GEN)./mars-mktab >mars-tab.h.new && \
556 mv mars-tab.h.new mars-tab.h
558 EXTRA_DIST += tests/mars.aes
559 MAINTAINERCLEANFILES += $(srcdir)/tests/mars
560 tests/mars: tests/mars.aes
561 $(AM_V_GEN)$(srcdir)/tests/aes-trans Mars \
562 <$(srcdir)/tests/mars.aes \
563 >$(srcdir)/tests/mars.new && \
564 mv $(srcdir)/tests/mars.new $(srcdir)/tests/mars
566 ## Daemen, Peeters, Van Assche and Rijmen's `Noekeon'.
569 ## Rivest's `RC2' block cipher.
571 libcatacomb_la_SOURCES += rc2-tab.h
576 ## Daemen and Rijmen's `Rijndael' block cipher, selected as AES.
577 BLKCS += rijndael rijndael192 rijndael256
578 libcatacomb_la_SOURCES += rijndael-base.h rijndael-base.c
579 rijndael-base.lo: rijndael-tab.h
580 CLEANFILES += rijndael-tab.h
581 noinst_PROGRAMS += rijndael-mktab
582 rijndael-tab.h: rijndael-mktab$e
583 $(AM_V_GEN)./rijndael-mktab >rijndael-tab.h.new && \
584 mv rijndael-tab.h.new rijndael-tab.h
585 rijndael.$t: tests/rijndael
586 EXTRA_DIST += tests/rijndael.aes
587 MAINTAINERCLEANFILES += $(srcdir)/tests/rijndael
588 tests/rijndael: tests/rijndael.aes
589 $(AM_V_GEN)$(srcdir)/tests/aes-trans Rijndael \
590 <$(srcdir)/tests/rijndael.aes \
591 >$(srcdir)/tests/rijndael.new && \
592 mv $(srcdir)/tests/rijndael.new $(srcdir)/tests/rijndael
594 ## Massey's `SAFER' block ciphers.
595 BLKCS += safer safersk
596 safer.lo: safer-tab.h
597 CLEANFILES += safer-tab.h
598 noinst_PROGRAMS += safer-mktab
599 safer-tab.h: safer-mktab$e
600 $(AM_V_GEN)./safer-mktab >safer-tab.h.new && \
601 mv safer-tab.h.new safer-tab.h
603 ## Anderson, Biham and Knudsen's `Serpent' block cipher.
605 libcatacomb_la_SOURCES += serpent-sbox.h
606 noinst_PROGRAMS += serpent-check
607 TESTS += serpent-check
608 serpent.$t: tests/serpent
609 EXTRA_DIST += tests/serpent.aes
610 MAINTAINERCLEANFILES += $(srcdir)/tests/serpent
611 tests/serpent: tests/serpent.aes
612 $(AM_V_GEN)$(srcdir)/tests/aes-trans Serpent -v rev=1 \
613 <$(srcdir)/tests/serpent.aes \
614 >$(srcdir)/tests/serpent.new && \
615 mv $(srcdir)/tests/serpent.new $(srcdir)/tests/serpent
617 ## The National Security Agency's `Skipjack' block cipher. You don't want to
620 libcatacomb_la_SOURCES += skipjack-tab.h
622 ## Daemen and Rijmen's `Square' block cipher.
624 square.lo: square-tab.h
625 CLEANFILES += square-tab.h
626 noinst_PROGRAMS += square-mktab
627 square-tab.h: square-mktab$e
628 $(AM_V_GEN)./square-mktab >square-tab.h.new && \
629 mv square-tab.h.new square-tab.h
631 ## Wheeler and Needham's `TEA' and `XTEA' block ciphers.
634 ## Schneier, Kelsey, Whiting, Wagner, Hall and Ferguson's `Twofish' block
637 twofish.lo: twofish-tab.h
638 CLEANFILES += twofish-tab.h
639 noinst_PROGRAMS += twofish-mktab
640 twofish-tab.h: twofish-mktab$e
641 $(AM_V_GEN)./twofish-mktab >twofish-tab.h.new && \
642 mv twofish-tab.h.new twofish-tab.h
643 twofish.$t: tests/twofish
644 EXTRA_DIST += tests/twofish.aes
645 MAINTAINERCLEANFILES += $(srcdir)/tests/twofish
646 tests/twofish: tests/twofish.aes
647 $(AM_V_GEN)$(srcdir)/tests/aes-trans Twofish \
648 <$(srcdir)/tests/twofish.aes \
649 >$(srcdir)/tests/twofish.new && \
650 mv $(srcdir)/tests/twofish.new $(srcdir)/tests/twofish
652 ## The old NIST modes for DES.
653 BLKCCIPHERMODES += cbc cfb ecb ofb
656 BLKCCIPHERMODES += counter
658 ###--------------------------------------------------------------------------
665 HASHMODES += $(HASHCIPHERMODES)
668 HASHMODES += $(HASHMACMODES)
670 ## Common definitions for hash functions.
671 pkginclude_HEADERS += hash.h
673 ## Source code and headers for the hash functions.
674 libcatacomb_la_SOURCES += $(HASH_C)
675 pkginclude_HEADERS += $(HASH_H)
677 ## Lim and KISA's `HAS-160', recommended for use with KCDSA.
680 ## Rivest's `MD' series of hash functions
681 HASHES += md2 md4 md5
682 libcatacomb_la_SOURCES += md2-tab.h
684 ## Dobbertin, Bosselaers and Preneel's `RIPEMD' suite.
685 HASHES += rmd128 rmd160 rmd256 rmd320
687 ## The National Security Agency's `SHA-1' hash function.
690 ## The National Security Agency's `SHA-2' suite.
691 HASHES += sha224 sha256
692 HASHES += sha384 sha512
694 ## Anderson and Biham's `Tiger' hash function.
696 libcatacomb_la_SOURCES += tiger-base.h
697 tiger.lo: tiger-tab.h
698 CLEANFILES += tiger-tab.h
699 noinst_PROGRAMS += tiger-mktab
700 tiger-tab.h: tiger-mktab$e
701 $(AM_V_GEN)./tiger-mktab >tiger-tab.h.new && \
702 mv tiger-tab.h.new tiger-tab.h
704 ## Barreto and Rijmen's `Whirlpool' hash function.
705 HASHES += whirlpool whirlpool256
706 whirlpool.lo: whirlpool-tab.h
707 CLEANFILES += whirlpool-tab.h
708 noinst_PROGRAMS += whirlpool-mktab
709 whirlpool-tab.h: whirlpool-mktab$e
710 $(AM_V_GEN)./whirlpool-mktab >whirlpool-tab.h.new && \
711 mv whirlpool-tab.h.new whirlpool-tab.h
713 ## Bellare, Canetti and Krawczyk's `HMAC' mode for message authentication.
716 ## MGF1, used in OAEP and PSS.
717 HASHCIPHERMODES += mgf
719 ###--------------------------------------------------------------------------
720 ### Other symmetric primitives.
722 ## The CRC32 algorithm, which is useful, but has no worthwhile security.
723 pkginclude_HEADERS += crc32.h
724 libcatacomb_la_SOURCES += crc32.c
725 ALL_HASHES += crc32=gcrc32
727 ## Rivest's `RC4' stream cipher.
728 pkginclude_HEADERS += rc4.h
729 libcatacomb_la_SOURCES += rc4.c
731 EXTRA_DIST += tests/rc4
734 ## Coppersmith and Rogaway's `SEAL' pseudorandom function.
735 pkginclude_HEADERS += seal.h
736 libcatacomb_la_SOURCES += seal.c
738 EXTRA_DIST += tests/seal
740 ###--------------------------------------------------------------------------
741 ### Autogenerated mode implementations.
743 ## The master stamp file, indicating that we generated all of the sources.
744 CLEANFILES += modes-gen-stamp
745 EXTRA_DIST += mode.h.in mode.c.in
747 $(AM_V_at)touch modes-gen-stamp
748 $(AM_V_GEN)$(multigen) -g $(srcdir)/mode.c.in \
750 base="$(BLKCS)" mode="$(BLKCMODES)"
751 $(AM_V_at)$(multigen) -g $(srcdir)/mode.c.in \
753 base="$(HASHES)" mode="$(HASHMODES)"
754 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
756 base="$(BLKCS)" mode="$(BLKCMODES)"
757 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
759 base="$(HASHES)" mode="$(HASHMODES)"
760 $(AM_V_at)touch modes-gen-stamp
762 ## The individual mode interfaces and implementations.
763 pkginclude_HEADERS += $(MODE_H)
765 ## Generated implementations.
766 BUILT_SOURCES += $(GENMODES_C)
767 CLEANFILES += $(GENMODES_C)
768 nodist_libcatacomb_la_SOURCES += $(GENMODES_C)
769 $(GENMODES_C): modes-gen-stamp
771 ## Generated interfaces.
772 BUILT_SOURCES += $(GENMODES_H)
773 CLEANFILES += $(GENMODES_H)
774 nodist_pkginclude_HEADERS += $(GENMODES_H)
775 $(GENMODES_H): modes-gen-stamp
777 ###--------------------------------------------------------------------------
778 ### Tables of classes for encryption, hashing, and message authentication.
780 ## The skeleton for the class tables.
781 EXTRA_DIST += gthingtab.c.in
783 ## Table of cipher classes.
784 pkginclude_HEADERS += gcipher.h
785 CLEANFILES += gciphertab.c
786 nodist_libcatacomb_la_SOURCES += gciphertab.c
787 gciphertab.c: gthingtab.c.in
788 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gciphertab.c \
789 what=gcipher cls=gccipher thing="$(ALL_CIPHERS)"
791 ## Table of hash classes.
792 pkginclude_HEADERS += ghash.h ghash-def.h
793 CLEANFILES += ghashtab.c
794 nodist_libcatacomb_la_SOURCES += ghashtab.c
795 ghashtab.c: gthingtab.c.in
796 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in ghashtab.c \
797 what=ghash cls=gchash thing="$(ALL_HASHES)"
799 ## Table of MAC classes.
800 pkginclude_HEADERS += gmac.h
801 CLEANFILES += gmactab.c
802 nodist_libcatacomb_la_SOURCES += gmactab.c
803 gmactab.c: gthingtab.c.in
804 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gmactab.c \
805 what=gmac cls=gcmac thing="$(ALL_MACS)"
807 ###--------------------------------------------------------------------------
808 ### Testing for symmetric crypto things.
810 ## Run the test programs.
811 TESTS += $(SYMM_TESTS)
812 EXTRA_DIST += $(SYMM_TEST_FILES)
814 ## A piece of sample text for round-trip testing encryption modes.
815 EXTRA_DIST += daftstory.h
817 ###--------------------------------------------------------------------------
820 ## Assistance for elliptic-curve keys.
821 pkginclude_HEADERS += ec-keys.h
822 libcatacomb_la_SOURCES += ec-fetch.c
824 ## Managing keys and keyring files.
825 pkginclude_HEADERS += key.h
826 libcatacomb_la_SOURCES += key-attr.c
827 libcatacomb_la_SOURCES += key-fetch.c
828 libcatacomb_la_SOURCES += key-file.c
829 libcatacomb_la_SOURCES += key-io.c
830 libcatacomb_la_SOURCES += key-misc.c
831 libcatacomb_la_SOURCES += key-moan.c
833 ## Managing key data.
834 pkginclude_HEADERS += key-data.h
835 libcatacomb_la_SOURCES += key-binary.c
836 libcatacomb_la_SOURCES += key-data.c
837 libcatacomb_la_SOURCES += key-flags.c
838 libcatacomb_la_SOURCES += key-pack.c
839 libcatacomb_la_SOURCES += key-pass.c
840 libcatacomb_la_SOURCES += key-text.c
843 pkginclude_HEADERS += key-error.h
844 libcatacomb_la_SOURCES += key-error.c
846 ## Reading passphrases.
847 pkginclude_HEADERS += passphrase.h
848 libcatacomb_la_SOURCES += passphrase.c
850 ## Interfacing with the passphrase pixie.
851 pkginclude_HEADERS += pixie.h
852 libcatacomb_la_SOURCES += pixie-common.c
854 ###--------------------------------------------------------------------------
857 ## Efficient sharing over GF(2^8).
858 pkginclude_HEADERS += gfshare.h
859 libcatacomb_la_SOURCES += gfshare.c
860 gfshare.lo: gfshare-tab.h
861 CLEANFILES += gfshare-tab.h
862 noinst_PROGRAMS += gfshare-mktab
863 gfshare-tab.h: gfshare-mktab$e
864 $(AM_V_GEN)./gfshare-mktab >gfshare-tab.h.new && \
865 mv gfshare-tab.h.new gfshare-tab.h
868 ## Number-theoretic sharing over GF(p).
869 pkginclude_HEADERS += share.h
870 libcatacomb_la_SOURCES += share.c
873 ###--------------------------------------------------------------------------
874 ### Public-key cryptography.
876 ## The Blum--Blum--Shub random-bit generator.
877 pkginclude_HEADERS += bbs.h
878 libcatacomb_la_SOURCES += bbs-fetch.c
879 libcatacomb_la_SOURCES += bbs-gen.c
880 libcatacomb_la_SOURCES += bbs-jump.c
882 libcatacomb_la_SOURCES += bbs-rand.c
884 EXTRA_DIST += tests/bbs
886 ## Plain Diffie--Hellman, in Schorr groups.
887 pkginclude_HEADERS += dh.h
888 libcatacomb_la_SOURCES += dh-check.c
889 libcatacomb_la_SOURCES += dh-fetch.c
890 libcatacomb_la_SOURCES += dh-gen.c
891 libcatacomb_la_SOURCES += dh-kcdsa.c
892 libcatacomb_la_SOURCES += dh-limlee.c
893 libcatacomb_la_SOURCES += dh-param.c
896 ## The National Security Agency's Digital Signature Algorithm.
897 pkginclude_HEADERS += dsa.h
898 libcatacomb_la_SOURCES += dsa-gen.c
900 libcatacomb_la_SOURCES += dsa-misc.c
901 libcatacomb_la_SOURCES += dsa-sign.c
903 libcatacomb_la_SOURCES += dsa-verify.c
904 TESTS += dsa-verify.$t
905 libcatacomb_la_SOURCES += dsa-check.c
906 EXTRA_DIST += tests/dsa
908 ## Generalization of DSA to arbitrary cyclic groups.
909 pkginclude_HEADERS += gdsa.h
910 libcatacomb_la_SOURCES += gdsa.c
912 EXTRA_DIST += tests/gdsa
914 ## KISA `KCDSA', generalized to arbitrary cyclic groups.
915 pkginclude_HEADERS += gkcdsa.h
916 libcatacomb_la_SOURCES += gkcdsa.c
918 EXTRA_DIST += tests/gkcdsa
920 ## General key validity checking machinery.
921 pkginclude_HEADERS += keycheck.h
922 libcatacomb_la_SOURCES += keycheck.c
923 libcatacomb_la_SOURCES += keycheck-mp.c
924 libcatacomb_la_SOURCES += keycheck-report.c
926 ## The Rivest--Shamir--Adleman trapdoor one-way function.
927 pkginclude_HEADERS += rsa.h
928 libcatacomb_la_SOURCES += rsa-fetch.c
929 libcatacomb_la_SOURCES += rsa-gen.c
930 libcatacomb_la_SOURCES += rsa-priv.c
931 libcatacomb_la_SOURCES += rsa-pub.c
932 libcatacomb_la_SOURCES += rsa-recover.c
933 libcatacomb_la_SOURCES += oaep.c
934 libcatacomb_la_SOURCES += pkcs1.c
935 libcatacomb_la_SOURCES += pss.c
936 EXTRA_DIST += rsa-test.c
938 EXTRA_DIST += tests/rsa
940 ###--------------------------------------------------------------------------
941 ### Random number generators.
943 ## The FIPS186 generator used to generate DSA domain parameters.
944 pkginclude_HEADERS += dsarand.h
945 libcatacomb_la_SOURCES += dsarand.c
947 ## Knuth's lagged-Fibonacci generator.
948 pkginclude_HEADERS += fibrand.h
949 libcatacomb_la_SOURCES += fibrand.c
951 ## The FIPS 140--2 random number generator tests.
952 pkginclude_HEADERS += fipstest.h
953 libcatacomb_la_SOURCES += fipstest.c
955 ## Interface for generic random number sources.
956 pkginclude_HEADERS += grand.h
957 libcatacomb_la_SOURCES += grand.c
959 ## A simple linear-congruential generator.
960 pkginclude_HEADERS += lcrand.h
961 libcatacomb_la_SOURCES += lcrand.c
963 EXTRA_DIST += tests/lcrand
965 ## Maurer's universal statistical test.
966 pkginclude_HEADERS += maurer.h
967 libcatacomb_la_SOURCES += maurer.c
969 ## System-specific noise acquisition.
970 pkginclude_HEADERS += noise.h
971 libcatacomb_la_SOURCES += noise.c
973 ## Cryptographic laundering for true random data generation.
974 pkginclude_HEADERS += rand.h
975 libcatacomb_la_SOURCES += rand.c
977 ## The SSL v3 pseudorandom function.
978 pkginclude_HEADERS += sslprf.h
979 libcatacomb_la_SOURCES += sslprf.c
981 EXTRA_DIST += tests/sslprf
983 ## The TLS v1 pseudorandom function.
984 pkginclude_HEADERS += tlsprf.h
985 libcatacomb_la_SOURCES += tlsprf.c
987 EXTRA_DIST += tests/tlsprf
989 ###--------------------------------------------------------------------------
990 ### The `catcrypt' library.
992 noinst_LTLIBRARIES += libcatcrypt.la
993 libcatcrypt_la_SOURCES =
996 libcatcrypt_la_SOURCES += cc.h
997 libcatcrypt_la_SOURCES += cc-enc.c
998 libcatcrypt_la_SOURCES += cc-hash.c
999 libcatcrypt_la_SOURCES += cc-kem.c
1000 libcatcrypt_la_SOURCES += cc-list.c
1001 libcatcrypt_la_SOURCES += cc-progress.c
1002 libcatcrypt_la_SOURCES += cc-sig.c
1003 libcatcrypt_la_SOURCES += cc-subcmd.c
1006 libcatcrypt_la_SOURCES += getdate.h
1007 libcatcrypt_la_SOURCES += getdate.y
1009 ###--------------------------------------------------------------------------
1010 ### Utility programs.
1012 UTILS_LIBS = libcatcrypt.la libcatacomb.la $(LIBS)
1014 ## Generate and verify datestamped cookies.
1015 bin_PROGRAMS += cookie
1016 cookie_LDADD = $(UTILS_LIBS)
1017 dist_man_MANS += cookie.1
1019 ## Asymmetric message encryption and decryption with deniable authentication.
1020 bin_PROGRAMS += catcrypt
1021 catcrypt_LDADD = $(UTILS_LIBS)
1022 dist_man_MANS += catcrypt.1
1024 ## Signing and verifying files.
1025 bin_PROGRAMS += catsign
1026 catsign_LDADD = $(UTILS_LIBS)
1027 dist_man_MANS += catsign.1
1029 ## Issue and verify signatures on directory trees.
1030 bin_PROGRAMS += dsig
1031 dsig_LDADD = $(UTILS_LIBS)
1032 dist_man_MANS += dsig.1
1034 ## Compute factorials to arbitrary precision.
1035 bin_PROGRAMS += factorial
1036 factorial_LDADD = $(UTILS_LIBS)
1038 ## Compute Fibonacci numbers to arbitrary precision.
1039 bin_PROGRAMS += fibonacci
1040 fibonacci_LDADD = $(UTILS_LIBS)
1042 ## Compute hashes of files.
1043 bin_PROGRAMS += hashsum
1044 hashsum_LDADD = $(UTILS_LIBS)
1045 dist_man_MANS += hashsum.1
1047 ## Key management utility.
1049 key_SOURCES = keyutil.c
1050 key_LDADD = $(UTILS_LIBS)
1051 dist_man_MANS += key.1 keyring.5
1053 ## Generate passphrases with given entropy using wordlists and Markov models.
1054 bin_PROGRAMS += mkphrase
1055 mkphrase_LDADD = $(UTILS_LIBS)
1056 dist_man_MANS += mkphrase.1
1058 ## Performance testing.
1059 bin_PROGRAMS += perftest
1060 perftest_LDADD = $(UTILS_LIBS)
1062 ## Remember passphrases for limited periods of time.
1063 bin_PROGRAMS += pixie
1064 pixie_SOURCES = pixie.c
1065 pixie_LDADD = libcatacomb.la
1066 dist_man_MANS += pixie.1
1067 EXTRA_DIST += xpixie
1069 ## Generate random data.
1070 bin_PROGRAMS += rspit
1071 rspit_LDADD = $(UTILS_LIBS)
1073 ###--------------------------------------------------------------------------
1076 SUFFIXES += .c .$t .to
1078 $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@
1079 .to.$t: libcatacomb.la
1080 $(AM_V_CCLD)$(LINK) $< libcatacomb.la $(LIBS)
1082 CLEANFILES += *.to *.$t
1084 ###--------------------------------------------------------------------------
1085 ### The pkg-config file.
1087 pkgconfigdir = $(libdir)/pkgconfig
1088 pkgconfig_DATA = catacomb.pc
1089 EXTRA_DIST += catacomb.pc.in
1090 CLEANFILES += catacomb.pc
1092 catacomb.pc: catacomb.pc.in Makefile
1093 $(SUBST) $(srcdir)/catacomb.pc.in >$@.new $(SUBSTITUTIONS) && \
1096 ###--------------------------------------------------------------------------
1097 ### Release tweaking.
1101 echo $(VERSION) >$(distdir)/RELEASE
1103 ## Additional build tools.
1104 EXTRA_DIST += auto-version
1106 ###--------------------------------------------------------------------------
1110 EXTRA_DIST += debian/rules
1111 EXTRA_DIST += debian/control
1112 EXTRA_DIST += debian/changelog
1113 EXTRA_DIST += debian/copyright
1116 EXTRA_DIST += debian/catacomb-bin.prerm
1117 EXTRA_DIST += debian/catacomb-bin.postinst
1118 EXTRA_DIST += debian/catacomb-bin.config
1119 EXTRA_DIST += debian/catacomb-bin.templates
1121 ###----- That's all, folks --------------------------------------------------