base/permute.h, utils/permute.lisp, symm/...: Formalize bit permutations.
[catacomb] / symm / desx.c
index 14115a5..e3737cc 100644 (file)
@@ -39,6 +39,7 @@
 #include "des.h"
 #include "desx.h"
 #include "gcipher.h"
+#include "permute.h"
 
 /*----- Tables ------------------------------------------------------------*/
 
@@ -123,6 +124,9 @@ void desx_init(desx_ctx *k, const void *buf, size_t sz)
 
 void desx_eblk(const desx_ctx *k, const uint32 *s, uint32 *d)
 {
+#define REGWD 32
+  typedef uint32 regty;
+
   uint32 x = s[0], y = s[1];
   x ^= k->prea; y ^= k->preb;
   DES_IP(x, y);
@@ -130,10 +134,15 @@ void desx_eblk(const desx_ctx *k, const uint32 *s, uint32 *d)
   DES_IPINV(x, y);
   x ^= k->posta; y ^= k->postb;
   d[0] = x, d[1] = y;
+
+#undef REGWD
 }
 
 void desx_dblk(const desx_ctx *k, const uint32 *s, uint32 *d)
 {
+#define REGWD 32
+  typedef uint32 regty;
+
   uint32 x = s[0], y = s[1];
   x ^= k->posta; y ^= k->postb;
   DES_IP(x, y);
@@ -141,6 +150,8 @@ void desx_dblk(const desx_ctx *k, const uint32 *s, uint32 *d)
   DES_IPINV(x, y);
   x ^= k->prea; y ^= k->preb;
   d[0] = x, d[1] = y;
+
+#undef REGWD
 }
 
 BLKC_TEST(DESX, desx)