mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
delete used tag before update
This commit is contained in:
parent
bd6ce7d4da
commit
dd79348b35
@ -437,17 +437,18 @@ namespace garlic
|
|||||||
if (it != m_Tags.end ())
|
if (it != m_Tags.end ())
|
||||||
{
|
{
|
||||||
// tag found. Use AES
|
// tag found. Use AES
|
||||||
|
auto decryption = it->second;
|
||||||
|
m_Tags.erase (it); // tag might be used only once
|
||||||
if (length >= 32)
|
if (length >= 32)
|
||||||
{
|
{
|
||||||
uint8_t iv[32]; // IV is first 16 bytes
|
uint8_t iv[32]; // IV is first 16 bytes
|
||||||
SHA256(buf, 32, iv);
|
SHA256(buf, 32, iv);
|
||||||
it->second->SetIV (iv);
|
decryption->SetIV (iv);
|
||||||
it->second->Decrypt (buf + 32, length - 32, buf + 32);
|
decryption->Decrypt (buf + 32, length - 32, buf + 32);
|
||||||
HandleAESBlock (buf + 32, length - 32, it->second, msg->from);
|
HandleAESBlock (buf + 32, length - 32, decryption, msg->from);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "Garlic: message length ", length, " is less than 32 bytes");
|
LogPrint (eLogWarning, "Garlic: message length ", length, " is less than 32 bytes");
|
||||||
m_Tags.erase (it); // tag might be used only once
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user