-static void alg_serpent_encrypt(const void *sch, const void *in, void *out) {
- serpent_encrypt(in, out, sch);
-}
-
-static void alg_serpent_decrypt(const void *sch, const void *in, void *out) {
- serpent_decrypt(in, out, sch);
-}
+#define ALIAS(alias,name,NAME)
+#define DO(name,NAME) \
+ static void alg_##name##_makekey(void *sch, const void *key, int keylen) { \
+ name##_set_key(sch, keylen, key); \
+ } \
+ static void alg_##name##_encr(const void *sch, const void *in, void *out) { \
+ name##_encrypt((void*)sch, NAME##_BLOCK_SIZE, out, in); \
+ } \
+ static void alg_##name##_decr(const void *sch, const void *in, void *out) { \
+ name##_decrypt((void*)sch, NAME##_BLOCK_SIZE, out, in); \
+ }
+ NETTLE_BLOCKCIPHERS
+#undef DO
+#undef ALIAS
+
+const BlockCipherAlgInfo cht_blockcipheralginfo_entries[]= {
+#define ALIAS(alias,name,NAME) \
+ { #alias, NAME##_BLOCK_SIZE, sizeof(struct name##_ctx), \
+ NAME##_MIN_KEY_SIZE, NAME##_MAX_KEY_SIZE, \
+ { alg_##name##_makekey, alg_##name##_encr }, \
+ { alg_##name##_makekey, alg_##name##_decr } \
+ },
+#define DO(name,NAME) ALIAS(name,name,NAME)
+ NETTLE_BLOCKCIPHERS
+#undef DO
+#undef ALIAS
+ { 0 }
+};