summaryrefslogtreecommitdiffstats
path: root/src/usr/secureboot/trusted/base/trustedbootMsg.H
diff options
context:
space:
mode:
authorChris Engel <cjengel@us.ibm.com>2016-06-03 16:44:29 -0500
committerStephen Cprek <smcprek@us.ibm.com>2016-07-18 15:32:39 -0500
commit661c7e6a3ef2f76bfce68cb67f2f6d2d1c3d6f9b (patch)
tree33373da8433aae14fca1fb58a141cc0402d072c6 /src/usr/secureboot/trusted/base/trustedbootMsg.H
parentb3f6347ef52994c4d37ac5f361b21fe4d4658462 (diff)
downloadtalos-hostboot-661c7e6a3ef2f76bfce68cb67f2f6d2d1c3d6f9b.tar.gz
talos-hostboot-661c7e6a3ef2f76bfce68cb67f2f6d2d1c3d6f9b.zip
Trustedboot PCR Extend reworked to use task message queue
Removed TPM log manager and required functions from HBB and replaced with a simple message queue Change-Id: I5f5a418b6ea8c0228229e8c45523385b488e2b6b RTC: 155519 ForwardPort: yes Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27133 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christopher J. Engel <cjengel@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/secureboot/trusted/base/trustedbootMsg.H')
-rw-r--r--src/usr/secureboot/trusted/base/trustedbootMsg.H174
1 files changed, 174 insertions, 0 deletions
diff --git a/src/usr/secureboot/trusted/base/trustedbootMsg.H b/src/usr/secureboot/trusted/base/trustedbootMsg.H
new file mode 100644
index 000000000..4fb4edeaf
--- /dev/null
+++ b/src/usr/secureboot/trusted/base/trustedbootMsg.H
@@ -0,0 +1,174 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/secureboot/trusted/base/trustedbootMsg.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file trustedbootMsg.H
+ *
+ * @brief Trustedboot Message
+ *
+ */
+#ifndef __TRUSTEDBOOTMSG_H
+#define __TRUSTEDBOOTMSG_H
+// -----------------------------------------------
+// Includes
+// -----------------------------------------------
+#include <errl/errlentry.H>
+#include <sys/msg.h>
+#include "../trustedTypes.H"
+
+namespace TRUSTEDBOOT
+{
+
+ /// Message mode
+ enum MessageMode
+ {
+ MSG_MODE_SYNC,
+ MSG_MODE_ASYNC
+ };
+
+ /// Message Command type
+ enum MessageType
+ {
+ MSG_TYPE_NOOP,
+ MSG_TYPE_PCREXTEND,
+ MSG_TYPE_SHUTDOWN,
+ MSG_TYPE_LAST = MSG_TYPE_SHUTDOWN
+ };
+
+ /// PCREXTEND message data
+ struct PcrExtendMsgData
+ {
+ TPM_Pcr mPcrIndex;
+ TPM_Alg_Id mAlgId;
+ EventTypes mEventType;
+ size_t mDigestSize;
+ uint8_t mDigest[TPM_ALG_SHA256_SIZE];
+ char mLogMsg[MAX_TPM_LOG_MSG];
+ };
+
+ // Trustedboot message class
+ class Message
+ {
+ public:
+ /// @brief Static factory
+ /// @param[in] i_type Trustedboot TYPE
+ /// @param[in] i_len Byte length of i_data
+ /// @param[in] i_data The data as required by the specific command
+ /// @param[in] i_mode Message mode
+ static Message* factory(MessageType i_type = MSG_TYPE_NOOP,
+ size_t i_len = 0,
+ uint8_t* i_data = NULL,
+ MessageMode i_mode = MSG_MODE_SYNC);
+
+ /// @brief Constructor
+ /// @param[in] i_type Message type
+ /// @param[in] i_len Byte length of i_data
+ /// @param[in] i_data The data as required by the specific command
+ /// @param[in] i_mode Message mode
+ Message(MessageType i_type = MSG_TYPE_NOOP,
+ size_t i_len = 0,
+ uint8_t* i_data = NULL,
+ MessageMode i_mode = MSG_MODE_SYNC);
+
+ /// @brief Message dtor
+ virtual ~Message(void)
+ {
+ // Do NOT delete[] iv_data here. For synchronous messages
+ // the caller wants this data and expects to delete[] it
+ // itself. For async messages it is deleted in the dtor
+
+ // Do NOT delete iv_errl here. For synchronous messages
+ // iv_errl is returned to the caller to commit and for
+ // asynchronous messages the error log is committed
+ // during the response processing
+ msg_free(iv_msg);
+ }
+
+ /// @brief complete the processing when a response arrives
+ virtual void response(msg_q_t i_msgQ) = 0;
+
+ msg_t* iv_msg; ///< Pointer back to our msg_q msg_t
+ errlHndl_t iv_errl; ///< Pointer to the errlHandl_t if needed
+ size_t iv_len; ///< Data Length
+ MessageMode iv_mode; ///< Message Mode
+ uint8_t* iv_data; ///< Pointer to the message data
+
+ private:
+ // Disallow copying this class. Should suffice for disabling copy for
+ // all subclasses too.
+ Message& operator=(const Message&);
+ Message(const Message&);
+
+ };
+
+ /// Trustedboot synchronous message
+ class SyncMessage : public Message
+ {
+ public:
+ /// @brief Constructor
+ /// @param[in] i_type Trustedboot TYPE
+ /// @param[in] i_len Byte length of i_data
+ /// @param[in] i_data The data as required by the specific command
+ SyncMessage(MessageType i_type = MSG_TYPE_NOOP,
+ size_t i_len = 0,
+ uint8_t* i_data = NULL);
+
+ /// @brief Dtor
+ virtual ~SyncMessage(void)
+ {
+ delete[] iv_data;
+ iv_data = NULL;
+ }
+
+ /// @brief complete the processing when a response arrives
+ virtual void response(msg_q_t i_msgQ);
+
+ };
+
+ /// Trustedboot asynchronous message
+ class AsyncMessage : public Message
+ {
+ public:
+ /// @brief Constructor
+ /// @param[in] i_type Trustedboot TYPE
+ /// @param[in] i_len Byte length of i_data
+ /// @param[in] i_data The data as required by the specific command
+ AsyncMessage(MessageType i_type = MSG_TYPE_NOOP,
+ size_t i_len = 0,
+ uint8_t* i_data = NULL);
+
+ /// @brief Dtor
+ virtual ~AsyncMessage(void)
+ {
+ delete[] iv_data;
+ iv_data = NULL;
+ }
+
+ /// @brief complete the processing when a response arrives
+ virtual void response(msg_q_t i_msgQ);
+ };
+
+};
+
+#endif
OpenPOWER on IntegriCloud