]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
crypto: use unaligned helpers
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 24 Aug 2018 01:08:03 +0000 (18:08 -0700)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 29 Aug 2018 05:20:13 +0000 (23:20 -0600)
This is not useful for WireGuard, but for the general use case we
probably want it this way, and the speed difference is mostly lost in
the noise.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/curve25519.c

index b0308532d4334bb7e235e3778010f0c5673cd218..043aefca357dbbac9f35a059e93518c626c4129b 100644 (file)
@@ -29,6 +29,9 @@ typedef int64_t s64;
 #define le32_to_cpup(a) (*(a))
 #define cpu_to_le64(a) (a)
 #endif
+#define get_unaligned_le32(a) le32_to_cpup((u32 *)(a))
+#define get_unaligned_le64(a) le64_to_cpup((u64 *)(a))
+#define put_unaligned_le64(s, d) *(u64 *)(d) = cpu_to_le64(s)
 #ifndef __always_inline
 #define __always_inline __inline __attribute__((__always_inline__))
 #endif