1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-27 13:14:15 +00:00

correct alignment for polyKey

This commit is contained in:
orignal 2018-11-24 14:41:17 -05:00
parent b07f851ce7
commit fa620e41a4

View File

@ -1088,9 +1088,9 @@ namespace crypto
bool ret = true; bool ret = true;
#if LEGACY_OPENSSL #if LEGACY_OPENSSL
// generate one time poly key // generate one time poly key
uint8_t polyKey[64]; uint64_t polyKey[8];
memset(polyKey, 0, sizeof(polyKey)); memset(polyKey, 0, sizeof(polyKey));
chacha20 (polyKey, 64, nonce, key, 0); chacha20 ((uint8_t *)polyKey, 64, nonce, key, 0);
// create Poly1305 message // create Poly1305 message
if (!ad) adLen = 0; if (!ad) adLen = 0;
@ -1142,7 +1142,7 @@ namespace crypto
{ {
uint64_t tag[4]; uint64_t tag[4];
// calculate Poly1305 tag // calculate Poly1305 tag
Poly1305HMAC (tag, (uint64_t *)polyKey, polyMsg.data (), offset); Poly1305HMAC (tag, polyKey, polyMsg.data (), offset);
if (memcmp (tag, msg + msgLen, 16)) ret = false; // compare with provided if (memcmp (tag, msg + msgLen, 16)) ret = false; // compare with provided
} }
#else #else