First set of code review patches
This commit is contained in:
parent
22c83f4b8d
commit
8c34c4cbb3
15 changed files with 315 additions and 182 deletions
|
|
@ -135,6 +135,10 @@ func (device *Device) CreateMessageInitiation(peer *Peer) (*MessageInitiation, e
|
|||
handshake.mutex.Lock()
|
||||
defer handshake.mutex.Unlock()
|
||||
|
||||
if isZero(handshake.precomputedStaticStatic[:]) {
|
||||
return nil, errors.New("Static shared secret is zero")
|
||||
}
|
||||
|
||||
// create ephemeral key
|
||||
|
||||
var err error
|
||||
|
|
@ -226,7 +230,11 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer {
|
|||
if peer == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
handshake := &peer.handshake
|
||||
if isZero(handshake.precomputedStaticStatic[:]) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// verify identity
|
||||
|
||||
|
|
@ -472,6 +480,7 @@ func (peer *Peer) NewKeyPair() *KeyPair {
|
|||
func() {
|
||||
kp.mutex.Lock()
|
||||
defer kp.mutex.Unlock()
|
||||
// TODO: Adapt kernel behavior noise.c:161
|
||||
if isInitiator {
|
||||
if kp.previous != nil {
|
||||
kp.previous.send = nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue