mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
check token in SessionRequest
This commit is contained in:
parent
2fef595b83
commit
81207999eb
@ -239,6 +239,14 @@ namespace transport
|
||||
uint8_t headerX[48];
|
||||
i2p::crypto::ChaCha20 (buf + 16, 48, i2p::context.GetSSU2IntroKey (), nonce, headerX);
|
||||
memcpy (&m_DestConnID, headerX, 8);
|
||||
uint64_t token;
|
||||
memcpy (&token, headerX + 8, 8);
|
||||
if (!token || token != m_Server.GetIncomingToken (m_RemoteEndpoint))
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU2: SessionRequest token mismatch. Retry");
|
||||
SendRetry ();
|
||||
return;
|
||||
}
|
||||
// KDF for session request
|
||||
m_NoiseState->MixHash ( { {header.buf, 16}, {headerX, 16} } ); // h = SHA256(h || header)
|
||||
m_NoiseState->MixHash (headerX + 16, 32); // h = SHA256(h || aepk);
|
||||
|
Loading…
Reference in New Issue
Block a user