mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 12:46:52 +01:00
handshake: Take the peer's static key from noise once per certificate check
This commit is contained in:
1 parent
35b3d92bdd
commit
4b295e086e
1 file changed
+4
-2
@@ -389,10 +389,12 @@ func (m *Machine) validateCert(payload Payload) error {
|
||||
m.failed = true
|
||||
return fmt.Errorf("%w: %v", ErrNoCredential, m.myVersion)
|
||||
}
|
||||
// PeerStatic builds a fresh composite key on every call for hybrid patterns.
|
||||
peerStatic := m.hs.PeerStatic()
|
||||
rc, err := cert.Recombine(
|
||||
cert.Version(payload.CertVersion),
|
||||
payload.Cert,
|
||||
m.hs.PeerStatic(),
|
||||
peerStatic,
|
||||
cred.Cert.Curve(),
|
||||
)
|
||||
if err != nil {
|
||||
@@ -400,7 +402,7 @@ func (m *Machine) validateCert(payload Payload) error {
|
||||
return fmt.Errorf("recombine cert: %w", err)
|
||||
}
|
||||
|
||||
if !bytes.Equal(rc.PublicKey(), m.hs.PeerStatic()) {
|
||||
if !bytes.Equal(rc.PublicKey(), peerStatic) {
|
||||
m.failed = true
|
||||
return ErrPublicKeyMismatch
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user