wireguard: add processing of received cookie messages 13/36713/3
authorAlexander Chernavin <achernavin@netgate.com>
Wed, 20 Jul 2022 10:48:56 +0000 (10:48 +0000)
committerMatthew Smith <mgsmith@netgate.com>
Wed, 3 Aug 2022 18:35:40 +0000 (18:35 +0000)
commit44ec846f4ad1c11cc596c9fa6b73284511131ed4
tree795b7243e2fa5a628dc9fabe407dcf76ee2600b2
parent818806062cd36a816fd778c6993d20d442d3d3ac
wireguard: add processing of received cookie messages

Type: feature

Currently, if a handshake message is sent and a cookie message is
received in reply, the cookie message will be ignored. Thus, further
handshake messages will not have valid mac2 and handshake will not be
able to be completed.

With this change, process received cookie messages to be able to
calculate mac2 for further handshake messages sent. Cover this with
tests.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Change-Id: I6d51459778b7145be7077badec479b2aa85960b9
14 files changed:
src/plugins/wireguard/CMakeLists.txt
src/plugins/wireguard/wireguard.c
src/plugins/wireguard/wireguard.h
src/plugins/wireguard/wireguard_chachapoly.c [new file with mode: 0644]
src/plugins/wireguard/wireguard_chachapoly.h [new file with mode: 0644]
src/plugins/wireguard/wireguard_cookie.c
src/plugins/wireguard/wireguard_cookie.h
src/plugins/wireguard/wireguard_hchacha20.h [new file with mode: 0644]
src/plugins/wireguard/wireguard_input.c
src/plugins/wireguard/wireguard_noise.c
src/plugins/wireguard/wireguard_timer.h
test/requirements-3.txt
test/requirements.txt
test/test_wireguard.py