Add sctp authentication to sctp_lib
This only works for linux >=5.4. When enabled, it will use
a shared key to authenticate messages. The functionality is
controlled by a flag and behind a linux version check.
Performance degradation is minimal, even for smaller messages
and unnoticeable when measuring overall system performance.
Change-Id: I836e61ec38a0c116fd7244b771437738ccca9828
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/aos/network/sctp_server.cc b/aos/network/sctp_server.cc
index fb736de..1bcbebd 100644
--- a/aos/network/sctp_server.cc
+++ b/aos/network/sctp_server.cc
@@ -21,8 +21,9 @@
namespace aos {
namespace message_bridge {
-SctpServer::SctpServer(int streams, std::string_view local_host,
- int local_port) {
+SctpServer::SctpServer(int streams, std::string_view local_host, int local_port,
+ std::vector<uint8_t> sctp_auth_key)
+ : sctp_(std::move(sctp_auth_key)) {
bool use_ipv6 = Ipv6Enabled();
sockaddr_local_ = ResolveSocket(local_host, local_port, use_ipv6);
while (true) {