Skip to content

Commit

Permalink
drop verifier not used anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Nov 26, 2014
1 parent 6153d79 commit f7d9064
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
m_Public = Identity (keys);
Expand Down
3 changes: 2 additions & 1 deletion Identity.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ namespace data
bool Verify (const uint8_t * buf, size_t len, const uint8_t * signature) const;
SigningKeyType GetSigningKeyType () const;
CryptoKeyType GetCryptoKeyType () const;

void DropVerifier (); // to save memory

private:

void CreateVerifier () const;
Expand Down
8 changes: 6 additions & 2 deletions RouterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ namespace data
{
// verify signature
int l = m_BufferLen - m_RouterIdentity.GetSignatureLen ();
if (!m_RouterIdentity.Verify ((uint8_t *)m_Buffer, l, (uint8_t *)m_Buffer + l))
LogPrint (eLogError, "signature verification failed");
if (!m_RouterIdentity.Verify ((uint8_t *)m_Buffer, l, (uint8_t *)m_Buffer + l))
{
LogPrint (eLogError, "signature verification failed");
m_IsUnreachable = true;
}
m_RouterIdentity.DropVerifier ();
}
}

Expand Down

0 comments on commit f7d9064

Please sign in to comment.