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 | 6f0fc6cb3e453b2082678cf6f59f4cc349f49b0e (patch) | |
tree | 91e160308241ade8cc55efc0d1295f5e438dfa89 /contrib/examples/embeddable-wg-library/wireguard.c | |
parent | keygen-html: bring back pure javascript implementation (diff) | |
download | wireguard-monolithic-historical-6f0fc6cb3e453b2082678cf6f59f4cc349f49b0e.tar.xz wireguard-monolithic-historical-6f0fc6cb3e453b2082678cf6f59f4cc349f49b0e.zip |
global: normalize -> clamp
Diffstat (limited to 'contrib/examples/embeddable-wg-library/wireguard.c')
-rw-r--r-- | contrib/examples/embeddable-wg-library/wireguard.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/examples/embeddable-wg-library/wireguard.c b/contrib/examples/embeddable-wg-library/wireguard.c index 1522c91..51da8ec 100644 --- a/contrib/examples/embeddable-wg-library/wireguard.c +++ b/contrib/examples/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) |