From 0970f3da1b7a0d5ea84b779dd54800a5c3098626 Mon Sep 17 00:00:00 2001 From: "Richard T. Carback III" <rick.carback@gmail.com> Date: Mon, 25 Jan 2021 21:41:05 +0000 Subject: [PATCH] Revert "Integrate with latest comms lib" This reverts commit 7f1d50b3d88972bc8441218fa18974c6db70c270. --- api/send.go | 2 +- auth/confirm.go | 2 +- auth/request.go | 4 ++-- network/follow.go | 5 +++-- network/message/handler.go | 6 +----- network/message/sendCmix.go | 2 +- network/message/sendE2E.go | 2 +- network/message/sendUnsafe.go | 2 +- 8 files changed, 11 insertions(+), 14 deletions(-) diff --git a/api/send.go b/api/send.go index dc100912f..84256b206 100644 --- a/api/send.go +++ b/api/send.go @@ -62,6 +62,6 @@ func (c *Client) NewCMIXMessage(recipient *id.ID, return format.Message{}, errors.New("Contents to long for cmix") } msg.SetContents(contents) - msg.SetEphemeralRID(recipient.Bytes()) + msg.SetRecipientID(recipient) return msg, nil } diff --git a/auth/confirm.go b/auth/confirm.go index 1f328d04e..a58306c2d 100644 --- a/auth/confirm.go +++ b/auth/confirm.go @@ -99,7 +99,7 @@ func ConfirmRequestAuth(partner contact.Contact, rng io.Reader, cmixMsg.SetKeyFP(fp) cmixMsg.SetMac(mac) cmixMsg.SetContents(baseFmt.Marshal()) - cmixMsg.SetEphemeralRID(partner.ID.Bytes()) + cmixMsg.SetRecipientID(partner.ID) // fixme: channel can get into a bricked state if the first save occurs and // the second does not or the two occur and the storage into critical diff --git a/auth/request.go b/auth/request.go index fecf318eb..906aa9539 100644 --- a/auth/request.go +++ b/auth/request.go @@ -132,7 +132,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader, cmixMsg.SetKeyFP(requestfp) cmixMsg.SetMac(mac) cmixMsg.SetContents(baseFmt.Marshal()) - cmixMsg.SetEphemeralRID(partner.ID.Bytes()) + cmixMsg.SetRecipientID(partner.ID) jww.INFO.Printf("PARTNER ID: %s", partner.ID) /*store state*/ @@ -149,7 +149,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader, //jww.INFO.Printf("CMIX MESSAGE 1: %s, %v, %v, %v", cmixMsg.GetRecipientID(), // cmixMsg.GetKeyFP(), cmixMsg.GetMac(), cmixMsg.GetContents()) - jww.INFO.Printf("CMIX MESSAGE FP: %s, %v", cmixMsg.GetEphemeralRID(), + jww.INFO.Printf("CMIX MESSAGE FP: %s, %v", cmixMsg.GetRecipientID(), cmixMsg.GetKeyFP()) /*send message*/ diff --git a/network/follow.go b/network/follow.go index 623afc54c..fdde48242 100644 --- a/network/follow.go +++ b/network/follow.go @@ -85,6 +85,7 @@ func (m *manager) follow(rng csprng.Source, comms followNetworkComms) { Hash: m.Instance.GetPartialNdf().GetHash(), }, LastUpdate: uint64(m.Instance.GetLastUpdateID()), + ClientID: m.Uid.Bytes(), } jww.TRACE.Printf("Polling %s for NDF...", gwHost) pollResp, err := comms.SendPoll(gwHost, &pollReq) @@ -102,7 +103,7 @@ func (m *manager) follow(rng csprng.Source, comms followNetworkComms) { return } var filterList []*bloom.Ring - for _, f := range pollResp.Filters.Filters { + for _, f := range pollResp.BloomFilters { jww.DEBUG.Printf("Bloom Filter size: %d, hashes: %d", bloomFilterSize, bloomFilterHashes) filter, err := bloom.InitByParameters(bloomFilterSize, @@ -112,7 +113,7 @@ func (m *manager) follow(rng csprng.Source, comms followNetworkComms) { jww.FATAL.Panicf("Unable to create a bloom filter: %+v", err) } - if err := filter.UnmarshalBinary(f.Filter); err != nil { + if err := filter.UnmarshalBinary(f); err != nil { jww.WARN.Printf("Failed to unmarshal filter: %+v", err) jww.INFO.Printf("Bloom Filter Unmarshal Data: %v", f) continue diff --git a/network/message/handler.go b/network/message/handler.go index 4dbfc014a..6a3d5bb2a 100644 --- a/network/message/handler.go +++ b/network/message/handler.go @@ -72,14 +72,10 @@ func (m *Manager) handleMessage(ecrMsg format.Message) { // if it doesnt match any form of encrypted, hear it as a raw message // and add it to garbled messages to be handled later msg = ecrMsg - sendID, err := id.Unmarshal(msg.GetEphemeralRID()) - if err != nil { - jww.FATAL.Panicf("%+v", err) - } raw := message.Receive{ Payload: msg.Marshal(), MessageType: message.Raw, - Sender: sendID, + Sender: msg.GetRecipientID(), Timestamp: time.Time{}, Encryption: message.None, } diff --git a/network/message/sendCmix.go b/network/message/sendCmix.go index b3879db17..4addcb7e8 100644 --- a/network/message/sendCmix.go +++ b/network/message/sendCmix.go @@ -97,7 +97,7 @@ func (m *Manager) SendCMIX(msg format.Message, param params.CMIX) (id.Round, err return 0, errors.WithMessage(err, "Failed to generate "+ "salt, this should never happen") } - jww.INFO.Printf("RECIPIENTIDPRE_ENCRYPT: %s", msg.GetEphemeralRID()) + jww.INFO.Printf("RECIPIENTIDPRE_ENCRYPT: %s", msg.GetRecipientID()) encMsg, kmacs := roundKeys.Encrypt(msg, salt) //build the message payload diff --git a/network/message/sendE2E.go b/network/message/sendE2E.go index 915d16f2c..04e24e8e4 100644 --- a/network/message/sendE2E.go +++ b/network/message/sendE2E.go @@ -51,7 +51,7 @@ func (m *Manager) SendE2E(msg message.Send, param params.E2E) ([]id.Round, e2e.M //create the cmix message msgCmix := format.NewMessage(m.Session.Cmix().GetGroup().GetP().ByteLen()) msgCmix.SetContents(p) - msgCmix.SetEphemeralRID(msg.Recipient.Bytes()) + msgCmix.SetRecipientID(msg.Recipient) //get a key to end to end encrypt key, err := partner.GetKeyForSending(param.Type) diff --git a/network/message/sendUnsafe.go b/network/message/sendUnsafe.go index 89476f4ba..c313ef8c5 100644 --- a/network/message/sendUnsafe.go +++ b/network/message/sendUnsafe.go @@ -51,7 +51,7 @@ func (m *Manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round, for i, p := range partitions { msgCmix := format.NewMessage(m.Session.Cmix().GetGroup().GetP().ByteLen()) msgCmix.SetContents(p) - msgCmix.SetEphemeralRID(msg.Recipient.Bytes()) + msgCmix.SetRecipientID(msg.Recipient) e2e.SetUnencrypted(msgCmix, m.Session.User().GetCryptographicIdentity().GetUserID()) wg.Add(1) go func(i int) { -- GitLab