ChiperBlock XOR

This commit is contained in:
orignal 2014-05-09 12:05:04 -04:00
parent 9372b33c2c
commit 37c3a9dcf1
2 changed files with 5 additions and 6 deletions

5
aes.h
View file

@ -14,13 +14,14 @@ namespace crypto
uint8_t buf[16];
uint64_t ll[2];
void operator^(const ChipherBlock& other) // XOR
void operator^=(const ChipherBlock& other) // XOR
{
#ifdef __x86_64__
__asm__
(
"movups (%[b1]), %%xmm0 \n"
"pxor (%[b2]), %%xmm0 \n"
"movups (%[b2]), %%xmm1 \n" // b2 might not be 16-bytes aligned
"pxor %%xmm1, %%xmm0 \n"
"movups %%xmm0, (%[b1]) \n"
: : [b1]"r"(buf), [b2]"r"(other.buf): "memory", "%xmm0"
);