Add a SecureBuffer class

SecureBuffer is like SecureString, but a specialization of
std::vector<uint8_t> that cleans up after itself

Tested: Executed various ipmi commands to see that they still work

Change-Id: Ifd255ef682d6e46d981de6a5a294d12f3666698b
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 598e650..efafd3d 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -250,6 +250,22 @@
     }
 };
 
+/** @brief Specialization of PackSingle for SecureBuffer */
+template <>
+struct PackSingle<SecureBuffer>
+{
+    static int op(Payload& p, const SecureBuffer& t)
+    {
+        if (p.bitCount != 0)
+        {
+            return 1;
+        }
+        p.raw.reserve(p.raw.size() + t.size());
+        p.raw.insert(p.raw.end(), t.begin(), t.end());
+        return 0;
+    }
+};
+
 /** @brief Specialization of PackSingle for std::string_view */
 template <>
 struct PackSingle<std::string_view>
diff --git a/include/ipmid/message/unpack.hpp b/include/ipmid/message/unpack.hpp
index d9ccba4..4ac4916 100644
--- a/include/ipmid/message/unpack.hpp
+++ b/include/ipmid/message/unpack.hpp
@@ -324,6 +324,20 @@
     }
 };
 
+/** @brief Specialization of UnpackSingle for SecureBuffer */
+template <>
+struct UnpackSingle<SecureBuffer>
+{
+    static int op(Payload& p, SecureBuffer& t)
+    {
+        // copy out the remainder of the message
+        t.reserve(p.raw.size() - p.rawIndex);
+        t.insert(t.begin(), p.raw.begin() + p.rawIndex, p.raw.end());
+        p.rawIndex = p.raw.size();
+        return 0;
+    }
+};
+
 /** @brief Specialization of UnpackSingle for Payload */
 template <>
 struct UnpackSingle<Payload>