mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-23 00:56:20 +00:00
types/key: restore Curve25519 clamping in NewPrivate
It was lost during a copy from wgcfg.NewPresharedKey (which doesn't clamp) instead of wgcfg.NewPrivateKey (which does). Fortunately this was only use for discovery messages (not WireGuard) and only for ephemeral process-lifetime keys.
This commit is contained in:
@@ -28,6 +28,8 @@ func NewPrivate() Private {
|
||||
if _, err := io.ReadFull(crand.Reader, p[:]); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
p[0] &= 248
|
||||
p[31] = (p[31] & 127) | 64
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user