Rearrange the file tree.
[u/mdw/catacomb] / symm / Makefile.am
CommitLineData
0f00dc4c
MW
1### -*-makefile-*-
2###
3### Build script for symmetric cryptography
4###
5### (c) 2013 Straylight/Edgeware
6###
7
8###----- Licensing notice ---------------------------------------------------
9###
10### This file is part of Catacomb.
11###
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.
16###
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.
21###
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.
26
27include $(top_srcdir)/vars.am
28
29noinst_LTLIBRARIES = libsymm.la
30libsymm_la_SOURCES =
31nodist_libsymm_la_SOURCES =
32
33TEST_LIBS = libsymm.la
34
35VPATH += modes
36
37###--------------------------------------------------------------------------
38### Autogenerated lists.
39
40## Fancy template substitutions.
41multigen = $(PYTHON) $(srcdir)/multigen
42EXTRA_DIST += multigen
43
44## The heart of this is an enormous cross-product of crypto primitives and
45## the corresponding modes of operation. Rather than write it out longhand,
46## we generate it using `multigen'. Unfortunately, this needs to be done
47## at the Automake level, which causes some interesting bootstrapping
48## problems.
49include modes.am
50
51EXTRA_DIST += modes.am.in modes.am
52MAINTAINERCLEANFILES += $(srcdir)/modes.am
53
54## Generate the lists.
55$(srcdir)/modes.am: modes.am.in
56 $(AM_V_GEN)$(multigen) -g $(srcdir)/modes.am.in $(srcdir)/modes.am \
57 blkc="$(BLKCS)" \
58 blkcmode="$(BLKCMODES)" \
59 blkcciphermode="$(BLKCCIPHERMODES)" \
60 hash="$(HASHES)" \
61 hashmode="$(HASHMODES)" \
62 hashciphermode="$(HASHCIPHERMODES)" \
63 hashmacmode="$(HASHMACMODES)"
64
65## Initialize lists of known classes.
66ALL_CIPHERS = $(CIPHER_MODES)
67ALL_HASHES = $(HASHES)
68ALL_MACS = $(MAC_MODES)
69
70###--------------------------------------------------------------------------
71### Block ciphers.
72
73BLKCS =
74BLKCMODES =
75
76BLKCCIPHERMODES =
77BLKCMODES += $(BLKCCIPHERMODES)
78
79## A tool for translating the AES-contest test vectors into a form our test
80## rigs understand.
81EXTRA_DIST += aes-trans
82
83## Block cipher utility macros, mainly used in mode implementations.
84pkginclude_HEADERS += blkc.h
85
86## Source code and headers for the block ciphers.
87libsymm_la_SOURCES += $(BLKC_C)
88pkginclude_HEADERS += $(BLKC_H)
89
90## Schneier's `Blowfish' block cipher.
91BLKCS += blowfish
92blowfish.lo: blowfish-tab.h
93CLEANFILES += blowfish-tab.h
94noinst_PROGRAMS += blowfish-mktab
95blowfish_mktab_CPPFLAGS = $(AM_CPPFLAGS) -DQUIET
96blowfish-tab.h: blowfish-mktab$e
97 $(AM_V_GEN)./blowfish-mktab >blowfish-tab.h.new && \
98 mv blowfish-tab.h.new blowfish-tab.h
99
100## Adams and Tavares' `CAST' block ciphers.
101BLKCS += cast128 cast256
102libsymm_la_SOURCES += cast-s.c cast-sk.c cast-base.h cast-tab.h
103cast256.$t: t/cast256
104EXTRA_DIST += t/cast256.aes
105MAINTAINERCLEANFILES += $(srcdir)/t/cast256
106t/cast256: t/cast256.aes
107 $(AM_V_GEN)$(srcdir)/aes-trans CAST256 \
108 <$(srcdir)/t/cast256.aes \
109 >$(srcdir)/t/cast256.new && \
110 mv $(srcdir)/t/cast256.new $(srcdir)/t/cast256
111
112## IBM's `DES' block cipher, by Feistel, Coppersmith, and others.
113BLKCS += des des3
114libsymm_la_SOURCES += des-base.h des-base.c desx-tab.h
115des-base.lo: des-tab.h
116CLEANFILES += des-tab.h
117noinst_PROGRAMS += des-mktab
118des-tab.h: des-mktab$e
119 $(AM_V_GEN)./des-mktab >des-tab.h.new && \
120 mv des-tab.h.new des-tab.h
121
122## Rivest's `DESX' variant, with pre- and post-whitening.
123BLKCS += desx
124libsymm_la_SOURCES += desx-tab.h
125
126## Lai and Massey's IDEA.
127BLKCS += idea
128
129## IBM's `MARS' block cipher.
130BLKCS += mars
131mars.lo: mars-tab.h
132CLEANFILES += mars-tab.h
133noinst_PROGRAMS += mars-mktab
134mars-tab.h: mars-mktab$e
135 $(AM_V_GEN)./mars-mktab >mars-tab.h.new && \
136 mv mars-tab.h.new mars-tab.h
137mars.$t: t/mars
138EXTRA_DIST += t/mars.aes
139MAINTAINERCLEANFILES += $(srcdir)/t/mars
140t/mars: t/mars.aes
141 $(AM_V_GEN)$(srcdir)/aes-trans Mars \
142 <$(srcdir)/t/mars.aes \
143 >$(srcdir)/t/mars.new && \
144 mv $(srcdir)/t/mars.new $(srcdir)/t/mars
145
146## Daemen, Peeters, Van Assche and Rijmen's `Noekeon'.
147BLKCS += noekeon
148
149## Rivest's `RC2' block cipher.
150BLKCS += rc2
151libsymm_la_SOURCES += rc2-tab.h
152
153## Rivest's `RC5'.
154BLKCS += rc5
155
156## Daemen and Rijmen's `Rijndael' block cipher, selected as AES.
157BLKCS += rijndael rijndael192 rijndael256
158libsymm_la_SOURCES += rijndael-base.h rijndael-base.c
159rijndael-base.lo: rijndael-tab.h
160CLEANFILES += rijndael-tab.h
161noinst_PROGRAMS += rijndael-mktab
162rijndael-tab.h: rijndael-mktab$e
163 $(AM_V_GEN)./rijndael-mktab >rijndael-tab.h.new && \
164 mv rijndael-tab.h.new rijndael-tab.h
165rijndael.$t: t/rijndael
166EXTRA_DIST += t/rijndael.aes
167MAINTAINERCLEANFILES += $(srcdir)/t/rijndael
168t/rijndael: t/rijndael.aes
169 $(AM_V_GEN)$(srcdir)/aes-trans Rijndael \
170 <$(srcdir)/t/rijndael.aes \
171 >$(srcdir)/t/rijndael.new && \
172 mv $(srcdir)/t/rijndael.new $(srcdir)/t/rijndael
173
174## Massey's `SAFER' block ciphers.
175BLKCS += safer safersk
176safer.lo: safer-tab.h
177CLEANFILES += safer-tab.h
178noinst_PROGRAMS += safer-mktab
179safer-tab.h: safer-mktab$e
180 $(AM_V_GEN)./safer-mktab >safer-tab.h.new && \
181 mv safer-tab.h.new safer-tab.h
182
183## Anderson, Biham and Knudsen's `Serpent' block cipher.
184BLKCS += serpent
185libsymm_la_SOURCES += serpent-sbox.h
186noinst_PROGRAMS += serpent-check
187TESTS += serpent-check
188serpent.$t: t/serpent
189EXTRA_DIST += t/serpent.aes
190MAINTAINERCLEANFILES += $(srcdir)/t/serpent
191t/serpent: t/serpent.aes
192 $(AM_V_GEN)$(srcdir)/aes-trans Serpent -v rev=1 \
193 <$(srcdir)/t/serpent.aes \
194 >$(srcdir)/t/serpent.new && \
195 mv $(srcdir)/t/serpent.new $(srcdir)/t/serpent
196
197## The National Security Agency's `Skipjack' block cipher. You don't want to
198## use this.
199BLKCS += skipjack
200libsymm_la_SOURCES += skipjack-tab.h
201
202## Daemen and Rijmen's `Square' block cipher.
203BLKCS += square
204square.lo: square-tab.h
205CLEANFILES += square-tab.h
206noinst_PROGRAMS += square-mktab
207square-tab.h: square-mktab$e
208 $(AM_V_GEN)./square-mktab >square-tab.h.new && \
209 mv square-tab.h.new square-tab.h
210
211## Wheeler and Needham's `TEA' and `XTEA' block ciphers.
212BLKCS += tea xtea
213
214## Schneier, Kelsey, Whiting, Wagner, Hall and Ferguson's `Twofish' block
215## cipher.
216BLKCS += twofish
217twofish.lo: twofish-tab.h
218CLEANFILES += twofish-tab.h
219noinst_PROGRAMS += twofish-mktab
220twofish-tab.h: twofish-mktab$e
221 $(AM_V_GEN)./twofish-mktab >twofish-tab.h.new && \
222 mv twofish-tab.h.new twofish-tab.h
223twofish.$t: t/twofish
224EXTRA_DIST += t/twofish.aes
225MAINTAINERCLEANFILES += $(srcdir)/t/twofish
226t/twofish: t/twofish.aes
227 $(AM_V_GEN)$(srcdir)/aes-trans Twofish \
228 <$(srcdir)/t/twofish.aes \
229 >$(srcdir)/t/twofish.new && \
230 mv $(srcdir)/t/twofish.new $(srcdir)/t/twofish
231
232## The old NIST modes for DES.
233BLKCCIPHERMODES += cbc cfb ecb ofb
234
235## Counter mode.
236BLKCCIPHERMODES += counter
237
238###--------------------------------------------------------------------------
239### Hash functions.
240
241HASHES =
242HASHMODES =
243
244HASHCIPHERMODES =
245HASHMODES += $(HASHCIPHERMODES)
246
247HASHMACMODES =
248HASHMODES += $(HASHMACMODES)
249
250## Common definitions for hash functions.
251pkginclude_HEADERS += hash.h
252
253## Source code and headers for the hash functions.
254libsymm_la_SOURCES += $(HASH_C)
255pkginclude_HEADERS += $(HASH_H)
256
257## Lim and KISA's `HAS-160', recommended for use with KCDSA.
258HASHES += has160
259
260## Rivest's `MD' series of hash functions
261HASHES += md2 md4 md5
262libsymm_la_SOURCES += md2-tab.h
263
264## Dobbertin, Bosselaers and Preneel's `RIPEMD' suite.
265HASHES += rmd128 rmd160 rmd256 rmd320
266
267## The National Security Agency's `SHA-1' hash function.
268HASHES += sha
269
270## The National Security Agency's `SHA-2' suite.
271HASHES += sha224 sha256
272HASHES += sha384 sha512
273
274## Anderson and Biham's `Tiger' hash function.
275HASHES += tiger
276libsymm_la_SOURCES += tiger-base.h
277tiger.lo: tiger-tab.h
278CLEANFILES += tiger-tab.h
279noinst_PROGRAMS += tiger-mktab
280tiger-tab.h: tiger-mktab$e
281 $(AM_V_GEN)./tiger-mktab >tiger-tab.h.new && \
282 mv tiger-tab.h.new tiger-tab.h
283
284## Barreto and Rijmen's `Whirlpool' hash function.
285HASHES += whirlpool whirlpool256
286whirlpool.lo: whirlpool-tab.h
287CLEANFILES += whirlpool-tab.h
288noinst_PROGRAMS += whirlpool-mktab
289whirlpool-tab.h: whirlpool-mktab$e
290 $(AM_V_GEN)./whirlpool-mktab >whirlpool-tab.h.new && \
291 mv whirlpool-tab.h.new whirlpool-tab.h
292
293## Bellare, Canetti and Krawczyk's `HMAC' mode for message authentication.
294HASHMACMODES += hmac
295
296## MGF1, used in OAEP and PSS.
297HASHCIPHERMODES += mgf
298
299###--------------------------------------------------------------------------
300### Other symmetric primitives.
301
302## The CRC32 algorithm, which is useful, but has no worthwhile security.
303pkginclude_HEADERS += crc32.h
304libsymm_la_SOURCES += crc32.c
305ALL_HASHES += crc32=gcrc32
306
307## Rivest's `RC4' stream cipher.
308pkginclude_HEADERS += rc4.h
309libsymm_la_SOURCES += rc4.c
310TESTS += rc4.$t
311EXTRA_DIST += t/rc4
312ALL_CIPHERS += rc4
313
314## Coppersmith and Rogaway's `SEAL' pseudorandom function.
315pkginclude_HEADERS += seal.h
316libsymm_la_SOURCES += seal.c
317TESTS += seal.$t
318EXTRA_DIST += t/seal
319ALL_CIPHERS += seal
320
321###--------------------------------------------------------------------------
322### Autogenerated mode implementations.
323
324## The master stamp file, indicating that we generated all of the sources.
325CLEANFILES += modes/gen-stamp
326EXTRA_DIST += mode.h.in mode.c.in
327modes/gen-stamp:
328 $(AM_V_at)$(MKDIR_P) modes
329 $(AM_V_GEN)$(multigen) -g $(srcdir)/mode.c.in \
330 modes/@base-@mode.c \
331 base="$(BLKCS)" mode="$(BLKCMODES)"
332 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
333 modes/@base-@mode.h \
334 base="$(BLKCS)" mode="$(BLKCMODES)"
335 $(AM_V_at)$(multigen) -g $(srcdir)/mode.c.in \
336 modes/@base-@mode.c \
337 base="$(HASHES)" mode="$(HASHMODES)"
338 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
339 modes/@base-@mode.h \
340 base="$(HASHES)" mode="$(HASHMODES)"
341 $(AM_V_at)touch modes/gen-stamp
342
343## The individual mode interfaces and implementations.
344pkginclude_HEADERS += $(MODE_H)
345
346## Generated implementations.
347BUILT_SOURCES += $(GENMODES_C)
348CLEANFILES += $(GENMODES_C)
349nodist_libsymm_la_SOURCES += $(GENMODES_C)
350$(GENMODES_C): modes/gen-stamp
351
352## Generated interfaces.
353BUILT_SOURCES += $(GENMODES_H)
354CLEANFILES += $(GENMODES_H)
355nodist_pkginclude_HEADERS += $(GENMODES_H)
356$(GENMODES_H): modes/gen-stamp
357
358###--------------------------------------------------------------------------
359### Tables of classes for encryption, hashing, and message authentication.
360
361## The skeleton for the class tables.
362EXTRA_DIST += gthingtab.c.in
363
364## Table of cipher classes.
365pkginclude_HEADERS += gcipher.h
366CLEANFILES += gciphertab.c
367nodist_libsymm_la_SOURCES += gciphertab.c
368gciphertab.c: gthingtab.c.in
369 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gciphertab.c \
370 what=gcipher cls=gccipher thing="$(ALL_CIPHERS)"
371
372## Table of hash classes.
373pkginclude_HEADERS += ghash.h ghash-def.h
374CLEANFILES += ghashtab.c
375nodist_libsymm_la_SOURCES += ghashtab.c
376ghashtab.c: gthingtab.c.in
377 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in ghashtab.c \
378 what=ghash cls=gchash thing="$(ALL_HASHES)"
379
380## Table of MAC classes.
381pkginclude_HEADERS += gmac.h
382CLEANFILES += gmactab.c
383nodist_libsymm_la_SOURCES += gmactab.c
384gmactab.c: gthingtab.c.in
385 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gmactab.c \
386 what=gmac cls=gcmac thing="$(ALL_MACS)"
387
388###--------------------------------------------------------------------------
389### Testing.
390
391## Run the test programs.
392TESTS += $(SYMM_TESTS)
393EXTRA_DIST += $(SYMM_TEST_FILES)
394
395## A piece of sample text for round-trip testing encryption modes.
396EXTRA_DIST += daftstory.h
397
398## Clean the debris from the `modes' subdirectory.
399CLEANFILES += modes/*.to modes/*.$t
400
401###----- That's all, folks --------------------------------------------------