d6ad3be309e0c106cec35af62c84901c6538008b
[openwrt/staging/mans0n.git] /
1 From eb6a11e6d69912d8bb0b951b08f6871785cfe0e9 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Tue, 4 Feb 2020 22:17:27 +0100
4 Subject: [PATCH 084/124] wireguard: selftests: ensure non-addition of peers
5 with failed precomputation
6
7 commit f9398acba6a4ae9cb98bfe4d56414d376eff8d57 upstream.
8
9 Ensure that peers with low order points are ignored, both in the case
10 where we already have a device private key and in the case where we do
11 not. This adds points that naturally give a zero output.
12
13 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 ---
17 tools/testing/selftests/wireguard/netns.sh | 6 ++++++
18 1 file changed, 6 insertions(+)
19
20 --- a/tools/testing/selftests/wireguard/netns.sh
21 +++ b/tools/testing/selftests/wireguard/netns.sh
22 @@ -516,6 +516,12 @@ n0 wg set wg0 peer "$pub2" allowed-ips 0
23 n0 wg set wg0 peer "$pub2" allowed-ips 0.0.0.0/0
24 n0 wg set wg0 peer "$pub2" allowed-ips ::/0,1700::/111,5000::/4,e000::/37,9000::/75
25 n0 wg set wg0 peer "$pub2" allowed-ips ::/0
26 +n0 wg set wg0 peer "$pub2" remove
27 +low_order_points=( AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= 4Ot6fDtBuK4WVuP68Z/EatoJjeucMrH9hmIFFl9JuAA= X5yVvKNQjCSx0LFVnIPvWwREXMRYHI6G2CJO3dCfEVc= 7P///////////////////////////////////////38= 7f///////////////////////////////////////38= 7v///////////////////////////////////////38= )
28 +n0 wg set wg0 private-key /dev/null ${low_order_points[@]/#/peer }
29 +[[ -z $(n0 wg show wg0 peers) ]]
30 +n0 wg set wg0 private-key <(echo "$key1") ${low_order_points[@]/#/peer }
31 +[[ -z $(n0 wg show wg0 peers) ]]
32 ip0 link del wg0
33
34 declare -A objects