diff --git a/NTCPSession.cpp b/NTCPSession.cpp index c874187a..fe9265f0 100644 --- a/NTCPSession.cpp +++ b/NTCPSession.cpp @@ -330,12 +330,13 @@ namespace transport LogPrint ("Phase 3 received: ", bytes_transferred); m_Decryption.Decrypt ((uint8_t *)&m_Establisher->phase3, sizeof(NTCPPhase3), (uint8_t *)&m_Establisher->phase3); m_RemoteIdentity = m_Establisher->phase3.ident; + uint32_t tsA = m_Establisher->phase3.timestamp; SignedData s; s.Insert (m_Establisher->phase1.pubKey, 256); // x s.Insert (m_Establisher->phase2.pubKey, 256); // y s.Insert (i2p::context.GetRouterInfo ().GetIdentHash (), 32); // ident - s.Insert (m_Establisher->phase3.timestamp); // tsA + s.Insert (tsA); // tsA s.Insert (tsB); // tsB if (!s.Verify (m_RemoteIdentity, m_Establisher->phase3.signature)) { @@ -344,17 +345,17 @@ namespace transport return; } - SendPhase4 (tsB); + SendPhase4 (tsA, tsB); } } - void NTCPSession::SendPhase4 (uint32_t tsB) + void NTCPSession::SendPhase4 (uint32_t tsA, uint32_t tsB) { SignedData s; s.Insert (m_Establisher->phase1.pubKey, 256); // x s.Insert (m_Establisher->phase2.pubKey, 256); // y s.Insert (m_RemoteIdentity.GetIdentHash (), 32); // ident - s.Insert (m_Establisher->phase3.timestamp); // tsA + s.Insert (tsA); // tsA s.Insert (tsB); // tsB auto keys = i2p::context.GetPrivateKeys (); auto signatureLen = keys.GetPublic ().GetSignatureLen (); diff --git a/NTCPSession.h b/NTCPSession.h index 935a0ef5..0e375311 100644 --- a/NTCPSession.h +++ b/NTCPSession.h @@ -88,7 +88,7 @@ namespace transport //server void SendPhase2 (); - void SendPhase4 (uint32_t tsB); + void SendPhase4 (uint32_t tsA, uint32_t tsB); void HandlePhase1Received (const boost::system::error_code& ecode, std::size_t bytes_transferred); void HandlePhase2Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsB); void HandlePhase3Received (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsB);