|
|
@ -272,6 +272,16 @@ namespace transport |
|
|
|
s.Insert (payload, 8); // relayTag and signed on time
|
|
|
|
s.Insert (payload, 8); // relayTag and signed on time
|
|
|
|
m_RelayTag = bufbe32toh (payload); |
|
|
|
m_RelayTag = bufbe32toh (payload); |
|
|
|
payload += 4; // relayTag
|
|
|
|
payload += 4; // relayTag
|
|
|
|
|
|
|
|
if (i2p::context.GetStatus () == eRouterStatusTesting) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
auto ts = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
|
|
|
|
uint32_t signedOnTime = bufbe32toh(payload); |
|
|
|
|
|
|
|
if (signedOnTime < ts - SSU_CLOCK_SKEW || signedOnTime > ts + SSU_CLOCK_SKEW) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LogPrint (eLogError, "SSU: clock skew detected ", (int)ts - signedOnTime, ". Check your clock"); |
|
|
|
|
|
|
|
i2p::context.SetStatus (eRouterStatusError); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
payload += 4; // signed on time
|
|
|
|
payload += 4; // signed on time
|
|
|
|
// decrypt signature
|
|
|
|
// decrypt signature
|
|
|
|
size_t signatureLen = m_RemoteIdentity->GetSignatureLen (); |
|
|
|
size_t signatureLen = m_RemoteIdentity->GetSignatureLen (); |
|
|
@ -310,6 +320,14 @@ namespace transport |
|
|
|
SetRemoteIdentity (std::make_shared<i2p::data::IdentityEx> (payload, identitySize)); |
|
|
|
SetRemoteIdentity (std::make_shared<i2p::data::IdentityEx> (payload, identitySize)); |
|
|
|
m_Data.UpdatePacketSize (m_RemoteIdentity->GetIdentHash ()); |
|
|
|
m_Data.UpdatePacketSize (m_RemoteIdentity->GetIdentHash ()); |
|
|
|
payload += identitySize; // identity
|
|
|
|
payload += identitySize; // identity
|
|
|
|
|
|
|
|
auto ts = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
|
|
|
|
uint32_t signedOnTime = bufbe32toh(payload); |
|
|
|
|
|
|
|
if (signedOnTime < ts - SSU_CLOCK_SKEW || signedOnTime > ts + SSU_CLOCK_SKEW) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LogPrint (eLogError, "SSU message 'confirmed' time difference ", (int)ts - signedOnTime, " exceeds clock skew"); |
|
|
|
|
|
|
|
Failed (); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
if (m_SignedData) |
|
|
|
if (m_SignedData) |
|
|
|
m_SignedData->Insert (payload, 4); // insert Alice's signed on time
|
|
|
|
m_SignedData->Insert (payload, 4); // insert Alice's signed on time
|
|
|
|
payload += 4; // signed-on time
|
|
|
|
payload += 4; // signed-on time
|
|
|
|