\r
FmpSetImage() will receive untrusted input and do basic validation.\r
\r
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
@retval EFI_ABORTED The operation is aborted.\r
@retval EFI_INVALID_PARAMETER The Image was NULL.\r
@retval EFI_UNSUPPORTED The operation is not supported.\r
- @retval EFI_SECURITY_VIOLATIO The operation could not be performed due to an authentication failure.\r
+ @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r
\r
**/\r
EFI_STATUS\r
}\r
\r
//\r
- // Pass Thru\r
+ // Pass Thru to System FMP Protocol on same handle as FMP Protocol\r
//\r
- Status = gBS->LocateProtocol(&gSystemFmpProtocolGuid, NULL, (VOID **)&SystemFmp);\r
+ Status = gBS->HandleProtocol(\r
+ SystemFmpPrivate->Handle,\r
+ &gSystemFmpProtocolGuid,\r
+ (VOID **)&SystemFmp\r
+ );\r
if (EFI_ERROR(Status)) {\r
- DEBUG((DEBUG_INFO, "(Agent)SetImage - SystemFmpProtocol - %r\n", Status));\r
- SystemFmpPrivate->LastAttempt.LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT;\r
- VarStatus = gRT->SetVariable(\r
- SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,\r
- &gSystemFmpLastAttemptVariableGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
- sizeof(SystemFmpPrivate->LastAttempt),\r
- &SystemFmpPrivate->LastAttempt\r
- );\r
- DEBUG((DEBUG_INFO, "(Agent)SetLastAttemp - %r\n", VarStatus));\r
- return Status;\r
+ Status = gBS->LocateProtocol (\r
+ &gSystemFmpProtocolGuid,\r
+ NULL,\r
+ (VOID **)&SystemFmp\r
+ );\r
+ if (EFI_ERROR(Status)) {\r
+ DEBUG((DEBUG_INFO, "(Agent)SetImage - SystemFmpProtocol - %r\n", Status));\r
+ SystemFmpPrivate->LastAttempt.LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT;\r
+ VarStatus = gRT->SetVariable(\r
+ SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,\r
+ &gSystemFmpLastAttemptVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ sizeof(SystemFmpPrivate->LastAttempt),\r
+ &SystemFmpPrivate->LastAttempt\r
+ );\r
+ DEBUG((DEBUG_INFO, "(Agent)SetLastAttemp - %r\n", VarStatus));\r
+ return Status;\r
+ }\r
}\r
\r
return SystemFmp->SetImage(SystemFmp, ImageIndex, Image, ImageSize, VendorCode, Progress, AbortReason);\r