Skip to content

Commit

Permalink
Secureboot: Enhanced Multinode Comm: Master Node
Browse files Browse the repository at this point in the history
This commit introduces the logic to create the master node nodecomm
request to the slave nodes and logic to process the responses from
the slave nodes. The data from the slave nodes (the slave quote) is
hashed and extended into PCR1. The binary quote blob is also included
in the TPM log as a log message.

Additional changes: the logic to relocate the TPM log to increase
its size, and the logic to allow uint8_t* instead of char* as
the TPM log message.

Change-Id: Ide4465f0d4a91aec815c9db5d765cdbde231dcd3
RTC: 203644
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71407
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Christopher J. Engel <cjengel@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Ilya Smirnov authored and dcrowell77 committed Feb 20, 2019
1 parent 7c42c4c commit 3a6180b
Show file tree
Hide file tree
Showing 19 changed files with 590 additions and 118 deletions.
11 changes: 0 additions & 11 deletions src/include/usr/secureboot/nodecommif.H
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ enum node_comm_link_mbox_info_t
NCDD_INVALID_LINK_MBOX = 0xFF,
};

// Each hex number is an encoding of the ascii string
// corresponding to the name given below.
typedef enum : uint64_t
{
MSTNOTPM = 0x4d53544e4f54504d,
NDNOTPM_ = 0x4e444e4f54504d5f,
MASTERQ_ = 0x4d4153545245515f,
NODEQUOT = 0x4e4f444551554f54,
INVALID_ = 0x494e56414c49445f,
} NCEyeCatcher_t;

/**
* @brief Execute a single transmission from one proc to another
* over the XBUS Link Mailbox facility
Expand Down
3 changes: 3 additions & 0 deletions src/include/usr/secureboot/secure_reasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ namespace SECUREBOOT
MOD_NCEX_GET_RANDOM = 0x29,
MOD_NC_RECV = 0x2A,
MOD_NC_GEN_SLAVE_RESPONSE = 0x2B,
MOD_NC_GEN_MASTER_REQUEST = 0x2C,
MOD_NC_PROCESS_SLAVE_QUOTE = 0x2D,
};

enum SECUREReasonCode
Expand Down Expand Up @@ -112,6 +114,7 @@ namespace SECUREBOOT
RC_NC_BAD_MASTER_TPM = SECURE_COMP_ID | 0x2C,
RC_NC_NO_PRIMARY_TPM_LOG = SECURE_COMP_ID | 0x2D,
RC_NC_BAD_MASTER_EYE_CATCH = SECURE_COMP_ID | 0x2E,
RC_NC_BAD_SLAVE_QUOTE = SECURE_COMP_ID | 0x2F,

// Reason codes 0xA0 - 0xEF reserved for trustedboot_reasoncodes.H
};
Expand Down
3 changes: 3 additions & 0 deletions src/include/usr/secureboot/trustedboot_reasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace TRUSTEDBOOT
MOD_TPM_CMD_FLUSH_CONTEXT = 0x20,
MOD_FLUSH_CONTEXT = 0x21,
MOD_PCR_READ = 0x22,
MOD_EXPAND_TPM_LOG = 0x23,
MOD_TPM_CMD_EXPAND_TPM_LOG = 0x24,
};

enum TRUSTEDReasonCode
Expand Down Expand Up @@ -114,6 +116,7 @@ namespace TRUSTEDBOOT
RC_UNREACHABLE_TPM = TRBOOT_COMP_ID | 0xBA,
RC_RAND_NUM_TOO_BIG = TRBOOT_COMP_ID | 0xBB,
RC_TPM_BAD_RESP = TRBOOT_COMP_ID | 0xBC,
RC_NO_TPM_LOG_MGR = TRBOOT_COMP_ID | 0xBD,
};
#ifdef __cplusplus
}
Expand Down
15 changes: 13 additions & 2 deletions src/include/usr/secureboot/trustedbootif.H
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ namespace TRUSTEDBOOT
* @param[in] i_eventType Event type to log
* @param[in] i_digest Digest value to write to PCR
* @param[in] i_digestSize Byte size of i_digest data
* @param[in] i_logMsg Null terminated log message, truncated at 128 chars
* @param[in] i_logMsg Log message in binary form
* @param[in] i_logMsgSize The size of the log message in bytes
* @param[in] i_sendAsync Perform extension asynchronously, default true
* @param[in] i_pTpm A specific TPM to singly extend a measurement into,
default is nullptr, which indicates all of the TPMs will be
Expand All @@ -199,7 +200,8 @@ namespace TRUSTEDBOOT
EventTypes i_eventType,
const uint8_t* i_digest,
size_t i_digestSize,
const char* i_logMsg,
const uint8_t* i_logMsg,
size_t i_logMsgSize,
bool i_sendAsync = true,
const TpmTarget* i_pTpm = nullptr,
bool i_mirrorToLog = true);
Expand Down Expand Up @@ -465,6 +467,15 @@ namespace TRUSTEDBOOT
size_t i_digestSize,
uint8_t* o_digest);

/**
* @brief Send the synchronous command to the given TPM to expand its log.
* Expanding the log means increasing its size to accomodate larger
* events in multinode communication protocol.
* @param[in] i_target the pointer to the TPM target; must not be nullptr
* @return nullptr on success; non-nullptr on error
*/
errlHndl_t expandTpmLog(TpmTarget* i_target);

} // end TRUSTEDBOOT namespace


