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
20745d90
Commit
20745d90
authored
Dec 7, 2021
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Group chat SIDH Fixes
parent
cb6bb59d
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!117
Release
,
!73
Quantum secure xx messenger key negotiation
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
groupChat/makeGroup_test.go
+20
-2
20 additions, 2 deletions
groupChat/makeGroup_test.go
groupChat/receiveRequest_test.go
+32
-1
32 additions, 1 deletion
groupChat/receiveRequest_test.go
with
52 additions
and
3 deletions
groupChat/makeGroup_test.go
+
20
−
2
View file @
20745d90
...
@@ -21,6 +21,8 @@ import (
...
@@ -21,6 +21,8 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"testing"
"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.
// 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,
...
@@ -290,14 +292,30 @@ func addPartners(m *Manager, t *testing.T) ([]*id.ID, group.Membership,
uid
:=
id
.
NewIdFromUInt
(
uint64
(
i
),
id
.
User
,
t
)
uid
:=
id
.
NewIdFromUInt
(
uint64
(
i
),
id
.
User
,
t
)
dhKey
:=
m
.
store
.
E2e
()
.
GetGroup
()
.
NewInt
(
int64
(
i
+
42
))
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
// Add to lists
memberIDs
[
i
]
=
uid
memberIDs
[
i
]
=
uid
members
=
append
(
members
,
group
.
Member
{
ID
:
uid
,
DhKey
:
dhKey
})
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
// Add partner
err
:=
m
.
store
.
E2e
()
.
AddPartner
(
uid
,
dhKey
,
dhKey
,
err
:=
m
.
store
.
E2e
()
.
AddPartner
(
uid
,
dhKey
,
dhKey
,
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
())
theirSIDHPubKey
,
mySIDHPrivKey
,
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Failed to add partner %d: %+v"
,
i
,
err
)
t
.
Errorf
(
"Failed to add partner %d: %+v"
,
i
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
groupChat/receiveRequest_test.go
+
32
−
1
View file @
20745d90
...
@@ -18,6 +18,8 @@ import (
...
@@ -18,6 +18,8 @@ import (
"strings"
"strings"
"testing"
"testing"
"time"
"time"
util
"gitlab.com/elixxir/client/storage/utility"
"github.com/cloudflare/circl/dh/sidh"
)
)
// Tests that the correct group is received from the request.
// Tests that the correct group is received from the request.
...
@@ -48,10 +50,24 @@ func TestManager_receiveRequest(t *testing.T) {
...
@@ -48,10 +50,24 @@ func TestManager_receiveRequest(t *testing.T) {
MessageType
:
message
.
GroupCreationRequest
,
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
(
_
=
m
.
store
.
E2e
()
.
AddPartner
(
g
.
Members
[
0
]
.
ID
,
g
.
Members
[
0
]
.
ID
,
g
.
Members
[
0
]
.
DhKey
,
g
.
Members
[
0
]
.
DhKey
,
m
.
store
.
E2e
()
.
GetGroup
()
.
NewInt
(
2
),
m
.
store
.
E2e
()
.
GetGroup
()
.
NewInt
(
2
),
theirSIDHPubKey
,
mySIDHPrivKey
,
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
(),
)
)
...
@@ -161,11 +177,26 @@ func TestManager_receiveRequest_SendMessageTypeError(t *testing.T) {
...
@@ -161,11 +177,26 @@ func TestManager_receiveRequest_SendMessageTypeError(t *testing.T) {
// Unit test of readRequest.
// Unit test of readRequest.
func
TestManager_readRequest
(
t
*
testing
.
T
)
{
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
(
_
=
m
.
store
.
E2e
()
.
AddPartner
(
g
.
Members
[
0
]
.
ID
,
g
.
Members
[
0
]
.
ID
,
g
.
Members
[
0
]
.
DhKey
,
g
.
Members
[
0
]
.
DhKey
,
m
.
store
.
E2e
()
.
GetGroup
()
.
NewInt
(
2
),
m
.
store
.
E2e
()
.
GetGroup
()
.
NewInt
(
2
),
theirSIDHPubKey
,
mySIDHPrivKey
,
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
(),
params
.
GetDefaultE2ESessionParams
(),
)
)
...
...
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