base/permute.h, utils/permute.lisp, symm/...: Formalize bit permutations.
[catacomb] / symm / des.c
index 06400a1..e751cf0 100644 (file)
@@ -37,6 +37,7 @@
 #include "blkc.h"
 #include "des-base.h"
 #include "des.h"
+#include "permute.h"
 #include "gcipher.h"
 
 /*----- Global variables --------------------------------------------------*/
@@ -258,20 +259,30 @@ void des_init(des_ctx *k, const void *buf, size_t sz)
 
 void des_eblk(const des_ctx *k, const uint32 *s, uint32 *d)
 {
+#define REGWD 32
+  typedef uint32 regty;
+
   uint32 x = s[0], y = s[1];
   DES_IP(x, y);
   DES_EBLK(k->k, x, y, x, y);
   DES_IPINV(x, y);
   d[0] = x, d[1] = y;
+
+#undef REGWD
 }
 
 void des_dblk(const des_ctx *k, const uint32 *s, uint32 *d)
 {
+#define REGWD 32
+  typedef uint32 regty;
+
   uint32 x = s[0], y = s[1];
   DES_IP(x, y);
   DES_DBLK(k->k, x, y, x, y);
   DES_IPINV(x, y);
   d[0] = x, d[1] = y;
+
+#undef REGWD
 }
 
 BLKC_TEST(DES, des)