Skip to content
Snippets Groups Projects
Commit e8875de6 authored by Jonah Husson's avatar Jonah Husson
Browse files

Fix garbled message bug

parent 67f70846
No related branches found
No related tags found
2 merge requests!170Release,!120Add 0 byte to message contents
......@@ -57,6 +57,11 @@ func (m *Manager) handleGarbledMessages() {
var failedMsgs []format.Message
//try to decrypt every garbled message, excising those who's counts are too high
for grbldMsg, count, timestamp, has := garbledMsgs.Next(); has; grbldMsg, count, timestamp, has = garbledMsgs.Next() {
//if it exists, check against all in the list
modifiedContents := append([]byte{0}, grbldMsg.GetContents()...)
identity := m.Session.GetUser().GetContact().ID
_, forMe, _ := m.Session.GetEdge().Check(identity, grbldMsg.GetIdentityFP(), modifiedContents)
if forMe {
fingerprint := grbldMsg.GetKeyFP()
// Check if the key is there, process it if it is
if key, isE2E := e2eKv.PopKey(fingerprint); isE2E {
......@@ -116,6 +121,8 @@ func (m *Manager) handleGarbledMessages() {
m.Session.GetGarbledMessages().Add(grbldMsg)
m.Switchboard.Speak(raw)
}
}
// fail the message if any part of the decryption fails,
// unless it is the last attempts and has been in the buffer long
// enough, in which case remove it
......
......@@ -71,7 +71,10 @@ func (m *Manager) handleMessage(ecrMsg format.Message, bundle Bundle, edge *edge
"check: %v (expected-default) vs %v (received)", identity.EphId,
identity.Source, expectedFP, ecrMsg.GetIdentityFP())
}
im := fmt.Sprintf("Garbled/RAW Message: keyFP: %v, round: %d"+
"msgDigest: %s, not determined to be for client", msg.GetKeyFP(), bundle.Round, msg.Digest())
m.Internal.Events.Report(1, "MessageReception", "Garbled", im)
m.Session.GetGarbledMessages().Add(msg)
return
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment