aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/embeddable-wg-library
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-01-11 01:13:35 -0800
committerJason A. Donenfeld <Jason@zx2c4.com>2019-01-23 14:29:44 +0100
commit777fe674c4c534bb0b9a97c4e5d90f06343c8f23 (patch)
treee6c1819a7891634ad35b968e922357f4b39a3c7b /contrib/embeddable-wg-library
parentkeygen-html: bring back pure javascript implementation (diff)
downloadwireguard-tools-777fe674c4c534bb0b9a97c4e5d90f06343c8f23.tar.xz
wireguard-tools-777fe674c4c534bb0b9a97c4e5d90f06343c8f23.zip
global: normalize -> clamp
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'contrib/embeddable-wg-library')
-rw-r--r--contrib/embeddable-wg-library/wireguard.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/embeddable-wg-library/wireguard.c b/contrib/embeddable-wg-library/wireguard.c
index 1522c91..51da8ec 100644
--- a/contrib/embeddable-wg-library/wireguard.c
+++ b/contrib/embeddable-wg-library/wireguard.c
@@ -1688,7 +1688,7 @@ static void invert(fe o, const fe i)
memzero_explicit(c, sizeof(c));
}
-static void normalize_key(uint8_t *z)
+static void clamp_key(uint8_t *z)
{
z[31] = (z[31] & 127) | 64;
z[0] &= 248;
@@ -1701,7 +1701,7 @@ void wg_generate_public_key(wg_key public_key, const wg_key private_key)
fe a = { 1 }, b = { 9 }, c = { 0 }, d = { 1 }, e, f;
memcpy(z, private_key, sizeof(z));
- normalize_key(z);
+ clamp_key(z);
for (i = 254; i >= 0; --i) {
r = (z[i >> 3] >> (i & 7)) & 1;
@@ -1745,7 +1745,7 @@ void wg_generate_public_key(wg_key public_key, const wg_key private_key)
void wg_generate_private_key(wg_key private_key)
{
wg_generate_preshared_key(private_key);
- normalize_key(private_key);
+ clamp_key(private_key);
}
void wg_generate_preshared_key(wg_key preshared_key)