diff options
author | Chris Engel <cjengel@us.ibm.com> | 2016-09-21 14:15:26 -0500 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2016-10-31 07:58:51 -0400 |
commit | a0575efc0dae3b41ee95e55d5a5e7acb12418c90 (patch) | |
tree | b2180423aa48bf15ce4e07b2df6ce4292b7f7a60 /src/usr/secureboot/trusted/base | |
parent | 777071e01eda3765370cfc3221d459f97026e233 (diff) | |
download | talos-hostboot-a0575efc0dae3b41ee95e55d5a5e7acb12418c90.tar.gz talos-hostboot-a0575efc0dae3b41ee95e55d5a5e7acb12418c90.zip |
Add a TPM separator during host start_payload
Change-Id: I11736ebe4b44e54584febc05e1dea50dd5304fa4
RTC: 155301
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30996
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: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/secureboot/trusted/base')
-rw-r--r-- | src/usr/secureboot/trusted/base/trustedbootMsg.H | 13 | ||||
-rw-r--r-- | src/usr/secureboot/trusted/base/trustedboot_base.C | 86 |
2 files changed, 86 insertions, 13 deletions
diff --git a/src/usr/secureboot/trusted/base/trustedbootMsg.H b/src/usr/secureboot/trusted/base/trustedbootMsg.H index 4fb4edeaf..79edde42e 100644 --- a/src/usr/secureboot/trusted/base/trustedbootMsg.H +++ b/src/usr/secureboot/trusted/base/trustedbootMsg.H @@ -52,6 +52,7 @@ namespace TRUSTEDBOOT { MSG_TYPE_NOOP, MSG_TYPE_PCREXTEND, + MSG_TYPE_SEPARATOR, MSG_TYPE_SHUTDOWN, MSG_TYPE_LAST = MSG_TYPE_SHUTDOWN }; @@ -94,9 +95,11 @@ namespace TRUSTEDBOOT /// @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 + if (NULL != iv_data) + { + delete[] iv_data; + iv_data = NULL; + } // Do NOT delete iv_errl here. For synchronous messages // iv_errl is returned to the caller to commit and for @@ -137,8 +140,6 @@ namespace TRUSTEDBOOT /// @brief Dtor virtual ~SyncMessage(void) { - delete[] iv_data; - iv_data = NULL; } /// @brief complete the processing when a response arrives @@ -161,8 +162,6 @@ namespace TRUSTEDBOOT /// @brief Dtor virtual ~AsyncMessage(void) { - delete[] iv_data; - iv_data = NULL; } /// @brief complete the processing when a response arrives diff --git a/src/usr/secureboot/trusted/base/trustedboot_base.C b/src/usr/secureboot/trusted/base/trustedboot_base.C index e782e115f..687aeb9f0 100644 --- a/src/usr/secureboot/trusted/base/trustedboot_base.C +++ b/src/usr/secureboot/trusted/base/trustedboot_base.C @@ -73,6 +73,81 @@ TpmTarget::TpmTarget() #endif +errlHndl_t pcrExtendSeparator(bool i_sendAsync) +{ + errlHndl_t err = NULL; +#ifdef CONFIG_TPMDD + MessageMode mode = (i_sendAsync) ? MSG_MODE_ASYNC : MSG_MODE_SYNC; + + TRACUCOMP( g_trac_trustedboot, + ENTER_MRK"pcrExtendSeparator()"); + + Message* msg = Message::factory(MSG_TYPE_SEPARATOR, + 0, + NULL, + mode); + assert(msg !=NULL, "BUG! Message is NULL"); + if (!i_sendAsync) + { + int rc = msg_sendrecv(systemTpms.msgQ, msg->iv_msg); + if (0 == rc) + { + err = msg->iv_errl; + msg->iv_errl = NULL; + } + // Sendrecv failure + else + { + /*@ + * @errortype ERRL_SEV_UNRECOVERABLE + * @moduleid MOD_TPM_SEPARATOR + * @reasoncode RC_SENDRECV_FAIL + * @userdata1 rc from msq_sendrecv() + * @devdesc msg_sendrecv() failed + * @custdesc Firmware error during system boot + */ + err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + MOD_TPM_SEPARATOR, + RC_SENDRECV_FAIL, + rc, + 0, + true); + err->collectTrace(SECURE_COMP_NAME); + } + delete msg; + msg = NULL; + } + else + { + int rc = msg_send(systemTpms.msgQ, msg->iv_msg); + if (rc) + { + /*@ + * @errortype ERRL_SEV_UNRECOVERABLE + * @moduleid MOD_TPM_SEPARATOR + * @reasoncode RC_SEND_FAIL + * @userdata1 rc from msq_send() + * @devdesc msg_send() failed + * @custdesc Firmware error during system boot + */ + err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + MOD_TPM_SEPARATOR, + RC_SEND_FAIL, + rc, + 0, + true); + err->collectTrace(SECURE_COMP_NAME); + } + } + + TRACUCOMP( g_trac_trustedboot, + EXIT_MRK"pcrExtendSeparator() - %s", + ((NULL == err) ? "No Error" : "With Error") ); + +#endif + return err; +} + errlHndl_t pcrExtend(TPM_Pcr i_pcr, const uint8_t* i_digest, size_t i_digestSize, @@ -88,8 +163,7 @@ errlHndl_t pcrExtend(TPM_Pcr i_pcr, ENTER_MRK"pcrExtend() pcr=%d msg='%s'", i_pcr, i_logMsg); TRACUBIN(g_trac_trustedboot, "pcrExtend() digest:", i_digest, i_digestSize); - // msgData will be freed when message is processed for async - // or below for sync message + // msgData will be freed when message is freed PcrExtendMsgData* msgData = new PcrExtendMsgData; memset(msgData, 0, sizeof(PcrExtendMsgData)); msgData->mPcrIndex = i_pcr; @@ -134,14 +208,14 @@ errlHndl_t pcrExtend(TPM_Pcr i_pcr, /*@ * @errortype ERRL_SEV_UNRECOVERABLE * @moduleid MOD_TPM_PCREXTEND - * @reasoncode RC_PCREXTEND_SENDRECV_FAIL + * @reasoncode RC_SENDRECV_FAIL * @userdata1 rc from msq_sendrecv() * @devdesc msg_sendrecv() failed * @custdesc Firmware error during system boot */ err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, MOD_TPM_PCREXTEND, - RC_PCREXTEND_SENDRECV_FAIL, + RC_SENDRECV_FAIL, rc, 0, true); @@ -158,14 +232,14 @@ errlHndl_t pcrExtend(TPM_Pcr i_pcr, /*@ * @errortype ERRL_SEV_UNRECOVERABLE * @moduleid MOD_TPM_PCREXTEND - * @reasoncode RC_PCREXTEND_SEND_FAIL + * @reasoncode RC_SEND_FAIL * @userdata1 rc from msq_send() * @devdesc msg_send() failed * @custdesc Firmware error during system boot */ err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, MOD_TPM_PCREXTEND, - RC_PCREXTEND_SEND_FAIL, + RC_SEND_FAIL, rc, 0, true); |