Update libpldm api encode_*_req functions to have payload_length param

There were a few of the APIs in libpldm's fru and platform
that Hostboot was using downstream that did not have the
payload_length param which the Hostboot templates expect. All
encode_*_req functions should end with a payload_length parameter
and this commit moves us towards that goal.

Tested: I ran run-unit-test-docker.sh from the openbmc-build-scripts
repo with the script pointed at my pldm directory.

Change-Id: Ief825111970db2faffaf00e431bc0f43f7a11b02
Signed-off-by: Christian Geddes <crgeddes@us.ibm.com>
diff --git a/libpldm/platform.c b/libpldm/platform.c
index 9e16ed2..9c696fc 100644
--- a/libpldm/platform.c
+++ b/libpldm/platform.c
@@ -620,12 +620,10 @@
 	return PLDM_SUCCESS;
 }
 
-int encode_platform_event_message_req(uint8_t instance_id,
-				      uint8_t format_version, uint8_t tid,
-				      uint8_t event_class,
-				      const uint8_t *event_data,
-				      size_t event_data_length,
-				      struct pldm_msg *msg)
+int encode_platform_event_message_req(
+    uint8_t instance_id, uint8_t format_version, uint8_t tid,
+    uint8_t event_class, const uint8_t *event_data, size_t event_data_length,
+    struct pldm_msg *msg, size_t payload_length)
 
 {
 	struct pldm_header_info header = {0};
@@ -648,6 +646,11 @@
 		return PLDM_ERROR_INVALID_DATA;
 	}
 
+	if (payload_length !=
+	    PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES + event_data_length) {
+		return PLDM_ERROR_INVALID_LENGTH;
+	}
+
 	if (event_class > PLDM_HEARTBEAT_TIMER_ELAPSED_EVENT &&
 	    !(event_class >= 0xF0 && event_class <= 0xFE)) {
 		return PLDM_ERROR_INVALID_DATA;