Browse Source

drop verifier not used anymore

pull/113/head
orignal 10 years ago
parent
commit
f7d90648e3
  1. 7
      Identity.cpp
  2. 3
      Identity.h
  3. 8
      RouterInfo.cpp

7
Identity.cpp

@ -265,6 +265,13 @@ namespace data
} }
} }
void IdentityEx::DropVerifier ()
{
auto verifier = m_Verifier;
m_Verifier = nullptr; // TODO: make this atomic
delete verifier;
}
PrivateKeys& PrivateKeys::operator=(const Keys& keys) PrivateKeys& PrivateKeys::operator=(const Keys& keys)
{ {
m_Public = Identity (keys); m_Public = Identity (keys);

3
Identity.h

@ -135,7 +135,8 @@ namespace data
bool Verify (const uint8_t * buf, size_t len, const uint8_t * signature) const; bool Verify (const uint8_t * buf, size_t len, const uint8_t * signature) const;
SigningKeyType GetSigningKeyType () const; SigningKeyType GetSigningKeyType () const;
CryptoKeyType GetCryptoKeyType () const; CryptoKeyType GetCryptoKeyType () const;
void DropVerifier (); // to save memory
private: private:
void CreateVerifier () const; void CreateVerifier () const;

8
RouterInfo.cpp

@ -101,8 +101,12 @@ namespace data
{ {
// verify signature // verify signature
int l = m_BufferLen - m_RouterIdentity.GetSignatureLen (); int l = m_BufferLen - m_RouterIdentity.GetSignatureLen ();
if (!m_RouterIdentity.Verify ((uint8_t *)m_Buffer, l, (uint8_t *)m_Buffer + l)) if (!m_RouterIdentity.Verify ((uint8_t *)m_Buffer, l, (uint8_t *)m_Buffer + l))
LogPrint (eLogError, "signature verification failed"); {
LogPrint (eLogError, "signature verification failed");
m_IsUnreachable = true;
}
m_RouterIdentity.DropVerifier ();
} }
} }

Loading…
Cancel
Save