Browse Source

fixed PeerTest signature verification

pull/1769/head
orignal 2 years ago
parent
commit
c6c3de9164
  1. 6
      libi2pd/SSU2Session.cpp

6
libi2pd/SSU2Session.cpp

@ -1474,13 +1474,13 @@ namespace transport
if (r) if (r)
{ {
size_t signatureLen = r->GetIdentity ()->GetSignatureLen (); size_t signatureLen = r->GetIdentity ()->GetSignatureLen ();
if (len >= 35 + signatureLen) if (len >= 35 + asz + 10 + signatureLen)
{ {
s.Reset (); s.Reset ();
s.Insert ((const uint8_t *)"PeerTestValidate", 16); // prologue s.Insert ((const uint8_t *)"PeerTestValidate", 16); // prologue
s.Insert (GetRemoteIdentity ()->GetIdentHash (), 32); // bhash s.Insert (GetRemoteIdentity ()->GetIdentHash (), 32); // bhash
s.Insert (buf + 35 + signatureLen, len - 35 - signatureLen); // signed data s.Insert (buf + 35, asz + 10); // signed data
if (s.Verify (r->GetIdentity (), buf + (len - signatureLen))) if (s.Verify (r->GetIdentity (), buf + 35 + asz + 10))
{ {
if (!m_Server.FindSession (r->GetIdentity ()->GetIdentHash ())) if (!m_Server.FindSession (r->GetIdentity ()->GetIdentHash ()))
{ {

Loading…
Cancel
Save