symm/sha512.[ch], etc.: Support SHA512/224 and SHA512/256.
[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
e5b61a8d 35VPATH += $(srcdir)/modes
0f00dc4c
MW
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.
24497005
MW
49##
50## Of course, now that we have this machinery for the complicated modes
51## generation, we might as well use it for simpler things.
0f00dc4c 52include modes.am
24497005 53include stubs.am
0f00dc4c
MW
54
55EXTRA_DIST += modes.am.in modes.am
24497005 56EXTRA_DIST += stubs.am.in stubs.am
0f00dc4c 57MAINTAINERCLEANFILES += $(srcdir)/modes.am
24497005 58MAINTAINERCLEANFILES += $(srcdir)/stubs.am
0f00dc4c
MW
59
60## Generate the lists.
77843a37 61$(srcdir)/modes.am: modes.am.in Makefile.am
0f00dc4c
MW
62 $(AM_V_GEN)$(multigen) -g $(srcdir)/modes.am.in $(srcdir)/modes.am \
63 blkc="$(BLKCS)" \
64 blkcmode="$(BLKCMODES)" \
65 blkcciphermode="$(BLKCCIPHERMODES)" \
66 hash="$(HASHES)" \
67 hashmode="$(HASHMODES)" \
68 hashciphermode="$(HASHCIPHERMODES)" \
69 hashmacmode="$(HASHMACMODES)"
24497005
MW
70$(srcdir)/stubs.am: stubs.am.in Makefile.am
71 $(AM_V_GEN)$(multigen) -g $(srcdir)/stubs.am.in $(srcdir)/stubs.am \
e91853c1 72 descr,hname,base="$(STUBS_HDR)" cname,cbase="$(STUBS_SRC)"
0f00dc4c
MW
73
74## Initialize lists of known classes.
75ALL_CIPHERS = $(CIPHER_MODES)
76ALL_HASHES = $(HASHES)
77ALL_MACS = $(MAC_MODES)
78
24497005
MW
79## Stub headers and sources.
80STUBS_HDR =
81STUBS_SRC =
82
0f00dc4c
MW
83###--------------------------------------------------------------------------
84### Block ciphers.
85
86BLKCS =
87BLKCMODES =
88
89BLKCCIPHERMODES =
90BLKCMODES += $(BLKCCIPHERMODES)
91
92## A tool for translating the AES-contest test vectors into a form our test
93## rigs understand.
94EXTRA_DIST += aes-trans
95
96## Block cipher utility macros, mainly used in mode implementations.
97pkginclude_HEADERS += blkc.h
98
99## Source code and headers for the block ciphers.
100libsymm_la_SOURCES += $(BLKC_C)
101pkginclude_HEADERS += $(BLKC_H)
102
103## Schneier's `Blowfish' block cipher.
104BLKCS += blowfish
c9cfa678
MW
105nodist_libsymm_la_SOURCES += ../precomp/symm/blowfish-tab.c
106PRECOMPS += $(precomp)/symm/blowfish-tab.c
e5b61a8d 107PRECOMP_PROGS += blowfish-mktab
0f00dc4c 108blowfish_mktab_CPPFLAGS = $(AM_CPPFLAGS) -DQUIET
e5b61a8d 109if !CROSS_COMPILING
c9cfa678
MW
110$(precomp)/symm/blowfish-tab.c:
111 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 112 $(AM_V_at)$(MAKE) blowfish-mktab$(EXEEXT)
c9cfa678
MW
113 $(AM_V_GEN)./blowfish-mktab >$(precomp)/symm/blowfish-tab.c.new && \
114 mv $(precomp)/symm/blowfish-tab.c.new \
115 $(precomp)/symm/blowfish-tab.c
e5b61a8d 116endif
0f00dc4c
MW
117
118## Adams and Tavares' `CAST' block ciphers.
119BLKCS += cast128 cast256
e5b61a8d 120libsymm_la_SOURCES += cast-s.c cast-sk.c cast-base.h
3c8d8c60 121cast256.log: t/cast256
0f00dc4c
MW
122EXTRA_DIST += t/cast256.aes
123MAINTAINERCLEANFILES += $(srcdir)/t/cast256
124t/cast256: t/cast256.aes
125 $(AM_V_GEN)$(srcdir)/aes-trans CAST256 \
126 <$(srcdir)/t/cast256.aes \
127 >$(srcdir)/t/cast256.new && \
128 mv $(srcdir)/t/cast256.new $(srcdir)/t/cast256
129
130## IBM's `DES' block cipher, by Feistel, Coppersmith, and others.
131BLKCS += des des3
c9cfa678
MW
132libsymm_la_SOURCES += des-base.h
133nodist_libsymm_la_SOURCES += ../precomp/symm/des-tab.c
134PRECOMPS += $(precomp)/symm/des-tab.c
e5b61a8d
MW
135PRECOMP_PROGS += des-mktab
136if !CROSS_COMPILING
c9cfa678
MW
137$(precomp)/symm/des-tab.c:
138 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 139 $(AM_V_at)$(MAKE) des-mktab$(EXEEXT)
c9cfa678
MW
140 $(AM_V_GEN)./des-mktab >$(precomp)/symm/des-tab.c.new && \
141 mv $(precomp)/symm/des-tab.c.new $(precomp)/symm/des-tab.c
e5b61a8d 142endif
0f00dc4c
MW
143
144## Rivest's `DESX' variant, with pre- and post-whitening.
145BLKCS += desx
e5b61a8d 146libsymm_la_SOURCES += desx-tab.c
0f00dc4c
MW
147
148## Lai and Massey's IDEA.
149BLKCS += idea
150
151## IBM's `MARS' block cipher.
152BLKCS += mars
c9cfa678
MW
153nodist_libsymm_la_SOURCES += ../precomp/symm/mars-tab.c
154PRECOMPS += $(precomp)/symm/mars-tab.c
e5b61a8d
MW
155PRECOMP_PROGS += mars-mktab
156if !CROSS_COMPILING
c9cfa678
MW
157$(precomp)/symm/mars-tab.c:
158 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 159 $(AM_V_at)$(MAKE) mars-mktab$(EXEEXT)
c9cfa678
MW
160 $(AM_V_GEN)./mars-mktab >$(precomp)/symm/mars-tab.c.new && \
161 mv $(precomp)/symm/mars-tab.c.new $(precomp)/symm/mars-tab.c
e5b61a8d 162endif
3c8d8c60 163mars.log: t/mars
0f00dc4c
MW
164EXTRA_DIST += t/mars.aes
165MAINTAINERCLEANFILES += $(srcdir)/t/mars
166t/mars: t/mars.aes
167 $(AM_V_GEN)$(srcdir)/aes-trans Mars \
168 <$(srcdir)/t/mars.aes \
169 >$(srcdir)/t/mars.new && \
170 mv $(srcdir)/t/mars.new $(srcdir)/t/mars
171
172## Daemen, Peeters, Van Assche and Rijmen's `Noekeon'.
173BLKCS += noekeon
174
175## Rivest's `RC2' block cipher.
176BLKCS += rc2
e5b61a8d 177libsymm_la_SOURCES += rc2-tab.c
0f00dc4c
MW
178
179## Rivest's `RC5'.
180BLKCS += rc5
181
182## Daemen and Rijmen's `Rijndael' block cipher, selected as AES.
183BLKCS += rijndael rijndael192 rijndael256
184libsymm_la_SOURCES += rijndael-base.h rijndael-base.c
226639f3 185if CPUFAM_X86
0f23f75f
MW
186libsymm_la_SOURCES += rijndael-x86ish-aesni.S
187endif
188if CPUFAM_AMD64
189libsymm_la_SOURCES += rijndael-x86ish-aesni.S
226639f3 190endif
26e182fc
MW
191if HAVE_AS_ARMV8_CRYPTO
192if CPUFAM_ARMEL
193libsymm_la_SOURCES += rijndael-arm-crypto.S
194endif
195endif
c9cfa678
MW
196nodist_libsymm_la_SOURCES += ../precomp/symm/rijndael-tab.c
197PRECOMPS += $(precomp)/symm/rijndael-tab.c
e5b61a8d
MW
198PRECOMP_PROGS += rijndael-mktab
199if !CROSS_COMPILING
c9cfa678
MW
200$(precomp)/symm/rijndael-tab.c:
201 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 202 $(AM_V_at)$(MAKE) rijndael-mktab$(EXEEXT)
c9cfa678
MW
203 $(AM_V_GEN)./rijndael-mktab >$(precomp)/symm/rijndael-tab.c.new && \
204 mv $(precomp)/symm/rijndael-tab.c.new \
205 $(precomp)/symm/rijndael-tab.c
e5b61a8d 206endif
3c8d8c60 207rijndael.log: t/rijndael
0f00dc4c
MW
208EXTRA_DIST += t/rijndael.aes
209MAINTAINERCLEANFILES += $(srcdir)/t/rijndael
210t/rijndael: t/rijndael.aes
211 $(AM_V_GEN)$(srcdir)/aes-trans Rijndael \
212 <$(srcdir)/t/rijndael.aes \
213 >$(srcdir)/t/rijndael.new && \
214 mv $(srcdir)/t/rijndael.new $(srcdir)/t/rijndael
215
216## Massey's `SAFER' block ciphers.
217BLKCS += safer safersk
c9cfa678
MW
218nodist_libsymm_la_SOURCES += ../precomp/symm/safer-tab.c
219PRECOMPS += $(precomp)/symm/safer-tab.c
e5b61a8d 220PRECOMP_PROGS += safer-mktab
24497005 221STUBS_HDR += SAFER-SK,safersk,safer
84924d42 222STUBS_SRC += safersk,safer
e5b61a8d 223if !CROSS_COMPILING
c9cfa678
MW
224$(precomp)/symm/safer-tab.c:
225 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 226 $(AM_V_at)$(MAKE) safer-mktab$(EXEEXT)
c9cfa678
MW
227 $(AM_V_GEN)./safer-mktab >$(precomp)/symm/safer-tab.c.new && \
228 mv $(precomp)/symm/safer-tab.c.new \
229 $(precomp)/symm/safer-tab.c
e5b61a8d 230endif
0f00dc4c
MW
231
232## Anderson, Biham and Knudsen's `Serpent' block cipher.
233BLKCS += serpent
234libsymm_la_SOURCES += serpent-sbox.h
e5b61a8d 235check_PROGRAMS += serpent-check
0f00dc4c 236TESTS += serpent-check
3c8d8c60 237serpent.log: t/serpent
0f00dc4c
MW
238EXTRA_DIST += t/serpent.aes
239MAINTAINERCLEANFILES += $(srcdir)/t/serpent
240t/serpent: t/serpent.aes
241 $(AM_V_GEN)$(srcdir)/aes-trans Serpent -v rev=1 \
242 <$(srcdir)/t/serpent.aes \
243 >$(srcdir)/t/serpent.new && \
244 mv $(srcdir)/t/serpent.new $(srcdir)/t/serpent
245
246## The National Security Agency's `Skipjack' block cipher. You don't want to
247## use this.
248BLKCS += skipjack
e5b61a8d 249libsymm_la_SOURCES += skipjack-tab.c
0f00dc4c
MW
250
251## Daemen and Rijmen's `Square' block cipher.
252BLKCS += square
c9cfa678
MW
253nodist_libsymm_la_SOURCES += ../precomp/symm/square-tab.c
254PRECOMPS += $(precomp)/symm/square-tab.c
e5b61a8d
MW
255PRECOMP_PROGS += square-mktab
256if !CROSS_COMPILING
c9cfa678
MW
257$(precomp)/symm/square-tab.c:
258 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 259 $(AM_V_at)$(MAKE) square-mktab$(EXEEXT)
c9cfa678
MW
260 $(AM_V_GEN)./square-mktab >$(precomp)/symm/square-tab.c.new && \
261 mv $(precomp)/symm/square-tab.c.new \
262 $(precomp)/symm/square-tab.c
e5b61a8d 263endif
0f00dc4c
MW
264
265## Wheeler and Needham's `TEA' and `XTEA' block ciphers.
266BLKCS += tea xtea
267
268## Schneier, Kelsey, Whiting, Wagner, Hall and Ferguson's `Twofish' block
269## cipher.
270BLKCS += twofish
c9cfa678
MW
271nodist_libsymm_la_SOURCES += ../precomp/symm/twofish-tab.c
272PRECOMPS += $(precomp)/symm/twofish-tab.c
e5b61a8d
MW
273PRECOMP_PROGS += twofish-mktab
274if !CROSS_COMPILING
c9cfa678
MW
275$(precomp)/symm/twofish-tab.c:
276 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 277 $(AM_V_at)$(MAKE) twofish-mktab$(EXEEXT)
c9cfa678
MW
278 $(AM_V_GEN)./twofish-mktab >$(precomp)/symm/twofish-tab.c.new && \
279 mv $(precomp)/symm/twofish-tab.c.new \
280 $(precomp)/symm/twofish-tab.c
e5b61a8d 281endif
3c8d8c60 282twofish.log: t/twofish
0f00dc4c
MW
283EXTRA_DIST += t/twofish.aes
284MAINTAINERCLEANFILES += $(srcdir)/t/twofish
285t/twofish: t/twofish.aes
286 $(AM_V_GEN)$(srcdir)/aes-trans Twofish \
287 <$(srcdir)/t/twofish.aes \
288 >$(srcdir)/t/twofish.new && \
289 mv $(srcdir)/t/twofish.new $(srcdir)/t/twofish
290
291## The old NIST modes for DES.
292BLKCCIPHERMODES += cbc cfb ecb ofb
293
294## Counter mode.
295BLKCCIPHERMODES += counter
296
297###--------------------------------------------------------------------------
298### Hash functions.
299
300HASHES =
301HASHMODES =
302
303HASHCIPHERMODES =
304HASHMODES += $(HASHCIPHERMODES)
305
306HASHMACMODES =
307HASHMODES += $(HASHMACMODES)
308
309## Common definitions for hash functions.
310pkginclude_HEADERS += hash.h
311
312## Source code and headers for the hash functions.
313libsymm_la_SOURCES += $(HASH_C)
314pkginclude_HEADERS += $(HASH_H)
315
316## Lim and KISA's `HAS-160', recommended for use with KCDSA.
317HASHES += has160
318
319## Rivest's `MD' series of hash functions
320HASHES += md2 md4 md5
e5b61a8d 321libsymm_la_SOURCES += md2-tab.c
0f00dc4c
MW
322
323## Dobbertin, Bosselaers and Preneel's `RIPEMD' suite.
324HASHES += rmd128 rmd160 rmd256 rmd320
325
326## The National Security Agency's `SHA-1' hash function.
327HASHES += sha
328
329## The National Security Agency's `SHA-2' suite.
330HASHES += sha224 sha256
12a5df42 331HASHES += sha384 sha512 sha512/224 sha512/256
24497005
MW
332STUBS_HDR += SHA-224,sha224,sha256
333STUBS_HDR += SHA-384,sha384,sha512
12a5df42
MW
334STUBS_HDR += SHA-512/256,sha512-256,sha512
335STUBS_HDR += SHA-512/224,sha512-224,sha512
84924d42
MW
336STUBS_SRC += sha224,sha256
337STUBS_SRC += sha384,sha512
12a5df42
MW
338STUBS_SRC += sha512-256,sha512
339STUBS_SRC += sha512-224,sha512
0f00dc4c
MW
340
341## Anderson and Biham's `Tiger' hash function.
342HASHES += tiger
c9cfa678
MW
343libsymm_la_SOURCES += tiger-base.h
344nodist_libsymm_la_SOURCES += ../precomp/symm/tiger-tab.c
345PRECOMPS += $(precomp)/symm/tiger-tab.c
e5b61a8d
MW
346PRECOMP_PROGS += tiger-mktab
347if !CROSS_COMPILING
c9cfa678
MW
348$(precomp)/symm/tiger-tab.c:
349 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 350 $(AM_V_at)$(MAKE) tiger-mktab$(EXEEXT)
c9cfa678
MW
351 $(AM_V_GEN)./tiger-mktab >$(precomp)/symm/tiger-tab.c.new && \
352 mv $(precomp)/symm/tiger-tab.c.new \
353 $(precomp)/symm/tiger-tab.c
e5b61a8d 354endif
0f00dc4c
MW
355
356## Barreto and Rijmen's `Whirlpool' hash function.
357HASHES += whirlpool whirlpool256
c9cfa678
MW
358nodist_libsymm_la_SOURCES += ../precomp/symm/whirlpool-tab.c
359PRECOMPS += $(precomp)/symm/whirlpool-tab.c
e5b61a8d 360PRECOMP_PROGS += whirlpool-mktab
24497005 361STUBS_HDR += Whirlpool-256,whirlpool256,whirlpool
84924d42 362STUBS_SRC += whirlpool256,whirlpool
e5b61a8d 363if !CROSS_COMPILING
c9cfa678
MW
364$(precomp)/symm/whirlpool-tab.c:
365 $(AM_V_at)$(MKDIR_P) $(precomp)/symm
ba57d652 366 $(AM_V_at)$(MAKE) whirlpool-mktab$(EXEEXT)
c9cfa678
MW
367 $(AM_V_GEN)./whirlpool-mktab \
368 >$(precomp)/symm/whirlpool-tab.c.new && \
369 mv $(precomp)/symm/whirlpool-tab.c.new \
370 $(precomp)/symm/whirlpool-tab.c
e5b61a8d 371endif
0f00dc4c
MW
372
373## Bellare, Canetti and Krawczyk's `HMAC' mode for message authentication.
374HASHMACMODES += hmac
375
376## MGF1, used in OAEP and PSS.
377HASHCIPHERMODES += mgf
378
379###--------------------------------------------------------------------------
380### Other symmetric primitives.
381
382## The CRC32 algorithm, which is useful, but has no worthwhile security.
383pkginclude_HEADERS += crc32.h
384libsymm_la_SOURCES += crc32.c
385ALL_HASHES += crc32=gcrc32
386
387## Rivest's `RC4' stream cipher.
388pkginclude_HEADERS += rc4.h
389libsymm_la_SOURCES += rc4.c
ba57d652 390TESTS += rc4.t$(EXEEXT)
0f00dc4c
MW
391EXTRA_DIST += t/rc4
392ALL_CIPHERS += rc4
393
394## Coppersmith and Rogaway's `SEAL' pseudorandom function.
395pkginclude_HEADERS += seal.h
396libsymm_la_SOURCES += seal.c
ba57d652 397TESTS += seal.t$(EXEEXT)
0f00dc4c
MW
398EXTRA_DIST += t/seal
399ALL_CIPHERS += seal
400
194e93f2
MW
401## Bernstein's `Salsa20' stream cipher. Most of the test vectors come from
402## the eSTREAM project, captured by the Internet Archive's Wayback Machine at
403##
404## http://web.archive.org/web/20070814004154/http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20.tar.gz?view=tar
405##
406## and automatically converted into the format we want.
407EXTRA_DIST += salsa20-tvconv
408pkginclude_HEADERS += salsa20.h salsa20-core.h
409libsymm_la_SOURCES += salsa20.c
e10e6494 410if CPUFAM_X86
0f23f75f
MW
411libsymm_la_SOURCES += salsa20-x86ish-sse2.S
412endif
413if CPUFAM_AMD64
414libsymm_la_SOURCES += salsa20-x86ish-sse2.S
e10e6494 415endif
704d59c8
MW
416if CPUFAM_ARMEL
417libsymm_la_SOURCES += salsa20-arm-neon.S
418endif
ba57d652 419TESTS += salsa20.t$(EXEEXT)
194e93f2 420ALL_CIPHERS += salsa20 salsa2012 salsa208
1778ca95 421ALL_CIPHERS += salsa20-ietf salsa2012-ietf salsa208-ietf
194e93f2
MW
422ALL_CIPHERS += xsalsa20 xsalsa2012 xsalsa208
423STUBS_HDR += Salsa20/12,salsa2012,salsa20
424STUBS_HDR += Salsa20/8,salsa208,salsa20
1778ca95
MW
425STUBS_HDR += Salsa20-IETF,salsa20-ietf,salsa20
426STUBS_HDR += Salsa20/12-IETF,salsa2012-ietf,salsa20
427STUBS_HDR += Salsa20/8-IETF,salsa208-ietf,salsa20
194e93f2
MW
428STUBS_HDR += XSalsa20,xsalsa20,salsa20
429STUBS_HDR += XSalsa20/12,xsalsa2012,salsa20
430STUBS_HDR += XSalsa20/8,xsalsa208,salsa20
431EXTRA_DIST += t/salsa20
432MAINTAINERCLEANFILES += t/salsa20
3c8d8c60 433salsa20.log: t/salsa20
194e93f2
MW
434SALSA20_ESTREAM_TV = t/salsa20.estream
435SALSA20_ESTREAM_TV += t/salsa2012.estream
436SALSA20_ESTREAM_TV += t/salsa208.estream
437EXTRA_DIST += t/salsa20.local $(SALSA20_ESTREAM_TV)
438t/salsa20: salsa20-tvconv t/salsa20.local $(SALSA20_ESTREAM_TV)
439 $(AM_V_GEN)cd $(srcdir) && \
440 { echo "### GENERATED by salsa20-tvconv" && \
441 cat t/salsa20.local && \
442 ./salsa20-tvconv $(SALSA20_ESTREAM_TV); \
443 } >t/salsa20.new && \
444 mv t/salsa20.new t/salsa20
445
55d81656
MW
446## Bernstein's `ChaCha' stream cipher.
447pkginclude_HEADERS += chacha.h chacha-core.h
448libsymm_la_SOURCES += chacha.c
e10e6494 449if CPUFAM_X86
0f23f75f
MW
450libsymm_la_SOURCES += chacha-x86ish-sse2.S
451endif
452if CPUFAM_AMD64
453libsymm_la_SOURCES += chacha-x86ish-sse2.S
e10e6494 454endif
704d59c8
MW
455if CPUFAM_ARMEL
456libsymm_la_SOURCES += chacha-arm-neon.S
457endif
ba57d652 458TESTS += chacha.t$(EXEEXT)
55d81656
MW
459EXTRA_DIST += t/chacha
460ALL_CIPHERS += chacha20 chacha12 chacha8
1778ca95 461ALL_CIPHERS += chacha20-ietf chacha12-ietf chacha8-ietf
55d81656
MW
462ALL_CIPHERS += xchacha20 xchacha12 xchacha8
463STUBS_HDR += ChaCha20,chacha20,chacha
464STUBS_HDR += ChaCha12,chacha12,chacha
465STUBS_HDR += ChaCha8,chacha8,chacha
1778ca95
MW
466STUBS_HDR += ChaCha20-IETF,chacha20-ietf,chacha
467STUBS_HDR += ChaCha12-IETF,chacha12-ietf,chacha
468STUBS_HDR += ChaCha8-IETF,chacha8-ietf,chacha
55d81656
MW
469STUBS_HDR += XChaCha20,xchacha20,chacha
470STUBS_HDR += XChaCha12,xchacha12,chacha
471STUBS_HDR += XChaCha8,xchacha8,chacha
472
57496a50
MW
473## Bernstein's `Poly1305' message authentication code.
474pkginclude_HEADERS += poly1305.h
475libsymm_la_SOURCES += poly1305.c
476TESTS += poly1305.t$(EXEEXT)
477TESTS += poly1305-p11.t$(EXEEXT)
478EXTRA_DIST += t/poly1305
479
480check_PROGRAMS += poly1305-p11.t
481poly1305_p11_t_SOURCES = poly1305.c
482poly1305_p11_t_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_RIG -DSRCDIR="\"$(srcdir)\""
483poly1305_p11_t_CPPFLAGS += -DPOLY1305_IMPL=11
484poly1305_p11_t_LDADD = $(TEST_LIBS) $(top_builddir)/libcatacomb.la
485poly1305_p11_t_LDADD += $(mLib_LIBS) $(CATACOMB_LIBS) $(LIBS)
486
0f00dc4c
MW
487###--------------------------------------------------------------------------
488### Autogenerated mode implementations.
489
490## The master stamp file, indicating that we generated all of the sources.
0f00dc4c 491EXTRA_DIST += mode.h.in mode.c.in
e5b61a8d
MW
492EXTRA_DIST += modes/gen-stamp
493MAINTAINERCLEANFILES += modes/gen-stamp
77843a37 494modes/gen-stamp: Makefile.am
e5b61a8d 495 $(AM_V_at)$(MKDIR_P) $(srcdir)/modes
0f00dc4c 496 $(AM_V_GEN)$(multigen) -g $(srcdir)/mode.c.in \
aaae9cab 497 $(srcdir)/modes/@{base:f}-@mode.c \
0f00dc4c
MW
498 base="$(BLKCS)" mode="$(BLKCMODES)"
499 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
aaae9cab 500 $(srcdir)/modes/@{base:f}-@mode.h \
0f00dc4c
MW
501 base="$(BLKCS)" mode="$(BLKCMODES)"
502 $(AM_V_at)$(multigen) -g $(srcdir)/mode.c.in \
aaae9cab 503 $(srcdir)/modes/@{base:f}-@mode.c \
0f00dc4c
MW
504 base="$(HASHES)" mode="$(HASHMODES)"
505 $(AM_V_at)$(multigen) -g $(srcdir)/mode.h.in \
aaae9cab 506 $(srcdir)/modes/@{base:f}-@mode.h \
0f00dc4c 507 base="$(HASHES)" mode="$(HASHMODES)"
e5b61a8d 508 $(AM_V_at)touch $(srcdir)/modes/gen-stamp
0f00dc4c
MW
509
510## The individual mode interfaces and implementations.
511pkginclude_HEADERS += $(MODE_H)
512
513## Generated implementations.
514BUILT_SOURCES += $(GENMODES_C)
e5b61a8d 515MAINTAINERCLEANFILES += $(GENMODES_C)
ef75f314 516libsymm_la_SOURCES += $(GENMODES_C)
0f00dc4c
MW
517$(GENMODES_C): modes/gen-stamp
518
519## Generated interfaces.
520BUILT_SOURCES += $(GENMODES_H)
e5b61a8d 521MAINTAINERCLEANFILES += $(GENMODES_H)
ef75f314 522pkginclude_HEADERS += $(GENMODES_H)
0f00dc4c
MW
523$(GENMODES_H): modes/gen-stamp
524
525###--------------------------------------------------------------------------
24497005
MW
526### Autogenerated stub headers.
527
528## The master stamp file.
529EXTRA_DIST += stub.h.in
530EXTRA_DIST += stubs.gen-stamp
531MAINTAINERCLEANFILES += stubs.gen-stamp
532stubs.gen-stamp: Makefile.am
533 $(AM_V_at)$(MKDIR_P) $(srcdir)/stubs
534 $(AM_V_GEN)$(multigen) -g $(srcdir)/stub.h.in \
535 $(srcdir)/@name.h descr,name,base="$(STUBS_HDR)"
536 $(AM_V_GEN)$(multigen) -g $(srcdir)/stub.c.in \
e91853c1 537 $(srcdir)/@name.c name,base="$(STUBS_SRC)"
24497005
MW
538 $(AM_V_at)touch $(srcdir)/stubs.gen-stamp
539
540## Generated stub headers.
541BUILT_SOURCES += $(STUB_H) $(STUB_C)
542MAINTAINERCLEANFILES += $(STUB_H) $(STUB_C)
543pkginclude_HEADERS += $(STUB_H)
544$(STUB_H) $(STUB_C): stubs.gen-stamp
545
546###--------------------------------------------------------------------------
0f00dc4c
MW
547### Tables of classes for encryption, hashing, and message authentication.
548
549## The skeleton for the class tables.
550EXTRA_DIST += gthingtab.c.in
551
552## Table of cipher classes.
553pkginclude_HEADERS += gcipher.h
554CLEANFILES += gciphertab.c
555nodist_libsymm_la_SOURCES += gciphertab.c
77843a37 556gciphertab.c: gthingtab.c.in Makefile.am
0f00dc4c
MW
557 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gciphertab.c \
558 what=gcipher cls=gccipher thing="$(ALL_CIPHERS)"
559
560## Table of hash classes.
561pkginclude_HEADERS += ghash.h ghash-def.h
562CLEANFILES += ghashtab.c
563nodist_libsymm_la_SOURCES += ghashtab.c
77843a37 564ghashtab.c: gthingtab.c.in Makefile.am
0f00dc4c
MW
565 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in ghashtab.c \
566 what=ghash cls=gchash thing="$(ALL_HASHES)"
567
568## Table of MAC classes.
569pkginclude_HEADERS += gmac.h
570CLEANFILES += gmactab.c
571nodist_libsymm_la_SOURCES += gmactab.c
77843a37 572gmactab.c: gthingtab.c.in Makefile.am
0f00dc4c
MW
573 $(AM_V_GEN)$(multigen) -g $(srcdir)/gthingtab.c.in gmactab.c \
574 what=gmac cls=gcmac thing="$(ALL_MACS)"
575
576###--------------------------------------------------------------------------
577### Testing.
578
579## Run the test programs.
580TESTS += $(SYMM_TESTS)
581EXTRA_DIST += $(SYMM_TEST_FILES)
582
583## A piece of sample text for round-trip testing encryption modes.
584EXTRA_DIST += daftstory.h
585
586## Clean the debris from the `modes' subdirectory.
ba57d652 587CLEANFILES += modes/*.to modes/*.t$(EXEEXT)
0f00dc4c
MW
588
589###----- That's all, folks --------------------------------------------------