Expand Down
8 changes: 5 additions & 3 deletions src/usr/secureboot/ext/drtm.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* Contributors Listed Below - COPYRIGHT 2013,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -79,7 +79,7 @@ const uint32_t DRTM_RIT_PAYLOAD_PHYS_ADDR_MB = 256-1;
// RIT protection payload
const char DRTM_RIT_PAYLOAD[] = {'D','R','T','M'};

const char* const DRTM_RIT_LOG_TEXT = "DrtmPayload";
const uint8_t const DRTM_RIT_LOG_TEXT[] = "DrtmPayload";

#endif

Expand Down Expand Up @@ -411,7 +411,9 @@ errlHndl_t validateDrtmPayload()
pError = TRUSTEDBOOT::pcrExtend(TRUSTEDBOOT::PCR_DRTM_17,
TRUSTEDBOOT::EV_COMPACT_HASH,
hash,
sizeof(SHA512_t),DRTM_RIT_LOG_TEXT);
sizeof(SHA512_t),
DRTM_RIT_LOG_TEXT,
sizeof(DRTM_RIT_LOG_TEXT));
if(pError)
{
SB_ERR("validateDrtmPayload: Failed in pcrExtend() for PCR 17");
Expand Down
23 changes: 23 additions & 0 deletions src/usr/secureboot/node_comm/node_comm.H
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <scom/centaurScomCache.H> // for TRACE_ERR_FMT, TRACE_ERR_ARGS
#include <secureboot/nodecommif.H>
#include "../trusted/trustedboot.H"
#include <secureboot/trustedbootif.H>
#include "../trusted/trustedTypes.H"

// ----------------------------------------------
// Defines
Expand Down Expand Up @@ -99,6 +101,27 @@ enum node_comm_registers_t : uint64_t
*/
};

// Each hex number is an encoding of the ascii string
// corresponding to the name given below.
typedef enum : uint64_t
{
MSTNOTPM = 0x4d53544e4f54504d,
NDNOTPM_ = 0x4e444e4f54504d5f,
MASTERQ_ = 0x4d4153545245515f,
NODEQUOT = 0x4e4f444551554f54,
INVALID_ = 0x494e56414c49445f,
} NCEyeCatcher_t;

// Enhanced multinode comm master node request blob
struct _MasterQuoteRequestBlob
{
SECUREBOOT::NODECOMM::NCEyeCatcher_t EyeCatcher; // master node eye catcher
TRUSTEDBOOT::MasterTpmNonce_t MasterNonce; //32-byte nonce
TRUSTEDBOOT::TPML_PCR_SELECTION PcrSelect; // PCRs to read
} PACKED;
typedef struct _MasterQuoteRequestBlob MasterQuoteRequestBlob;


/**
* @brief Convert Link Mailbox Register Address based on mode (XBUS or ABUS)
*
Expand Down

0 comments on commit 3a6180b

Please sign in to comment.