Modify the verifyPacketIntegrity to pass the Payload length
Change-Id: I952a8f5d6b953b98e727c5680bd964960ca9db4e
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/message_parsers.cpp b/message_parsers.cpp
index 7b42e00..be70753 100644
--- a/message_parsers.cpp
+++ b/message_parsers.cpp
@@ -171,7 +171,9 @@
if (message->isPacketAuthenticated)
{
- if (!(internal::verifyPacketIntegrity(inPacket,*(message.get()))))
+ if (!(internal::verifyPacketIntegrity(inPacket,
+ *(message.get()),
+ payloadLen)))
{
throw std::runtime_error("Packet Integrity check failed");
}
@@ -230,10 +232,9 @@
}
bool verifyPacketIntegrity(const std::vector<uint8_t>& packet,
- const Message& message)
+ const Message& message,
+ size_t payloadLen)
{
- auto payloadLen = message.payload.size();
-
/*
* Padding bytes are added to cause the number of bytes in the data range
* covered by the AuthCode(Integrity Data) field to be a multiple of 4 bytes
diff --git a/message_parsers.hpp b/message_parsers.hpp
index 118da6e..d11dc5b 100644
--- a/message_parsers.hpp
+++ b/message_parsers.hpp
@@ -176,11 +176,13 @@
* @brief Verify the integrity data of the incoming IPMI packet
*
* @param[in] packet - Incoming IPMI packet
- * @param[in] inMessage - IPMI Message populated from the incoming packet
+ * @param[in] message - IPMI Message populated from the incoming packet
+ * @param[in] payloadLen - Length of the IPMI payload
*
*/
bool verifyPacketIntegrity(const std::vector<uint8_t>& packet,
- const Message& message);
+ const Message& message,
+ size_t payloadLen);
/*
* @brief Add Integrity data to the outgoing IPMI packet
@@ -191,7 +193,6 @@
*/
void addIntegrityData(std::vector<uint8_t>& packet, const Message& message);
-
} // namespace internal
} // namespace ipmi20parser