summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/usr/runtime/populate_hbruntime.C4
-rw-r--r--src/usr/runtime/preverifiedlidmgr.C8
-rw-r--r--src/usr/util/test/testmclmgr.H71
-rw-r--r--src/usr/util/utilmclmgr.C7
4 files changed, 71 insertions, 19 deletions
diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C
index 12a6fba9f..38e1236ab 100644
--- a/src/usr/runtime/populate_hbruntime.C
+++ b/src/usr/runtime/populate_hbruntime.C
@@ -1092,9 +1092,6 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId)
break;
}
- // @TODO RTC:125304 enable when PHYP changes necessary for pre-verified
- // lids are in a fips release
-/*
// Load lids from Master Container Lid Container provided by FSP
if (INITSERVICE::spBaseServicesEnabled())
{
@@ -1105,7 +1102,6 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId)
break;
}
}
-*/
} while(0);
// If lock obtained, always unlock Pre verified lid manager
diff --git a/src/usr/runtime/preverifiedlidmgr.C b/src/usr/runtime/preverifiedlidmgr.C
index 4e5d9a2dc..4e869711f 100644
--- a/src/usr/runtime/preverifiedlidmgr.C
+++ b/src/usr/runtime/preverifiedlidmgr.C
@@ -180,12 +180,9 @@ errlHndl_t PreVerifiedLidMgr::_loadFromPnor(const PNOR::SectionId i_sec,
bool l_loadImage = false;
if(cv_payloadKind == TARGETING::PAYLOAD_KIND_PHYP)
{
- // @TODO RTC:178163 enable when PHYP changes necessary for pre-verified
- // lids are in a fips release
-/*
l_loadImage = true;
// Verified Lid - Header Only
- if ( (l_lids.containerLid != INVALID_LIDID) &&
+ if ( (l_lids.containerLid != Util::INVALID_LIDID) &&
!isLidLoaded(l_lids.containerLid))
{
char l_containerLidStr [Util::lidIdStrLength] {};
@@ -204,7 +201,7 @@ errlHndl_t PreVerifiedLidMgr::_loadFromPnor(const PNOR::SectionId i_sec,
}
// Verified Lid - Content Only
- if ( (l_lids.lid != INVALID_LIDID) &&
+ if ( (l_lids.lid != Util::INVALID_LIDID) &&
!isLidLoaded(l_lids.lid))
{
char l_lidStr[Util::lidIdStrLength] {};
@@ -220,7 +217,6 @@ errlHndl_t PreVerifiedLidMgr::_loadFromPnor(const PNOR::SectionId i_sec,
break;
}
}
-*/
}
else if(cv_payloadKind == TARGETING::PAYLOAD_KIND_SAPPHIRE)
{
diff --git a/src/usr/util/test/testmclmgr.H b/src/usr/util/test/testmclmgr.H
index 9f425a285..290c73d5c 100644
--- a/src/usr/util/test/testmclmgr.H
+++ b/src/usr/util/test/testmclmgr.H
@@ -32,6 +32,7 @@
#include "../utilbase.H"
#include <usr/vmmconst.h>
#include <runtime/preverifiedlidmgr.H>
+#include <util/util_reasoncodes.H>
namespace MCL
{
@@ -224,9 +225,9 @@ public:
/**
* @brief Test that MCL manager properly parses a MCL
*/
- void testMCLparser(void)
+ void testMclParser(void)
{
- UTIL_FT(ENTER_MRK"testMCLparser start" );
+ UTIL_FT(ENTER_MRK"testMclParser start" );
// Generate test MCL
TestMcl l_TestMcl{};
@@ -237,10 +238,10 @@ public:
// Ensure the Comp Info Caches match
if (l_TestMcl.iv_compInfoCache != l_mcl.iv_compInfoCache)
{
- TS_FAIL("testMCLparser> Comp Info Caches do not match");
+ TS_FAIL("testMclParser> Comp Info Caches do not match");
}
- UTIL_FT(EXIT_MRK"testMCLparser complete");
+ UTIL_FT(EXIT_MRK"testMclParser complete");
}
void testProcessMclComponents()
@@ -291,7 +292,7 @@ public:
errlHndl_t l_errl = nullptr;
// Generate test MCL with Secure Lids
- TestMcl l_TestMcl { {Util::TEST_LIDID, Util::TEST_LIDID},
+ TestMcl l_TestMcl { {Util::TEST_LIDID},
{{COMP_TEST2,true}}
};
@@ -324,6 +325,66 @@ public:
UTIL_FT(EXIT_MRK"testProcessSecureMclComponents complete");
}
+
+ void testMclSizeMismatch()
+ {
+ UTIL_FT(ENTER_MRK"testMclSizeMismatch start" );
+
+ errlHndl_t l_errl = nullptr;
+
+ // Generate test MCL with Secure Lids
+ // Add 2 secure sections.
+ // The secure header for the first one will only have the size of 1 lid
+ // So we will get a mismatch between the Secure header's total container
+ // size and what the UtilLidMgr reads out.
+ TestMcl l_TestMcl { {Util::TEST_LIDID, Util::TEST_LIDID},
+ {{COMP_TEST2,true}}
+ };
+
+ // Pass test MCL to MCL manager
+ MasterContainerLidMgr l_mcl(l_TestMcl.iv_bufferStart,
+ l_TestMcl.iv_size);
+
+ // Ensure the Comp Info Caches match
+ if (l_TestMcl.iv_compInfoCache != l_mcl.iv_compInfoCache)
+ {
+ TS_FAIL("testMclSizeMismatch> Comp Info Caches do not match");
+ }
+
+ PreVerifiedLidMgr::initLock(PREVERLIDMGR_TEST_ADDR);
+
+ // Get Instance of Pre-Verified lid manager
+ auto l_preVerLidMgr = PreVerifiedLidMgr::getInstance();
+
+ // Clear lids loaded cache as other test cases fill it in.
+ l_preVerLidMgr.cv_lidsLoaded.clear();
+
+ l_errl = l_mcl.processComponents();
+ if(l_errl)
+ {
+ // Expected Error
+ if(l_errl->reasonCode() == Util::UTIL_MCL_SIZE_MISMATCH)
+ {
+ delete l_errl;
+ l_errl = nullptr;
+ UTIL_FT("testMclSizeMismatch expected error");
+ }
+ // Not Expected Error
+ else
+ {
+ errlCommit(l_errl,UTIL_COMP_ID);
+ TS_FAIL("testMclSizeMismatch> processComponents returned an unexpected error");
+ }
+ }
+ else
+ {
+ TS_FAIL("testMclSizeMismatch> processComponents did not return expected error");
+ }
+
+ PreVerifiedLidMgr::unlock();
+
+ UTIL_FT(EXIT_MRK"testMclSizeMismatch complete");
+ }
};
#endif \ No newline at end of file
diff --git a/src/usr/util/utilmclmgr.C b/src/usr/util/utilmclmgr.C
index 824df42b7..f7ad7bce6 100644
--- a/src/usr/util/utilmclmgr.C
+++ b/src/usr/util/utilmclmgr.C
@@ -621,11 +621,10 @@ errlHndl_t MasterContainerLidMgr::verifyExtend(const ComponentID& i_compId,
SECUREBOOT::ContainerHeader l_conHdr(iv_pVaddr);
// Cache size stats into comp info cache
- // @TODO RTC:125304 re-enable when total size is supported correctly
- //io_compInfo.totalSize = l_conHdr.totalContainerSize();
+ io_compInfo.totalSize = l_conHdr.totalContainerSize();
io_compInfo.protectedSize = l_conHdr.payloadTextSize();
- //io_compInfo.unprotectedSize = l_conHdr.totalContainerSize() -
- // l_conHdr.payloadTextSize();
+ io_compInfo.unprotectedSize = l_conHdr.totalContainerSize() -
+ l_conHdr.payloadTextSize();
// @TODO RTC:125304 re-enable when component id is supported in lids
if (0)// memcmp(l_conHdr.componentId(), i_compId.data(),
OpenPOWER on IntegriCloud