Skip to content
Snippets Groups Projects
Commit a45daceb authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

finishing touches to send cmix

parent 5e4097c3
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ type Manager struct { ...@@ -42,7 +42,7 @@ type Manager struct {
instance *network.Instance instance *network.Instance
//channels //channels
nodeRegistration chan *id.ID nodeRegistration chan network.NodeGateway
//local pointer to user ID because it is used often //local pointer to user ID because it is used often
uid *id.ID uid *id.ID
......
...@@ -7,7 +7,6 @@ import ( ...@@ -7,7 +7,6 @@ import (
"gitlab.com/elixxir/client/context/params" "gitlab.com/elixxir/client/context/params"
"gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/comms/network"
"gitlab.com/elixxir/crypto/csprng"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
...@@ -53,7 +52,7 @@ func (m *Manager) sendCMIX(msg format.Message, param params.CMIX) (id.Round, err ...@@ -53,7 +52,7 @@ func (m *Manager) sendCMIX(msg format.Message, param params.CMIX) (id.Round, err
//keying relationships //keying relationships
roundKeys, missingKeys := m.Context.Session.Cmix().GetRoundKeys(topology) roundKeys, missingKeys := m.Context.Session.Cmix().GetRoundKeys(topology)
if len(missingKeys) > 0 { if len(missingKeys) > 0 {
go handleMissingNodeKeys(missingKeys) go handleMissingNodeKeys(m.instance, m.nodeRegistration, missingKeys)
continue continue
} }
...@@ -68,7 +67,10 @@ func (m *Manager) sendCMIX(msg format.Message, param params.CMIX) (id.Round, err ...@@ -68,7 +67,10 @@ func (m *Manager) sendCMIX(msg format.Message, param params.CMIX) (id.Round, err
//encrypt the message //encrypt the message
salt := make([]byte, 32) salt := make([]byte, 32)
_, err := csprng.NewSystemRNG().Read(salt) stream := m.Context.Rng.GetStream()
_, err = stream.Read(salt)
stream.Close()
if err != nil { if err != nil {
return 0, errors.WithMessage(err, "Failed to generate "+ return 0, errors.WithMessage(err, "Failed to generate "+
"salt, this should never happen") "salt, this should never happen")
...@@ -127,4 +129,18 @@ func buildToplogy(nodes [][]byte) (*connect.Circuit, error) { ...@@ -127,4 +129,18 @@ func buildToplogy(nodes [][]byte) (*connect.Circuit, error) {
} }
func handleMissingNodeKeys(nodes []*id.ID) {} func handleMissingNodeKeys(instance *network.Instance, newNodeChan chan network.NodeGateway, nodes []*id.ID) {
for _, n := range nodes {
ng, err := instance.GetNodeAndGateway(n)
if err != nil {
jww.ERROR.Printf("Node contained in round cannot be found: %s", err)
continue
}
select {
case newNodeChan <- ng:
default:
jww.ERROR.Printf("Failed to send node registration for %s", n)
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment