24(EFIAPI *INTERNAL_VAR_CHECK_FUNCTION)(
33 INTERNAL_VAR_CHECK_FUNCTION CheckFunction;
55 UINT16 FilePathListLength;
59 FilePathListLength = *((UINT16 *)((
UINTN)Data +
sizeof (UINT32)));
64 Description = (CHAR16 *)((
UINTN)Data +
sizeof (UINT32) +
sizeof (UINT16));
65 while (Description < (CHAR16 *)((
UINTN)Data + DataSize)) {
66 if (*Description == L
'\0') {
73 if ((
UINTN)Description >= ((
UINTN)Data + DataSize)) {
74 return EFI_INVALID_PARAMETER;
84 return EFI_INVALID_PARAMETER;
87 if (((
UINTN)FilePathList + FilePathListLength) > ((
UINTN)Data + DataSize)) {
88 return EFI_INVALID_PARAMETER;
92 return EFI_INVALID_PARAMETER;
96 return EFI_INVALID_PARAMETER;
122 return EFI_INVALID_PARAMETER;
148 return EFI_INVALID_PARAMETER;
176 String = (CHAR8 *)Data;
177 if (String[DataSize - 1] ==
'\0') {
180 for (Index = 1; Index < DataSize && (String[DataSize - 1 - Index] !=
'\0'); Index++) {
183 if (Index == DataSize) {
184 return EFI_INVALID_PARAMETER;
210 if ((DataSize % VariablePropery->MinSize) != 0) {
211 return EFI_INVALID_PARAMETER;
229 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
231 VARIABLE_ATTRIBUTE_BS_RT,
240 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
242 VARIABLE_ATTRIBUTE_NV_BS_RT,
251 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
253 VARIABLE_ATTRIBUTE_NV_BS_RT,
262 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
264 VARIABLE_ATTRIBUTE_BS_RT,
273 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
275 VARIABLE_ATTRIBUTE_NV_BS_RT,
284 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
286 VARIABLE_ATTRIBUTE_NV_BS_RT,
293 EFI_CON_OUT_VARIABLE_NAME,
295 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
297 VARIABLE_ATTRIBUTE_NV_BS_RT,
304 EFI_ERR_OUT_VARIABLE_NAME,
306 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
308 VARIABLE_ATTRIBUTE_NV_BS_RT,
317 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
319 VARIABLE_ATTRIBUTE_BS_RT,
326 EFI_CON_OUT_DEV_VARIABLE_NAME,
328 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
330 VARIABLE_ATTRIBUTE_BS_RT,
337 EFI_ERR_OUT_DEV_VARIABLE_NAME,
339 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
341 VARIABLE_ATTRIBUTE_BS_RT,
350 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
352 VARIABLE_ATTRIBUTE_NV_BS_RT,
361 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
363 VARIABLE_ATTRIBUTE_NV_BS_RT,
372 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
374 VARIABLE_ATTRIBUTE_BS_RT,
383 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
385 VARIABLE_ATTRIBUTE_BS_RT,
394 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
396 VARIABLE_ATTRIBUTE_NV_BS_RT,
405 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
407 VARIABLE_ATTRIBUTE_NV_BS_RT,
416 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
418 VARIABLE_ATTRIBUTE_NV_BS_RT,
427 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
428 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
429 VARIABLE_ATTRIBUTE_BS_RT,
438 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
440 VARIABLE_ATTRIBUTE_NV_BS_RT_AT,
449 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
451 VARIABLE_ATTRIBUTE_NV_BS_RT_AT,
460 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
461 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
462 VARIABLE_ATTRIBUTE_BS_RT,
471 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
472 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
473 VARIABLE_ATTRIBUTE_BS_RT,
482 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
483 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
484 VARIABLE_ATTRIBUTE_BS_RT,
493 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
494 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
495 VARIABLE_ATTRIBUTE_BS_RT,
504 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
505 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
506 VARIABLE_ATTRIBUTE_BS_RT,
515 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
516 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
517 VARIABLE_ATTRIBUTE_BS_RT,
526 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
527 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
528 VARIABLE_ATTRIBUTE_BS_RT,
537 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
539 VARIABLE_ATTRIBUTE_BS_RT,
548 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
550 VARIABLE_ATTRIBUTE_NV_BS_RT,
559 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
560 VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
561 VARIABLE_ATTRIBUTE_BS_RT,
573 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
575 VARIABLE_ATTRIBUTE_NV_BS_RT,
576 sizeof (UINT32) +
sizeof (UINT16),
584 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
586 VARIABLE_ATTRIBUTE_NV_BS_RT,
587 sizeof (UINT32) +
sizeof (UINT16),
595 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
597 VARIABLE_ATTRIBUTE_NV_BS_RT,
598 sizeof (UINT32) +
sizeof (UINT16),
606 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
608 VARIABLE_ATTRIBUTE_NV_BS_RT,
615 L
"PlatformRecovery####",
617 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
619 VARIABLE_ATTRIBUTE_BS_RT,
620 sizeof (UINT32) +
sizeof (UINT16),
634 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
636 VARIABLE_ATTRIBUTE_NV_BS_RT_AT,
645 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
647 VARIABLE_ATTRIBUTE_NV_BS_RT_AT,
656 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
658 VARIABLE_ATTRIBUTE_NV_BS_RT_AT,
672 VAR_CHECK_VARIABLE_PROPERTY_REVISION,
674 VARIABLE_ATTRIBUTE_NV_BS_RT_HR,
682 &gEfiGlobalVariableGuid,
683 &gEfiImageSecurityDatabaseGuid,
684 &gEfiHardwareErrorVariableGuid
707 return (BOOLEAN)((Char >= L
'0' && Char <= L
'9') || (Char >= L
'A' && Char <= L
'F'));
727 IN CHAR16 *VariableName,
731 if (!
CompareGuid (VendorGuid, &gEfiHardwareErrorVariableGuid) ||
733 (
StrnCmp (VariableName, L
"HwErrRec",
StrLen (L
"HwErrRec")) != 0) ||
755INTERNAL_VAR_CHECK_FUNCTION
757 IN CHAR16 *VariableName,
765 if (
CompareGuid (VendorGuid, &gEfiGlobalVariableGuid)) {
769 for (Index = 0; Index <
sizeof (mGlobalVariableList)/
sizeof (mGlobalVariableList[0]); Index++) {
770 if (
StrCmp (mGlobalVariableList[Index].Name, VariableName) == 0) {
771 *VariableProperty = &(mGlobalVariableList[Index].VariableProperty);
772 return mGlobalVariableList[Index].CheckFunction;
779 NameLength =
StrLen (VariableName) - 4;
780 for (Index = 0; Index <
sizeof (mGlobalVariableList2)/
sizeof (mGlobalVariableList2[0]); Index++) {
781 if ((
StrLen (VariableName) ==
StrLen (mGlobalVariableList2[Index].Name)) &&
782 (
StrnCmp (VariableName, mGlobalVariableList2[Index].Name, NameLength) == 0) &&
788 *VariableProperty = &(mGlobalVariableList2[Index].VariableProperty);
789 return mGlobalVariableList2[Index].CheckFunction;
815 IN CHAR16 *VariableName,
817 IN UINT32 Attributes,
826 INTERNAL_VAR_CHECK_FUNCTION VarCheckFunction;
828 if ((((Attributes & EFI_VARIABLE_APPEND_WRITE) == 0) && (DataSize == 0)) || (Attributes == 0)) {
837 return EFI_INVALID_PARAMETER;
841 for (Index = 0; Index <
sizeof (mUefiDefinedGuid)/
sizeof (mUefiDefinedGuid[0]); Index++) {
842 if (
CompareGuid (VendorGuid, mUefiDefinedGuid[Index])) {
852 DEBUG ((DEBUG_INFO,
"UEFI Variable Check fail %r - %s not in %g namespace\n", EFI_INVALID_PARAMETER, VariableName, VendorGuid));
853 return EFI_INVALID_PARAMETER;
862 VarCheckProperty =
NULL;
864 if (VarCheckFunction !=
NULL) {
865 Status = VarCheckFunction (
870 if (EFI_ERROR (Status)) {
871 DEBUG ((DEBUG_INFO,
"UEFI Variable Check function fail %r - %g:%s\n", Status, VendorGuid, VariableName));
893 for (Index = 0; Index <
sizeof (mGlobalVariableList)/
sizeof (mGlobalVariableList[0]); Index++) {
895 mGlobalVariableList[Index].Name,
896 &gEfiGlobalVariableGuid,
897 &mGlobalVariableList[Index].VariableProperty
901 for (Index = 0; Index <
sizeof (mGlobalVariableList2)/
sizeof (mGlobalVariableList2[0]); Index++) {
903 mGlobalVariableList2[Index].Name,
904 &gEfiGlobalVariableGuid,
905 &mGlobalVariableList2[Index].VariableProperty
912 for (Index = 0; Index <
sizeof (mImageSecurityVariableList)/
sizeof (mImageSecurityVariableList[0]); Index++) {
914 mImageSecurityVariableList[Index].Name,
915 &gEfiImageSecurityDatabaseGuid,
916 &mImageSecurityVariableList[Index].VariableProperty
924 mHwErrRecVariable.Name,
925 &gEfiHardwareErrorVariableGuid,
926 &mHwErrRecVariable.VariableProperty
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
INTN EFIAPI StrnCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
BOOLEAN EFIAPI IsDevicePathValid(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINTN MaxSize)
#define EFI_BOOT_ORDER_VARIABLE_NAME
#define EFI_OS_INDICATIONS_VARIABLE_NAME
#define EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME
#define EFI_SYS_PREP_ORDER_VARIABLE_NAME
#define EFI_CON_IN_DEV_VARIABLE_NAME
#define EFI_DBX_DEFAULT_VARIABLE_NAME
#define EFI_SETUP_MODE_NAME
#define EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME
#define EFI_DBT_DEFAULT_VARIABLE_NAME
#define EFI_KEY_EXCHANGE_KEY_NAME
#define EFI_LANG_VARIABLE_NAME
#define EFI_PLATFORM_LANG_CODES_VARIABLE_NAME
#define EFI_CON_IN_VARIABLE_NAME
#define EFI_KEK_DEFAULT_VARIABLE_NAME
#define EFI_PK_DEFAULT_VARIABLE_NAME
#define EFI_DB_DEFAULT_VARIABLE_NAME
#define EFI_BOOT_CURRENT_VARIABLE_NAME
#define EFI_LANG_CODES_VARIABLE_NAME
#define EFI_BOOT_NEXT_VARIABLE_NAME
#define EFI_TIME_OUT_VARIABLE_NAME
#define EFI_PLATFORM_LANG_VARIABLE_NAME
#define EFI_SIGNATURE_SUPPORT_NAME
#define EFI_PLATFORM_KEY_NAME
#define EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME
#define EFI_VENDOR_KEYS_VARIABLE_NAME
#define EFI_DRIVER_ORDER_VARIABLE_NAME
#define EFI_SECURE_BOOT_MODE_NAME
#define EFI_IMAGE_SECURITY_DATABASE2
#define EFI_IMAGE_SECURITY_DATABASE1
#define EFI_IMAGE_SECURITY_DATABASE
#define DEBUG(Expression)
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD
EFI_STATUS EFIAPI VarCheckLibRegisterSetVariableCheckHandler(IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler)
EFI_STATUS EFIAPI VarCheckLibVariablePropertySet(IN CHAR16 *Name, IN EFI_GUID *Guid, IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty)
EFI_STATUS EFIAPI VarCheckLibVariablePropertyGet(IN CHAR16 *Name, IN EFI_GUID *Guid, OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty)
EFI_STATUS EFIAPI InternalVarCheckSizeArray(IN VAR_CHECK_VARIABLE_PROPERTY *VariablePropery, IN UINTN DataSize, IN VOID *Data)
BOOLEAN EFIAPI IsHwErrRecVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
EFI_STATUS EFIAPI SetVariableCheckHandlerUefiDefined(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
BOOLEAN EFIAPI VarCheckUefiIsHexaDecimalDigitCharacter(IN CHAR16 Char)
EFI_STATUS EFIAPI InternalVarCheckLoadOption(IN VAR_CHECK_VARIABLE_PROPERTY *VariablePropery, IN UINTN DataSize, IN VOID *Data)
RETURN_STATUS EFIAPI VarCheckUefiLibNullClassConstructor(VOID)
EFI_STATUS EFIAPI InternalVarCheckKeyOption(IN VAR_CHECK_VARIABLE_PROPERTY *VariablePropery, IN UINTN DataSize, IN VOID *Data)
INTERNAL_VAR_CHECK_FUNCTION GetUefiDefinedVarCheckFunction(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT VAR_CHECK_VARIABLE_PROPERTY **VariableProperty)
EFI_STATUS EFIAPI InternalVarCheckDevicePath(IN VAR_CHECK_VARIABLE_PROPERTY *VariablePropery, IN UINTN DataSize, IN VOID *Data)
EFI_STATUS EFIAPI InternalVarCheckAsciiString(IN VAR_CHECK_VARIABLE_PROPERTY *VariablePropery, IN UINTN DataSize, IN VOID *Data)
VOID VariablePropertySetUefiDefined(VOID)