**/\r
VOID *\r
InternalHstiFindAip (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- OUT VOID **HstiData OPTIONAL,\r
- OUT UINTN *HstiSize OPTIONAL\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ OUT VOID **HstiData OPTIONAL,\r
+ OUT UINTN *HstiSize OPTIONAL\r
)\r
{\r
EFI_STATUS Status;\r
return NULL;\r
}\r
\r
- Hsti = NULL;\r
- Aip = NULL;\r
- InformationBlock = NULL;\r
+ Hsti = NULL;\r
+ Aip = NULL;\r
+ InformationBlock = NULL;\r
InformationBlockSize = 0;\r
for (Index = 0; Index < NoHandles; Index++) {\r
Status = gBS->HandleProtocol (\r
break;\r
}\r
}\r
+\r
FreePool (InfoTypesBuffer);\r
\r
if (AipCandidate == NULL) {\r
//\r
// Check HSTI Role\r
//\r
- Aip = AipCandidate;\r
+ Aip = AipCandidate;\r
Status = Aip->GetInformation (\r
Aip,\r
&gAdapterInfoPlatformSecurityGuid,\r
\r
Hsti = InformationBlock;\r
if ((Hsti->Role == Role) &&\r
- ((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0))) {\r
+ ((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0)))\r
+ {\r
break;\r
} else {\r
Hsti = NULL;\r
continue;\r
}\r
}\r
+\r
FreePool (Handles);\r
\r
if (Hsti == NULL) {\r
if (HstiData != NULL) {\r
*HstiData = InformationBlock;\r
}\r
+\r
if (HstiSize != NULL) {\r
*HstiSize = InformationBlockSize;\r
}\r
+\r
return Aip;\r
}\r
\r
**/\r
BOOLEAN\r
InternalHstiIsValidTable (\r
- IN VOID *HstiData,\r
- IN UINTN HstiSize\r
+ IN VOID *HstiData,\r
+ IN UINTN HstiSize\r
)\r
{\r
ADAPTER_INFO_PLATFORM_SECURITY *Hsti;\r
DEBUG ((DEBUG_ERROR, "HstiData == NULL\n"));\r
return FALSE;\r
}\r
- if (HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) {\r
+\r
+ if (HstiSize < sizeof (ADAPTER_INFO_PLATFORM_SECURITY)) {\r
DEBUG ((DEBUG_ERROR, "HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)\n"));\r
return FALSE;\r
}\r
- if (((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < Hsti->SecurityFeaturesSize) {\r
+\r
+ if (((HstiSize - sizeof (ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < Hsti->SecurityFeaturesSize) {\r
DEBUG ((DEBUG_ERROR, "((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < SecurityFeaturesSize\n"));\r
return FALSE;\r
}\r
// Check Role\r
//\r
if ((Hsti->Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) ||\r
- (Hsti->Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM)) {\r
+ (Hsti->Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM))\r
+ {\r
DEBUG ((DEBUG_ERROR, "Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE ||\n"));\r
DEBUG ((DEBUG_ERROR, "Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM\n"));\r
return FALSE;\r
//\r
// Check ImplementationID\r
//\r
- for (Index = 0; Index < sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0]); Index++) {\r
+ for (Index = 0; Index < sizeof (Hsti->ImplementationID)/sizeof (Hsti->ImplementationID[0]); Index++) {\r
if (Hsti->ImplementationID[Index] == 0) {\r
break;\r
}\r
}\r
- if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) {\r
+\r
+ if (Index == sizeof (Hsti->ImplementationID)/sizeof (Hsti->ImplementationID[0])) {\r
DEBUG ((DEBUG_ERROR, "ImplementationID has no NUL CHAR\n"));\r
return FALSE;\r
}\r
\r
- ErrorStringSize = HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3;\r
- ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3);\r
+ ErrorStringSize = HstiSize - sizeof (ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3;\r
+ ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3);\r
\r
//\r
// basic check for ErrorString\r
DEBUG ((DEBUG_ERROR, "ErrorStringSize == 0\n"));\r
return FALSE;\r
}\r
+\r
if ((ErrorStringSize & BIT0) != 0) {\r
DEBUG ((DEBUG_ERROR, "(ErrorStringSize & BIT0) != 0\n"));\r
return FALSE;\r
//\r
// ErrorString might not be CHAR16 aligned.\r
//\r
- CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar));\r
+ CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar));\r
for (ErrorStringLength = 0; (ErrorChar != 0) && (ErrorStringLength < (ErrorStringSize/2)); ErrorStringLength++) {\r
ErrorString++;\r
- CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar));\r
+ CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar));\r
}\r
\r
//\r
DEBUG ((DEBUG_ERROR, "ErrorString has no NUL CHAR\n"));\r
return FALSE;\r
}\r
+\r
if (ErrorStringLength == (ErrorStringSize/2)) {\r
DEBUG ((DEBUG_ERROR, "ErrorString Length incorrect\n"));\r
return FALSE;\r
EFI_STATUS\r
EFIAPI\r
HstiLibSetTable (\r
- IN VOID *Hsti,\r
- IN UINTN HstiSize\r
+ IN VOID *Hsti,\r
+ IN UINTN HstiSize\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_HANDLE Handle;\r
- HSTI_AIP_PRIVATE_DATA *HstiAip;\r
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
- UINT32 Role;\r
- CHAR16 *ImplementationID;\r
- UINT32 SecurityFeaturesSize;\r
- UINT8 *SecurityFeaturesRequired;\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE Handle;\r
+ HSTI_AIP_PRIVATE_DATA *HstiAip;\r
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
+ UINT32 Role;\r
+ CHAR16 *ImplementationID;\r
+ UINT32 SecurityFeaturesSize;\r
+ UINT8 *SecurityFeaturesRequired;\r
\r
if (!InternalHstiIsValidTable (Hsti, HstiSize)) {\r
return EFI_VOLUME_CORRUPTED;\r
}\r
\r
- Role = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->Role;\r
+ Role = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->Role;\r
ImplementationID = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->ImplementationID;\r
- Aip = InternalHstiFindAip (Role, ImplementationID, NULL, NULL);\r
+ Aip = InternalHstiFindAip (Role, ImplementationID, NULL, NULL);\r
if (Aip != NULL) {\r
return EFI_ALREADY_STARTED;\r
}\r
\r
- HstiAip = AllocateZeroPool (sizeof(HSTI_AIP_PRIVATE_DATA));\r
+ HstiAip = AllocateZeroPool (sizeof (HSTI_AIP_PRIVATE_DATA));\r
if (HstiAip == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
+\r
HstiAip->Hsti = AllocateCopyPool (HstiSize, Hsti);\r
if (HstiAip->Hsti == NULL) {\r
FreePool (HstiAip);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
+\r
if (Role != PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) {\r
- SecurityFeaturesRequired = (UINT8 *)HstiAip->Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY);\r
- SecurityFeaturesSize = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->SecurityFeaturesSize;\r
+ SecurityFeaturesRequired = (UINT8 *)HstiAip->Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY);\r
+ SecurityFeaturesSize = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->SecurityFeaturesSize;\r
ZeroMem (SecurityFeaturesRequired, SecurityFeaturesSize);\r
}\r
\r
HstiAip->Signature = HSTI_AIP_PRIVATE_SIGNATURE;\r
- CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof(EFI_ADAPTER_INFORMATION_PROTOCOL));\r
- HstiAip->HstiSize = HstiSize;\r
+ CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof (EFI_ADAPTER_INFORMATION_PROTOCOL));\r
+ HstiAip->HstiSize = HstiSize;\r
HstiAip->HstiMaxSize = HstiSize;\r
\r
Handle = NULL;\r
EFI_STATUS\r
EFIAPI\r
HstiLibGetTable (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- OUT VOID **Hsti,\r
- OUT UINTN *HstiSize\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ OUT VOID **Hsti,\r
+ OUT UINTN *HstiSize\r
)\r
{\r
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
\r
Aip = InternalHstiFindAip (Role, ImplementationID, Hsti, HstiSize);\r
if (Aip == NULL) {\r
return EFI_NOT_FOUND;\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
**/\r
EFI_STATUS\r
InternalHstiRecordFeaturesVerified (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- IN UINT32 ByteIndex,\r
- IN UINT8 Bit,\r
- IN BOOLEAN Set\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ IN UINT32 ByteIndex,\r
+ IN UINT8 Bit,\r
+ IN BOOLEAN Set\r
)\r
{\r
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
- ADAPTER_INFO_PLATFORM_SECURITY *Hsti;\r
- UINTN HstiSize;\r
- UINT8 *SecurityFeaturesVerified;\r
- EFI_STATUS Status;\r
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
+ ADAPTER_INFO_PLATFORM_SECURITY *Hsti;\r
+ UINTN HstiSize;\r
+ UINT8 *SecurityFeaturesVerified;\r
+ EFI_STATUS Status;\r
\r
Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize);\r
if (Aip == NULL) {\r
return EFI_UNSUPPORTED;\r
}\r
\r
- SecurityFeaturesVerified = (UINT8 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 2);\r
+ SecurityFeaturesVerified = (UINT8 *)((UINTN)Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 2);\r
\r
if (Set) {\r
SecurityFeaturesVerified[ByteIndex] = (UINT8)(SecurityFeaturesVerified[ByteIndex] | (Bit));\r
EFI_STATUS\r
EFIAPI\r
HstiLibSetFeaturesVerified (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- IN UINT32 ByteIndex,\r
- IN UINT8 BitMask\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ IN UINT32 ByteIndex,\r
+ IN UINT8 BitMask\r
)\r
{\r
return InternalHstiRecordFeaturesVerified (\r
EFI_STATUS\r
EFIAPI\r
HstiLibClearFeaturesVerified (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- IN UINT32 ByteIndex,\r
- IN UINT8 BitMask\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ IN UINT32 ByteIndex,\r
+ IN UINT8 BitMask\r
)\r
{\r
return InternalHstiRecordFeaturesVerified (\r
**/\r
EFI_STATUS\r
InternalHstiRecordErrorString (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- IN CHAR16 *ErrorString,\r
- IN BOOLEAN Append\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ IN CHAR16 *ErrorString,\r
+ IN BOOLEAN Append\r
)\r
{\r
- EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
- ADAPTER_INFO_PLATFORM_SECURITY *Hsti;\r
- UINTN HstiSize;\r
- UINTN StringSize;\r
- VOID *NewHsti;\r
- UINTN NewHstiSize;\r
- UINTN Offset;\r
- EFI_STATUS Status;\r
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
+ ADAPTER_INFO_PLATFORM_SECURITY *Hsti;\r
+ UINTN HstiSize;\r
+ UINTN StringSize;\r
+ VOID *NewHsti;\r
+ UINTN NewHstiSize;\r
+ UINTN Offset;\r
+ EFI_STATUS Status;\r
\r
Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize);\r
if (Aip == NULL) {\r
}\r
\r
if (Append) {\r
- Offset = HstiSize - sizeof(CHAR16);\r
+ Offset = HstiSize - sizeof (CHAR16);\r
} else {\r
- Offset = sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3;\r
+ Offset = sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3;\r
}\r
+\r
StringSize = StrSize (ErrorString);\r
\r
NewHstiSize = Offset + StringSize;\r
- NewHsti = AllocatePool (NewHstiSize);\r
+ NewHsti = AllocatePool (NewHstiSize);\r
if (NewHsti == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
EFI_STATUS\r
EFIAPI\r
HstiLibAppendErrorString (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- IN CHAR16 *ErrorString\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ IN CHAR16 *ErrorString\r
)\r
{\r
return InternalHstiRecordErrorString (\r
EFI_STATUS\r
EFIAPI\r
HstiLibSetErrorString (\r
- IN UINT32 Role,\r
- IN CHAR16 *ImplementationID OPTIONAL,\r
- IN CHAR16 *ErrorString\r
+ IN UINT32 Role,\r
+ IN CHAR16 *ImplementationID OPTIONAL,\r
+ IN CHAR16 *ErrorString\r
)\r
{\r
return InternalHstiRecordErrorString (\r