aboutsummaryrefslogtreecommitdiffstats
path: root/noise-types.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-02-03 22:00:36 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-05 12:59:42 +0100
commit3af9aa88a310f7c2b86bae1ebb3ed3843424ce9e (patch)
treec92b471e4a728cc41b8f18d1bca7d7f21d61a839 /noise-types.go
parenttai64n: whiten nano seconds (diff)
downloadwireguard-go-3af9aa88a310f7c2b86bae1ebb3ed3843424ce9e.tar.xz
wireguard-go-3af9aa88a310f7c2b86bae1ebb3ed3843424ce9e.zip
noise: store clamped key instead of raw key
Diffstat (limited to '')
-rw-r--r--noise-types.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/noise-types.go b/noise-types.go
index df6ee77..902905e 100644
--- a/noise-types.go
+++ b/noise-types.go
@@ -45,8 +45,10 @@ func (key NoisePrivateKey) Equals(tar NoisePrivateKey) bool {
return subtle.ConstantTimeCompare(key[:], tar[:]) == 1
}
-func (key *NoisePrivateKey) FromHex(src string) error {
- return loadExactHex(key[:], src)
+func (key *NoisePrivateKey) FromHex(src string) (err error) {
+ err = loadExactHex(key[:], src)
+ key.clamp()
+ return
}
func (key NoisePrivateKey) ToHex() string {