add AVX to clobber list

pull/739/head
orignal 8 years ago
parent 992603496e
commit 34df1b1646

@ -386,9 +386,11 @@ namespace crypto
// HMAC
const uint64_t IPAD = 0x3636363636363636;
const uint64_t OPAD = 0x5C5C5C5C5C5C5C5C;
#if defined(__AVX__)
static const uint64_t ipads[] = { IPAD, IPAD, IPAD, IPAD };
static const uint64_t opads[] = { OPAD, OPAD, OPAD, OPAD };
#endif
void HMACMD5Digest (uint8_t * msg, size_t len, const MACKey& key, uint8_t * digest)
// key is 32 bytes
@ -413,7 +415,7 @@ namespace crypto
"movups %%xmm0, 80%[hash] \n" // zero last 16 bytes
: [buf]"=m"(*buf), [hash]"=m"(*hash)
: [key]"m"(*(const uint8_t *)key), [ipad]"m"(*ipads), [opad]"m"(*opads)
: "memory"
: "memory", "%xmm0" // TODO: change to %ymm0 later
);
#else
// ikeypad
@ -421,13 +423,19 @@ namespace crypto
buf[1] = key.GetLL ()[1] ^ IPAD;
buf[2] = key.GetLL ()[2] ^ IPAD;
buf[3] = key.GetLL ()[3] ^ IPAD;
memcpy (buf + 4, ipads, 32);
buf[4] = IPAD;
buf[5] = IPAD;
buf[6] = IPAD;
buf[7] = IPAD;
// okeypad
hash[0] = key.GetLL ()[0] ^ OPAD;
hash[1] = key.GetLL ()[1] ^ OPAD;
hash[2] = key.GetLL ()[2] ^ OPAD;
hash[3] = key.GetLL ()[3] ^ OPAD;
memcpy (hash + 4, opads, 32);
hash[4] = OPAD;
hash[5] = OPAD;
hash[6] = OPAD;
hash[7] = OPAD;
// fill last 16 bytes with zeros (first hash size assumed 32 bytes in I2P)
memset (hash + 10, 0, 16);
#endif

Loading…
Cancel
Save