diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-01-11 01:13:35 -0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-01-23 14:29:44 +0100 |
commit | 777fe674c4c534bb0b9a97c4e5d90f06343c8f23 (patch) | |
tree | e6c1819a7891634ad35b968e922357f4b39a3c7b /contrib/keygen-html | |
parent | keygen-html: bring back pure javascript implementation (diff) | |
download | wireguard-tools-777fe674c4c534bb0b9a97c4e5d90f06343c8f23.tar.xz wireguard-tools-777fe674c4c534bb0b9a97c4e5d90f06343c8f23.zip |
global: normalize -> clamp
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'contrib/keygen-html')
-rw-r--r-- | contrib/keygen-html/wireguard.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/keygen-html/wireguard.js b/contrib/keygen-html/wireguard.js index e96da3e..e262459 100644 --- a/contrib/keygen-html/wireguard.js +++ b/contrib/keygen-html/wireguard.js @@ -91,7 +91,7 @@ o[a] = c[a]; } - function normalizeKey(z) { + function clamp(z) { z[31] = (z[31] & 127) | 64; z[0] &= 248; } @@ -108,7 +108,7 @@ _9 = gf([9]); for (var i = 0; i < 32; ++i) z[i] = privateKey[i]; - normalizeKey(z); + clamp(z); for (var i = 254; i >= 0; --i) { r = (z[i >>> 3] >>> (i & 7)) & 1; cswap(a, b, r); @@ -148,7 +148,7 @@ function generatePrivateKey() { var privateKey = generatePresharedKey(); - normalizeKey(privateKey); + clamp(privateKey); return privateKey; } |