handle new session reply

This commit is contained in:
orignal 2020-01-29 12:54:26 -05:00
parent abe668f1c3
commit a1dbec0fcb
3 changed files with 56 additions and 13 deletions

View file

@ -869,23 +869,14 @@ namespace garlic
{
// TODO
auto session = it->second;
if (session->NewOutgoingSessionReply (buf, len, handleClove))
m_ECIESx25519Sessions.emplace (session->GetRemoteStaticKey (), session);
else
{
if (!session->NewOutgoingSessionReply (buf, len, handleClove))
LogPrint (eLogError, "Garlic: can't decrypt ECIES-X25519-AEAD-Ratchet new session reply");
m_ECIESx25519Tags.erase (tag);
m_ECIESx25519Sessions.erase (session->GetRemoteStaticKey ());
}
m_ECIESx25519Tags.erase (tag);
}
else
{
auto session = std::make_shared<ECIESX25519AEADRatchetSession> (this);
if (session->NewIncomingSession (buf, len, handleClove))
{
m_ECIESx25519Sessions.emplace (session->GetRemoteStaticKey (), session);
}
else
if (!session->NewIncomingSession (buf, len, handleClove))
LogPrint (eLogError, "Garlic: can't decrypt ECIES-X25519-AEAD-Ratchet new session");
}
}
@ -950,5 +941,11 @@ namespace garlic
{
m_ECIESx25519Tags.emplace (tag, session);
}
void GarlicDestination::AddECIESx25519Session (const uint8_t * staticKey, ECIESX25519AEADRatchetSessionPtr session)
{
m_ECIESx25519Sessions.emplace (staticKey, session);
}
}
}