7 if type(x) is not tuple and type(x) is not list:
11 for j in cross(*seq[1:]):
23 square rijndael rijndael192 rijndael256
27 ecb cbc cfb ofb counter
33 salsa20 salsa20/12 salsa20/8
34 salsa20-ietf salsa20/12-ietf salsa20/8-ietf
35 xsalsa20 xsalsa20/12 xsalsa20/8
36 chacha20 chacha12 chacha8
37 chacha20-ietf chacha12-ietf chacha8-ietf
38 xchacha20 xchacha12 xchacha8
40 streamciphers += map(lambda s: s.replace('/', ''), latindances)
42 md2 md4 md5 tiger has160
43 sha sha224 sha256 sha512/224 sha512/256 sha384 sha512
44 rmd128 rmd160 rmd256 rmd320
45 whirlpool whirlpool256
46 sha3-224 sha3-256 sha3-384 sha3-512
52 print '/* algorithms.h [generated] */'
56 print '#include <catacomb/%s.h>' % i.replace('/', '-')
58 print '#include <catacomb/%s-%s.h>' % (i.replace('/', '-'), j)
59 for i in streamciphers:
60 print '#include <catacomb/%s.h>' % i.replace('/', '-')
63 print '#include <catacomb/%s.h>' % i.replace('/', '-')
65 print '#include <catacomb/%s-%s.h>' % (i.replace('/', '-'), j)
68 print '#define PRPS(_) \\'
70 print '\t_(%s, %s) \\' % (i.upper(), i)
74 print '#define RNGS(_) \\'
75 for i in (cross(prps, ['ofb', 'counter'])):
76 print ('\t_("%(prim)s-%(mode)s", %(primid)s_keysz, ' +
77 '%(primid)s_%(mode)srand, RNG_PLAIN, 0) \\') % \
78 {'prim': i[0], 'mode': i[1],
79 'primid': i[0].replace('-', '_').replace('/', '_')}
80 for i in (cross(hashes, 'mgf')):
81 print ('\t_("%(prim)s-%(mode)s", %(primid)s_%(mode)skeysz, ' +
82 '%(primid)s_%(mode)srand, RNG_PLAIN, 0) \\') % \
83 {'prim': i[0], 'mode': i[1],
84 'primid': i[0].replace('-', '_').replace('/', '_')}
85 print '\t_("rc4", rc4_keysz, rc4_rand, 0, 0) \\'
86 print '\t_("seal", seal_keysz, seal_rand, RNG_SEAL, 0) \\'
88 for r in ['salsa20', 'xsalsa20', 'chacha', 'xchacha']:
93 raise ValueError, 'failed to find root name for %s' % i
94 if i.endswith('-ietf'): root += '_ietf'
95 print ('\t_("%(name)s", %(root)s_keysz, %(id)s_rand, ' +
96 'RNG_LATIN, %(ROOT)s_NONCESZ) \\') % \
97 {'name': i, 'id': i.replace('/', '').replace('-', '_'),
98 'root': root, 'ROOT': root.upper()}
100 print ('\t_("shake%(w)d", shake%(w)d_keysz, cshake%(w)d_rand, ' +
101 'RNG_SHAKE, 0) \\') % \
103 print ('\t_("kmac%(w)d", kmac%(w)d_keysz, kmac%(w)d_rand, ' +
104 'RNG_KMAC, 0) \\') % \