From 9372b33c2ccff0d0e2643c6f29e152b89a1b2e0d Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 9 May 2014 11:44:39 -0400 Subject: [PATCH] ChiperBlock XOR --- aes.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/aes.h b/aes.h index f9dee69c..89a3a62d 100644 --- a/aes.h +++ b/aes.h @@ -13,6 +13,22 @@ namespace crypto { uint8_t buf[16]; uint64_t ll[2]; + + void operator^(const ChipherBlock& other) // XOR + { +#ifdef __x86_64__ + __asm__ + ( + "movups (%[b1]), %%xmm0 \n" + "pxor (%[b2]), %%xmm0 \n" + "movups %%xmm0, (%[b1]) \n" + : : [b1]"r"(buf), [b2]"r"(other.buf): "memory", "%xmm0" + ); +#else + ll[0] ^= other.ll[0]; + ll[1] ^= other.ll[1]; +#endif + } }; #ifdef __x86_64__