SecurityPkg TcgStorageOpalLib: Check the capability before use.

For Pyrite SSC device, it may not supports Active Key,  So
add check logic before enable it.

Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
Dong, Eric 2016-05-05 08:51:28 +08:00 committed by Feng Tian
parent 6e2814c1a1
commit 6e7423c3c2

View File

@ -814,6 +814,7 @@ OpalSetLockingSpAuthorityEnabledAndPin(
TCG_PARSE_STRUCT ParseStruct;
UINT32 Size;
TCG_UID ActiveKey;
TCG_RESULT Ret;
NULL_CHECK(LockingSpSession);
NULL_CHECK(NewPin);
@ -901,8 +902,12 @@ OpalSetLockingSpAuthorityEnabledAndPin(
ERROR_CHECK(OpalCreateRetrieveGlobalLockingRangeActiveKey(LockingSpSession, &CreateStruct, &Size));
ERROR_CHECK(OpalPerformMethod(LockingSpSession, Size, Buf, sizeof(Buf), &ParseStruct, MethodStatus));
ERROR_CHECK(OpalParseRetrieveGlobalLockingRangeActiveKey(&ParseStruct, &ActiveKey));
//
// For Pyrite type SSC, it not supports Active Key.
// So here add check logic before enable it.
//
Ret = OpalParseRetrieveGlobalLockingRangeActiveKey(&ParseStruct, &ActiveKey);
if (Ret == TcgResultSuccess) {
ERROR_CHECK(TcgInitTcgCreateStruct(&CreateStruct, Buf, sizeof(Buf)));
ERROR_CHECK(TcgCreateSetAce(
&CreateStruct,
@ -926,6 +931,7 @@ OpalSetLockingSpAuthorityEnabledAndPin(
//
return TcgResultFailure;
}
}
ERROR_CHECK(TcgInitTcgCreateStruct(&CreateStruct, Buf, sizeof(Buf)));
ERROR_CHECK(TcgCreateSetAce(