diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2018-06-27 17:09:43 -0500 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2018-06-29 12:04:57 -0400 |
commit | b37f41b2c08cf48413acbaef5f914ea43c89e427 (patch) | |
tree | dbd8b3ff4934fe8e566a11f400f29ae7dac5d4b6 /src/include | |
parent | fc087d0b82682431317f199bdbcda0fa0ffb2aac (diff) | |
download | talos-hostboot-b37f41b2c08cf48413acbaef5f914ea43c89e427.tar.gz talos-hostboot-b37f41b2c08cf48413acbaef5f914ea43c89e427.zip |
Secure Boot: Copy PHyp secure header into standard reserved memory area
This change alters where Hostboot copies the Phyp secure header; instead
of placing it in front of PHYP (PHyp HRMOR-4k), it instead redirects it to the
standard reserved memory area. By doing this, we prevent it from
unintentionally ending up in mirrored memory.
Change-Id: I0b228b4a748310eba2b580efe2f191adca0d05e3
CQ: SW435712
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61525
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/usr/runtime/preverifiedlidmgr.H | 44 | ||||
-rw-r--r-- | src/include/usr/util/utilmclmgr.H | 28 |
2 files changed, 53 insertions, 19 deletions
diff --git a/src/include/usr/runtime/preverifiedlidmgr.H b/src/include/usr/runtime/preverifiedlidmgr.H index 4b087e102..c5c335ce0 100644 --- a/src/include/usr/runtime/preverifiedlidmgr.H +++ b/src/include/usr/runtime/preverifiedlidmgr.H @@ -67,22 +67,26 @@ class PreVerifiedLidMgr const size_t i_size); /** - * @brief Load PNOR section into HB reserved memory + * @brief Load LID into HB reserved memory * - * @param[in] i_sec - PNOR section ID - * @param[in] i_addr - Virtual Address of PNOR section - * @param[in] i_size - Size of PNOR section - * @param[in] i_isPhypComp - Indicates if PHYP lids - * NOTE: PHYP lids go to address HRMOR - 4K - * @param[out] o_resvMemAddr - Mainstore address Lid was put in + * @param[in] i_lidId ID of LID to load + * @param[in] i_addr Virtual address of LID data + * @param[in] i_size Size of LID data + * @param[in] i_isPhypComp Whether LID is part of the PHyp component + * NOTE: PHYP LIDs (other than signature LID) will be loaded to + * an area anchored at PHyp's HRMOR + * @param[in] i_firstLid Whether this is the first LID of a component + * @param[out] o_resvMemAddr Mainstore address LID was loaded to * - * @return Error handle if error + * @return errlHndl_t Error log handle on failure, else nullptr */ - static errlHndl_t loadFromMCL(const uint32_t i_lidId, - const uint64_t i_addr, - const size_t i_size, - const bool i_isPhypComp, - uint64_t &o_resvMemAddr); + static errlHndl_t loadFromMCL( + uint32_t i_lidId, + uint64_t i_addr, + size_t i_size, + bool i_isPhypComp, + bool i_firstLid, + uint64_t& o_resvMemAddr); protected: @@ -127,11 +131,13 @@ class PreVerifiedLidMgr /** * @brief Internal implementation of loadFromMCL function. */ - errlHndl_t _loadFromMCL(const uint32_t i_lidId, - const uint64_t i_addr, - const size_t i_size, - const bool i_isPhypComp, - uint64_t &o_resvMemAddr); + errlHndl_t _loadFromMCL( + uint32_t i_lidId, + uint64_t i_addr, + size_t i_size, + bool i_isPhypComp, + bool i_firstLid, + uint64_t& o_resvMemAddr); // Private Members/Variables @@ -233,4 +239,4 @@ class PreVerifiedLidMgr }; -#endif
\ No newline at end of file +#endif diff --git a/src/include/usr/util/utilmclmgr.H b/src/include/usr/util/utilmclmgr.H index 82ef6f2ed..5ce5e089f 100644 --- a/src/include/usr/util/utilmclmgr.H +++ b/src/include/usr/util/utilmclmgr.H @@ -31,6 +31,7 @@ #include <errl/errlentry.H> #include <usr/vmmconst.h> #include <securerom/ROM.H> +#include <limits.h> // Forward declarations class MasterContainerLidMgrTest; @@ -267,6 +268,30 @@ class MasterContainerLidMgr static errlHndl_t tpmExtend(const ComponentID& i_compId, const SECUREBOOT::ContainerHeader& i_conHdr); + /** + * @brief Caches a copy of the PHyp secure header + * + * @param[in] i_pHeader Pointer to PHyp secure header; + * Must not be nullptr or API will assert. Input header must be + * exactly PAGESIZE bytes + */ + static void cachePhypHeader(const uint8_t* i_pHeader) + { + assert(i_pHeader != nullptr, + "Bug! PHyp header pointer was nullptr"); + memcpy(cv_pPhypHeader,i_pHeader,PAGESIZE); + } + + /** + * @brief Returns pointer to the cached PHyp secure header + * + * @return const uint8_t* Pointer to cached Phyp secure header + */ + static const uint8_t* getPhypHeader() + { + return cv_pPhypHeader; + }; + protected: /** @@ -403,6 +428,9 @@ class MasterContainerLidMgr // Cache current comp id string for easy tracing CompIdString iv_curCompIdStr; + // Cached PHyp header + static uint8_t cv_pPhypHeader[PAGE_SIZE]; + // Allow test cases to call custom constructors and have direct access friend class ::MasterContainerLidMgrTest; }; |