- print ('\t_("%(prim)s-%(mode)s", %(prim)s_%(mode)skeysz, ' +
- '%(prim)s_%(mode)srand, 0) \\') % \
- {'prim': i[0], 'mode': i[1]}
-print '\t_("rc4", rc4_keysz, rc4_rand, 0) \\'
-print '\t_("seal", seal_keysz, seal_rand, RNGF_INT) \\'
+ print ('\t_("%(prim)s-%(mode)s", %(primid)s_%(mode)skeysz, ' +
+ '%(primid)s_%(mode)srand, RNG_PLAIN, 0) \\') % \
+ {'prim': i[0], 'mode': i[1],
+ 'primid': i[0].replace('-', '_').replace('/', '_')}
+print '\t_("rc4", rc4_keysz, rc4_rand, 0, 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):
+ root = r
+ 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, ' +
+ 'RNG_LATIN, %(ROOT)s_NONCESZ) \\') % \
+ {'name': i, 'id': i.replace('/', '').replace('-', '_'),
+ 'root': root, 'ROOT': root.upper()}
+for i in [128, 256]:
+ print ('\t_("shake%(w)d", shake%(w)d_keysz, cshake%(w)d_rand, ' +
+ 'RNG_SHAKE, 0) \\') % \
+ {'w': i}
+ print ('\t_("kmac%(w)d", kmac%(w)d_keysz, kmac%(w)d_rand, ' +
+ 'RNG_KMAC, 0) \\') % \
+ {'w': i}