]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg: dedup secret normalization
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 31 Jan 2018 14:58:17 +0000 (15:58 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 31 Jan 2018 14:58:17 +0000 (15:58 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/curve25519.c

index 061b9135a08729b0476ca933e91058820d28db1e..0ed49770b6656d19a7d618698010f064bd7d3148 100644 (file)
@@ -35,6 +35,7 @@ typedef u32 __le32;
 #ifndef __force
 #define __force
 #endif
+#define normalize_secret(a) curve25519_normalize_secret(a)
 
 static noinline void memzero_explicit(void *s, size_t count)
 {
@@ -42,13 +43,6 @@ static noinline void memzero_explicit(void *s, size_t count)
        __asm__ __volatile__("": :"r"(s) :"memory");
 }
 
-static __always_inline void normalize_secret(u8 secret[CURVE25519_POINT_SIZE])
-{
-       secret[0] &= 248;
-       secret[31] &= 127;
-       secret[31] |= 64;
-}
-
 #ifdef __SIZEOF_INT128__
 #include "../crypto/curve25519-hacl64.h"
 #else