Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
a45daceb
Commit
a45daceb
authored
Sep 15, 2020
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
finishing touches to send cmix
parent
5e4097c3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
network/manager.go
+1
-1
1 addition, 1 deletion
network/manager.go
network/sendCmix.go
+20
-4
20 additions, 4 deletions
network/sendCmix.go
with
21 additions
and
5 deletions
network/manager.go
+
1
−
1
View file @
a45daceb
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
network/sendCmix.go
+
20
−
4
View file @
a45daceb
...
@@ -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
)
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment