Browse Source

don't verify signature twice

pull/1082/head
orignal 7 years ago
parent
commit
7db2e9dc4a
  1. 4
      libi2pd/LeaseSet.cpp
  2. 2
      libi2pd/LeaseSet.h
  3. 2
      libi2pd/NetDb.cpp

4
libi2pd/LeaseSet.cpp

@ -21,7 +21,7 @@ namespace data
ReadFromBuffer (); ReadFromBuffer ();
} }
void LeaseSet::Update (const uint8_t * buf, size_t len) void LeaseSet::Update (const uint8_t * buf, size_t len, bool verifySignature)
{ {
if (len > m_BufferLen) if (len > m_BufferLen)
{ {
@ -31,7 +31,7 @@ namespace data
} }
memcpy (m_Buffer, buf, len); memcpy (m_Buffer, buf, len);
m_BufferLen = len; m_BufferLen = len;
ReadFromBuffer (false, false); // we assume signature is verified already ReadFromBuffer (false, verifySignature);
} }
void LeaseSet::PopulateLeases () void LeaseSet::PopulateLeases ()

2
libi2pd/LeaseSet.h

@ -57,7 +57,7 @@ namespace data
LeaseSet (const uint8_t * buf, size_t len, bool storeLeases = true); LeaseSet (const uint8_t * buf, size_t len, bool storeLeases = true);
~LeaseSet () { delete[] m_Buffer; }; ~LeaseSet () { delete[] m_Buffer; };
void Update (const uint8_t * buf, size_t len); void Update (const uint8_t * buf, size_t len, bool verifySignature = true);
bool IsNewer (const uint8_t * buf, size_t len) const; bool IsNewer (const uint8_t * buf, size_t len) const;
void PopulateLeases (); // from buffer void PopulateLeases (); // from buffer

2
libi2pd/NetDb.cpp

@ -242,7 +242,7 @@ namespace data
{ {
if(it->second->GetExpirationTime() < expires) if(it->second->GetExpirationTime() < expires)
{ {
it->second->Update (buf, len); it->second->Update (buf, len, false); // signature is verified already
LogPrint (eLogInfo, "NetDb: LeaseSet updated: ", ident.ToBase32()); LogPrint (eLogInfo, "NetDb: LeaseSet updated: ", ident.ToBase32());
updated = true; updated = true;
} }

Loading…
Cancel
Save