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/util/file.cc b/aos/util/file.cc
index 591539c..52657a9 100644
--- a/aos/util/file.cc
+++ b/aos/util/file.cc
@@ -47,6 +47,22 @@
   return r;
 }
 
+std::vector<uint8_t> ReadFileToVecOrDie(const std::string_view filename) {
+  std::vector<uint8_t> r;
+  ScopedFD fd(open(::std::string(filename).c_str(), O_RDONLY));
+  PCHECK(fd.get() != -1) << ": opening " << filename;
+  while (true) {
+    uint8_t buffer[1024];
+    const ssize_t result = read(fd.get(), buffer, sizeof(buffer));
+    PCHECK(result >= 0) << ": reading from " << filename;
+    if (result == 0) {
+      break;
+    }
+    std::copy(buffer, buffer + result, std::back_inserter(r));
+  }
+  return r;
+}
+
 void WriteStringToFileOrDie(const std::string_view filename,
                             const std::string_view contents,
                             mode_t permissions) {