mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 12:24:19 +00:00
correct MixHash after decryption
This commit is contained in:
parent
d5f3d6111e
commit
21501cbf81
@ -687,10 +687,8 @@ namespace i2p
|
|||||||
if (IsECIES ())
|
if (IsECIES ())
|
||||||
{
|
{
|
||||||
if (!m_InitialNoiseState) return false;
|
if (!m_InitialNoiseState) return false;
|
||||||
m_CurrentNoiseState.reset (new i2p::crypto::NoiseSymmetricState ());
|
|
||||||
// m_InitialNoiseState is h = SHA256(h || hepk)
|
// m_InitialNoiseState is h = SHA256(h || hepk)
|
||||||
memcpy (m_CurrentNoiseState->m_CK, m_InitialNoiseState->m_CK, 64);
|
m_CurrentNoiseState.reset (new i2p::crypto::NoiseSymmetricState (*m_InitialNoiseState));
|
||||||
memcpy (m_CurrentNoiseState->m_H, m_InitialNoiseState->m_H, 32);
|
|
||||||
m_CurrentNoiseState->MixHash (encrypted, 32); // h = SHA256(h || sepk)
|
m_CurrentNoiseState->MixHash (encrypted, 32); // h = SHA256(h || sepk)
|
||||||
uint8_t sharedSecret[32];
|
uint8_t sharedSecret[32];
|
||||||
m_Decryptor->Decrypt (encrypted, sharedSecret, ctx, false);
|
m_Decryptor->Decrypt (encrypted, sharedSecret, ctx, false);
|
||||||
@ -704,7 +702,7 @@ namespace i2p
|
|||||||
LogPrint (eLogWarning, "Router: Tunnel record AEAD decryption failed");
|
LogPrint (eLogWarning, "Router: Tunnel record AEAD decryption failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_CurrentNoiseState->MixHash (encrypted, TUNNEL_BUILD_RECORD_SIZE); // h = SHA256(h || ciphertext)
|
m_CurrentNoiseState->MixHash (encrypted, ECIES_BUILD_REQUEST_RECORD_CLEAR_TEXT_SIZE + 16); // h = SHA256(h || ciphertext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user