### -*-makefile-*- ### ### Build script for Catacomb ### ### (c) 2013 Straylight/Edgeware ### ###----- Licensing notice --------------------------------------------------- ### ### This file is part of Catacomb. ### ### Catacomb is free software; you can redistribute it and/or modify ### it under the terms of the GNU Library General Public License as ### published by the Free Software Foundation; either version 2 of the ### License, or (at your option) any later version. ### ### Catacomb is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU Library General Public License for more details. ### ### You should have received a copy of the GNU Library General Public ### License along with Catacomb; if not, write to the Free ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ### MA 02111-1307, USA. ###-------------------------------------------------------------------------- ### Miscellaneous useful definitions. ## Some convenient abbreviations for file suffixes. e = $(EXEEXT) o = $(OBJEXT) t = t$e ## Installation directories. archincludedir = $(pkglibdir)/include ###-------------------------------------------------------------------------- ### Initial values of common variables. SUBDIRS = EXTRA_DIST = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = SUFFIXES = TESTS = BUILT_SOURCES = bin_PROGRAMS = noinst_PROGRAMS = lib_LTLIBRARIES = noinst_LTLIBRARIES = pkginclude_HEADERS = nodist_pkginclude_HEADERS = archinclude_HEADERS = nodist_archinclude_HEADERS = dist_man_MANS = ###-------------------------------------------------------------------------- ### Standard configuration substitutions. ## Substitute tags in files. confsubst = $(top_srcdir)/config/confsubst EXTRA_DIST += config/confsubst SUBSTITUTIONS = \ prefix=$(prefix) exec_prefix=$(exec_prefix) \ libdir=$(libdir) includedir=$(includedir) \ PACKAGE=$(PACKAGE) VERSION=$(VERSION) \ CATACOMB_LIBS="$(CATACOMB_LIBS)" V_SUBST = $(V_SUBST_$(V)) V_SUBST_ = $(V_SUBST_$(AM_DEFAULT_VERBOSITY)) V_SUBST_0 = @echo " SUBST $@"; SUBST = $(V_SUBST)$(confsubst) ###-------------------------------------------------------------------------- ### The main library. lib_LTLIBRARIES += libcatacomb.la libcatacomb_la_LIBADD = $(CATACOMB_LIBS) $(mLib_LIBS) libcatacomb_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO) libcatacomb_la_SOURCES = nodist_libcatacomb_la_SOURCES = ###-------------------------------------------------------------------------- ### Basic utilities. ## The locked-memory arena. pkginclude_HEADERS += arena.h libcatacomb_la_SOURCES += arena.c ## Constant-type operations. pkginclude_HEADERS += ct.h libcatacomb_la_SOURCES += ct.c ## Acceptable key-size descriptions. pkginclude_HEADERS += keysz.h libcatacomb_la_SOURCES += keysz.c keysz-conv.c ## System-level memory locking. pkginclude_HEADERS += lmem.h libcatacomb_la_SOURCES += lmem.c ## Clearing secrets from memory. pkginclude_HEADERS += paranoia.h ###-------------------------------------------------------------------------- ### Main multiprecision integer library. ## This library is unfortunately intertwined with some of the code generation ## programs, so we must be rather careful. The important bits of the maths ## library needed by these programs is separated out into `libmpbase'. There ## is work going on to fix this unpleasant situation by generating the ## relevant files from Python scripts rather than C programs, using ## information gathered by `configure'. noinst_LTLIBRARIES += libmpbase.la libcatacomb_la_LIBADD += libmpbase.la libmpbase_la_LIBADD = $(mLib_LIBS) libmpbase_la_SOURCES = $(libmpbase_la_OBJECTS): mptypes.h ## Additional buffer I/O functions for mathematical objects. pkginclude_HEADERS += buf.h libcatacomb_la_SOURCES += buf.c ## Infrastructure for fast exponentiation. pkginclude_HEADERS += exp.h libcatacomb_la_SOURCES += exp.c ## Main user-visible multiprecision arithmetic. pkginclude_HEADERS += mp.h libmpbase_la_SOURCES += mp-arith.c TESTS += mp-arith.$t libmpbase_la_SOURCES += mp-const.c libcatacomb_la_SOURCES += mp-exp.c mp-exp.h libcatacomb_la_SOURCES += mp-gcd.c TESTS += mp-gcd.$t libmpbase_la_SOURCES += mp-io.c libcatacomb_la_SOURCES += mp-jacobi.c TESTS += mp-jacobi.$t libmpbase_la_SOURCES += mp-mem.c libmpbase_la_SOURCES += mp-misc.c libcatacomb_la_SOURCES += mp-modexp.c TESTS += mp-modexp.$t libcatacomb_la_SOURCES += mp-modsqrt.c TESTS += mp-modsqrt.$t libcatacomb_la_SOURCES += mp-sqrt.c TESTS += mp-sqrt.$t libcatacomb_la_SOURCES += mp-test.c EXTRA_DIST += tests/mp ## Computing Fibonacci numbers. pkginclude_HEADERS += mp-fibonacci.h libcatacomb_la_SOURCES += mp-fibonacci.c TESTS += mp-fibonacci.$t ## Special memory allocation for multiprecision integers. pkginclude_HEADERS += mparena.h libmpbase_la_SOURCES += mparena.c ## Barrett reduction, an efficient method for modular reduction. pkginclude_HEADERS += mpbarrett.h libcatacomb_la_SOURCES += mpbarrett.c TESTS += mpbarrett.$t libcatacomb_la_SOURCES += mpbarrett-exp.c mpbarrett-mexp.c mpbarrett-exp.h TESTS += mpbarrett-exp.$t mpbarrett-mexp.$t EXTRA_DIST += tests/mpbarrett ## Solving congruences using the Chinese Remainder Theorem. pkginclude_HEADERS += mpcrt.h libcatacomb_la_SOURCES += mpcrt.c TESTS += mpcrt.$t EXTRA_DIST += tests/mpcrt ## Conversions between machine-native and multiprecision integers. pkginclude_HEADERS += mpint.h libcatacomb_la_SOURCES += mpint.c TESTS += mpint.$t EXTRA_DIST += tests/mpint ## Table of upper and lower limits of various types of machine integers, as ## multiprecision integers. nodist_archinclude_HEADERS += mplimits.h nodist_libcatacomb_la_SOURCES += mplimits.c CLEANFILES += mplimits.h mplimits.c noinst_PROGRAMS += genlimits genlimits_LDADD = libmpbase.la mplimits.c: genlimits$e $(AM_V_GEN)./genlimits c >mplimits.c.new && \ mv mplimits.c.new mplimits.c mplimits.h: genlimits$e $(AM_V_GEN)./genlimits h >mplimits.h.new && \ mv mplimits.h.new mplimits.h $(genlimits_OBJECTS): mptypes.h mplimits.lo: mplimits.h ## Montgomery reduction, a clever method for modular arithmetic. pkginclude_HEADERS += mpmont.h libcatacomb_la_SOURCES += mpmont.c TESTS += mpmont.$t libcatacomb_la_SOURCES += mpmont-exp.c mpmont-mexp.c mpmont-exp.h TESTS += mpmont-exp.$t mpmont-mexp.$t EXTRA_DIST += tests/mpmont ## Efficient multiplication of many small numbers. pkginclude_HEADERS += mpmul.h libcatacomb_la_SOURCES += mpmul.c TESTS += mpmul.$t ## Generating random numbers. pkginclude_HEADERS += mprand.h libcatacomb_la_SOURCES += mprand.c ## Efficient reduction modulo numbers with conveninent binary ## representations. pkginclude_HEADERS += mpreduce.h libcatacomb_la_SOURCES += mpreduce.c mpreduce-exp.h TESTS += mpreduce.$t EXTRA_DIST += tests/mpreduce ## Iteratiion over the bianry representation of multiprecision integers. pkginclude_HEADERS += mpscan.h libmpbase_la_SOURCES += mpscan.c ## Conversion between multiprecision integers and their textual ## representations. pkginclude_HEADERS += mptext.h libmpbase_la_SOURCES += mptext.c TESTS += mptext.$t libcatacomb_la_SOURCES += mptext-dstr.c libcatacomb_la_SOURCES += mptext-file.c libcatacomb_la_SOURCES += mptext-len.c libmpbase_la_SOURCES += mptext-string.c EXTRA_DIST += tests/mptext ## Basic types used in the representation of multiprecision integers. nodist_archinclude_HEADERS += mptypes.h BUILT_SOURCES += mptypes.h CLEANFILES += mptypes.h noinst_PROGRAMS += mptypes mptypes.h: mptypes$e $(AM_V_GEN)./mptypes >mptypes.h.new && mv mptypes.h.new mptypes.h ## Low-level multiprecision arithmetic. pkginclude_HEADERS += mpx.h bitops.h mpw.h libmpbase_la_SOURCES += mpx.c TESTS += mpx.$t libmpbase_la_SOURCES += karatsuba.h mpx-kmul.c mpx-ksqr.c TESTS += mpx-kmul.$t mpx-ksqr.$t noinst_PROGRAMS += bittest TESTS += bittest EXTRA_DIST += tests/mpx ## A quick-and-dirty parser, used for parsing descriptions of groups, fields, ## etc. pkginclude_HEADERS += rho.h libcatacomb_la_SOURCES += rho.c TESTS += rho.$t ## Pollard's `rho' algorithm for determining discrete logarithms. pkginclude_HEADERS += qdparse.h libcatacomb_la_SOURCES += qdparse.c ###-------------------------------------------------------------------------- ### Prime number checking, searching, and related jobs. ## Generating Lim--Lee groups, i.e., unit groups of finite fields without ## small subgroups (except for the obvious ones). pkginclude_HEADERS += limlee.h libcatacomb_la_SOURCES += limlee.c ## A table of small prime numbers. nodist_pkginclude_HEADERS += primetab.h nodist_libcatacomb_la_SOURCES += primetab.c CLEANFILES += primetab.h primetab.c BUILT_SOURCES += primetab.h primetab.c noinst_PROGRAMS += genprimes genprimes_LDADD = $(mLib_LIBS) primetab.h: primetab.c primetab.c: genprimes$e $(AM_V_GEN)./genprimes -hprimetab.h -cprimetab.c \ -sCATACOMB_PRIMETAB_H \ -n256 -t"unsigned short" -iprimetab ## Filtering candidate prime numbers by checking for small factors ## efficiently. pkginclude_HEADERS += pfilt.h libcatacomb_la_SOURCES += pfilt.c ## Generating prime numbers (and other kinds of numbers which need searching ## for). pkginclude_HEADERS += pgen.h libcatacomb_la_SOURCES += pgen.c libcatacomb_la_SOURCES += pgen-gcd.c libcatacomb_la_SOURCES += pgen-simul.c libcatacomb_la_SOURCES += pgen-stdev.c TESTS += pgen.$t EXTRA_DIST += tests/pgen ## Finding primitive elements in finite fields. pkginclude_HEADERS += prim.h libcatacomb_la_SOURCES += prim.c ## Iterating over all prime numbers from a given starting point. pkginclude_HEADERS += primeiter.h libcatacomb_la_SOURCES += primeiter.c TESTS += primeiter.$t primeiter.lo: wheel.h ## The Miller--Rabin primality test. pkginclude_HEADERS += rabin.h libcatacomb_la_SOURCES += rabin.c ## Finding `strong' primes, using Gordon's algorithm. Once upon a time, ## products of these kinds of numbers were harder to factor. pkginclude_HEADERS += strongprime.h libcatacomb_la_SOURCES += strongprime.c ## A `wheel', used by the prime iteration machinery. nodist_pkginclude_HEADERS += wheel.h nodist_libcatacomb_la_SOURCES += wheel.c CLEANFILES += wheel.h wheel.c noinst_PROGRAMS += genwheel genwheel_LDADD = $(mLib_LIBS) wheel.h: wheel.c wheel.c: genwheel$e $(AM_V_GEN)./genwheel -hwheel.h -cwheel.c \ -sCATACOMB_WHEEL_H \ -n5 -t"unsigned char" -iwheel ###-------------------------------------------------------------------------- ### Binary polynomial arithmetic. ## User-visible binary polynomial arithmetic. pkginclude_HEADERS += gf.h libcatacomb_la_SOURCES += gf-arith.c TESTS += gf-arith.$t libcatacomb_la_SOURCES += gf-exp.c gf-exp.h libcatacomb_la_SOURCES += gf-gcd.c TESTS += gf-gcd.$t EXTRA_DIST += tests/gf ## Low-level binary polynomial arithmetic. pkginclude_HEADERS += gfx.h libcatacomb_la_SOURCES += gfx.c TESTS += gfx.$t libcatacomb_la_SOURCES += gfx-kmul.c TESTS += gfx-kmul.$t libcatacomb_la_SOURCES += gfx-sqr.c gfx-sqr.lo: gfx-sqr-tab.h TESTS += gfx-sqr.$t CLEANFILES += gfx-sqr-tab.h noinst_PROGRAMS += gfx-sqr-mktab gfx-sqr-tab.h: gfx-sqr-mktab$e $(AM_V_GEN)./gfx-sqr-mktab >gfx-sqr-tab.h.in && \ mv gfx-sqr-tab.h.in gfx-sqr-tab.h EXTRA_DIST += tests/gfx ## Conversions between normal and polynomial basis representations for binary ## fields. pkginclude_HEADERS += gfn.h libcatacomb_la_SOURCES += gfn.c TESTS += gfn.$t EXTRA_DIST += tests/gfn ## Efficient reduction modulo sparse polynomials. pkginclude_HEADERS += gfreduce.h libcatacomb_la_SOURCES += gfreduce.c gfreduce-exp.h TESTS += gfreduce.$t EXTRA_DIST += tests/gfreduce ###-------------------------------------------------------------------------- ### Abstractions for various kinds of algebraic objects. ## Abstract cyclic groups. pkginclude_HEADERS += group.h group-guts.h libcatacomb_la_SOURCES += group-dstr.c libcatacomb_la_SOURCES += group-exp.c group-exp.h libcatacomb_la_SOURCES += group-file.c libcatacomb_la_SOURCES += group-parse.c libcatacomb_la_SOURCES += group-stdops.c libcatacomb_la_SOURCES += group-string.c libcatacomb_la_SOURCES += g-bin.c libcatacomb_la_SOURCES += g-prime.c libcatacomb_la_SOURCES += g-ec.c EXTRA_DIST += group-test.c TESTS += group-test.$t EXTRA_DIST += tests/group ## Abstract finite fields. pkginclude_HEADERS += field.h field-guts.h libcatacomb_la_SOURCES += field.c libcatacomb_la_SOURCES += field-exp.c field-exp.h libcatacomb_la_SOURCES += field-parse.c libcatacomb_la_SOURCES += f-binpoly.c libcatacomb_la_SOURCES += f-niceprime.c libcatacomb_la_SOURCES += f-prime.c ## Table of built-in binary fields. pkginclude_HEADERS += bintab.h libcatacomb_la_SOURCES += bintab.c CLEANFILES += bintab.c EXTRA_DIST += bintab.in bin-gentab.awk bintab.c: bintab.in bin-gentab.awk mpdump$e $(AM_V_GEN)awk -f $(srcdir)/bin-gentab.awk \ <$(srcdir)/bintab.in >bintab.c.new && \ mv bintab.c.new bintab.c ## Table of built-in prime fields. pkginclude_HEADERS += ptab.h libcatacomb_la_SOURCES += ptab.c CLEANFILES += ptab.c EXTRA_DIST += ptab.in p-gentab.awk ptab.c: ptab.in p-gentab.awk mpdump$e $(AM_V_GEN)awk -f $(srcdir)/p-gentab.awk \ <$(srcdir)/ptab.in >ptab.c.new && \ mv ptab.c.new ptab.c ## A utility for building multiprecision integer constants. noinst_PROGRAMS += mpdump mpdump_LDADD = libmpbase.la $(mpdump_OBJECTS): mptypes.h ###-------------------------------------------------------------------------- ### Elliptic curve arithmetic. ## Basic elliptic curve arithmetic. pkginclude_HEADERS += ec.h ec-guts.h libcatacomb_la_SOURCES += ec.c libcatacomb_la_SOURCES += ec-exp.c ec-exp.h libcatacomb_la_SOURCES += ec-info.c TESTS += ec-info.$t libcatacomb_la_SOURCES += ec-bin.c TESTS += ec-bin.$t libcatacomb_la_SOURCES += ec-prime.c TESTS += ec-prime.$t EXTRA_DIST += tests/ec ## The standard `raw' encoding (`EC2OSP') of elliptic curve points. pkginclude_HEADERS += ec-raw.h libcatacomb_la_SOURCES += ec-raw.c ## Test infrastructure for elliptic curves. pkginclude_HEADERS += ec-test.h libcatacomb_la_SOURCES += ec-test.c TESTS += ec-test.$t ## A table of built-in elliptic curves. pkginclude_HEADERS += ectab.h libcatacomb_la_SOURCES += ectab.c CLEANFILES += ectab.c EXTRA_DIST += ectab.in ec-gentab.awk ectab.c: ectab.in ec-gentab.awk mpdump$e $(AM_V_GEN)awk -f $(srcdir)/ec-gentab.awk \ <$(srcdir)/ectab.in >ectab.c.new && \ mv ectab.c.new ectab.c ###-------------------------------------------------------------------------- ### Autogenerated lists. ## Fancy template substitutions. multigen = python $(srcdir)/multigen EXTRA_DIST += multigen ## The heart of this is an enormous cross-product of crypto primitives and ## the corresponding modes of operation. Rather than write it out longhand, ## we generate it using `multigen'. Unfortunately, this needs to be done ## at the Automake level, which causes some interesting bootstrapping ## problems. include modes.am EXTRA_DIST += modes.am.in modes.am MAINTAINERCLEANFILES += $(srcdir)/modes.am ## Generate the lists. $(srcdir)/modes.am: modes.am.in $(AM_V_GEN)$(multigen) -g $(srcdir)/modes.am.in $(srcdir)/modes.am \ blkc="$(BLKCS)" \ blkcmode="$(BLKCMODES)" \ blkcciphermode="$(BLKCCIPHERMODES)" \ hash="$(HASHES)" \ hashmode="$(HASHMODES)" \ hashciphermode="$(HASHCIPHERMODES)" \ hashmacmode="$(HASHMACMODES)" ## Initialize lists of known classes. ALL_CIPHERS = $(CIPHER_MODES) ALL_HASHES = $(HASHES) ALL_MACS = $(MAC_MODES) ###-------------------------------------------------------------------------- ### Block ciphers. BLKCS = BLKCMODES = BLKCCIPHERMODES = BLKCMODES += $(BLKCCIPHERMODES) ## A tool for translating the AES-contest test vectors into a form our test ## rigs understand. EXTRA_DIST += tests/aes-trans ## Block cipher utility macros, mainly used in mode implementations. pkginclude_HEADERS += blkc.h ## Source code and headers for the block ciphers. libcatacomb_la_SOURCES += $(BLKC_C) pkginclude_HEADERS += $(BLKC_H) ## Schneier's `Blowfish' block cipher. BLKCS += blowfish blowfish.lo: blowfish-tab.h CLEANFILES += blowfish-tab.h noinst_PROGRAMS += blowfish-mktab blowfish_mktab_CPPFLAGS = $(AM_CPPFLAGS) -DQUIET blowfish-tab.h: blowfish-mktab$e $(AM_V_GEN)./blowfish-mktab >blowfish-tab.h.new && \ mv blowfish-tab.h.new blowfish-tab.h ## Adams and Tavares' `CAST' block ciphers. BLKCS += cast128 cast256 libcatacomb_la_SOURCES += cast-s.c cast-sk.c cast-base.h cast-tab.h cast256.$t: tests/cast256 EXTRA_DIST += tests/cast256.aes MAINTAINERCLEANFILES += $(srcdir)/tests/cast256 tests/cast256: tests/cast256.aes $(AM_V_GEN)$(srcdir)/tests/aes-trans CAST256 \ <$(srcdir)/tests/cast256.aes \ >$(srcdir)/tests/cast256.new && \ mv $(srcdir)/tests/cast256.new $(srcdir)/tests/cast256 ## IBM's `DES' block cipher, by Feistel, Coppersmith, and others. BLKCS += des des3 libcatacomb_la_SOURCES += des-base.h des-base.c desx-tab.h des-base.lo: des-tab.h CLEANFILES += des-tab.h noinst_PROGRAMS += des-mktab des-tab.h: des-mktab$e $(AM_V_GEN)./des-mktab >des-tab.h.new && \ mv des-tab.h.new des-tab.h ## Rivest's `DESX' variant, with pre- and post-whitening. BLKCS += desx libcatacomb_la_SOURCES += desx-tab.h ## Lai and Massey's IDEA. BLKCS += idea ## IBM's `MARS' block cipher. BLKCS += mars mars.lo: mars-tab.h CLEANFILES += mars-tab.h noinst_PROGRAMS += mars-mktab mars-tab.h: mars-mktab$e $(AM_V_GEN)./mars-mktab >mars-tab.h.new && \ mv mars-tab.h.new mars-tab.h mars.$t: tests/mars EXTRA_DIST += tests/mars.aes MAINTAINERCLEANFILES += $(srcdir)/tests/mars tests/mars: tests/mars.aes $(AM_V_GEN)$(srcdir)/tests/aes-trans Mars \ <$(srcdir)/tests/mars.aes \ >$(srcdir)/tests/mars.new && \ mv $(srcdir)/tests/mars.new $(srcdir)/tests/mars ## Daemen, Peeters, Van Assche and Rijmen's `Noekeon'. BLKCS += noekeon ## Rivest's `RC2' block cipher. BLKCS += rc2 libcatacomb_la_SOURCES += rc2-tab.h ## Rivest's `RC5'. BLKCS += rc5 ## Daemen and Rijmen's `Rijndael' block cipher, selected as AES. BLKCS += rijndael rijndael192 rijndael256 libcatacomb_la_SOURCES += rijndael-base.h rijndael-base.c rijndael-base.lo: rijndael-tab.h CLEANFILES += rijndael-tab.h noinst_PROGRAMS += rijndael-mktab rijndael-tab.h: rijndael-mktab$e $(AM_V_GEN)./rijndael-mktab >rijndael-tab.h.new && \ mv rijndael-tab.h.new rijndael-tab.h rijndael.$t: tests/rijndael EXTRA_DIST += tests/rijndael.aes MAINTAINERCLEANFILES += $(srcdir)/tests/rijndael tests/rijndael: tests/rijndael.aes $(AM_V_GEN)$(srcdir)/tests/aes-trans Rijndael \ <$(srcdir)/tests/rijndael.aes \ >$(srcdir)/tests/rijndael.new && \ mv $(srcdir)/tests/rijndael.new $(srcdir)/tests/rijndael ## Massey's `SAFER' block ciphers. BLKCS += safer safersk safer.lo: safer-tab.h CLEANFILES += safer-tab.h noinst_PROGRAMS += safer-mktab safer-tab.h: safer-mktab$e $(AM_V_GEN)./safer-mktab >safer-tab.h.new && \ mv safer-tab.h.new safer-tab.h ## Anderson, Biham and Knudsen's `Serpent' block cipher. BLKCS += serpent libcatacomb_la_SOURCES += serpent-sbox.h noinst_PROGRAMS += serpent-check TESTS += serpent-check serpent.$t: tests/serpent EXTRA_DIST += tests/serpent.aes MAINTAINERCLEANFILES += $(srcdir)/tests/serpent tests/serpent: tests/serpent.aes $(AM_V_GEN)$(srcdir)/tests/aes-trans Serpent -v rev=1 \ <$(srcdir)/tests/serpent.aes \ >$(srcdir)/tests/serpent.new && \ mv $(srcdir)/tests/serpent.new $(srcdir)/tests/serpent ## The National Security Agency's `Skipjack' block cipher. You don't want to ## use this. BLKCS += skipjack libcatacomb_la_SOURCES += skipjack-tab.h ## Daemen and Rijmen's `Square' block cipher. BLKCS += square square.lo: square-tab.h CLEANFILES += square-tab.h noinst_PROGRAMS += square-mktab square-tab.h: square-mktab$e $(AM_V_GEN)./square-mktab >square-tab.h.new && \ mv square-tab.h.new square-tab.h ## Wheeler and Needham's `TEA' and `XTEA' block ciphers. BLKCS += tea xtea ## Schneier, Kelsey, Whiting, Wagner, Hall and Ferguson's `Twofish' block ## cipher. BLKCS += twofish twofish.lo: twofish-tab.h CLEANFILES += twofish-tab.h noinst_PROGRAMS += twofish-mktab twofish-tab.h: twofish-mktab$e $(AM_V_GEN)./twofish-mktab >twofish-tab.h.new && \ mv twofish-tab.h.new twofish-tab.h twofish.$t: tests/twofish EXTRA_DIST += tests/twofish.aes MAINTAINERCLEANFILES += $(srcdir)/tests/twofish tests/twofish: tests/twofish.aes $(AM_V_GEN)$(srcdir)/tests/aes-trans Twofish \ <$(srcdir)/tests/twofish.aes \ >$(srcdir)/tests/twofish.new && \ mv $(srcdir)/tests/twofish.new $(srcdir)/tests/twofish ## The old NIST modes for DES. BLKCCIPHERMODES += cbc cfb ecb ofb ## Counter mode. BLKCCIPHERMODES += counter ###-------------------------------------------------------------------------- ### Hash functions. HASHES = HASHMODES = HASHCIPHERMODES = HASHMODES += $(HASHCIPHERMODES) HASHMACMODES = HASHMODES += $(HASHMACMODES) ## Common definitions for hash functions. pkginclude_HEADERS += hash.h ## Source code and headers for the hash functions. libcatacomb_la_SOURCES += $(HASH_C) pkginclude_HEADERS += $(HASH_H) ## Lim and KISA's `HAS-160', recommended for use with KCDSA. HASHES += has160 ## Rivest's `MD' series of hash functions HASHES += md2 md4 md5 libcatacomb_la_SOURCES += md2-tab.h ## Dobbertin, Bosselaers and Preneel's `RIPEMD' suite. HASHES += rmd128 rmd160 rmd256 rmd320 ## The National Security Agency's `SHA-1' hash function. HASHES += sha ## The National Security Agency's `SHA-2' suite. HASHES += sha224 sha256 HASHES += sha384 sha512 ## Anderson and Biham's `Tiger' hash function. HASHES += tiger libcatacomb_la_SOURCES += tiger-base.h tiger.lo: tiger-tab.h CLEANFILES += tiger-tab.h noinst_PROGRAMS += tiger-mktab tiger-tab.h: tiger-mktab$e $(AM_V_GEN)./tiger-mktab >tiger-tab.h.new && \ mv tiger-tab.h.new tiger-tab.h ## Barreto and Rijmen's `Whirlpool' hash function. HASHES += whirlpool whirlpool256 whirlpool.lo: whirlpool-tab.h CLEANFILES += whirlpool-tab.h noinst_PROGRAMS += whirlpool-mktab whirlpool-tab.h: whirlpool-mktab$e $(AM_V_GEN)./whirlpool-mktab >whirlpool-tab.h.new && \ mv whirlpool-tab.h.new whirlpool-tab.h ## Bellare, Canetti and Krawczyk's `HMAC' mode for message authentication. HASHMACMODES += hmac ## MGF1, used in OAEP and PSS. HASHCIPHERMODES += mgf ###-------------------------------------------------------------------------- ### Other symmetric primitives. ## The CRC32 algorithm, which is useful, but has no worthwhile security. pkginclude_HEADERS += crc32.h libcatacomb_la_SOURCES += crc32.c ALL_HASHES += crc32=gcrc32 ## Rivest's `RC4' stream cipher. pkginclude_HEADERS += rc4.h libcatacomb_la_SOURCES += rc4.c TESTS += rc4.$t EXTRA_DIST += tests/rc4 ALL_CIPHERS += rc4 ## Coppersmith and Rogaway's `SEAL' pseudorandom function. pkginclude_HEADERS += seal.h libcatacomb_la_SOURCES += seal.c TESTS += seal.$t EXTRA_DIST += tests/seal ALL_CIPHERS += seal ###-------------------------------------------------------------------------- ### Autogenerated mode implementations. ## The master stamp file, indicating that we generated all of the sources. CLEANFILES += modes-gen-stamp EXTRA_DIST += mode.h.in mode.c.in modes-gen-stamp: $(AM_V_at)touch modes-gen-stamp $(AM_V_GEN)$(multigen) -g $(srcdir)/mode.c.in \ @base-@mode.c \ base="$(BLKCS)" mode="$(BLKCMODES)" $(AM_V_at)$(multigen) -g $(srcdir)/mode.c.in \ @base-@mode.c \ base="$(HASHES)" mode="$(HASHMODES)" $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \ @base-@mode.h \ base="$(BLKCS)" mode="$(BLKCMODES)" $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \ @base-@mode.h \ base="$(HASHES)" mode="$(HASHMODES)" $(AM_V_at)touch modes-gen-stamp ## The individual mode interfaces and implementations. pkginclude_HEADERS += $(MODE_H) ## Generated implementations. BUILT_SOURCES += $(GENMODES_C) CLEANFILES += $(GENMODES_C) nodist_libcatacomb_la_SOURCES += $(GENMODES_C) $(GENMODES_C): modes-gen-stamp ## Generated interfaces. BUILT_SOURCES += $(GENMODES_H) CLEANFILES += $(GENMODES_H) nodist_pkginclude_HEADERS += $(GENMODES_H) $(GENMODES_H): modes-gen-stamp ###-------------------------------------------------------------------------- ### Tables of classes for encryption, hashing, and message authentication. ## The skeleton for the class tables. EXTRA_DIST += gthingtab.c.in ## Table of cipher classes. pkginclude_HEADERS += gcipher.h CLEANFILES += gciphertab.c nodist_libcatacomb_la_SOURCES += gciphertab.c gciphertab.c: gthingtab.c.in $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gciphertab.c \ what=gcipher cls=gccipher thing="$(ALL_CIPHERS)" ## Table of hash classes. pkginclude_HEADERS += ghash.h ghash-def.h CLEANFILES += ghashtab.c nodist_libcatacomb_la_SOURCES += ghashtab.c ghashtab.c: gthingtab.c.in $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in ghashtab.c \ what=ghash cls=gchash thing="$(ALL_HASHES)" ## Table of MAC classes. pkginclude_HEADERS += gmac.h CLEANFILES += gmactab.c nodist_libcatacomb_la_SOURCES += gmactab.c gmactab.c: gthingtab.c.in $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gmactab.c \ what=gmac cls=gcmac thing="$(ALL_MACS)" ###-------------------------------------------------------------------------- ### Testing for symmetric crypto things. ## Run the test programs. TESTS += $(SYMM_TESTS) EXTRA_DIST += $(SYMM_TEST_FILES) ## A piece of sample text for round-trip testing encryption modes. EXTRA_DIST += daftstory.h ###-------------------------------------------------------------------------- ### Key management. ## Assistance for elliptic-curve keys. pkginclude_HEADERS += ec-keys.h libcatacomb_la_SOURCES += ec-fetch.c ## Managing keys and keyring files. pkginclude_HEADERS += key.h libcatacomb_la_SOURCES += key-attr.c libcatacomb_la_SOURCES += key-fetch.c libcatacomb_la_SOURCES += key-file.c libcatacomb_la_SOURCES += key-io.c libcatacomb_la_SOURCES += key-misc.c libcatacomb_la_SOURCES += key-moan.c ## Managing key data. pkginclude_HEADERS += key-data.h libcatacomb_la_SOURCES += key-binary.c libcatacomb_la_SOURCES += key-data.c libcatacomb_la_SOURCES += key-flags.c libcatacomb_la_SOURCES += key-pack.c libcatacomb_la_SOURCES += key-pass.c libcatacomb_la_SOURCES += key-text.c ## Error reporting. pkginclude_HEADERS += key-error.h libcatacomb_la_SOURCES += key-error.c ## Reading passphrases. pkginclude_HEADERS += passphrase.h libcatacomb_la_SOURCES += passphrase.c ## Interfacing with the passphrase pixie. pkginclude_HEADERS += pixie.h libcatacomb_la_SOURCES += pixie-common.c ###-------------------------------------------------------------------------- ### Secret sharing. ## Efficient sharing over GF(2^8). pkginclude_HEADERS += gfshare.h libcatacomb_la_SOURCES += gfshare.c gfshare.lo: gfshare-tab.h CLEANFILES += gfshare-tab.h noinst_PROGRAMS += gfshare-mktab gfshare-tab.h: gfshare-mktab$e $(AM_V_GEN)./gfshare-mktab >gfshare-tab.h.new && \ mv gfshare-tab.h.new gfshare-tab.h TESTS += gfshare.$t ## Number-theoretic sharing over GF(p). pkginclude_HEADERS += share.h libcatacomb_la_SOURCES += share.c TESTS += share.$t ###-------------------------------------------------------------------------- ### Public-key cryptography. ## The Blum--Blum--Shub random-bit generator. pkginclude_HEADERS += bbs.h libcatacomb_la_SOURCES += bbs-fetch.c libcatacomb_la_SOURCES += bbs-gen.c libcatacomb_la_SOURCES += bbs-jump.c TESTS += bbs-jump.$t libcatacomb_la_SOURCES += bbs-rand.c TESTS += bbs-rand.$t EXTRA_DIST += tests/bbs ## Plain Diffie--Hellman, in Schorr groups. pkginclude_HEADERS += dh.h libcatacomb_la_SOURCES += dh-check.c libcatacomb_la_SOURCES += dh-fetch.c libcatacomb_la_SOURCES += dh-gen.c libcatacomb_la_SOURCES += dh-kcdsa.c libcatacomb_la_SOURCES += dh-limlee.c libcatacomb_la_SOURCES += dh-param.c TESTS += dh-param.$t ## The National Security Agency's Digital Signature Algorithm. pkginclude_HEADERS += dsa.h libcatacomb_la_SOURCES += dsa-gen.c TESTS += dsa-gen.$t libcatacomb_la_SOURCES += dsa-misc.c libcatacomb_la_SOURCES += dsa-sign.c TESTS += dsa-sign.$t libcatacomb_la_SOURCES += dsa-verify.c TESTS += dsa-verify.$t libcatacomb_la_SOURCES += dsa-check.c EXTRA_DIST += tests/dsa ## Generalization of DSA to arbitrary cyclic groups. pkginclude_HEADERS += gdsa.h libcatacomb_la_SOURCES += gdsa.c TESTS += gdsa.$t EXTRA_DIST += tests/gdsa ## KISA `KCDSA', generalized to arbitrary cyclic groups. pkginclude_HEADERS += gkcdsa.h libcatacomb_la_SOURCES += gkcdsa.c TESTS += gkcdsa.$t EXTRA_DIST += tests/gkcdsa ## General key validity checking machinery. pkginclude_HEADERS += keycheck.h libcatacomb_la_SOURCES += keycheck.c libcatacomb_la_SOURCES += keycheck-mp.c libcatacomb_la_SOURCES += keycheck-report.c ## The Rivest--Shamir--Adleman trapdoor one-way function. pkginclude_HEADERS += rsa.h libcatacomb_la_SOURCES += rsa-fetch.c libcatacomb_la_SOURCES += rsa-gen.c libcatacomb_la_SOURCES += rsa-priv.c libcatacomb_la_SOURCES += rsa-pub.c libcatacomb_la_SOURCES += rsa-recover.c libcatacomb_la_SOURCES += oaep.c libcatacomb_la_SOURCES += pkcs1.c libcatacomb_la_SOURCES += pss.c EXTRA_DIST += rsa-test.c TESTS += rsa-test.$t EXTRA_DIST += tests/rsa ###-------------------------------------------------------------------------- ### Random number generators. ## The FIPS186 generator used to generate DSA domain parameters. pkginclude_HEADERS += dsarand.h libcatacomb_la_SOURCES += dsarand.c ## Knuth's lagged-Fibonacci generator. pkginclude_HEADERS += fibrand.h libcatacomb_la_SOURCES += fibrand.c ## The FIPS 140--2 random number generator tests. pkginclude_HEADERS += fipstest.h libcatacomb_la_SOURCES += fipstest.c ## Interface for generic random number sources. pkginclude_HEADERS += grand.h libcatacomb_la_SOURCES += grand.c ## A simple linear-congruential generator. pkginclude_HEADERS += lcrand.h libcatacomb_la_SOURCES += lcrand.c TESTS += lcrand.$t EXTRA_DIST += tests/lcrand ## Maurer's universal statistical test. pkginclude_HEADERS += maurer.h libcatacomb_la_SOURCES += maurer.c ## System-specific noise acquisition. pkginclude_HEADERS += noise.h libcatacomb_la_SOURCES += noise.c ## Cryptographic laundering for true random data generation. pkginclude_HEADERS += rand.h libcatacomb_la_SOURCES += rand.c ## The SSL v3 pseudorandom function. pkginclude_HEADERS += sslprf.h libcatacomb_la_SOURCES += sslprf.c TESTS += sslprf.$t EXTRA_DIST += tests/sslprf ## The TLS v1 pseudorandom function. pkginclude_HEADERS += tlsprf.h libcatacomb_la_SOURCES += tlsprf.c TESTS += tlsprf.$t EXTRA_DIST += tests/tlsprf ###-------------------------------------------------------------------------- ### The `catcrypt' library. noinst_LTLIBRARIES += libcatcrypt.la libcatcrypt_la_SOURCES = ## The main library. libcatcrypt_la_SOURCES += cc.h libcatcrypt_la_SOURCES += cc-enc.c libcatcrypt_la_SOURCES += cc-hash.c libcatcrypt_la_SOURCES += cc-kem.c libcatcrypt_la_SOURCES += cc-list.c libcatcrypt_la_SOURCES += cc-progress.c libcatcrypt_la_SOURCES += cc-sig.c libcatcrypt_la_SOURCES += cc-subcmd.c ## Date parsing. libcatcrypt_la_SOURCES += getdate.h libcatcrypt_la_SOURCES += getdate.y ###-------------------------------------------------------------------------- ### Utility programs. UTILS_LIBS = libcatcrypt.la libcatacomb.la $(mLib_LIBS) $(LIBS) ## Generate and verify datestamped cookies. bin_PROGRAMS += cookie cookie_LDADD = $(UTILS_LIBS) dist_man_MANS += cookie.1 ## Asymmetric message encryption and decryption with deniable authentication. bin_PROGRAMS += catcrypt catcrypt_LDADD = $(UTILS_LIBS) dist_man_MANS += catcrypt.1 ## Signing and verifying files. bin_PROGRAMS += catsign catsign_LDADD = $(UTILS_LIBS) dist_man_MANS += catsign.1 ## Issue and verify signatures on directory trees. bin_PROGRAMS += dsig dsig_LDADD = $(UTILS_LIBS) dist_man_MANS += dsig.1 ## Compute factorials to arbitrary precision. bin_PROGRAMS += factorial factorial_LDADD = $(UTILS_LIBS) ## Compute Fibonacci numbers to arbitrary precision. bin_PROGRAMS += fibonacci fibonacci_LDADD = $(UTILS_LIBS) ## Compute hashes of files. bin_PROGRAMS += hashsum hashsum_LDADD = $(UTILS_LIBS) dist_man_MANS += hashsum.1 ## Key management utility. bin_PROGRAMS += key key_SOURCES = keyutil.c key_LDADD = $(UTILS_LIBS) dist_man_MANS += key.1 keyring.5 ## Generate passphrases with given entropy using wordlists and Markov models. bin_PROGRAMS += mkphrase mkphrase_LDADD = $(UTILS_LIBS) dist_man_MANS += mkphrase.1 ## Performance testing. bin_PROGRAMS += perftest perftest_LDADD = $(UTILS_LIBS) ## Remember passphrases for limited periods of time. bin_PROGRAMS += pixie pixie_SOURCES = pixie.c pixie_LDADD = libcatacomb.la $(mLib_LIBS) $(PIXIE_LIBS) dist_man_MANS += pixie.1 EXTRA_DIST += xpixie ## Generate random data. bin_PROGRAMS += rspit rspit_LDADD = $(UTILS_LIBS) ###-------------------------------------------------------------------------- ### Testing. SUFFIXES += .c .$t .to .c.to: $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@ .to.$t: libcatacomb.la $(AM_V_CCLD)$(LINK) $< libcatacomb.la $(mLib_LIBS) $(LIBS) .PRECIOUS: %.to CLEANFILES += *.to *.$t ###-------------------------------------------------------------------------- ### The pkg-config file. pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = catacomb.pc EXTRA_DIST += catacomb.pc.in CLEANFILES += catacomb.pc catacomb.pc: catacomb.pc.in Makefile $(SUBST) $(srcdir)/catacomb.pc.in >$@.new $(SUBSTITUTIONS) && \ mv $@.new $@ ###-------------------------------------------------------------------------- ### Release tweaking. ## Release number. dist-hook:: echo $(VERSION) >$(distdir)/RELEASE ## Additional build tools. EXTRA_DIST += config/auto-version ###-------------------------------------------------------------------------- ### Debian. ## General stuff. EXTRA_DIST += debian/rules EXTRA_DIST += debian/control EXTRA_DIST += debian/changelog EXTRA_DIST += debian/copyright ## catacomb-bin EXTRA_DIST += debian/catacomb-bin.prerm EXTRA_DIST += debian/catacomb-bin.postinst EXTRA_DIST += debian/catacomb-bin.config EXTRA_DIST += debian/catacomb-bin.templates ###----- That's all, folks --------------------------------------------------