mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
don't verify signature twice
This commit is contained in:
parent
e8d6c803cd
commit
b1c701085b
@ -31,7 +31,7 @@ namespace data
|
||||
}
|
||||
memcpy (m_Buffer, buf, len);
|
||||
m_BufferLen = len;
|
||||
ReadFromBuffer (false);
|
||||
ReadFromBuffer (false, false); // we assume signature is verified already
|
||||
}
|
||||
|
||||
void LeaseSet::PopulateLeases ()
|
||||
@ -40,7 +40,7 @@ namespace data
|
||||
ReadFromBuffer (false);
|
||||
}
|
||||
|
||||
void LeaseSet::ReadFromBuffer (bool readIdentity)
|
||||
void LeaseSet::ReadFromBuffer (bool readIdentity, bool verifySignature)
|
||||
{
|
||||
if (readIdentity || !m_Identity)
|
||||
m_Identity = std::make_shared<IdentityEx>(m_Buffer, m_BufferLen);
|
||||
@ -128,7 +128,7 @@ namespace data
|
||||
}
|
||||
|
||||
// verify
|
||||
if (!m_Identity->Verify (m_Buffer, leases - m_Buffer, leases))
|
||||
if (verifySignature && !m_Identity->Verify (m_Buffer, leases - m_Buffer, leases))
|
||||
{
|
||||
LogPrint (eLogWarning, "LeaseSet: verification failed");
|
||||
m_IsValid = false;
|
||||
|
@ -81,7 +81,7 @@ namespace data
|
||||
|
||||
private:
|
||||
|
||||
void ReadFromBuffer (bool readIdentity = true);
|
||||
void ReadFromBuffer (bool readIdentity = true, bool verifySignature = true);
|
||||
uint64_t ExtractTimestamp (const uint8_t * buf, size_t len) const; // min expiration time
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user