--- /dev/null
+### -*-makefile-*-
+###
+### Build script for symmetric cryptography
+###
+### (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.
+
+include $(top_srcdir)/vars.am
+
+noinst_LTLIBRARIES = libsymm.la
+libsymm_la_SOURCES =
+nodist_libsymm_la_SOURCES =
+
+TEST_LIBS = libsymm.la
+
+VPATH += modes
+
+###--------------------------------------------------------------------------
+### 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 += aes-trans
+
+## Block cipher utility macros, mainly used in mode implementations.
+pkginclude_HEADERS += blkc.h
+
+## Source code and headers for the block ciphers.
+libsymm_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
+libsymm_la_SOURCES += cast-s.c cast-sk.c cast-base.h cast-tab.h
+cast256.$t: t/cast256
+EXTRA_DIST += t/cast256.aes
+MAINTAINERCLEANFILES += $(srcdir)/t/cast256
+t/cast256: t/cast256.aes
+ $(AM_V_GEN)$(srcdir)/aes-trans CAST256 \
+ <$(srcdir)/t/cast256.aes \
+ >$(srcdir)/t/cast256.new && \
+ mv $(srcdir)/t/cast256.new $(srcdir)/t/cast256
+
+## IBM's `DES' block cipher, by Feistel, Coppersmith, and others.
+BLKCS += des des3
+libsymm_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
+libsymm_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: t/mars
+EXTRA_DIST += t/mars.aes
+MAINTAINERCLEANFILES += $(srcdir)/t/mars
+t/mars: t/mars.aes
+ $(AM_V_GEN)$(srcdir)/aes-trans Mars \
+ <$(srcdir)/t/mars.aes \
+ >$(srcdir)/t/mars.new && \
+ mv $(srcdir)/t/mars.new $(srcdir)/t/mars
+
+## Daemen, Peeters, Van Assche and Rijmen's `Noekeon'.
+BLKCS += noekeon
+
+## Rivest's `RC2' block cipher.
+BLKCS += rc2
+libsymm_la_SOURCES += rc2-tab.h
+
+## Rivest's `RC5'.
+BLKCS += rc5
+
+## Daemen and Rijmen's `Rijndael' block cipher, selected as AES.
+BLKCS += rijndael rijndael192 rijndael256
+libsymm_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: t/rijndael
+EXTRA_DIST += t/rijndael.aes
+MAINTAINERCLEANFILES += $(srcdir)/t/rijndael
+t/rijndael: t/rijndael.aes
+ $(AM_V_GEN)$(srcdir)/aes-trans Rijndael \
+ <$(srcdir)/t/rijndael.aes \
+ >$(srcdir)/t/rijndael.new && \
+ mv $(srcdir)/t/rijndael.new $(srcdir)/t/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
+libsymm_la_SOURCES += serpent-sbox.h
+noinst_PROGRAMS += serpent-check
+TESTS += serpent-check
+serpent.$t: t/serpent
+EXTRA_DIST += t/serpent.aes
+MAINTAINERCLEANFILES += $(srcdir)/t/serpent
+t/serpent: t/serpent.aes
+ $(AM_V_GEN)$(srcdir)/aes-trans Serpent -v rev=1 \
+ <$(srcdir)/t/serpent.aes \
+ >$(srcdir)/t/serpent.new && \
+ mv $(srcdir)/t/serpent.new $(srcdir)/t/serpent
+
+## The National Security Agency's `Skipjack' block cipher. You don't want to
+## use this.
+BLKCS += skipjack
+libsymm_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: t/twofish
+EXTRA_DIST += t/twofish.aes
+MAINTAINERCLEANFILES += $(srcdir)/t/twofish
+t/twofish: t/twofish.aes
+ $(AM_V_GEN)$(srcdir)/aes-trans Twofish \
+ <$(srcdir)/t/twofish.aes \
+ >$(srcdir)/t/twofish.new && \
+ mv $(srcdir)/t/twofish.new $(srcdir)/t/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.
+libsymm_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
+libsymm_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
+libsymm_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
+libsymm_la_SOURCES += crc32.c
+ALL_HASHES += crc32=gcrc32
+
+## Rivest's `RC4' stream cipher.
+pkginclude_HEADERS += rc4.h
+libsymm_la_SOURCES += rc4.c
+TESTS += rc4.$t
+EXTRA_DIST += t/rc4
+ALL_CIPHERS += rc4
+
+## Coppersmith and Rogaway's `SEAL' pseudorandom function.
+pkginclude_HEADERS += seal.h
+libsymm_la_SOURCES += seal.c
+TESTS += seal.$t
+EXTRA_DIST += t/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)$(MKDIR_P) modes
+ $(AM_V_GEN)$(multigen) -g $(srcdir)/mode.c.in \
+ modes/@base-@mode.c \
+ base="$(BLKCS)" mode="$(BLKCMODES)"
+ $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
+ modes/@base-@mode.h \
+ base="$(BLKCS)" mode="$(BLKCMODES)"
+ $(AM_V_at)$(multigen) -g $(srcdir)/mode.c.in \
+ modes/@base-@mode.c \
+ base="$(HASHES)" mode="$(HASHMODES)"
+ $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
+ modes/@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_libsymm_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_libsymm_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_libsymm_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_libsymm_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.
+
+## 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
+
+## Clean the debris from the `modes' subdirectory.
+CLEANFILES += modes/*.to modes/*.$t
+
+###----- That's all, folks --------------------------------------------------