copy noise state

This commit is contained in:
orignal 2020-11-03 15:42:53 -05:00
parent f94d03465a
commit b8064b9b4b

View File

@ -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);