mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
delete symmkey on cleanup
This commit is contained in:
parent
a05a54b38e
commit
da1e52357f
3 changed files with 13 additions and 2 deletions
|
@ -88,6 +88,11 @@ namespace garlic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RatchetTagSet::DeleteSymmKey (int index)
|
||||||
|
{
|
||||||
|
m_ItermediateSymmKeys.erase (index);
|
||||||
|
}
|
||||||
|
|
||||||
void RatchetTagSet::Expire ()
|
void RatchetTagSet::Expire ()
|
||||||
{
|
{
|
||||||
if (!m_ExpirationTimestamp)
|
if (!m_ExpirationTimestamp)
|
||||||
|
@ -659,7 +664,9 @@ namespace garlic
|
||||||
if (moreTags > 0)
|
if (moreTags > 0)
|
||||||
{
|
{
|
||||||
GenerateMoreReceiveTags (receiveTagset, moreTags);
|
GenerateMoreReceiveTags (receiveTagset, moreTags);
|
||||||
receiveTagset->MoveTrimBehind (moreTags >> 1); // /2
|
index -= (moreTags >> 1); // /2
|
||||||
|
if (index > 0)
|
||||||
|
receiveTagset->SetTrimBehind (index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -52,11 +52,12 @@ namespace garlic
|
||||||
const uint8_t * GetNextRootKey () const { return m_NextRootKey; };
|
const uint8_t * GetNextRootKey () const { return m_NextRootKey; };
|
||||||
int GetNextIndex () const { return m_NextIndex; };
|
int GetNextIndex () const { return m_NextIndex; };
|
||||||
void GetSymmKey (int index, uint8_t * key);
|
void GetSymmKey (int index, uint8_t * key);
|
||||||
|
void DeleteSymmKey (int index);
|
||||||
|
|
||||||
std::shared_ptr<ECIESX25519AEADRatchetSession> GetSession () { return m_Session.lock (); };
|
std::shared_ptr<ECIESX25519AEADRatchetSession> GetSession () { return m_Session.lock (); };
|
||||||
int GetTagSetID () const { return m_TagSetID; };
|
int GetTagSetID () const { return m_TagSetID; };
|
||||||
void SetTagSetID (int tagsetID) { m_TagSetID = tagsetID; };
|
void SetTagSetID (int tagsetID) { m_TagSetID = tagsetID; };
|
||||||
void MoveTrimBehind (int offset) { m_TrimBehindIndex += offset; };
|
void SetTrimBehind (int index) { if (index > m_TrimBehindIndex) m_TrimBehindIndex = index; };
|
||||||
|
|
||||||
void Expire ();
|
void Expire ();
|
||||||
bool IsExpired (uint64_t ts) const { return m_ExpirationTimestamp && ts > m_ExpirationTimestamp; };
|
bool IsExpired (uint64_t ts) const { return m_ExpirationTimestamp && ts > m_ExpirationTimestamp; };
|
||||||
|
|
|
@ -817,7 +817,10 @@ namespace garlic
|
||||||
for (auto it = m_ECIESx25519Tags.begin (); it != m_ECIESx25519Tags.end ();)
|
for (auto it = m_ECIESx25519Tags.begin (); it != m_ECIESx25519Tags.end ();)
|
||||||
{
|
{
|
||||||
if (it->second.tagset->IsExpired (ts) || it->second.tagset->IsIndexExpired (it->second.index))
|
if (it->second.tagset->IsExpired (ts) || it->second.tagset->IsIndexExpired (it->second.index))
|
||||||
|
{
|
||||||
|
it->second.tagset->DeleteSymmKey (it->second.index);
|
||||||
it = m_ECIESx25519Tags.erase (it);
|
it = m_ECIESx25519Tags.erase (it);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue