From b8064b9b4b6a4534d7e4089d57376b32c55cb144 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 3 Nov 2020 15:42:53 -0500 Subject: [PATCH] copy noise state --- libi2pd/RouterContext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libi2pd/RouterContext.cpp b/libi2pd/RouterContext.cpp index da9b42fc..8b5f5b77 100644 --- a/libi2pd/RouterContext.cpp +++ b/libi2pd/RouterContext.cpp @@ -687,8 +687,10 @@ namespace i2p if (IsECIES ()) { if (!m_InitialNoiseState) return false; + m_CurrentNoiseState.reset (new i2p::crypto::NoiseSymmetricState ()); // m_InitialNoiseState is h = SHA256(h || hepk) - m_CurrentNoiseState.reset (new i2p::crypto::NoiseSymmetricState (*m_InitialNoiseState)); + memcpy (m_CurrentNoiseState->m_CK, m_InitialNoiseState->m_CK, 64); + memcpy (m_CurrentNoiseState->m_H, m_InitialNoiseState->m_H, 32); m_CurrentNoiseState->MixHash (encrypted, 32); // h = SHA256(h || sepk) uint8_t sharedSecret[32]; m_Decryptor->Decrypt (encrypted, sharedSecret, ctx, false);