|
|
|
@ -9,6 +9,7 @@
@@ -9,6 +9,7 @@
|
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include "I2PEndian.h" |
|
|
|
|
#include "ChaCha20.h" |
|
|
|
|
|
|
|
|
|
#if !OPENSSL_AEAD_CHACHA20_POLY1305 |
|
|
|
@ -89,14 +90,14 @@ void Chacha20Init (Chacha20State& state, const uint8_t * nonce, const uint8_t *
@@ -89,14 +90,14 @@ void Chacha20Init (Chacha20State& state, const uint8_t * nonce, const uint8_t *
|
|
|
|
|
for (size_t i = 0; i < 8; i++) |
|
|
|
|
state.data[4 + i] = chacha::u8t32le(key + i * 4); |
|
|
|
|
|
|
|
|
|
state.data[12] = counter; |
|
|
|
|
state.data[12] = htole32 (counter); |
|
|
|
|
for (size_t i = 0; i < 3; i++) |
|
|
|
|
state.data[13 + i] = chacha::u8t32le(nonce + i * 4); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Chacha20SetCounter (Chacha20State& state, uint32_t counter) |
|
|
|
|
{ |
|
|
|
|
state.data[12] = counter; |
|
|
|
|
state.data[12] = htole32 (counter); |
|
|
|
|
state.offset = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|