aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/serpent_simd
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-06-03 13:05:18 +0000
committerlloyd <[email protected]>2011-06-03 13:05:18 +0000
commit1a093ca23da0481e4509dc1c4bf324118adf64b5 (patch)
treef64121f89a7491da5646402df8ae771e7d753aec /src/block/serpent_simd
parent26d63a04dc6bb563c749dacb82a7c3c52eeed769 (diff)
Fix building with --via-amalgamation; it wouldn't generate the
amalgamation properly, but would happen to work if a previously written amalgamation was around. Also make changes allowing using the SIMD optimized versions of SHA-1 and Serpent to be used in the amalgamation.
Diffstat (limited to 'src/block/serpent_simd')
-rw-r--r--src/block/serpent_simd/info.txt4
-rw-r--r--src/block/serpent_simd/serp_simd.cpp433
-rw-r--r--src/block/serpent_simd/serp_simd_sbox.h425
3 files changed, 432 insertions, 430 deletions
diff --git a/src/block/serpent_simd/info.txt b/src/block/serpent_simd/info.txt
index b6628d1d4..cd1a0dc7e 100644
--- a/src/block/serpent_simd/info.txt
+++ b/src/block/serpent_simd/info.txt
@@ -13,7 +13,3 @@ serp_simd.cpp
<header:public>
serp_simd.h
</header:public>
-
-<header:internal>
-serp_simd_sbox.h
-</header:internal>
diff --git a/src/block/serpent_simd/serp_simd.cpp b/src/block/serpent_simd/serp_simd.cpp
index babe68d40..2b5e429fc 100644
--- a/src/block/serpent_simd/serp_simd.cpp
+++ b/src/block/serpent_simd/serp_simd.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/serp_simd.h>
-#include <botan/internal/serp_simd_sbox.h>
#include <botan/internal/simd_32.h>
#include <botan/loadstor.h>
@@ -14,6 +13,420 @@ namespace Botan {
namespace {
+#define SBoxE1(B0, B1, B2, B3) \
+ do { \
+ B3 ^= B0; \
+ SIMD_32 B4 = B1; \
+ B1 &= B3; \
+ B4 ^= B2; \
+ B1 ^= B0; \
+ B0 |= B3; \
+ B0 ^= B4; \
+ B4 ^= B3; \
+ B3 ^= B2; \
+ B2 |= B1; \
+ B2 ^= B4; \
+ B4 = ~B4; \
+ B4 |= B1; \
+ B1 ^= B3; \
+ B1 ^= B4; \
+ B3 |= B0; \
+ B1 ^= B3; \
+ B4 ^= B3; \
+ B3 = B0; \
+ B0 = B1; \
+ B1 = B4; \
+ } while(0);
+
+#define SBoxE2(B0, B1, B2, B3) \
+ do { \
+ B0 = ~B0; \
+ B2 = ~B2; \
+ SIMD_32 B4 = B0; \
+ B0 &= B1; \
+ B2 ^= B0; \
+ B0 |= B3; \
+ B3 ^= B2; \
+ B1 ^= B0; \
+ B0 ^= B4; \
+ B4 |= B1; \
+ B1 ^= B3; \
+ B2 |= B0; \
+ B2 &= B4; \
+ B0 ^= B1; \
+ B1 &= B2; \
+ B1 ^= B0; \
+ B0 &= B2; \
+ B4 ^= B0; \
+ B0 = B2; \
+ B2 = B3; \
+ B3 = B1; \
+ B1 = B4; \
+ } while(0);
+
+#define SBoxE3(B0, B1, B2, B3) \
+ do { \
+ SIMD_32 B4 = B0; \
+ B0 &= B2; \
+ B0 ^= B3; \
+ B2 ^= B1; \
+ B2 ^= B0; \
+ B3 |= B4; \
+ B3 ^= B1; \
+ B4 ^= B2; \
+ B1 = B3; \
+ B3 |= B4; \
+ B3 ^= B0; \
+ B0 &= B1; \
+ B4 ^= B0; \
+ B1 ^= B3; \
+ B1 ^= B4; \
+ B0 = B2; \
+ B2 = B1; \
+ B1 = B3; \
+ B3 = ~B4; \
+ } while(0);
+
+#define SBoxE4(B0, B1, B2, B3) \
+ do { \
+ SIMD_32 B4 = B0; \
+ B0 |= B3; \
+ B3 ^= B1; \
+ B1 &= B4; \
+ B4 ^= B2; \
+ B2 ^= B3; \
+ B3 &= B0; \
+ B4 |= B1; \
+ B3 ^= B4; \
+ B0 ^= B1; \
+ B4 &= B0; \
+ B1 ^= B3; \
+ B4 ^= B2; \
+ B1 |= B0; \
+ B1 ^= B2; \
+ B0 ^= B3; \
+ B2 = B1; \
+ B1 |= B3; \
+ B0 ^= B1; \
+ B1 = B2; \
+ B2 = B3; \
+ B3 = B4; \
+ } while(0);
+
+#define SBoxE5(B0, B1, B2, B3) \
+ do { \
+ B1 ^= B3; \
+ B3 = ~B3; \
+ B2 ^= B3; \
+ B3 ^= B0; \
+ SIMD_32 B4 = B1; \
+ B1 &= B3; \
+ B1 ^= B2; \
+ B4 ^= B3; \
+ B0 ^= B4; \
+ B2 &= B4; \
+ B2 ^= B0; \
+ B0 &= B1; \
+ B3 ^= B0; \
+ B4 |= B1; \
+ B4 ^= B0; \
+ B0 |= B3; \
+ B0 ^= B2; \
+ B2 &= B3; \
+ B0 = ~B0; \
+ B4 ^= B2; \
+ B2 = B0; \
+ B0 = B1; \
+ B1 = B4; \
+ } while(0);
+
+#define SBoxE6(B0, B1, B2, B3) \
+ do { \
+ B0 ^= B1; \
+ B1 ^= B3; \
+ B3 = ~B3; \
+ SIMD_32 B4 = B1; \
+ B1 &= B0; \
+ B2 ^= B3; \
+ B1 ^= B2; \
+ B2 |= B4; \
+ B4 ^= B3; \
+ B3 &= B1; \
+ B3 ^= B0; \
+ B4 ^= B1; \
+ B4 ^= B2; \
+ B2 ^= B0; \
+ B0 &= B3; \
+ B2 = ~B2; \
+ B0 ^= B4; \
+ B4 |= B3; \
+ B4 ^= B2; \
+ B2 = B0; \
+ B0 = B1; \
+ B1 = B3; \
+ B3 = B4; \
+ } while(0);
+
+#define SBoxE7(B0, B1, B2, B3) \
+ do { \
+ B2 = ~B2; \
+ SIMD_32 B4 = B3; \
+ B3 &= B0; \
+ B0 ^= B4; \
+ B3 ^= B2; \
+ B2 |= B4; \
+ B1 ^= B3; \
+ B2 ^= B0; \
+ B0 |= B1; \
+ B2 ^= B1; \
+ B4 ^= B0; \
+ B0 |= B3; \
+ B0 ^= B2; \
+ B4 ^= B3; \
+ B4 ^= B0; \
+ B3 = ~B3; \
+ B2 &= B4; \
+ B3 ^= B2; \
+ B2 = B4; \
+ } while(0);
+
+#define SBoxE8(B0, B1, B2, B3) \
+ do { \
+ SIMD_32 B4 = B1; \
+ B1 |= B2; \
+ B1 ^= B3; \
+ B4 ^= B2; \
+ B2 ^= B1; \
+ B3 |= B4; \
+ B3 &= B0; \
+ B4 ^= B2; \
+ B3 ^= B1; \
+ B1 |= B4; \
+ B1 ^= B0; \
+ B0 |= B4; \
+ B0 ^= B2; \
+ B1 ^= B4; \
+ B2 ^= B1; \
+ B1 &= B0; \
+ B1 ^= B4; \
+ B2 = ~B2; \
+ B2 |= B0; \
+ B4 ^= B2; \
+ B2 = B1; \
+ B1 = B3; \
+ B3 = B0; \
+ B0 = B4; \
+ } while(0);
+
+#define SBoxD1(B0, B1, B2, B3) \
+ do { \
+ B2 = ~B2; \
+ SIMD_32 B4 = B1; \
+ B1 |= B0; \
+ B4 = ~B4; \
+ B1 ^= B2; \
+ B2 |= B4; \
+ B1 ^= B3; \
+ B0 ^= B4; \
+ B2 ^= B0; \
+ B0 &= B3; \
+ B4 ^= B0; \
+ B0 |= B1; \
+ B0 ^= B2; \
+ B3 ^= B4; \
+ B2 ^= B1; \
+ B3 ^= B0; \
+ B3 ^= B1; \
+ B2 &= B3; \
+ B4 ^= B2; \
+ B2 = B1; \
+ B1 = B4; \
+ } while(0);
+
+#define SBoxD2(B0, B1, B2, B3) \
+ do { \
+ SIMD_32 B4 = B1; \
+ B1 ^= B3; \
+ B3 &= B1; \
+ B4 ^= B2; \
+ B3 ^= B0; \
+ B0 |= B1; \
+ B2 ^= B3; \
+ B0 ^= B4; \
+ B0 |= B2; \
+ B1 ^= B3; \
+ B0 ^= B1; \
+ B1 |= B3; \
+ B1 ^= B0; \
+ B4 = ~B4; \
+ B4 ^= B1; \
+ B1 |= B0; \
+ B1 ^= B0; \
+ B1 |= B4; \
+ B3 ^= B1; \
+ B1 = B0; \
+ B0 = B4; \
+ B4 = B2; \
+ B2 = B3; \
+ B3 = B4; \
+ } while(0);
+
+#define SBoxD3(B0, B1, B2, B3) \
+ do { \
+ B2 ^= B3; \
+ B3 ^= B0; \
+ SIMD_32 B4 = B3; \
+ B3 &= B2; \
+ B3 ^= B1; \
+ B1 |= B2; \
+ B1 ^= B4; \
+ B4 &= B3; \
+ B2 ^= B3; \
+ B4 &= B0; \
+ B4 ^= B2; \
+ B2 &= B1; \
+ B2 |= B0; \
+ B3 = ~B3; \
+ B2 ^= B3; \
+ B0 ^= B3; \
+ B0 &= B1; \
+ B3 ^= B4; \
+ B3 ^= B0; \
+ B0 = B1; \
+ B1 = B4; \
+ } while(0);
+
+#define SBoxD4(B0, B1, B2, B3) \
+ do { \
+ SIMD_32 B4 = B2; \
+ B2 ^= B1; \
+ B0 ^= B2; \
+ B4 &= B2; \
+ B4 ^= B0; \
+ B0 &= B1; \
+ B1 ^= B3; \
+ B3 |= B4; \
+ B2 ^= B3; \
+ B0 ^= B3; \
+ B1 ^= B4; \
+ B3 &= B2; \
+ B3 ^= B1; \
+ B1 ^= B0; \
+ B1 |= B2; \
+ B0 ^= B3; \
+ B1 ^= B4; \
+ B0 ^= B1; \
+ B4 = B0; \
+ B0 = B2; \
+ B2 = B3; \
+ B3 = B4; \
+ } while(0);
+
+#define SBoxD5(B0, B1, B2, B3) \
+ do { \
+ SIMD_32 B4 = B2; \
+ B2 &= B3; \
+ B2 ^= B1; \
+ B1 |= B3; \
+ B1 &= B0; \
+ B4 ^= B2; \
+ B4 ^= B1; \
+ B1 &= B2; \
+ B0 = ~B0; \
+ B3 ^= B4; \
+ B1 ^= B3; \
+ B3 &= B0; \
+ B3 ^= B2; \
+ B0 ^= B1; \
+ B2 &= B0; \
+ B3 ^= B0; \
+ B2 ^= B4; \
+ B2 |= B3; \
+ B3 ^= B0; \
+ B2 ^= B1; \
+ B1 = B3; \
+ B3 = B4; \
+ } while(0);
+
+#define SBoxD6(B0, B1, B2, B3) \
+ do { \
+ B1 = ~B1; \
+ SIMD_32 B4 = B3; \
+ B2 ^= B1; \
+ B3 |= B0; \
+ B3 ^= B2; \
+ B2 |= B1; \
+ B2 &= B0; \
+ B4 ^= B3; \
+ B2 ^= B4; \
+ B4 |= B0; \
+ B4 ^= B1; \
+ B1 &= B2; \
+ B1 ^= B3; \
+ B4 ^= B2; \
+ B3 &= B4; \
+ B4 ^= B1; \
+ B3 ^= B4; \
+ B4 = ~B4; \
+ B3 ^= B0; \
+ B0 = B1; \
+ B1 = B4; \
+ B4 = B3; \
+ B3 = B2; \
+ B2 = B4; \
+ } while(0);
+
+#define SBoxD7(B0, B1, B2, B3) \
+ do { \
+ B0 ^= B2; \
+ SIMD_32 B4 = B2; \
+ B2 &= B0; \
+ B4 ^= B3; \
+ B2 = ~B2; \
+ B3 ^= B1; \
+ B2 ^= B3; \
+ B4 |= B0; \
+ B0 ^= B2; \
+ B3 ^= B4; \
+ B4 ^= B1; \
+ B1 &= B3; \
+ B1 ^= B0; \
+ B0 ^= B3; \
+ B0 |= B2; \
+ B3 ^= B1; \
+ B4 ^= B0; \
+ B0 = B1; \
+ B1 = B2; \
+ B2 = B4; \
+ } while(0);
+
+#define SBoxD8(B0, B1, B2, B3) \
+ do { \
+ SIMD_32 B4 = B2; \
+ B2 ^= B0; \
+ B0 &= B3; \
+ B4 |= B3; \
+ B2 = ~B2; \
+ B3 ^= B1; \
+ B1 |= B0; \
+ B0 ^= B2; \
+ B2 &= B4; \
+ B3 &= B4; \
+ B1 ^= B2; \
+ B2 ^= B0; \
+ B0 |= B2; \
+ B4 ^= B1; \
+ B0 ^= B3; \
+ B3 ^= B4; \
+ B4 |= B0; \
+ B3 ^= B2; \
+ B4 ^= B2; \
+ B2 = B1; \
+ B1 = B0; \
+ B0 = B3; \
+ B3 = B4; \
+ } while(0);
+
#define key_xor(round, B0, B1, B2, B3) \
do { \
B0 ^= SIMD_32(keys[4*round ]); \
@@ -175,6 +588,24 @@ void serpent_decrypt_4(const byte in[64],
#undef transform
#undef i_transform
+#undef SBoxE1
+#undef SBoxE2
+#undef SBoxE3
+#undef SBoxE4
+#undef SBoxE5
+#undef SBoxE6
+#undef SBoxE7
+#undef SBoxE8
+
+#undef SBoxD1
+#undef SBoxD2
+#undef SBoxD3
+#undef SBoxD4
+#undef SBoxD5
+#undef SBoxD6
+#undef SBoxD7
+#undef SBoxD8
+
/*
* Serpent Encryption
*/
diff --git a/src/block/serpent_simd/serp_simd_sbox.h b/src/block/serpent_simd/serp_simd_sbox.h
deleted file mode 100644
index 71eca19e5..000000000
--- a/src/block/serpent_simd/serp_simd_sbox.h
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
-* Serpent Sboxes in SIMD form
-* (C) 2009 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_SERPENT_SIMD_SBOXES_H__
-#define BOTAN_SERPENT_SIMD_SBOXES_H__
-
-#define SBoxE1(B0, B1, B2, B3) \
- do { \
- B3 ^= B0; \
- SIMD_32 B4 = B1; \
- B1 &= B3; \
- B4 ^= B2; \
- B1 ^= B0; \
- B0 |= B3; \
- B0 ^= B4; \
- B4 ^= B3; \
- B3 ^= B2; \
- B2 |= B1; \
- B2 ^= B4; \
- B4 = ~B4; \
- B4 |= B1; \
- B1 ^= B3; \
- B1 ^= B4; \
- B3 |= B0; \
- B1 ^= B3; \
- B4 ^= B3; \
- B3 = B0; \
- B0 = B1; \
- B1 = B4; \
- } while(0);
-
-#define SBoxE2(B0, B1, B2, B3) \
- do { \
- B0 = ~B0; \
- B2 = ~B2; \
- SIMD_32 B4 = B0; \
- B0 &= B1; \
- B2 ^= B0; \
- B0 |= B3; \
- B3 ^= B2; \
- B1 ^= B0; \
- B0 ^= B4; \
- B4 |= B1; \
- B1 ^= B3; \
- B2 |= B0; \
- B2 &= B4; \
- B0 ^= B1; \
- B1 &= B2; \
- B1 ^= B0; \
- B0 &= B2; \
- B4 ^= B0; \
- B0 = B2; \
- B2 = B3; \
- B3 = B1; \
- B1 = B4; \
- } while(0);
-
-#define SBoxE3(B0, B1, B2, B3) \
- do { \
- SIMD_32 B4 = B0; \
- B0 &= B2; \
- B0 ^= B3; \
- B2 ^= B1; \
- B2 ^= B0; \
- B3 |= B4; \
- B3 ^= B1; \
- B4 ^= B2; \
- B1 = B3; \
- B3 |= B4; \
- B3 ^= B0; \
- B0 &= B1; \
- B4 ^= B0; \
- B1 ^= B3; \
- B1 ^= B4; \
- B0 = B2; \
- B2 = B1; \
- B1 = B3; \
- B3 = ~B4; \
- } while(0);
-
-#define SBoxE4(B0, B1, B2, B3) \
- do { \
- SIMD_32 B4 = B0; \
- B0 |= B3; \
- B3 ^= B1; \
- B1 &= B4; \
- B4 ^= B2; \
- B2 ^= B3; \
- B3 &= B0; \
- B4 |= B1; \
- B3 ^= B4; \
- B0 ^= B1; \
- B4 &= B0; \
- B1 ^= B3; \
- B4 ^= B2; \
- B1 |= B0; \
- B1 ^= B2; \
- B0 ^= B3; \
- B2 = B1; \
- B1 |= B3; \
- B0 ^= B1; \
- B1 = B2; \
- B2 = B3; \
- B3 = B4; \
- } while(0);
-
-#define SBoxE5(B0, B1, B2, B3) \
- do { \
- B1 ^= B3; \
- B3 = ~B3; \
- B2 ^= B3; \
- B3 ^= B0; \
- SIMD_32 B4 = B1; \
- B1 &= B3; \
- B1 ^= B2; \
- B4 ^= B3; \
- B0 ^= B4; \
- B2 &= B4; \
- B2 ^= B0; \
- B0 &= B1; \
- B3 ^= B0; \
- B4 |= B1; \
- B4 ^= B0; \
- B0 |= B3; \
- B0 ^= B2; \
- B2 &= B3; \
- B0 = ~B0; \
- B4 ^= B2; \
- B2 = B0; \
- B0 = B1; \
- B1 = B4; \
- } while(0);
-
-#define SBoxE6(B0, B1, B2, B3) \
- do { \
- B0 ^= B1; \
- B1 ^= B3; \
- B3 = ~B3; \
- SIMD_32 B4 = B1; \
- B1 &= B0; \
- B2 ^= B3; \
- B1 ^= B2; \
- B2 |= B4; \
- B4 ^= B3; \
- B3 &= B1; \
- B3 ^= B0; \
- B4 ^= B1; \
- B4 ^= B2; \
- B2 ^= B0; \
- B0 &= B3; \
- B2 = ~B2; \
- B0 ^= B4; \
- B4 |= B3; \
- B4 ^= B2; \
- B2 = B0; \
- B0 = B1; \
- B1 = B3; \
- B3 = B4; \
- } while(0);
-
-#define SBoxE7(B0, B1, B2, B3) \
- do { \
- B2 = ~B2; \
- SIMD_32 B4 = B3; \
- B3 &= B0; \
- B0 ^= B4; \
- B3 ^= B2; \
- B2 |= B4; \
- B1 ^= B3; \
- B2 ^= B0; \
- B0 |= B1; \
- B2 ^= B1; \
- B4 ^= B0; \
- B0 |= B3; \
- B0 ^= B2; \
- B4 ^= B3; \
- B4 ^= B0; \
- B3 = ~B3; \
- B2 &= B4; \
- B3 ^= B2; \
- B2 = B4; \
- } while(0);
-
-#define SBoxE8(B0, B1, B2, B3) \
- do { \
- SIMD_32 B4 = B1; \
- B1 |= B2; \
- B1 ^= B3; \
- B4 ^= B2; \
- B2 ^= B1; \
- B3 |= B4; \
- B3 &= B0; \
- B4 ^= B2; \
- B3 ^= B1; \
- B1 |= B4; \
- B1 ^= B0; \
- B0 |= B4; \
- B0 ^= B2; \
- B1 ^= B4; \
- B2 ^= B1; \
- B1 &= B0; \
- B1 ^= B4; \
- B2 = ~B2; \
- B2 |= B0; \
- B4 ^= B2; \
- B2 = B1; \
- B1 = B3; \
- B3 = B0; \
- B0 = B4; \
- } while(0);
-
-#define SBoxD1(B0, B1, B2, B3) \
- do { \
- B2 = ~B2; \
- SIMD_32 B4 = B1; \
- B1 |= B0; \
- B4 = ~B4; \
- B1 ^= B2; \
- B2 |= B4; \
- B1 ^= B3; \
- B0 ^= B4; \
- B2 ^= B0; \
- B0 &= B3; \
- B4 ^= B0; \
- B0 |= B1; \
- B0 ^= B2; \
- B3 ^= B4; \
- B2 ^= B1; \
- B3 ^= B0; \
- B3 ^= B1; \
- B2 &= B3; \
- B4 ^= B2; \
- B2 = B1; \
- B1 = B4; \
- } while(0);
-
-#define SBoxD2(B0, B1, B2, B3) \
- do { \
- SIMD_32 B4 = B1; \
- B1 ^= B3; \
- B3 &= B1; \
- B4 ^= B2; \
- B3 ^= B0; \
- B0 |= B1; \
- B2 ^= B3; \
- B0 ^= B4; \
- B0 |= B2; \
- B1 ^= B3; \
- B0 ^= B1; \
- B1 |= B3; \
- B1 ^= B0; \
- B4 = ~B4; \
- B4 ^= B1; \
- B1 |= B0; \
- B1 ^= B0; \
- B1 |= B4; \
- B3 ^= B1; \
- B1 = B0; \
- B0 = B4; \
- B4 = B2; \
- B2 = B3; \
- B3 = B4; \
- } while(0);
-
-#define SBoxD3(B0, B1, B2, B3) \
- do { \
- B2 ^= B3; \
- B3 ^= B0; \
- SIMD_32 B4 = B3; \
- B3 &= B2; \
- B3 ^= B1; \
- B1 |= B2; \
- B1 ^= B4; \
- B4 &= B3; \
- B2 ^= B3; \
- B4 &= B0; \
- B4 ^= B2; \
- B2 &= B1; \
- B2 |= B0; \
- B3 = ~B3; \
- B2 ^= B3; \
- B0 ^= B3; \
- B0 &= B1; \
- B3 ^= B4; \
- B3 ^= B0; \
- B0 = B1; \
- B1 = B4; \
- } while(0);
-
-#define SBoxD4(B0, B1, B2, B3) \
- do { \
- SIMD_32 B4 = B2; \
- B2 ^= B1; \
- B0 ^= B2; \
- B4 &= B2; \
- B4 ^= B0; \
- B0 &= B1; \
- B1 ^= B3; \
- B3 |= B4; \
- B2 ^= B3; \
- B0 ^= B3; \
- B1 ^= B4; \
- B3 &= B2; \
- B3 ^= B1; \
- B1 ^= B0; \
- B1 |= B2; \
- B0 ^= B3; \
- B1 ^= B4; \
- B0 ^= B1; \
- B4 = B0; \
- B0 = B2; \
- B2 = B3; \
- B3 = B4; \
- } while(0);
-
-#define SBoxD5(B0, B1, B2, B3) \
- do { \
- SIMD_32 B4 = B2; \
- B2 &= B3; \
- B2 ^= B1; \
- B1 |= B3; \
- B1 &= B0; \
- B4 ^= B2; \
- B4 ^= B1; \
- B1 &= B2; \
- B0 = ~B0; \
- B3 ^= B4; \
- B1 ^= B3; \
- B3 &= B0; \
- B3 ^= B2; \
- B0 ^= B1; \
- B2 &= B0; \
- B3 ^= B0; \
- B2 ^= B4; \
- B2 |= B3; \
- B3 ^= B0; \
- B2 ^= B1; \
- B1 = B3; \
- B3 = B4; \
- } while(0);
-
-#define SBoxD6(B0, B1, B2, B3) \
- do { \
- B1 = ~B1; \
- SIMD_32 B4 = B3; \
- B2 ^= B1; \
- B3 |= B0; \
- B3 ^= B2; \
- B2 |= B1; \
- B2 &= B0; \
- B4 ^= B3; \
- B2 ^= B4; \
- B4 |= B0; \
- B4 ^= B1; \
- B1 &= B2; \
- B1 ^= B3; \
- B4 ^= B2; \
- B3 &= B4; \
- B4 ^= B1; \
- B3 ^= B4; \
- B4 = ~B4; \
- B3 ^= B0; \
- B0 = B1; \
- B1 = B4; \
- B4 = B3; \
- B3 = B2; \
- B2 = B4; \
- } while(0);
-
-#define SBoxD7(B0, B1, B2, B3) \
- do { \
- B0 ^= B2; \
- SIMD_32 B4 = B2; \
- B2 &= B0; \
- B4 ^= B3; \
- B2 = ~B2; \
- B3 ^= B1; \
- B2 ^= B3; \
- B4 |= B0; \
- B0 ^= B2; \
- B3 ^= B4; \
- B4 ^= B1; \
- B1 &= B3; \
- B1 ^= B0; \
- B0 ^= B3; \
- B0 |= B2; \
- B3 ^= B1; \
- B4 ^= B0; \
- B0 = B1; \
- B1 = B2; \
- B2 = B4; \
- } while(0);
-
-#define SBoxD8(B0, B1, B2, B3) \
- do { \
- SIMD_32 B4 = B2; \
- B2 ^= B0; \
- B0 &= B3; \
- B4 |= B3; \
- B2 = ~B2; \
- B3 ^= B1; \
- B1 |= B0; \
- B0 ^= B2; \
- B2 &= B4; \
- B3 &= B4; \
- B1 ^= B2; \
- B2 ^= B0; \
- B0 |= B2; \
- B4 ^= B1; \
- B0 ^= B3; \
- B3 ^= B4; \
- B4 |= B0; \
- B3 ^= B2; \
- B4 ^= B2; \
- B2 = B1; \
- B1 = B0; \
- B0 = B3; \
- B3 = B4; \
- } while(0);
-
-#endif