mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
correct chacha20 for multiple messages
This commit is contained in:
parent
e68f1dbc99
commit
ef6db64e9f
4 changed files with 81 additions and 58 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue