Browse Source

pass tsA to SendPhase4

pull/113/head
orignal 10 years ago
parent
commit
f7ce86e0c4
  1. 9
      NTCPSession.cpp
  2. 2
      NTCPSession.h

9
NTCPSession.cpp

@ -330,12 +330,13 @@ namespace transport @@ -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 @@ -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 ();

2
NTCPSession.h

@ -88,7 +88,7 @@ namespace transport @@ -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);

Loading…
Cancel
Save