aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/curve25519.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-02-03 21:50:54 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-03 21:51:18 +0100
commit897548e927fc90d13a19e1b1f29a549e7f885621 (patch)
treed27bc7200af21ab98724973011b5a78de6dcdba8 /src/tools/curve25519.h
parentchacha20poly1305: permit unaligned strides on certain platforms (diff)
downloadwireguard-monolithic-historical-897548e927fc90d13a19e1b1f29a549e7f885621.tar.xz
wireguard-monolithic-historical-897548e927fc90d13a19e1b1f29a549e7f885621.zip
noise: store clamped key instead of raw key
Diffstat (limited to 'src/tools/curve25519.h')
-rw-r--r--src/tools/curve25519.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/tools/curve25519.h b/src/tools/curve25519.h
index badcda0..c047019 100644
--- a/src/tools/curve25519.h
+++ b/src/tools/curve25519.h
@@ -10,7 +10,7 @@
#include <sys/types.h>
enum curve25519_lengths {
- CURVE25519_KEY_SIZE = 32,
+ CURVE25519_KEY_SIZE = 32
};
void curve25519(uint8_t mypublic[static CURVE25519_KEY_SIZE], const uint8_t secret[static CURVE25519_KEY_SIZE], const uint8_t basepoint[static CURVE25519_KEY_SIZE]);
@@ -18,8 +18,7 @@ void curve25519_generate_public(uint8_t pub[static CURVE25519_KEY_SIZE], const u
static inline void curve25519_clamp_secret(uint8_t secret[static CURVE25519_KEY_SIZE])
{
secret[0] &= 248;
- secret[31] &= 127;
- secret[31] |= 64;
+ secret[31] = (secret[31] & 127) | 64;
}
#endif