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.hpp b/include/ipmid/message.hpp
index 808d96b..8cb9192 100644
--- a/include/ipmid/message.hpp
+++ b/include/ipmid/message.hpp
@@ -21,6 +21,7 @@
#include <exception>
#include <ipmid/api-types.hpp>
#include <ipmid/message/types.hpp>
+#include <ipmid/types.hpp>
#include <memory>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/connection.hpp>
@@ -115,7 +116,7 @@
Payload(Payload&&) = default;
Payload& operator=(Payload&&) = default;
- explicit Payload(std::vector<uint8_t>&& data) : raw(std::move(data))
+ explicit Payload(SecureBuffer&& data) : raw(std::move(data))
{
}
@@ -480,7 +481,7 @@
// partial bytes in the form of bits
fixed_uint_t<details::bitStreamSize> bitStream;
size_t bitCount = 0;
- std::vector<uint8_t> raw;
+ SecureBuffer raw;
size_t rawIndex = 0;
bool trailingOk = true;
bool unpackCheck = false;
@@ -594,8 +595,8 @@
using ptr = std::shared_ptr<Request>;
- explicit Request(Context::ptr context, std::vector<uint8_t>&& d) :
- payload(std::forward<std::vector<uint8_t>>(d)), ctx(context)
+ explicit Request(Context::ptr context, SecureBuffer&& d) :
+ payload(std::forward<SecureBuffer>(d)), ctx(context)
{
}