Skip to content

Commit c22b417

Browse files
mehdilauterssebthom
authored andcommitted
fix runfalk#130: wireguard patch added for armada38x / DSM 7.0 build
A build issue was introduced on the wiregard-linux-compat codebase. The fix has been requested for a merge on the project repository WireGuard/wireguard-linux-compat#5 Waiting it to be merged, a patch was added to this project to locally fix the problem
1 parent 5992a6b commit c22b417

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ $(WIREGUARD_DIR)/src/Makefile: $(WIREGUARD_TAR)
4949
tar -xf $(WIREGUARD_TAR)
5050
patch $(WIREGUARD_DIR)/src/netlink.c $(ROOT_DIR)/patch/netlink.patch
5151
patch $(WIREGUARD_DIR)/src/peerlookup.c $(ROOT_DIR)/patch/peerlookup.patch
52+
patch $(WIREGUARD_DIR)/src/compat/siphash/siphash.c $(ROOT_DIR)/patch/siphash.patch
5253
ifeq ($(APPLY_MEMNEQ_PATCH), 1)
5354
patch $(WIREGUARD_DIR)/src/compat/Kbuild.include $(ROOT_DIR)/patch/memneq.patch
5455
endif

patch/siphash.patch

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
--- a/src/compat/siphash/siphash.c
2+
+++ b/src/compat/siphash/siphash.c
3+
@@ -77,11 +77,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
4+
bytemask_from_count(left)));
5+
#else
6+
switch (left) {
7+
- case 7: b |= ((u64)end[6]) << 48; fallthrough;
8+
- case 6: b |= ((u64)end[5]) << 40; fallthrough;
9+
- case 5: b |= ((u64)end[4]) << 32; fallthrough;
10+
+ case 7: b |= ((u64)end[6]) << 48;
11+
+ case 6: b |= ((u64)end[5]) << 40;
12+
+ case 5: b |= ((u64)end[4]) << 32;
13+
case 4: b |= le32_to_cpup(data); break;
14+
- case 3: b |= ((u64)end[2]) << 16; fallthrough;
15+
+ case 3: b |= ((u64)end[2]) << 16;
16+
case 2: b |= le16_to_cpup(data); break;
17+
case 1: b |= end[0];
18+
}
19+
@@ -109,11 +109,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
20+
bytemask_from_count(left)));
21+
#else
22+
switch (left) {
23+
- case 7: b |= ((u64)end[6]) << 48; fallthrough;
24+
- case 6: b |= ((u64)end[5]) << 40; fallthrough;
25+
- case 5: b |= ((u64)end[4]) << 32; fallthrough;
26+
+ case 7: b |= ((u64)end[6]) << 48;
27+
+ case 6: b |= ((u64)end[5]) << 40;
28+
+ case 5: b |= ((u64)end[4]) << 32;
29+
case 4: b |= get_unaligned_le32(end); break;
30+
- case 3: b |= ((u64)end[2]) << 16; fallthrough;
31+
+ case 3: b |= ((u64)end[2]) << 16;
32+
case 2: b |= get_unaligned_le16(end); break;
33+
case 1: b |= end[0];
34+
}
35+
@@ -269,11 +269,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
36+
bytemask_from_count(left)));
37+
#else
38+
switch (left) {
39+
- case 7: b |= ((u64)end[6]) << 48; fallthrough;
40+
- case 6: b |= ((u64)end[5]) << 40; fallthrough;
41+
- case 5: b |= ((u64)end[4]) << 32; fallthrough;
42+
+ case 7: b |= ((u64)end[6]) << 48;
43+
+ case 6: b |= ((u64)end[5]) << 40;
44+
+ case 5: b |= ((u64)end[4]) << 32;
45+
case 4: b |= le32_to_cpup(data); break;
46+
- case 3: b |= ((u64)end[2]) << 16; fallthrough;
47+
+ case 3: b |= ((u64)end[2]) << 16;
48+
case 2: b |= le16_to_cpup(data); break;
49+
case 1: b |= end[0];
50+
}
51+
@@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
52+
bytemask_from_count(left)));
53+
#else
54+
switch (left) {
55+
- case 7: b |= ((u64)end[6]) << 48; fallthrough;
56+
- case 6: b |= ((u64)end[5]) << 40; fallthrough;
57+
- case 5: b |= ((u64)end[4]) << 32; fallthrough;
58+
+ case 7: b |= ((u64)end[6]) << 48;
59+
+ case 6: b |= ((u64)end[5]) << 40;
60+
+ case 5: b |= ((u64)end[4]) << 32;
61+
case 4: b |= get_unaligned_le32(end); break;
62+
- case 3: b |= ((u64)end[2]) << 16; fallthrough;
63+
+ case 3: b |= ((u64)end[2]) << 16;
64+
case 2: b |= get_unaligned_le16(end); break;
65+
case 1: b |= end[0];
66+
}
67+
@@ -426,7 +426,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
68+
v0 ^= m;
69+
}
70+
switch (left) {
71+
- case 3: b |= ((u32)end[2]) << 16; fallthrough;
72+
+ case 3: b |= ((u32)end[2]) << 16;
73+
case 2: b |= le16_to_cpup(data); break;
74+
case 1: b |= end[0];
75+
}
76+
@@ -448,7 +448,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
77+
v0 ^= m;
78+
}
79+
switch (left) {
80+
- case 3: b |= ((u32)end[2]) << 16; fallthrough;
81+
+ case 3: b |= ((u32)end[2]) << 16;
82+
case 2: b |= get_unaligned_le16(end); break;
83+
case 1: b |= end[0];
84+
}

0 commit comments

Comments
 (0)