X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb-python/blobdiff_plain/3f4f64b80b775c630201089785c43e1af24060bb..348254521f404f683d0230a84ae4943c9d20e51c:/algorithms.py diff --git a/algorithms.py b/algorithms.py index 3ceb207..a7a2caa 100644 --- a/algorithms.py +++ b/algorithms.py @@ -30,8 +30,12 @@ streamciphers = ''' rc4 seal '''.split() latindances = ''' -salsa20 salsa20/12 salsa20/8 xsalsa20 xsalsa20/12 xsalsa20/8 -chacha20 chacha12 chacha8 xchacha20 xchacha12 xchacha8 +salsa20 salsa20/12 salsa20/8 +salsa20-ietf salsa20/12-ietf salsa20/8-ietf +xsalsa20 xsalsa20/12 xsalsa20/8 +chacha20 chacha12 chacha8 +chacha20-ietf chacha12-ietf chacha8-ietf +xchacha20 xchacha12 xchacha8 '''.split() streamciphers += map(lambda s: s.translate(None, '/'), latindances) hashes = ''' @@ -69,14 +73,14 @@ print print '#define RNGS(_) \\' for i in (cross(prps, ['ofb', 'counter'])): print ('\t_("%(prim)s-%(mode)s", %(prim)s_keysz, ' + - '%(prim)s_%(mode)srand, 0, 0) \\') % \ + '%(prim)s_%(mode)srand, RNG_PLAIN, 0) \\') % \ {'prim': i[0], 'mode': i[1]} for i in (cross(hashes, 'mgf')): print ('\t_("%(prim)s-%(mode)s", %(prim)s_%(mode)skeysz, ' + - '%(prim)s_%(mode)srand, 0, 0) \\') % \ + '%(prim)s_%(mode)srand, RNG_PLAIN, 0) \\') % \ {'prim': i[0], 'mode': i[1]} print '\t_("rc4", rc4_keysz, rc4_rand, 0, 0) \\' -print '\t_("seal", seal_keysz, seal_rand, RNGF_INT, 0) \\' +print '\t_("seal", seal_keysz, seal_rand, RNG_SEAL, 0) \\' for i in latindances: for r in ['salsa20', 'xsalsa20', 'chacha', 'xchacha']: if i.startswith(r): @@ -84,9 +88,10 @@ for i in latindances: break else: raise ValueError, 'failed to find root name for %s' % i + if i.endswith('-ietf'): root += '_ietf' print ('\t_("%(name)s", %(root)s_keysz, %(id)s_rand, ' + - 'RNGF_NONCE, %(ROOT)s_NONCESZ) \\') % \ - {'name': i, 'id': i.translate(None, '/'), + 'RNG_LATIN, %(ROOT)s_NONCESZ) \\') % \ + {'name': i, 'id': i.translate(None, '/').replace('-', '_'), 'root': root, 'ROOT': root.upper()} print '\t/* end */' print