mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
expose poly1305 digester
This commit is contained in:
parent
d148898ad7
commit
f385c624c7
3 changed files with 244 additions and 244 deletions
|
@ -1126,13 +1126,13 @@ namespace crypto
|
|||
if (encrypt)
|
||||
{
|
||||
// calculate Poly1305 tag and write in after encrypted data
|
||||
Poly1305HMAC ((uint32_t *)(buf + msgLen), (uint32_t *)polyKey, polyMsg.data (), offset);
|
||||
Poly1305HMAC ((uint64_t *)(buf + msgLen), (uint64_t *)polyKey, polyMsg.data (), offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t tag[8];
|
||||
uint64_t tag[4];
|
||||
// calculate Poly1305 tag
|
||||
Poly1305HMAC (tag, (uint32_t *)polyKey, polyMsg.data (), offset);
|
||||
Poly1305HMAC (tag, (uint64_t *)polyKey, polyMsg.data (), offset);
|
||||
if (memcmp (tag, msg + msgLen, 16)) ret = false; // compare with provided
|
||||
}
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue