base/permute.h, utils/permute.lisp, symm/...: Formalize bit permutations.
[catacomb] / symm / des3.c
index dedd9f2..92a6f2a 100644 (file)
@@ -38,6 +38,7 @@
 #include "des-base.h"
 #include "des.h"
 #include "des3.h"
+#include "permute.h"
 #include "gcipher.h"
 
 /*----- Global variables --------------------------------------------------*/
@@ -92,6 +93,9 @@ void des3_init(des3_ctx *k, const void *buf, size_t sz)
 
 void des3_eblk(const des3_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->a.k, x, y, x, y);
@@ -99,10 +103,15 @@ void des3_eblk(const des3_ctx *k, const uint32 *s, uint32 *d)
   DES_EBLK(k->c.k, x, y, x, y);
   DES_IPINV(x, y);
   d[0] = x, d[1] = y;
+
+#undef REGWD
 }
 
 void des3_dblk(const des3_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->c.k, x, y, x, y);
@@ -110,6 +119,8 @@ void des3_dblk(const des3_ctx *k, const uint32 *s, uint32 *d)
   DES_DBLK(k->a.k, x, y, x, y);
   DES_IPINV(x, y);
   d[0] = x, d[1] = y;
+
+#undef REGWD
 }
 
 BLKC_TEST(DES3, des3)