diff options
author | Jaymes Wilks <mjwilks@us.ibm.com> | 2017-09-13 09:53:39 -0500 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2017-10-20 12:50:04 -0400 |
commit | b70fc1ac984f9da0d9e4932b8a9e40b1ccf4da50 (patch) | |
tree | 509a1189bbbb420583dadd61603a08eb6691e2c3 /src/usr/pnor/test | |
parent | 3f4963bae6821005c0d355587e43ca17512e5a3b (diff) | |
download | talos-hostboot-b70fc1ac984f9da0d9e4932b8a9e40b1ccf4da50.tar.gz talos-hostboot-b70fc1ac984f9da0d9e4932b8a9e40b1ccf4da50.zip |
Implement Secure unload
Implement Secure unload of secure sections within PNOR.
Change-Id: I92a00013d23e0506f89f89ec41a193eac0b25d25
RTC:157475
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46203
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: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/test')
-rw-r--r-- | src/usr/pnor/test/pnorrptest.H | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/src/usr/pnor/test/pnorrptest.H b/src/usr/pnor/test/pnorrptest.H index d42ce93a5..c0267ebd2 100644 --- a/src/usr/pnor/test/pnorrptest.H +++ b/src/usr/pnor/test/pnorrptest.H @@ -830,12 +830,12 @@ class PnorRpTest : public CxxTest::TestSuite errlHndl_t pError=NULL; do { - if (!PNOR::isEnforcedSecureSection(PNOR::SBE_IPL)) + if (!PNOR::isEnforcedSecureSection(PNOR::MEMD)) { break; } - pError = PNOR::loadSecureSection(PNOR::SBE_IPL); + pError = PNOR::loadSecureSection(PNOR::MEMD); if(pError != NULL) { TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " @@ -844,7 +844,7 @@ class PnorRpTest : public CxxTest::TestSuite break; } - pError = PNOR::unloadSecureSection(PNOR::SBE_IPL); + pError = PNOR::unloadSecureSection(PNOR::MEMD); if(pError != NULL) { TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " @@ -853,6 +853,75 @@ class PnorRpTest : public CxxTest::TestSuite break; } + // try loading MEMD a few times + for (int i=0; i<10; i++) + { + pError = PNOR::loadSecureSection(PNOR::MEMD); + if(pError != nullptr) + { + TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " + "loadSecureSection returned an error on MEMD section load attempt %i",i); + break; + } + } + if (pError != nullptr) + { + ERRORLOG::errlCommit(pError,PNOR_COMP_ID); + break; + } + + + // try unloading MEMD the exact same number of times we loaded it + for (int i=0; i<10; i++) + { + pError = PNOR::unloadSecureSection(PNOR::MEMD); + if(pError != nullptr) + { + TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " + "loadSecureSection returned an error on MEMD section unload attempt %i", i); + break; + } + } + if (pError != nullptr) + { + ERRORLOG::errlCommit(pError,PNOR_COMP_ID); + break; + } + + // TODO RTC 181272 + // In order for the below test to work, we need to make sure that + // MEMD is never actually being loaded or unloaded during this test. + // Since all of the tests run in parallel, we can't really + // guarantee this completely if someone decides to write a test for + // MEMD, so ideally we would need some kind of mutex to prevent this. + + // Try to unload the secure section one extra time + // We expect to see an error log + pError = PNOR::unloadSecureSection(PNOR::MEMD); + if(pError == nullptr) + { + TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " + "unloadSecureSection failed to return error on extra invoke"); + break; + } + else + { + if(pError->reasonCode() != PNOR::RC_EXTERNAL_ERROR || + pError->moduleId() != PNOR::MOD_PNORRP_LOADUNLOADSECURESECTION) + { + ERRORLOG::errlCommit(pError, PNOR_COMP_ID); + TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " + "unloadSecureSection return an unexpected error"); + break; + } + else + { + // passed the test + delete pError; + pError = nullptr; + } + } + } while (0); #endif } |