From f7e997519298d6d767ff4a3fa88f6f9cedd81be3 Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 24 Nov 2018 09:43:30 -0500 Subject: [PATCH] restore BlockCipher XOR using SSE --- libi2pd/Crypto.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libi2pd/Crypto.h b/libi2pd/Crypto.h index 5daf82b0..cbfeb0e9 100644 --- a/libi2pd/Crypto.h +++ b/libi2pd/Crypto.h @@ -123,8 +123,20 @@ namespace crypto ); } else -#endif +#endif { +#if defined(__SSE__) // SSE + __asm__ + ( + "movups (%[buf]), %%xmm0 \n" + "movups (%[other]), %%xmm1 \n" + "pxor %%xmm1, %%xmm0 \n" + "movups %%xmm0, (%[buf]) \n" + : + : [buf]"r"(buf), [other]"r"(other.buf) + : "%xmm0", "%xmm1", "memory" + ); +#else if (!(((size_t)buf | (size_t)other.buf) & 0x03)) // multiple of 4 ? { // we are good to cast to uint32_t * @@ -136,6 +148,7 @@ namespace crypto for (int i = 0; i < 16; i++) buf[i] ^= other.buf[i]; } +#endif } } };