use AEN-NI for garlic encryption

This commit is contained in:
orignal 2014-05-11 22:37:33 -04:00
parent cc302847a8
commit 3eb4cc9eed
3 changed files with 25 additions and 30 deletions

11
aes.h
View file

@ -16,19 +16,8 @@ namespace crypto
void operator^=(const ChipherBlock& other) // XOR
{
#ifdef __x86_64__
__asm__
(
"movups (%[b1]), %%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"
);
#else
ll[0] ^= other.ll[0];
ll[1] ^= other.ll[1];
#endif
}
};