mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-23 17:36:37 +02:00
cleanup NSR keys
Some checks failed
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / buster (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Building container for linux/386 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
Some checks failed
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / buster (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Building container for linux/386 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
This commit is contained in:
parent
9b967059ad
commit
2afdd5b723
2 changed files with 25 additions and 7 deletions
|
@ -95,6 +95,17 @@ namespace garlic
|
||||||
m_ItermediateSymmKeys.erase (index);
|
m_ItermediateSymmKeys.erase (index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReceiveRatchetTagSet::ReceiveRatchetTagSet (std::shared_ptr<ECIESX25519AEADRatchetSession> session, bool isNS):
|
||||||
|
m_Session (session), m_IsNS (isNS)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ReceiveRatchetTagSet::~ReceiveRatchetTagSet ()
|
||||||
|
{
|
||||||
|
if (m_IsNS && m_Session)
|
||||||
|
m_Session->CleanupReceiveNSRKeys ();
|
||||||
|
}
|
||||||
|
|
||||||
void ReceiveRatchetTagSet::Expire ()
|
void ReceiveRatchetTagSet::Expire ()
|
||||||
{
|
{
|
||||||
if (!m_ExpirationTimestamp)
|
if (!m_ExpirationTimestamp)
|
||||||
|
@ -252,6 +263,14 @@ namespace garlic
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ECIESX25519AEADRatchetSession::CleanupReceiveNSRKeys ()
|
||||||
|
{
|
||||||
|
m_EphemeralKeys = nullptr;
|
||||||
|
#if OPENSSL_PQ
|
||||||
|
m_PQKeys = nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool ECIESX25519AEADRatchetSession::HandleNewIncomingSession (const uint8_t * buf, size_t len)
|
bool ECIESX25519AEADRatchetSession::HandleNewIncomingSession (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -824,10 +843,8 @@ namespace garlic
|
||||||
if (m_State == eSessionStateNewSessionSent)
|
if (m_State == eSessionStateNewSessionSent)
|
||||||
{
|
{
|
||||||
m_State = eSessionStateEstablished;
|
m_State = eSessionStateEstablished;
|
||||||
//m_EphemeralKeys = nullptr; // TODO: delete after a while
|
// don't delete m_EpehemralKey and m_PQKeys because delayd NSR's migth come
|
||||||
#if OPENSSL_PQ
|
// done in CleanupReceiveNSRKeys called from NSR tagset destructor
|
||||||
// m_PQKeys = nullptr; // TODO: delete after a while
|
|
||||||
#endif
|
|
||||||
m_SessionCreatedTimestamp = i2p::util::GetSecondsSinceEpoch ();
|
m_SessionCreatedTimestamp = i2p::util::GetSecondsSinceEpoch ();
|
||||||
GetOwner ()->AddECIESx25519Session (m_RemoteStaticKey, shared_from_this ());
|
GetOwner ()->AddECIESx25519Session (m_RemoteStaticKey, shared_from_this ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ namespace garlic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ReceiveRatchetTagSet (std::shared_ptr<ECIESX25519AEADRatchetSession> session, bool isNS = false):
|
ReceiveRatchetTagSet (std::shared_ptr<ECIESX25519AEADRatchetSession> session, bool isNS = false);
|
||||||
m_Session (session), m_IsNS (isNS) {};
|
~ReceiveRatchetTagSet () override;
|
||||||
|
|
||||||
bool IsNS () const { return m_IsNS; };
|
bool IsNS () const { return m_IsNS; };
|
||||||
std::shared_ptr<ECIESX25519AEADRatchetSession> GetSession () { return m_Session; };
|
std::shared_ptr<ECIESX25519AEADRatchetSession> GetSession () { return m_Session; };
|
||||||
|
@ -184,7 +184,8 @@ namespace garlic
|
||||||
bool CheckExpired (uint64_t ts); // true is expired
|
bool CheckExpired (uint64_t ts); // true is expired
|
||||||
bool CanBeRestarted (uint64_t ts) const { return ts > m_SessionCreatedTimestamp + ECIESX25519_RESTART_TIMEOUT; }
|
bool CanBeRestarted (uint64_t ts) const { return ts > m_SessionCreatedTimestamp + ECIESX25519_RESTART_TIMEOUT; }
|
||||||
bool IsInactive (uint64_t ts) const { return ts > m_LastActivityTimestamp + ECIESX25519_INACTIVITY_TIMEOUT && CanBeRestarted (ts); }
|
bool IsInactive (uint64_t ts) const { return ts > m_LastActivityTimestamp + ECIESX25519_INACTIVITY_TIMEOUT && CanBeRestarted (ts); }
|
||||||
|
void CleanupReceiveNSRKeys (); // called from ReceiveRatchetTagSet at Alice's side
|
||||||
|
|
||||||
bool IsRatchets () const override { return true; };
|
bool IsRatchets () const override { return true; };
|
||||||
bool IsReadyToSend () const override { return m_State != eSessionStateNewSessionSent; };
|
bool IsReadyToSend () const override { return m_State != eSessionStateNewSessionSent; };
|
||||||
bool IsTerminated () const override { return m_IsTerminated; }
|
bool IsTerminated () const override { return m_IsTerminated; }
|
||||||
|
|
Loading…
Add table
Reference in a new issue