create new ECIESX25519AEADRatchet session if not found

This commit is contained in:
orignal 2020-01-16 19:33:00 -05:00
parent 00cb15d9b4
commit 451c3945f0
3 changed files with 35 additions and 24 deletions

View file

@ -664,7 +664,12 @@ namespace garlic
auto it = m_ECIESx25519Sessions.find (staticKey);
if (it != m_ECIESx25519Sessions.end ())
session = it->second;
// TODO: Alice
if (!session)
{
session = std::make_shared<ECIESX25519AEADRatchetSession> (this);
session->SetRemoteStaticKey (staticKey);
m_ECIESx25519Sessions.emplace (staticKey, session);
}
return session;
}
else
@ -860,7 +865,7 @@ namespace garlic
if (session->NewIncomingSession (buf, len, std::bind (&GarlicDestination::HandleECIESx25519GarlicClove,
this, std::placeholders::_1, std::placeholders::_2)))
{
m_ECIESx25519Sessions.emplace (session->GetStaticKey (), session);
m_ECIESx25519Sessions.emplace (session->GetRemoteStaticKey (), session);
}
else
LogPrint (eLogError, "Garlic: can't decrypt ECIES-X25519-AEAD-Ratchet new session");