mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
create and encrypt SessionRequest
This commit is contained in:
parent
73e572b66b
commit
510fe43ec4
2 changed files with 49 additions and 13 deletions
|
@ -19,9 +19,27 @@ namespace i2p
|
|||
namespace transport
|
||||
{
|
||||
const int SSU2_TERMINATION_TIMEOUT = 330; // 5.5 minutes
|
||||
|
||||
enum SSU2MessageType
|
||||
{
|
||||
eSSU2SessionRequest = 0
|
||||
};
|
||||
|
||||
class SSU2Session: public TransportSession, public std::enable_shared_from_this<SSU2Session>
|
||||
{
|
||||
union Header
|
||||
{
|
||||
uint64_t ll[2];
|
||||
uint8_t buf[16];
|
||||
struct
|
||||
{
|
||||
uint8_t connID[8];
|
||||
uint8_t packetNum[4];
|
||||
uint8_t type;
|
||||
uint8_t flags[3];
|
||||
} h;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
SSU2Session (std::shared_ptr<const i2p::data::RouterInfo> in_RemoteRouter = nullptr,
|
||||
|
@ -31,7 +49,7 @@ namespace transport
|
|||
private:
|
||||
|
||||
void SendSessionRequest ();
|
||||
void EncryptHeader (i2p::crypto::ChipherBlock& header);
|
||||
void EncryptHeader (Header& h);
|
||||
void CreateHeaderMask (const uint8_t * kh1, const uint8_t * nonce1, const uint8_t * kh2, const uint8_t * nonce2);
|
||||
|
||||
private:
|
||||
|
@ -40,7 +58,11 @@ namespace transport
|
|||
std::unique_ptr<i2p::crypto::NoiseSymmetricState> m_NoiseState;
|
||||
std::shared_ptr<const i2p::data::RouterInfo::Address> m_Address;
|
||||
|
||||
i2p::crypto::ChipherBlock m_HeaderMask;
|
||||
union
|
||||
{
|
||||
uint64_t ll[2];
|
||||
uint8_t buf[16];
|
||||
} m_HeaderMask;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue