explicit use of std::vector instead of buffer/Buffer
There were several scoped 'using buffer = std::vector<uint8_t>;' in
header files. This consolidates the code base to use
std::vector<uint8_t> instead of buffer or Buffer. This makes the code
easier to read and debug.
Change-Id: I918a0f6ca9b8e4b9d331175dccff45cbf4c8379d
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/integrity_algo.hpp b/integrity_algo.hpp
index eb78578..0d869c7 100644
--- a/integrity_algo.hpp
+++ b/integrity_algo.hpp
@@ -10,7 +10,6 @@
namespace integrity
{
-using Buffer = std::vector<uint8_t>;
using Key = std::array<uint8_t, SHA_DIGEST_LENGTH>;
/*
@@ -66,7 +65,7 @@
* @param[in] - Additional keying material to generate K1
* @param[in] - AuthCode length
*/
- explicit Interface(const Buffer& sik,
+ explicit Interface(const std::vector<uint8_t>& sik,
const Key& addKey,
size_t authLength);
@@ -88,9 +87,9 @@
* using integrity algorithm on the packet data, false otherwise
*/
bool virtual verifyIntegrityData(
- const Buffer& packet,
+ const std::vector<uint8_t>& packet,
const size_t packetLen,
- Buffer::const_iterator integrityData) const = 0;
+ std::vector<uint8_t>::const_iterator integrityData) const = 0;
/**
* @brief Generate integrity data for the outgoing IPMI packet
@@ -100,7 +99,8 @@
* @return authcode for the outgoing IPMI packet
*
*/
- Buffer virtual generateIntegrityData(const Buffer& input) const = 0;
+ std::vector<uint8_t> virtual generateIntegrityData(
+ const std::vector<uint8_t>& input) const = 0;
/**
* @brief Check if the Integrity algorithm is supported
@@ -157,7 +157,7 @@
*
* @param[in] - Session Integrity Key
*/
- explicit AlgoSHA1(const Buffer& sik) :
+ explicit AlgoSHA1(const std::vector<uint8_t>& sik) :
Interface(sik, const1, SHA1_96_AUTHCODE_LENGTH) {}
AlgoSHA1() = delete;
@@ -179,9 +179,10 @@
* using integrity algorithm on the packet data, false otherwise
*/
bool verifyIntegrityData(
- const Buffer& packet,
+ const std::vector<uint8_t>& packet,
const size_t length,
- Buffer::const_iterator integrityData) const override;
+ std::vector<uint8_t>::const_iterator integrityData)
+ const override;
/**
* @brief Generate integrity data for the outgoing IPMI packet
@@ -191,7 +192,8 @@
* @return on success return the integrity data for the outgoing IPMI
* packet
*/
- Buffer generateIntegrityData(const Buffer& packet) const override;
+ std::vector<uint8_t> generateIntegrityData(
+ const std::vector<uint8_t>& packet) const override;
private:
/**
@@ -203,7 +205,8 @@
* @return on success returns the message authentication code
*
*/
- Buffer generateHMAC(const uint8_t* input, const size_t len) const;
+ std::vector<uint8_t> generateHMAC(const uint8_t* input,
+ const size_t len) const;
};
}// namespace integrity