1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 04:04:16 +00:00

read Identity from SessionConfirmed message

This commit is contained in:
orignal 2014-09-18 14:16:16 -04:00
parent ddc18a9b28
commit cb46d63058
2 changed files with 16 additions and 1 deletions

16
SSU.cpp
View File

@ -226,7 +226,21 @@ namespace ssu
void SSUSession::ProcessSessionConfirmed (uint8_t * buf, size_t len)
{
LogPrint ("Session confirmed received");
LogPrint ("Session confirmed received");
uint8_t * payload = buf + sizeof (SSUHeader);
payload++; // identity fragment info
uint16_t identitySize = be16toh (*(uint16_t *)payload);
payload += 2; // size of identity fragment
if (identitySize == i2p::data::DEFAULT_IDENTITY_SIZE)
{
i2p::data::Identity ident;
ident.FromBuffer (payload, identitySize);
m_RemoteIdent = ident.Hash ();
}
else
LogPrint ("SSU unexpected identity size ", identitySize);
payload += identitySize; // identity
// TODO: verify signature
SendI2NPMessage (CreateDeliveryStatusMsg (0));
Established ();
}

1
SSU.h
View File

@ -129,6 +129,7 @@ namespace ssu
SSUServer& m_Server;
boost::asio::ip::udp::endpoint m_RemoteEndpoint;
const i2p::data::RouterInfo * m_RemoteRouter;
i2p::data::IdentHash m_RemoteIdent; // if m_RemoteRouter is null
boost::asio::deadline_timer m_Timer;
i2p::data::DHKeysPair * m_DHKeysPair; // X - for client and Y - for server
bool m_PeerTest;