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

add ephemeral ed key to link funcs, fixes for integration

parent 2c92e341
Branches
Tags
2 merge requests!48Release,!46No registration
...@@ -118,7 +118,7 @@ func TestClientServer(t *testing.T) { ...@@ -118,7 +118,7 @@ func TestClientServer(t *testing.T) {
reporter := round.NewClientFailureReport(nid) reporter := round.NewClientFailureReport(nid)
nsm := storage.NewNodeSecretManager() nsm := storage.NewNodeSecretManager()
precanStore := storage.NewPrecanStore(true, grp) precanStore := storage.NewPrecanStore(true, grp)
stream.LinkStream(grp, testSalts, kmacs, ephKeys, usrs, keys, keys, reporter, 0, 32, nsm, precanStore) stream.LinkStream(grp, testSalts, kmacs, ephKeys, nil, usrs, keys, keys, reporter, 0, 32, nsm, precanStore)
err := Keygen.Adapt(&stream, cryptops.Keygen, chunk) err := Keygen.Adapt(&stream, cryptops.Keygen, chunk)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
......
...@@ -54,7 +54,7 @@ type KeygenSubStream struct { ...@@ -54,7 +54,7 @@ type KeygenSubStream struct {
// at Link time, but they should represent an area that'll be filled with valid // at Link time, but they should represent an area that'll be filled with valid
// data or space for data when the cryptop runs // data or space for data when the cryptop runs
func (k *KeygenSubStream) LinkStream(grp *cyclic.Group, inSalts [][]byte, func (k *KeygenSubStream) LinkStream(grp *cyclic.Group, inSalts [][]byte,
inKMACS [][][]byte, inEphKeys [][]bool, inUsers []*id.ID, outKeysA, outKeysB *cyclic.IntBuffer, inKMACS [][][]byte, inEphKeys [][]bool, clEphemeralEd nike.PublicKey, inUsers []*id.ID, outKeysA, outKeysB *cyclic.IntBuffer,
reporter *round.ClientReport, roundID id.Round, batchSize uint32, reporter *round.ClientReport, roundID id.Round, batchSize uint32,
nodeSecrets *storage.NodeSecretManager, precanStore *storage.PrecanStore) { nodeSecrets *storage.NodeSecretManager, precanStore *storage.PrecanStore) {
k.Grp = grp k.Grp = grp
...@@ -69,6 +69,7 @@ func (k *KeygenSubStream) LinkStream(grp *cyclic.Group, inSalts [][]byte, ...@@ -69,6 +69,7 @@ func (k *KeygenSubStream) LinkStream(grp *cyclic.Group, inSalts [][]byte,
k.batchSize = batchSize k.batchSize = batchSize
k.NodeSecrets = nodeSecrets k.NodeSecrets = nodeSecrets
k.Precanned = precanStore k.Precanned = precanStore
k.ClientEphemeralEd = clEphemeralEd
} }
// Returns the substream, used to return an embedded struct off an interface // Returns the substream, used to return an embedded struct off an interface
......
...@@ -52,7 +52,7 @@ func (s *KeygenTestStream) Link(grp *cyclic.Group, batchSize uint32, source ...i ...@@ -52,7 +52,7 @@ func (s *KeygenTestStream) Link(grp *cyclic.Group, batchSize uint32, source ...i
// KeygenSubStream's Link so they can be populated in-place by the // KeygenSubStream's Link so they can be populated in-place by the
// CommStream for the graph // CommStream for the graph
s.KeygenSubStream.LinkStream(grp, make([][]byte, batchSize), s.KeygenSubStream.LinkStream(grp, make([][]byte, batchSize),
make([][][]byte, batchSize), make([][]bool, batchSize), make([][][]byte, batchSize), make([][]bool, batchSize), nil,
make([]*id.ID, batchSize), make([]*id.ID, batchSize),
grp.NewIntBuffer(batchSize, grp.NewInt(1)), grp.NewIntBuffer(batchSize, grp.NewInt(1)),
grp.NewIntBuffer(batchSize, grp.NewInt(1)), grp.NewIntBuffer(batchSize, grp.NewInt(1)),
......
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/crypto/nike"
"gitlab.com/elixxir/crypto/nike/ecdh" "gitlab.com/elixxir/crypto/nike/ecdh"
"gitlab.com/elixxir/gpumathsgo" "gitlab.com/elixxir/gpumathsgo"
"gitlab.com/elixxir/gpumathsgo/cryptops" "gitlab.com/elixxir/gpumathsgo/cryptops"
...@@ -100,7 +101,7 @@ func (s *KeygenDecryptStream) Link(grp *cyclic.Group, batchSize uint32, source . ...@@ -100,7 +101,7 @@ func (s *KeygenDecryptStream) Link(grp *cyclic.Group, batchSize uint32, source .
grp.NewIntBuffer(batchSize, grp.NewInt(1)), grp.NewIntBuffer(batchSize, grp.NewInt(1)),
grp.NewIntBuffer(batchSize, grp.NewInt(1)), grp.NewIntBuffer(batchSize, grp.NewInt(1)),
users, make([][]byte, batchSize), make([][][]byte, batchSize), users, make([][]byte, batchSize), make([][][]byte, batchSize),
make([][]bool, batchSize), clientReporter, roundID, make([][]bool, batchSize), s.ClientEphemeralEd, clientReporter, roundID,
nodeSecret, precanStore) nodeSecret, precanStore)
} }
...@@ -108,7 +109,7 @@ func (s *KeygenDecryptStream) Link(grp *cyclic.Group, batchSize uint32, source . ...@@ -108,7 +109,7 @@ func (s *KeygenDecryptStream) Link(grp *cyclic.Group, batchSize uint32, source .
func (s *KeygenDecryptStream) LinkKeygenDecryptStream(grp *cyclic.Group, func (s *KeygenDecryptStream) LinkKeygenDecryptStream(grp *cyclic.Group,
batchSize uint32, round *round.Buffer, pool *gpumaths.StreamPool, batchSize uint32, round *round.Buffer, pool *gpumaths.StreamPool,
ecrPayloadA, ecrPayloadB, keysPayloadA, keysPayloadB *cyclic.IntBuffer, ecrPayloadA, ecrPayloadB, keysPayloadA, keysPayloadB *cyclic.IntBuffer,
users []*id.ID, salts [][]byte, kmacs [][][]byte, ephKeys [][]bool, users []*id.ID, salts [][]byte, kmacs [][][]byte, ephKeys [][]bool, clientEphemeralEd nike.PublicKey,
clientReporter *round.ClientReport, roundId id.Round, clientReporter *round.ClientReport, roundId id.Round,
nodeSecrets *storage.NodeSecretManager, nodeSecrets *storage.NodeSecretManager,
precanStore *storage.PrecanStore) { precanStore *storage.PrecanStore) {
...@@ -128,8 +129,9 @@ func (s *KeygenDecryptStream) LinkKeygenDecryptStream(grp *cyclic.Group, ...@@ -128,8 +129,9 @@ func (s *KeygenDecryptStream) LinkKeygenDecryptStream(grp *cyclic.Group,
s.KMACS = kmacs s.KMACS = kmacs
s.NodeSecrets = nodeSecrets s.NodeSecrets = nodeSecrets
s.EphemeralKeys = ephKeys s.EphemeralKeys = ephKeys
s.ClientEphemeralEd = clientEphemeralEd
s.KeygenSubStream.LinkStream(s.Grp, s.Salts, s.KMACS, s.EphemeralKeys, s.KeygenSubStream.LinkStream(s.Grp, s.Salts, s.KMACS, s.EphemeralKeys, s.ClientEphemeralEd,
s.Users, s.KeysPayloadA, s.KeysPayloadB, clientReporter, roundId, s.Users, s.KeysPayloadA, s.KeysPayloadB, clientReporter, roundId,
batchSize, nodeSecrets, precanStore) batchSize, nodeSecrets, precanStore)
} }
...@@ -191,6 +193,10 @@ func (s *KeygenDecryptStream) Input(index uint32, slot *mixmessages.Slot) error ...@@ -191,6 +193,10 @@ func (s *KeygenDecryptStream) Input(index uint32, slot *mixmessages.Slot) error
// Output a cmix slot message for IO // Output a cmix slot message for IO
func (s *KeygenDecryptStream) Output(index uint32) *mixmessages.Slot { func (s *KeygenDecryptStream) Output(index uint32) *mixmessages.Slot {
var edBytes []byte
if s.ClientEphemeralEd != nil {
edBytes = s.ClientEphemeralEd.Bytes()
}
return &mixmessages.Slot{ return &mixmessages.Slot{
Index: index, Index: index,
SenderID: (*s.Users[index])[:], SenderID: (*s.Users[index])[:],
...@@ -198,6 +204,8 @@ func (s *KeygenDecryptStream) Output(index uint32) *mixmessages.Slot { ...@@ -198,6 +204,8 @@ func (s *KeygenDecryptStream) Output(index uint32) *mixmessages.Slot {
PayloadA: s.EcrPayloadA.Get(index).Bytes(), PayloadA: s.EcrPayloadA.Get(index).Bytes(),
PayloadB: s.EcrPayloadB.Get(index).Bytes(), PayloadB: s.EcrPayloadB.Get(index).Bytes(),
KMACs: s.KMACS[index], KMACs: s.KMACS[index],
EphemeralKeys: s.EphemeralKeys[index],
Ed25519: edBytes,
} }
} }
......
...@@ -803,7 +803,7 @@ func (ds *DebugStream) Link(grp *cyclic.Group, batchSize uint32, ...@@ -803,7 +803,7 @@ func (ds *DebugStream) Link(grp *cyclic.Group, batchSize uint32,
testReport := round.NewClientFailureReport(fakeNodeID) testReport := round.NewClientFailureReport(fakeNodeID)
ds.LinkKeygenDecryptStream(grp, batchSize, roundBuf, nil, ecrPayloadA, ecrPayloadB, grp.NewIntBuffer(batchSize, grp.NewInt(1)), grp.NewIntBuffer(batchSize, grp.NewInt(1)), users, make([][]byte, batchSize), make([][][]byte, batchSize), make([][]bool, batchSize), testReport, 0, storage.NewNodeSecretManager(), storage.NewPrecanStore(true, grp)) ds.LinkKeygenDecryptStream(grp, batchSize, roundBuf, nil, ecrPayloadA, ecrPayloadB, grp.NewIntBuffer(batchSize, grp.NewInt(1)), grp.NewIntBuffer(batchSize, grp.NewInt(1)), users, make([][]byte, batchSize), make([][][]byte, batchSize), make([][]bool, batchSize), nil, testReport, 0, storage.NewNodeSecretManager(), storage.NewPrecanStore(true, grp))
ds.LinkIdentifyStreams(grp, batchSize, roundBuf, nil, ecrPayloadA, ecrPayloadB, ds.LinkIdentifyStreams(grp, batchSize, roundBuf, nil, ecrPayloadA, ecrPayloadB,
ecrPayloadAPermuted, ecrPayloadBPermuted) ecrPayloadAPermuted, ecrPayloadBPermuted)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment