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/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>