aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/compat/siphash
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-04-09 06:25:04 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-04-09 06:25:20 +0200
commit4e478eac82c3c8516e1d5766a66f16af38cfd1a6 (patch)
treedfc9ced5af877be13c30f55421aeb3cf2066cf47 /src/compat/siphash
parentcompat: support 3.14 (diff)
downloadwireguard-monolithic-historical-4e478eac82c3c8516e1d5766a66f16af38cfd1a6.tar.xz
wireguard-monolithic-historical-4e478eac82c3c8516e1d5766a66f16af38cfd1a6.zip
compat: support 3.12
Diffstat (limited to 'src/compat/siphash')
-rw-r--r--src/compat/siphash/siphash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compat/siphash/siphash.c b/src/compat/siphash/siphash.c
index 3ae58b4..1ebfd5e 100644
--- a/src/compat/siphash/siphash.c
+++ b/src/compat/siphash/siphash.c
@@ -13,6 +13,16 @@
#include <linux/siphash.h>
#include <asm/unaligned.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
+#ifdef __LITTLE_ENDIAN
+ #define HASH_LEN_DECLARE u32 hash; u32 len;
+ #define bytemask_from_count(cnt) (~(~0ul << (cnt)*8))
+#else
+ #define HASH_LEN_DECLARE u32 len; u32 hash;
+ #define bytemask_from_count(cnt) (~(~0ul >> (cnt)*8))
+#endif
+#endif
+
#if defined(CONFIG_DCACHE_WORD_ACCESS) && BITS_PER_LONG == 64
#include <linux/dcache.h>
#include <asm/word-at-a-time.h>