mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
check if session key is available
This commit is contained in:
parent
2140f49665
commit
747383a5e6
2 changed files with 5 additions and 4 deletions
8
SSU.cpp
8
SSU.cpp
|
@ -843,11 +843,11 @@ namespace ssu
|
|||
|
||||
void SSUSession::SendSesionDestroyed ()
|
||||
{
|
||||
uint8_t buf[48 + 18], iv[16];
|
||||
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator ();
|
||||
rnd.GenerateBlock (iv, 16); // random iv
|
||||
if (m_State == eSessionStateEstablished)
|
||||
if (HasSessionKey ())
|
||||
{
|
||||
uint8_t buf[48 + 18], iv[16];
|
||||
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator ();
|
||||
rnd.GenerateBlock (iv, 16); // random iv
|
||||
// encrypt message with session key
|
||||
FillHeaderAndEncrypt (PAYLOAD_TYPE_SESSION_DESTROYED, buf, 48, m_SessionKey, iv, m_MacKey);
|
||||
m_Server.Send (buf, 48, m_RemoteEndpoint);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue