mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
correct chacha20 for multiple messages
This commit is contained in:
@@ -1182,12 +1182,12 @@ namespace crypto
|
||||
chacha20 ((uint8_t *)polyKey, 64, nonce, key, 0);
|
||||
Poly1305 polyHash (polyKey);
|
||||
// encrypt buffers
|
||||
Chacha20State state;
|
||||
Chacha20Init (state, nonce, key, 1);
|
||||
chacha::Chacha20State state;
|
||||
chacha::Chacha20Init (state, nonce, key, 1);
|
||||
size_t size = 0;
|
||||
for (auto& it: bufs)
|
||||
{
|
||||
Chacha20Encrypt (state, (uint8_t *)it.first, it.second);
|
||||
chacha::Chacha20Encrypt (state, (uint8_t *)it.first, it.second);
|
||||
polyHash.Update ((uint8_t *)it.first, it.second); // after encryption
|
||||
size += it.second;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user