mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
MdeModulePkg/Variable/RuntimeDxe: Modify function return status
Make VariableServiceSetVariable and VariableServiceQueryVariableInfo functions return status following UEFI 2.7 spec. Cc: Zhang Chao <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: chenc2 <chen.a.chen@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
This commit is contained in:
parent
7d3a7c22a6
commit
67943427ad
@ -3146,7 +3146,11 @@ VariableServiceSetVariable (
|
|||||||
// Make sure if runtime bit is set, boot service bit is set also.
|
// Make sure if runtime bit is set, boot service bit is set also.
|
||||||
//
|
//
|
||||||
if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
|
if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
|
||||||
return EFI_INVALID_PARAMETER;
|
if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
} else {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
} else if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {
|
} else if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {
|
||||||
if (!mVariableModuleGlobal->VariableGlobal.AuthSupport) {
|
if (!mVariableModuleGlobal->VariableGlobal.AuthSupport) {
|
||||||
//
|
//
|
||||||
@ -3169,15 +3173,16 @@ VariableServiceSetVariable (
|
|||||||
//
|
//
|
||||||
if (((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
|
if (((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
|
||||||
&& ((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) {
|
&& ((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) {
|
if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) {
|
||||||
if (DataSize < AUTHINFO_SIZE) {
|
//
|
||||||
//
|
// If DataSize == AUTHINFO_SIZE and then PayloadSize is 0.
|
||||||
// Try to write Authenticated Variable without AuthInfo.
|
// Maybe it's the delete operation of common authenticated variable at user physical presence.
|
||||||
//
|
//
|
||||||
return EFI_SECURITY_VIOLATION;
|
if (DataSize != AUTHINFO_SIZE) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
PayloadSize = DataSize - AUTHINFO_SIZE;
|
PayloadSize = DataSize - AUTHINFO_SIZE;
|
||||||
} else if ((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) {
|
} else if ((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) {
|
||||||
@ -3523,6 +3528,13 @@ VariableServiceQueryVariableInfo (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||||
|
//
|
||||||
|
// Deprecated attribute, make this check as highest priority.
|
||||||
|
//
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
if ((Attributes & EFI_VARIABLE_ATTRIBUTES_MASK) == 0) {
|
if ((Attributes & EFI_VARIABLE_ATTRIBUTES_MASK) == 0) {
|
||||||
//
|
//
|
||||||
// Make sure the Attributes combination is supported by the platform.
|
// Make sure the Attributes combination is supported by the platform.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user