diff --git a/src/crypto/wild_keccak.h b/src/crypto/wild_keccak.h index f7abaf0c..f9fd7e32 100644 --- a/src/crypto/wild_keccak.h +++ b/src/crypto/wild_keccak.h @@ -29,11 +29,16 @@ extern "C" { namespace crypto { +#define CONCAT_IMPL(x, y) x##y +#define CONCAT(x, y) CONCAT_IMPL(x, y) +#define UNIQUE(x) CONCAT(x, __LINE__) + #define OPT_XOR_4_RES(A_, B_, C_, D_, Res) \ - ((uint64_t*)&Res)[0] = ((const uint64_t*)&A_)[0] ^ ((const uint64_t*)&B_)[0] ^ ((const uint64_t*)&C_)[0] ^ ((const uint64_t*)&D_)[0]; \ - ((uint64_t*)&Res)[1] = ((const uint64_t*)&A_)[1] ^ ((const uint64_t*)&B_)[1] ^ ((const uint64_t*)&C_)[1] ^ ((const uint64_t*)&D_)[1]; \ - ((uint64_t*)&Res)[2] = ((const uint64_t*)&A_)[2] ^ ((const uint64_t*)&B_)[2] ^ ((const uint64_t*)&C_)[2] ^ ((const uint64_t*)&D_)[2]; \ - ((uint64_t*)&Res)[3] = ((const uint64_t*)&A_)[3] ^ ((const uint64_t*)&B_)[3] ^ ((const uint64_t*)&C_)[3] ^ ((const uint64_t*)&D_)[3]; + crypto::hash UNIQUE(A) = A_;crypto::hash UNIQUE(B) = B_;crypto::hash UNIQUE(C) = C_; crypto::hash UNIQUE(D) = D_; \ + ((uint64_t*)&Res)[0] = ((const uint64_t*)&UNIQUE(A))[0] ^ ((const uint64_t*)&UNIQUE(B))[0] ^ ((const uint64_t*)&UNIQUE(C))[0] ^ ((const uint64_t*)&UNIQUE(D))[0]; \ + ((uint64_t*)&Res)[1] = ((const uint64_t*)&UNIQUE(A))[1] ^ ((const uint64_t*)&UNIQUE(B))[1] ^ ((const uint64_t*)&UNIQUE(C))[1] ^ ((const uint64_t*)&UNIQUE(D))[1]; \ + ((uint64_t*)&Res)[2] = ((const uint64_t*)&UNIQUE(A))[2] ^ ((const uint64_t*)&UNIQUE(B))[2] ^ ((const uint64_t*)&UNIQUE(C))[2] ^ ((const uint64_t*)&UNIQUE(D))[2]; \ + ((uint64_t*)&Res)[3] = ((const uint64_t*)&UNIQUE(A))[3] ^ ((const uint64_t*)&UNIQUE(B))[3] ^ ((const uint64_t*)&UNIQUE(C))[3] ^ ((const uint64_t*)&UNIQUE(D))[3]; typedef uint64_t state_t_m[25]; typedef uint64_t mixin_t[KK_MIXIN_SIZE];