Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
comms
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
comms
Commits
0a29afe5
Commit
0a29afe5
authored
Apr 14, 2021
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Clean up ecPublic key handling
parent
a736185c
No related branches found
No related tags found
2 merge requests
!58
Revert "Modify waiting lock"
,
!9
Release
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
network/dataStructures/round.go
+1
-3
1 addition, 3 deletions
network/dataStructures/round.go
network/instance.go
+27
-6
27 additions, 6 deletions
network/instance.go
with
28 additions
and
9 deletions
network/dataStructures/round.go
+
1
−
3
View file @
0a29afe5
...
...
@@ -60,9 +60,7 @@ func (r *Round) Get() *pb.RoundInfo {
jww
.
FATAL
.
Panicf
(
"Could not validate "
+
"the roundInfo signature: %+v: %v"
,
r
.
info
,
err
)
}
}
if
r
.
ecPubKey
!=
nil
{
}
else
{
// Check the sig, panic if failure
err
:=
signature
.
VerifyEddsa
(
r
.
info
,
r
.
ecPubKey
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
network/instance.go
+
27
−
6
View file @
0a29afe5
...
...
@@ -12,6 +12,7 @@ package network
import
(
"bytes"
"fmt"
"github.com/katzenpost/core/crypto/eddsa"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
pb
"gitlab.com/elixxir/comms/mixmessages"
...
...
@@ -51,7 +52,7 @@ type Instance struct {
// using the RSA key or the EC key.
// Set to true, they shall use elliptic, set to false they shall use RSA
useElliptic
bool
ecPublicKey
*
eddsa
.
PublicKey
// Waiting Rounds
waitingRounds
*
ds
.
WaitingRounds
...
...
@@ -168,6 +169,24 @@ func NewInstance(c *connect.ProtoComms, partial, full *ndf.NetworkDefinition, er
useElliptic
:
useElliptic
,
}
i
.
ecPublicKey
,
err
=
ec
.
LoadPublicKeyFromString
(
i
.
GetEllipticPublicKey
())
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
fmt
.
Sprintf
(
"Could not load elliptic key from ndf"
))
}
var
ecPublicKey
*
eddsa
.
PublicKey
if
full
!=
nil
&&
full
.
Registration
.
EllipticPubKey
!=
""
{
ecPublicKey
,
err
=
ec
.
LoadPublicKeyFromString
(
i
.
GetEllipticPublicKey
())
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
fmt
.
Sprintf
(
"Could not load elliptic key from ndf"
))
}
}
else
if
partial
.
Registration
.
EllipticPubKey
!=
""
{
ecPublicKey
,
err
=
ec
.
LoadPublicKeyFromString
(
i
.
GetEllipticPublicKey
())
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
fmt
.
Sprintf
(
"Could not load elliptic key from ndf"
))
}
}
cmix
:=
""
if
full
!=
nil
&&
full
.
CMIX
.
Prime
!=
""
{
cmix
,
_
=
full
.
CMIX
.
String
()
...
...
@@ -196,6 +215,12 @@ func NewInstance(c *connect.ProtoComms, partial, full *ndf.NetworkDefinition, er
}
}
if
ecPublicKey
!=
nil
{
i
.
ecPublicKey
=
ecPublicKey
}
else
{
jww
.
DEBUG
.
Printf
(
"Elliptic public key was not set, could not be found in NDF"
)
}
i
.
waitingRounds
=
ds
.
NewWaitingRounds
()
i
.
events
=
ds
.
NewRoundEvents
()
i
.
validationLevel
=
validationLevel
...
...
@@ -480,11 +505,7 @@ func (i *Instance) RoundUpdate(info *pb.RoundInfo) error {
var
rnd
*
ds
.
Round
if
i
.
useElliptic
{
// Use the elliptic key only
ecPublicKey
,
err
:=
ec
.
LoadPublicKeyFromString
(
i
.
GetEllipticPublicKey
())
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
fmt
.
Sprintf
(
"Could not load elliptic key from ndf"
))
}
rnd
=
ds
.
NewRound
(
info
,
nil
,
ecPublicKey
)
rnd
=
ds
.
NewRound
(
info
,
nil
,
i
.
ecPublicKey
)
}
else
{
// Use the rsa key only
rnd
=
ds
.
NewRound
(
info
,
perm
.
GetPubKey
(),
nil
)
...
...
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