Skip to content
Snippets Groups Projects
Commit 20745d90 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Group chat SIDH Fixes

parent cb6bb59d
No related branches found
No related tags found
2 merge requests!117Release,!73Quantum secure xx messenger key negotiation
......@@ -21,6 +21,8 @@ import (
"strconv"
"strings"
"testing"
util "gitlab.com/elixxir/client/storage/utility"
"github.com/cloudflare/circl/dh/sidh"
)
// Tests that Manager.MakeGroup adds a group and returns the expected status.
......@@ -290,14 +292,30 @@ func addPartners(m *Manager, t *testing.T) ([]*id.ID, group.Membership,
uid := id.NewIdFromUInt(uint64(i), id.User, t)
dhKey := m.store.E2e().GetGroup().NewInt(int64(i + 42))
myVariant := sidh.KeyVariantSidhA
prng := rand.New(rand.NewSource(int64(i+42)))
mySIDHPrivKey := util.NewSIDHPrivateKey(myVariant)
mySIDHPubKey := util.NewSIDHPublicKey(myVariant)
mySIDHPrivKey.Generate(prng)
mySIDHPrivKey.GeneratePublicKey(mySIDHPubKey)
theirVariant := sidh.KeyVariant(sidh.KeyVariantSidhB)
theirSIDHPrivKey := util.NewSIDHPrivateKey(theirVariant)
theirSIDHPubKey := util.NewSIDHPublicKey(theirVariant)
theirSIDHPrivKey.Generate(prng)
theirSIDHPrivKey.GeneratePublicKey(theirSIDHPubKey)
// Add to lists
memberIDs[i] = uid
members = append(members, group.Member{ID: uid, DhKey: dhKey})
dkl.Add(dhKey, group.Member{ID: uid, DhKey: dhKey}, m.store.E2e().GetGroup())
dkl.Add(dhKey, group.Member{ID: uid, DhKey: dhKey},
m.store.E2e().GetGroup())
// Add partner
err := m.store.E2e().AddPartner(uid, dhKey, dhKey,
params.GetDefaultE2ESessionParams(), params.GetDefaultE2ESessionParams())
theirSIDHPubKey, mySIDHPrivKey,
params.GetDefaultE2ESessionParams(),
params.GetDefaultE2ESessionParams())
if err != nil {
t.Errorf("Failed to add partner %d: %+v", i, err)
}
......
......@@ -18,6 +18,8 @@ import (
"strings"
"testing"
"time"
util "gitlab.com/elixxir/client/storage/utility"
"github.com/cloudflare/circl/dh/sidh"
)
// Tests that the correct group is received from the request.
......@@ -48,10 +50,24 @@ func TestManager_receiveRequest(t *testing.T) {
MessageType: message.GroupCreationRequest,
}
myVariant := sidh.KeyVariantSidhA
mySIDHPrivKey := util.NewSIDHPrivateKey(myVariant)
mySIDHPubKey := util.NewSIDHPublicKey(myVariant)
mySIDHPrivKey.Generate(prng)
mySIDHPrivKey.GeneratePublicKey(mySIDHPubKey)
theirVariant := sidh.KeyVariant(sidh.KeyVariantSidhB)
theirSIDHPrivKey := util.NewSIDHPrivateKey(theirVariant)
theirSIDHPubKey := util.NewSIDHPublicKey(theirVariant)
theirSIDHPrivKey.Generate(prng)
theirSIDHPrivKey.GeneratePublicKey(theirSIDHPubKey)
_ = m.store.E2e().AddPartner(
g.Members[0].ID,
g.Members[0].DhKey,
m.store.E2e().GetGroup().NewInt(2),
theirSIDHPubKey, mySIDHPrivKey,
params.GetDefaultE2ESessionParams(),
params.GetDefaultE2ESessionParams(),
)
......@@ -161,11 +177,26 @@ func TestManager_receiveRequest_SendMessageTypeError(t *testing.T) {
// Unit test of readRequest.
func TestManager_readRequest(t *testing.T) {
m, g := newTestManager(rand.New(rand.NewSource(42)), t)
prng := rand.New(rand.NewSource(42))
m, g := newTestManager(prng, t)
myVariant := sidh.KeyVariantSidhA
mySIDHPrivKey := util.NewSIDHPrivateKey(myVariant)
mySIDHPubKey := util.NewSIDHPublicKey(myVariant)
mySIDHPrivKey.Generate(prng)
mySIDHPrivKey.GeneratePublicKey(mySIDHPubKey)
theirVariant := sidh.KeyVariant(sidh.KeyVariantSidhB)
theirSIDHPrivKey := util.NewSIDHPrivateKey(theirVariant)
theirSIDHPubKey := util.NewSIDHPublicKey(theirVariant)
theirSIDHPrivKey.Generate(prng)
theirSIDHPrivKey.GeneratePublicKey(theirSIDHPubKey)
_ = m.store.E2e().AddPartner(
g.Members[0].ID,
g.Members[0].DhKey,
m.store.E2e().GetGroup().NewInt(2),
theirSIDHPubKey, mySIDHPrivKey,
params.GetDefaultE2ESessionParams(),
params.GetDefaultE2ESessionParams(),
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment