Changeset 58466 in vbox for trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg
- Timestamp:
- Oct 29, 2015 4:30:44 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 103777
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 209 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
- Property svn:mergeinfo changed
/vendor/edk2/current merged: 103769-103776
- Property svn:mergeinfo changed
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/RngTest/RngTest.c
r58464 r58466 3 3 4 4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 13 **/ 13 **/ 14 14 15 15 #include <Uefi.h> … … 25 25 as the real entry point for the application. 26 26 27 @param[in] ImageHandle The firmware allocated handle for the EFI image. 27 @param[in] ImageHandle The firmware allocated handle for the EFI image. 28 28 @param[in] SystemTable A pointer to the EFI System Table. 29 29 30 30 @retval EFI_SUCCESS The entry point is executed successfully. 31 31 @retval other Some error occurs when executing this entry point. … … 53 53 PtrRngAlg = NULL; 54 54 Rand = NULL; 55 55 56 56 Print (L"UEFI RNG Protocol Testing :\n"); 57 57 Print (L"----------------------------\n"); … … 72 72 // Rng->GetInfo() interface test. 73 73 //----------------------------------------- 74 74 75 75 Print (L" -- Call RNG->GetInfo() interface : "); 76 76 RngAlgListSize = 0; … … 91 91 PtrRngAlg->Data2, PtrRngAlg->Data3, PtrRngAlg->Data4[0], PtrRngAlg->Data4[1], 92 92 PtrRngAlg->Data4[2], PtrRngAlg->Data4[3], PtrRngAlg->Data4[4], 93 PtrRngAlg->Data4[5], PtrRngAlg->Data4[6], PtrRngAlg->Data4[7]); 93 PtrRngAlg->Data4[5], PtrRngAlg->Data4[6], PtrRngAlg->Data4[7]); 94 94 } 95 95 … … 107 107 goto Exit; 108 108 } 109 109 110 110 // 111 111 // RNG with default algorithm … … 118 118 Print (L"[Pass]"); 119 119 } 120 120 121 121 // 122 122 // RNG with SP800-90-HMAC-256 … … 226 226 227 227 Print (L"\n -- Exit UEFI RNG Protocol Test (Status = %r).\n", Status); 228 228 229 229 Exit: 230 230 if (Rand != NULL) { -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/RngTest/RngTest.inf
r58464 r58466 1 1 ## @file 2 2 # UEFI RNG (Random Number Generator) Protocol test application. 3 # 4 # This application can print out the supported RNG algorithm in UEFI RNG Protocol. 5 # And then it will do a generation test on the supported RNG algorithm. 3 # 4 # This application can print out the supported RNG algorithm in UEFI RNG Protocol. 5 # And then it will do a generation test on the supported RNG algorithm. 6 6 # 7 7 # Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> … … 53 53 gEfiRngAlgorithmX931AesGuid ## SOMETIMES_CONSUMES ## GUID # Unique ID of the algorithm for RNG 54 54 gEfiRngAlgorithmRaw ## SOMETIMES_CONSUMES ## GUID # Unique ID of the algorithm for RNG 55 55 56 56 [UserExtensions.TianoCore."ExtraFiles"] 57 57 RngTestExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/VariableInfo/VariableInfo.c
r48674 r58466 1 1 /** @file 2 If the Variable services have PcdVariableCollectStatistics set to TRUE then 3 this utility will print out the statistics information. You can use console 2 If the Variable services have PcdVariableCollectStatistics set to TRUE then 3 this utility will print out the statistics information. You can use console 4 4 redirection to capture the data. 5 5 6 6 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 10 http://opensource.org/licenses/bsd-license.php 11 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 14 … … 35 35 /** 36 36 37 This function get the variable statistics data from SMM variable driver. 37 This function get the variable statistics data from SMM variable driver. 38 38 39 39 @param[in, out] SmmCommunicateHeader In input, a pointer to a collection of data that will 40 be passed into an SMM environment. In output, a pointer 40 be passed into an SMM environment. In output, a pointer 41 41 to a collection of data that comes from an SMM environment. 42 42 @param[in, out] SmmCommunicateSize The size of the SmmCommunicateHeader. 43 43 44 44 @retval EFI_SUCCESS Get the statistics data information. 45 45 @retval EFI_NOT_FOUND Not found. … … 62 62 SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) &SmmCommunicateHeader->Data[0]; 63 63 SmmVariableFunctionHeader->Function = SMM_VARIABLE_FUNCTION_GET_STATISTICS; 64 64 65 65 Status = mSmmCommunication->Communicate (mSmmCommunication, SmmCommunicateHeader, SmmCommunicateSize); 66 66 ASSERT_EFI_ERROR (Status); 67 68 Status = SmmVariableFunctionHeader->ReturnStatus; 67 68 Status = SmmVariableFunctionHeader->ReturnStatus; 69 69 return Status; 70 70 } … … 73 73 /** 74 74 75 This function get and print the variable statistics data from SMM variable driver. 76 75 This function get and print the variable statistics data from SMM variable driver. 76 77 77 @retval EFI_SUCCESS Print the statistics information successfully. 78 78 @retval EFI_NOT_FOUND Not found the statistics information. … … 81 81 EFI_STATUS 82 82 PrintInfoFromSmm ( 83 VOID 83 VOID 84 84 ) 85 85 { … … 91 91 SMM_VARIABLE_COMMUNICATE_HEADER *FunctionHeader; 92 92 EFI_SMM_VARIABLE_PROTOCOL *Smmvariable; 93 93 94 94 95 95 Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **) &Smmvariable); … … 101 101 if (EFI_ERROR (Status)) { 102 102 return Status; 103 } 103 } 104 104 105 105 CommSize = SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; … … 107 107 CommBuffer = AllocateZeroPool (CommSize); 108 108 ASSERT (CommBuffer != NULL); 109 109 110 110 Print (L"Non-Volatile SMM Variables:\n"); 111 111 do { … … 119 119 } 120 120 121 if (EFI_ERROR (Status) || (CommSize <= SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE)) { 121 if (EFI_ERROR (Status) || (CommSize <= SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE)) { 122 122 break; 123 123 } … … 132 132 if (!VariableInfo->Volatile) { 133 133 Print ( 134 L"%g R%03d(%03d) W%03d D%03d:%s\n", 135 &VariableInfo->VendorGuid, 134 L"%g R%03d(%03d) W%03d D%03d:%s\n", 135 &VariableInfo->VendorGuid, 136 136 VariableInfo->ReadCount, 137 137 VariableInfo->CacheCount, … … 142 142 } 143 143 } while (TRUE); 144 144 145 145 Print (L"Volatile SMM Variables:\n"); 146 146 ZeroMem (CommBuffer, CommSize); … … 155 155 } 156 156 157 if (EFI_ERROR (Status) || (CommSize <= SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE)) { 157 if (EFI_ERROR (Status) || (CommSize <= SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE)) { 158 158 break; 159 159 } … … 168 168 if (VariableInfo->Volatile) { 169 169 Print ( 170 L"%g R%03d(%03d) W%03d D%03d:%s\n", 171 &VariableInfo->VendorGuid, 170 L"%g R%03d(%03d) W%03d D%03d:%s\n", 171 &VariableInfo->VendorGuid, 172 172 VariableInfo->ReadCount, 173 173 VariableInfo->CacheCount, … … 179 179 } while (TRUE); 180 180 181 FreePool (CommBuffer); 181 FreePool (CommBuffer); 182 182 return Status; 183 183 } … … 185 185 /** 186 186 The user Entry Point for Application. The user code starts with this function 187 as the real entry point for the image goes into a library that calls this 187 as the real entry point for the image goes into a library that calls this 188 188 function. 189 189 190 @param[in] ImageHandle The firmware allocated handle for the EFI image. 190 @param[in] ImageHandle The firmware allocated handle for the EFI image. 191 191 @param[in] SystemTable A pointer to the EFI System Table. 192 192 193 193 @retval EFI_SUCCESS The entry point is executed successfully. 194 194 @retval other Some error occurs when executing this entry point. … … 216 216 return Status; 217 217 } 218 } 218 } 219 219 220 220 if (!EFI_ERROR (Status) && (Entry != NULL)) { … … 224 224 if (!VariableInfo->Volatile) { 225 225 Print ( 226 L"%g R%03d(%03d) W%03d D%03d:%s\n", 227 &VariableInfo->VendorGuid, 226 L"%g R%03d(%03d) W%03d D%03d:%s\n", 227 &VariableInfo->VendorGuid, 228 228 VariableInfo->ReadCount, 229 229 VariableInfo->CacheCount, … … 242 242 if (VariableInfo->Volatile) { 243 243 Print ( 244 L"%g R%03d(%03d) W%03d D%03d:%s\n", 245 &VariableInfo->VendorGuid, 244 L"%g R%03d(%03d) W%03d D%03d:%s\n", 245 &VariableInfo->VendorGuid, 246 246 VariableInfo->ReadCount, 247 247 VariableInfo->CacheCount, -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/VariableInfo/VariableInfo.inf
r58459 r58466 50 50 [Protocols] 51 51 gEfiSmmCommunicationProtocolGuid ## SOMETIMES_CONSUMES 52 52 53 53 ## UNDEFINED # Used to do smm communication 54 ## SOMETIMES_CONSUMES 55 gEfiSmmVariableProtocolGuid 56 54 ## SOMETIMES_CONSUMES 55 gEfiSmmVariableProtocolGuid 56 57 57 [Guids] 58 58 gEfiAuthenticatedVariableGuid ## SOMETIMES_CONSUMES ## SystemTable -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/AuthenticatedVariableFormat.h
r58459 r58466 1 1 /** @file 2 The variable data structures are related to EDKII-specific 2 The variable data structures are related to EDKII-specific 3 3 implementation of UEFI authenticated variables. 4 AuthenticatedVariableFormat.h defines variable data headers 4 AuthenticatedVariableFormat.h defines variable data headers 5 5 and variable storage region headers. 6 6 7 7 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 11 http://opensource.org/licenses/bsd-license.php 12 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 … … 118 118 EFI_GUID Signature; 119 119 /// 120 /// Size of entire variable store, 120 /// Size of entire variable store, 121 121 /// including size of variable store header but not including the size of FvHeader. 122 122 /// … … 169 169 UINT64 MonotonicCount; 170 170 /// 171 /// Associated TimeStamp value against replay attack. 171 /// Associated TimeStamp value against replay attack. 172 172 /// 173 173 EFI_TIME TimeStamp; … … 197 197 /// This structure contains the variable list that is put in EFI system table. 198 198 /// The variable driver collects all variables that were used at boot service time and produces this list. 199 /// This is an optional feature to dump all used variables in shell environment. 199 /// This is an optional feature to dump all used variables in shell environment. 200 200 /// 201 201 struct _VARIABLE_INFO_ENTRY { 202 202 VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry. 203 203 EFI_GUID VendorGuid; ///< Guid of Variable. 204 CHAR16 *Name; ///< Name of Variable. 204 CHAR16 *Name; ///< Name of Variable. 205 205 UINT32 Attributes; ///< Attributes of variable defined in UEFI spec. 206 206 UINT32 ReadCount; ///< Number of times to read this variable. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/MeasuredFvHob.h
r58464 r58466 1 1 /** @file 2 Defines the HOB GUID used to pass all PEI measured FV info to 2 Defines the HOB GUID used to pass all PEI measured FV info to 3 3 DXE Driver. 4 4 5 5 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/PhysicalPresenceData.h
r58459 r58466 2 2 Define the variable data structures used for TCG physical presence. 3 3 The TPM request from firmware or OS is saved to variable. And it is 4 cleared after it is processed in the next boot cycle. The TPM response 4 cleared after it is processed in the next boot cycle. The TPM response 5 5 is saved to variable. 6 6 7 7 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 11 http://opensource.org/licenses/bsd-license.php 12 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 … … 39 39 #define PHYSICAL_PRESENCE_DISABLE 2 40 40 #define PHYSICAL_PRESENCE_ACTIVATE 3 41 #define PHYSICAL_PRESENCE_DEACTIVATE 4 41 #define PHYSICAL_PRESENCE_DEACTIVATE 4 42 42 #define PHYSICAL_PRESENCE_CLEAR 5 43 43 #define PHYSICAL_PRESENCE_ENABLE_ACTIVATE 6 … … 61 61 // 62 62 // This variable is used to save TPM Management Flags and corresponding operations. 63 // It should be protected from malicious software (e.g. Set it as read-only variable). 63 // It should be protected from malicious software (e.g. Set it as read-only variable). 64 64 // 65 65 #define PHYSICAL_PRESENCE_FLAGS_VARIABLE L"PhysicalPresenceFlags" -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/PwdCredentialProviderHii.h
r48674 r58466 3 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/SecureBootConfigHii.h
r48674 r58466 1 1 /** @file 2 GUIDs used as HII FormSet and HII Package list GUID in SecureBootConfigDxe driver. 3 2 GUIDs used as HII FormSet and HII Package list GUID in SecureBootConfigDxe driver. 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 8 http://opensource.org/licenses/bsd-license.php. 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/SecurityPkgTokenSpace.h
r48674 r58466 3 3 4 4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TcgConfigHii.h
r48674 r58466 1 1 /** @file 2 GUIDs used as HII FormSet and HII Package list GUID in TcgConfig driver. 3 2 GUIDs used as HII FormSet and HII Package list GUID in TcgConfig driver. 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 8 http://opensource.org/licenses/bsd-license.php. 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TcgEventHob.h
r58459 r58466 1 1 /** @file 2 Defines the HOB GUID used to pass a TCG_PCR_EVENT from a TPM PEIM to 3 a TPM DXE Driver. A GUIDed HOB is generated for each measurement 2 Defines the HOB GUID used to pass a TCG_PCR_EVENT from a TPM PEIM to 3 a TPM DXE Driver. A GUIDed HOB is generated for each measurement 4 4 made in the PEI Phase. 5 5 6 6 Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 10 http://opensource.org/licenses/bsd-license.php 11 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 14 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TrEEConfigHii.h
r58464 r58466 1 1 /** @file 2 GUIDs used as HII FormSet and HII Package list GUID in TrEEConfig driver. 3 2 GUIDs used as HII FormSet and HII Package list GUID in TrEEConfig driver. 3 4 4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 8 http://opensource.org/licenses/bsd-license.php. 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TrEEPhysicalPresenceData.h
r58464 r58466 2 2 Define the variable data structures used for TrEE physical presence. 3 3 The TPM2 request from firmware or OS is saved to variable. And it is 4 cleared after it is processed in the next boot cycle. The TPM2 response 4 cleared after it is processed in the next boot cycle. The TPM2 response 5 5 is saved to variable. 6 6 … … 42 42 // 43 43 // This variable is used to save TPM Management Flags and corresponding operations. 44 // It should be protected from malicious software (e.g. Set it as read-only variable). 44 // It should be protected from malicious software (e.g. Set it as read-only variable). 45 45 // 46 46 #define TREE_PHYSICAL_PRESENCE_FLAGS_VARIABLE L"TrEEPhysicalPresenceFlags" -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/UsbCredentialProviderHii.h
r48674 r58466 3 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/UserIdentifyManagerHii.h
r48674 r58466 3 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/UserProfileManagerHii.h
r48674 r58466 3 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/PlatformSecureLib.h
r48674 r58466 3 3 4 4 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 20 20 21 21 This function provides a platform-specific method to detect whether the platform 22 is operating by a physically present user. 22 is operating by a physically present user. 23 23 24 24 Programmatic changing of platform security policy (such as disable Secure Boot, … … 29 29 NOTE THAT: This function cannot depend on any EFI Variable Service since they are 30 30 not available when this function is called in AuthenticateVariable driver. 31 31 32 32 @retval TRUE The platform is operated by a physically present user. 33 33 @retval FALSE The platform is NOT operated by a physically present user. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TcgPhysicalPresenceLib.h
r58459 r58466 4 4 5 5 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 20 20 Check and execute the pending TPM request and Lock TPM. 21 21 22 The TPM request may come from OS or BIOS. This API will display request information and wait 22 The TPM request may come from OS or BIOS. This API will display request information and wait 23 23 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after 24 the TPM request is confirmed, and one or more reset may be required to make TPM request to 24 the TPM request is confirmed, and one or more reset may be required to make TPM request to 25 25 take effect. At last, it will lock TPM to prevent TPM state change by malware. 26 26 27 27 This API should be invoked after console in and console out are all ready as they are required 28 to display request information and get user input to confirm the request. This API should also 28 to display request information and get user input to confirm the request. This API should also 29 29 be invoked as early as possible as TPM is locked in this function. 30 30 31 31 **/ 32 32 VOID … … 41 41 The TPM request may come from OS. This API will check if TPM request exists and need user 42 42 input to confirmation. 43 43 44 44 @retval TRUE TPM needs input to confirm user physical presence. 45 45 @retval FALSE TPM doesn't need input to confirm user physical presence. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TcgPpVendorLib.h
r58464 r58466 5 5 The Vendor Specific PPI operation may change TPM state, BIOS TPM management 6 6 flags, and may need additional boot cycle. 7 7 8 8 Caution: This function may receive untrusted input. 9 9 10 10 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 14 14 http://opensource.org/licenses/bsd-license.php 15 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 18 18 … … 64 64 65 65 This API should be invoked in BIOS boot phase to process pending request. 66 66 67 67 Caution: This function may receive untrusted input. 68 68 69 69 If OperationRequest < 128, then ASSERT(). 70 70 … … 89 89 90 90 This API should be invoked in BIOS boot phase to process pending request. 91 91 92 92 Caution: This function may receive untrusted input. 93 93 … … 119 119 120 120 Caution: This function may receive untrusted input. 121 121 122 122 If OperationRequest < 128, then ASSERT(). 123 123 … … 142 142 143 143 Caution: This function may receive untrusted input. 144 144 145 145 If OperationRequest < 128, then ASSERT(). 146 146 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm12CommandLib.h
r58464 r58466 85 85 /** 86 86 Send NV DefineSpace command to TPM1.2. 87 87 88 88 @param PubInfo The public parameters of the NV area. 89 89 @param EncAuth The encrypted AuthData, only valid if the attributes require subsequent authorization. … … 101 101 /** 102 102 Send NV ReadValue command to TPM1.2. 103 103 104 104 @param NvIndex The index of the area to set. 105 105 @param Offset The offset into the area. … … 121 121 /** 122 122 Send NV WriteValue command to TPM1.2. 123 123 124 124 @param NvIndex The index of the area to set. 125 125 @param Offset The offset into the NV Area. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm12DeviceLib.h
r58464 r58466 28 28 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 29 29 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 30 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 30 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 31 31 **/ 32 32 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm2CommandLib.h
r58464 r58466 26 26 An Event sequence starts if this is TPM_ALG_NULL. 27 27 @param[out] SequenceHandle A handle to reference the sequence 28 28 29 29 @retval EFI_SUCCESS Operation completed successfully. 30 30 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 44 44 @param[in] SequenceHandle Handle for the sequence object 45 45 @param[in] Buffer Data to be added to hash 46 46 47 47 @retval EFI_SUCCESS Operation completed successfully. 48 48 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 65 65 @param[in] Buffer Data to be added to the Event 66 66 @param[out] Results List of digests computed for the PCR 67 67 68 68 @retval EFI_SUCCESS Operation completed successfully. 69 69 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 84 84 @param[in] Buffer Data to be added to the hash/HMAC 85 85 @param[out] Result The returned HMAC or digest in a sized buffer 86 86 87 87 @retval EFI_SUCCESS Operation completed successfully. 88 88 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 167 167 @param[in] AuthHandle TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP} 168 168 @param[in] AuthSession Auth Session context 169 169 170 170 @retval EFI_SUCCESS Operation completed successfully. 171 171 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 317 317 @param[out] NvPublic The public area of the index. 318 318 @param[out] NvName The Name of the nvIndex. 319 319 320 320 @retval EFI_SUCCESS Operation completed successfully. 321 321 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 338 338 @param[in] Auth The authorization data. 339 339 @param[in] NvPublic The public area of the index. 340 340 341 341 @retval EFI_SUCCESS Operation completed successfully. 342 342 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 358 358 @param[in] NvIndex The NV Index. 359 359 @param[in] AuthSession Auth Session context 360 360 361 361 @retval EFI_SUCCESS Operation completed successfully. 362 362 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 380 380 @param[in] Offset Byte offset into the area. 381 381 @param[in,out] OutData The data read. 382 382 383 383 @retval EFI_SUCCESS Operation completed successfully. 384 384 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 404 404 @param[in] InData The data to write. 405 405 @param[in] Offset The offset into the NV Area. 406 406 407 407 @retval EFI_SUCCESS Operation completed successfully. 408 408 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 522 522 @param[out] PcrSelectionOut The PCR in the returned list. 523 523 @param[out] PcrValues The contents of the PCR indicated in pcrSelect. 524 524 525 525 @retval EFI_SUCCESS Operation completed successfully. 526 526 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 545 545 @param[out] SizeNeeded number of octets required to satisfy the request 546 546 @param[out] SizeAvailable Number of octets available. Computed before the allocation 547 547 548 548 @retval EFI_SUCCESS Operation completed successfully. 549 549 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 564 564 This command returns various information regarding the TPM and its current state. 565 565 566 The capability parameter determines the category of data returned. The property parameter 567 selects the first value of the selected category to be returned. If there is no property 566 The capability parameter determines the category of data returned. The property parameter 567 selects the first value of the selected category to be returned. If there is no property 568 568 that corresponds to the value of property, the next higher value is returned, if it exists. 569 The moreData parameter will have a value of YES if there are more values of the requested 569 The moreData parameter will have a value of YES if there are more values of the requested 570 570 type that were not returned. 571 If no next capability exists, the TPM will return a zero-length list and moreData will have 571 If no next capability exists, the TPM will return a zero-length list and moreData will have 572 572 a value of NO. 573 573 574 NOTE: 575 To simplify this function, leave returned CapabilityData for caller to unpack since there are 574 NOTE: 575 To simplify this function, leave returned CapabilityData for caller to unpack since there are 576 576 many capability categories and only few categories will be used in firmware. It means the caller 577 577 need swap the byte order for the feilds in CapabilityData. 578 578 579 579 @param[in] Capability Group selection; determines the format of the response. 580 @param[in] Property Further definition of information. 580 @param[in] Property Further definition of information. 581 581 @param[in] PropertyCount Number of properties of the indicated type to return. 582 582 @param[out] MoreData Flag to indicate if there are more values of this type. 583 583 @param[out] CapabilityData The capability data. 584 584 585 585 @retval EFI_SUCCESS Operation completed successfully. 586 586 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 602 602 603 603 @param[out] Family The Family of TPM. (a 4-octet character string) 604 604 605 605 @retval EFI_SUCCESS Operation completed successfully. 606 606 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 618 618 619 619 @param[out] ManufactureId The manufacture ID of TPM. 620 620 621 621 @retval EFI_SUCCESS Operation completed successfully. 622 622 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 635 635 @param[out] FirmwareVersion1 The FirmwareVersion1. 636 636 @param[out] FirmwareVersion2 The FirmwareVersion2. 637 637 638 638 @retval EFI_SUCCESS Operation completed successfully. 639 639 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 653 653 @param[out] MaxCommandSize The maximum value for commandSize in a command. 654 654 @param[out] MaxResponseSize The maximum value for responseSize in a command. 655 655 656 656 @retval EFI_SUCCESS Operation completed successfully. 657 657 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 666 666 /** 667 667 This command returns Returns a list of TPMS_ALG_PROPERTIES. Each entry is an 668 algorithm ID and a set of properties of the algorithm. 668 algorithm ID and a set of properties of the algorithm. 669 669 670 670 This function parse the value got from TPM2_GetCapability and return the list. 671 671 672 672 @param[out] AlgList List of algorithm. 673 673 674 674 @retval EFI_SUCCESS Operation completed successfully. 675 675 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 687 687 688 688 @param[out] LockoutCounter The LockoutCounter of TPM. 689 689 690 690 @retval EFI_SUCCESS Operation completed successfully. 691 691 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 703 703 704 704 @param[out] LockoutInterval The LockoutInterval of TPM. 705 705 706 706 @retval EFI_SUCCESS Operation completed successfully. 707 707 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 720 720 @param[out] InputBufferSize The InputBufferSize of TPM. 721 721 the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER) 722 722 723 723 @retval EFI_SUCCESS Operation completed successfully. 724 724 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 736 736 737 737 @param[out] Pcrs The Pcr Selection 738 738 739 739 @retval EFI_SUCCESS Operation completed successfully. 740 740 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 752 752 753 753 @param[out] AlgorithmSet The AlgorithmSet of TPM. 754 754 755 755 @retval EFI_SUCCESS Operation completed successfully. 756 756 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 809 809 @param[out] SessionHandle Handle for the newly created session. 810 810 @param[out] NonceTPM The initial nonce from the TPM, used in the computation of the sessionKey. 811 811 812 812 @retval EFI_SUCCESS Operation completed successfully. 813 813 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 831 831 832 832 @param[in] FlushHandle The handle of the item to flush. 833 833 834 834 @retval EFI_SUCCESS Operation completed successfully. 835 835 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 845 845 The caller proves knowledge of the secret value using an authorization 846 846 session using the authValue associated with authHandle. 847 847 848 848 @param[in] AuthHandle Handle for an entity providing the authorization 849 849 @param[in] PolicySession Handle for the policy session being extended. … … 855 855 @param[out] Timeout Time value used to indicate to the TPM when the ticket expires. 856 856 @param[out] PolicyTicket A ticket that includes a value indicating when the authorization expires. 857 857 858 858 @retval EFI_SUCCESS Operation completed successfully. 859 859 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 881 881 @param[in] PolicySession Handle for the policy session being extended. 882 882 @param[in] HashList the list of hashes to check for a match. 883 883 884 884 @retval EFI_SUCCESS Operation completed successfully. 885 885 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 897 897 @param[in] PolicySession Handle for the policy session being extended. 898 898 @param[in] Code The allowed commandCode. 899 899 900 900 @retval EFI_SUCCESS Operation completed successfully. 901 901 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 914 914 @param[in] PolicySession Handle for the policy session. 915 915 @param[out] PolicyHash the current value of the policyHash of policySession. 916 916 917 917 @retval EFI_SUCCESS Operation completed successfully. 918 918 @retval EFI_DEVICE_ERROR The command was unsuccessful. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm2DeviceLib.h
r58464 r58466 28 28 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 29 29 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 30 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 30 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 31 31 **/ 32 32 EFI_STATUS … … 62 62 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 63 63 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 64 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 64 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 65 65 **/ 66 66 typedef -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TpmCommLib.h
r58459 r58466 4 4 5 5 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 162 162 163 163 /// 164 /// When this bit is 1, TPM is in the Ready state, 164 /// When this bit is 1, TPM is in the Ready state, 165 165 /// indicating it is ready to receive a new command. 166 166 /// … … 211 211 TisPcWaitRegisterBits ( 212 212 IN UINT8 *Register, 213 IN UINT8 BitSet, 214 IN UINT8 BitClear, 215 IN UINT32 TimeOut 216 ); 217 218 /** 219 Get BurstCount by reading the burstCount field of a TIS regiger 213 IN UINT8 BitSet, 214 IN UINT8 BitClear, 215 IN UINT32 TimeOut 216 ); 217 218 /** 219 Get BurstCount by reading the burstCount field of a TIS regiger 220 220 in the time of default TIS_TIMEOUT_D. 221 221 … … 235 235 236 236 /** 237 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 237 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 238 238 to Status Register in time. 239 239 … … 251 251 252 252 /** 253 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 253 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 254 254 to ACCESS Register in the time of default TIS_TIMEOUT_D. 255 255 … … 274 274 @param[in] DataLen Size of the raw data. 275 275 @param[out] Digest Pointer to a buffer that stores the final digest. 276 276 277 277 @retval EFI_SUCCESS Always successfully calculate the final digest. 278 278 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TpmMeasurementLib.h
r58464 r58466 32 32 **/ 33 33 EFI_STATUS 34 EFIAPI 34 EFIAPI 35 35 TpmMeasureAndLogData ( 36 36 IN UINT32 PcrIndex, -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TrEEPhysicalPresenceLib.h
r58464 r58466 4 4 5 5 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 23 23 Check and execute the pending TPM request. 24 24 25 The TPM request may come from OS or BIOS. This API will display request information and wait 25 The TPM request may come from OS or BIOS. This API will display request information and wait 26 26 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after 27 the TPM request is confirmed, and one or more reset may be required to make TPM request to 27 the TPM request is confirmed, and one or more reset may be required to make TPM request to 28 28 take effect. 29 29 30 30 This API should be invoked after console in and console out are all ready as they are required 31 to display request information and get user input to confirm the request. 31 to display request information and get user input to confirm the request. 32 32 33 33 @param PlatformAuth platform auth value. NULL means no platform auth change. … … 44 44 The TPM request may come from OS. This API will check if TPM request exists and need user 45 45 input to confirmation. 46 46 47 47 @retval TRUE TPM needs input to confirm user physical presence. 48 48 @retval FALSE TPM doesn't need input to confirm user physical presence. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TrEEPpVendorLib.h
r58464 r58466 5 5 The Vendor Specific PPI operation may change TPM state, BIOS TPM management 6 6 flags, and may need additional boot cycle. 7 7 8 8 Caution: This function may receive untrusted input. 9 9 10 10 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 14 14 http://opensource.org/licenses/bsd-license.php 15 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 18 18 … … 67 67 68 68 This API should be invoked in BIOS boot phase to process pending request. 69 69 70 70 Caution: This function may receive untrusted input. 71 71 72 72 If OperationRequest < 128, then ASSERT(). 73 73 … … 94 94 95 95 This API should be invoked in BIOS boot phase to process pending request. 96 96 97 97 Caution: This function may receive untrusted input. 98 98 … … 124 124 125 125 Caution: This function may receive untrusted input. 126 126 127 127 If OperationRequest < 128, then ASSERT(). 128 128 … … 147 147 148 148 Caution: This function may receive untrusted input. 149 149 150 150 If OperationRequest < 128, then ASSERT(). 151 151 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Ppi/FirmwareVolumeInfoMeasurementExcluded.h
r58464 r58466 3 3 4 4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Ppi/LockPhysicalPresence.h
r48674 r58466 1 1 /** @file 2 This file defines the lock physical Presence PPI. This PPI is 3 produced by a platform specific PEIM and consumed by the TPM 2 This file defines the lock physical Presence PPI. This PPI is 3 produced by a platform specific PEIM and consumed by the TPM 4 4 PEIM. 5 5 6 6 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 10 http://opensource.org/licenses/bsd-license.php 11 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 14 … … 19 19 20 20 /// 21 /// Global ID for the PEI_LOCK_PHYSICAL_PRESENCE_PPI_GUID. 21 /// Global ID for the PEI_LOCK_PHYSICAL_PRESENCE_PPI_GUID. 22 22 /// 23 23 #define PEI_LOCK_PHYSICAL_PRESENCE_PPI_GUID \ … … 47 47 48 48 /// 49 /// This service abstracts TPM physical presence lock interface. It is necessary for 50 /// safety to convey this information to the TPM driver so that TPM physical presence 51 /// can be locked as early as possible. This PPI is produced by a platform specific 49 /// This service abstracts TPM physical presence lock interface. It is necessary for 50 /// safety to convey this information to the TPM driver so that TPM physical presence 51 /// can be locked as early as possible. This PPI is produced by a platform specific 52 52 /// PEIM and consumed by the TPM PEIM. 53 53 /// -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Ppi/TpmInitialized.h
r58459 r58466 3 3 initialized. PEIMs that must execute after TPM hardware initialization 4 4 may use this GUID in their dependency expressions. 5 5 6 6 Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 10 http://opensource.org/licenses/bsd-license.php 11 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 14 … … 19 19 20 20 /// 21 /// Global ID for the PEI_TPM_INITIALIZED_PPI which always uses a NULL interface. 21 /// Global ID for the PEI_TPM_INITIALIZED_PPI which always uses a NULL interface. 22 22 /// 23 23 #define PEI_TPM_INITIALIZED_PPI_GUID \ … … 29 29 30 30 /// 31 /// Global ID for the PEI_TPM_INITIALIZATION_DONE_PPI which always uses a NULL interface. 31 /// Global ID for the PEI_TPM_INITIALIZATION_DONE_PPI which always uses a NULL interface. 32 32 /// 33 33 #define PEI_TPM_INITIALIZATION_DONE_PPI_GUID \ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c
r58459 r58466 3 3 4 4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 34 34 35 35 @param[in] File This is a pointer to the device path of the file 36 that is being dispatched. 37 38 @return UINT32 Image Type 36 that is being dispatched. 37 38 @return UINT32 Image Type 39 39 40 40 **/ … … 45 45 { 46 46 EFI_STATUS Status; 47 EFI_HANDLE DeviceHandle; 47 EFI_HANDLE DeviceHandle; 48 48 EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; 49 49 EFI_BLOCK_IO_PROTOCOL *BlockIo; … … 111 111 112 112 // 113 // File is not in a Firmware Volume or on a Block I/O device, so check to see if 113 // File is not in a Firmware Volume or on a Block I/O device, so check to see if 114 114 // the device path supports the Simple File System Protocol. 115 115 // … … 130 130 // 131 131 // File is not from an FV, Block I/O or Simple File System, so the only options 132 // left are a PCI Option ROM and a Load File Protocol such as a PXE Boot from a NIC. 132 // left are a PCI Option ROM and a Load File Protocol such as a PXE Boot from a NIC. 133 133 // 134 134 TempDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)File; 135 135 while (!IsDevicePathEndType (TempDevicePath)) { 136 136 switch (DevicePathType (TempDevicePath)) { 137 137 138 138 case MEDIA_DEVICE_PATH: 139 139 if (DevicePathSubType (TempDevicePath) == MEDIA_RELATIVE_OFFSET_RANGE_DP) { … … 145 145 if (DevicePathSubType(TempDevicePath) == MSG_MAC_ADDR_DP) { 146 146 return IMAGE_FROM_REMOVABLE_MEDIA; 147 } 147 } 148 148 break; 149 149 … … 153 153 TempDevicePath = NextDevicePathNode (TempDevicePath); 154 154 } 155 return IMAGE_UNKNOWN; 155 return IMAGE_UNKNOWN; 156 156 } 157 157 … … 192 192 return EFI_NOT_FOUND; 193 193 } 194 194 195 195 // 196 196 // Get current user access information. … … 235 235 break; 236 236 } 237 237 238 238 ASSERT (Info != NULL); 239 239 if (Info->InfoType != EFI_USER_INFO_ACCESS_POLICY_RECORD) { 240 240 continue; 241 241 } 242 242 243 243 // 244 244 // Get specified access information. … … 257 257 } 258 258 } 259 259 260 260 if (Info != NULL) { 261 261 FreePool (Info); … … 267 267 Get file name from device path. 268 268 269 The file name may contain one or more device path node. Save the file name in a 270 buffer if file name is found. The caller is responsible to free the buffer. 271 269 The file name may contain one or more device path node. Save the file name in a 270 buffer if file name is found. The caller is responsible to free the buffer. 271 272 272 @param[in] DevicePath A pointer to a device path. 273 273 @param[out] FileName The callee allocated buffer to save the file name if file name is found. 274 274 @param[out] FileNameOffset The offset of file name in device path if file name is found. 275 275 276 276 @retval UINTN The file name length. 0 means file name is not found. 277 277 278 278 **/ 279 UINTN 279 UINTN 280 280 GetFileName ( 281 281 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, … … 343 343 NodeStr = (CHAR8 *)TmpDevicePath + sizeof (EFI_DEVICE_PATH_PROTOCOL); 344 344 NodeStrLength = DevicePathNodeLength (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof(CHAR16); 345 345 346 346 if ((FirstNodeChar == '\\') && (LastNodeChar == '\\')) { 347 347 // … … 349 349 // 350 350 NodeStr += sizeof (CHAR16); 351 NodeStrLength -= sizeof (CHAR16); 351 NodeStrLength -= sizeof (CHAR16); 352 352 } else if ((FirstNodeChar != '\\') && (LastNodeChar != '\\')) { 353 353 // … … 356 356 WriteUnaligned16 ((UINT16 *)(*FileName + Length), '\\'); 357 357 Length += sizeof (CHAR16); 358 } 358 } 359 359 CopyMem (*FileName + Length, NodeStr, NodeStrLength); 360 360 Length += NodeStrLength; 361 361 362 362 LastNodeChar = (CHAR16) ReadUnaligned16 ((UINT16 *) (NodeStr + NodeStrLength - sizeof(CHAR16))); 363 363 TmpDevicePath = NextDevicePathNode (TmpDevicePath); 364 } 364 } 365 365 366 366 return Length; … … 374 374 If DevicePath2 is identical with DevicePath1, or with DevicePath1's child device 375 375 path, then TRUE returned. Otherwise, FALSE is returned. 376 376 377 377 If DevicePath1 is NULL, then ASSERT(). 378 378 If DevicePath2 is NULL, then ASSERT(). … … 381 381 @param[in] DevicePath2 A pointer to a device path. 382 382 383 @retval TRUE Two device paths are identical , or DevicePath2 is 383 @retval TRUE Two device paths are identical , or DevicePath2 is 384 384 DevicePath1's child device path. 385 @retval FALSE Two device paths are not identical, and DevicePath2 385 @retval FALSE Two device paths are not identical, and DevicePath2 386 386 is not DevicePath1's child device path. 387 387 … … 411 411 return FALSE; 412 412 } 413 414 // 415 // The file name may contain one or more device path node. 413 414 // 415 // The file name may contain one or more device path node. 416 416 // To compare the file name, copy file name to a buffer and compare the buffer. 417 417 // … … 423 423 goto Done; 424 424 } 425 if (CompareMem (DevicePath1, DevicePath2, FileNameOffset1) != 0) { 425 if (CompareMem (DevicePath1, DevicePath2, FileNameOffset1) != 0) { 426 426 DevicePathEqual = FALSE; 427 427 goto Done; … … 431 431 goto Done; 432 432 } 433 if (CompareMem (FileName1, FileName2, FileNameSize1) != 0) { 433 if (CompareMem (FileName1, FileName2, FileNameSize1) != 0) { 434 434 DevicePathEqual = FALSE; 435 435 goto Done; … … 450 450 if (CompareMem (DevicePath1, DevicePath2, DevicePathSize) != 0) { 451 451 DevicePathEqual = FALSE; 452 } 453 454 Done: 452 } 453 454 Done: 455 455 if (FileName1 != NULL) { 456 456 FreePool (FileName1); … … 464 464 465 465 /** 466 Check whether the image pointed to by DevicePath is in the device path list 467 specified by AccessType. 466 Check whether the image pointed to by DevicePath is in the device path list 467 specified by AccessType. 468 468 469 469 @param[in] DevicePath Points to device path. 470 470 @param[in] AccessType The type of user access control. 471 471 472 472 @retval TURE The DevicePath is in the specified List. 473 473 @retval FALSE The DevicePath is not in the specified List. … … 483 483 EFI_USER_INFO_ACCESS_CONTROL *Access; 484 484 EFI_DEVICE_PATH_PROTOCOL *Path; 485 UINTN OffSet; 485 UINTN OffSet; 486 486 487 487 Status = GetAccessControl (&Access, AccessType); 488 488 if (EFI_ERROR (Status)) { 489 489 return FALSE; 490 } 490 } 491 491 492 492 OffSet = 0; 493 493 while (OffSet < Access->Size - sizeof (EFI_USER_INFO_ACCESS_CONTROL)) { 494 Path = (EFI_DEVICE_PATH_PROTOCOL*)((UINT8*)(Access + 1) + OffSet); 494 Path = (EFI_DEVICE_PATH_PROTOCOL*)((UINT8*)(Access + 1) + OffSet); 495 495 if (CheckDevicePath (Path, DevicePath)) { 496 496 // … … 499 499 FreePool (Access); 500 500 return TRUE; 501 } 501 } 502 502 OffSet += GetDevicePathSize (Path); 503 503 } 504 504 505 505 FreePool (Access); 506 return FALSE; 507 } 508 509 510 /** 511 Check whether the image pointed to by DevicePath is permitted to load. 506 return FALSE; 507 } 508 509 510 /** 511 Check whether the image pointed to by DevicePath is permitted to load. 512 512 513 513 @param[in] DevicePath Points to device path 514 514 515 515 @retval TURE The image pointed by DevicePath is permitted to load. 516 516 @retval FALSE The image pointed by DevicePath is forbidden to load. … … 524 524 if (IsDevicePathInList (DevicePath, EFI_USER_INFO_ACCESS_PERMIT_LOAD)) { 525 525 // 526 // This access control overrides any restrictions put in place by the 526 // This access control overrides any restrictions put in place by the 527 527 // EFI_USER_INFO_ACCESS_FORBID_LOAD record. 528 528 // 529 529 return TRUE; 530 530 } 531 531 532 532 if (IsDevicePathInList (DevicePath, EFI_USER_INFO_ACCESS_FORBID_LOAD)) { 533 533 // … … 536 536 return FALSE; 537 537 } 538 539 return TRUE; 540 } 541 542 543 /** 544 Check the image pointed by DevicePath is a boot option or not. 538 539 return TRUE; 540 } 541 542 543 /** 544 Check the image pointed by DevicePath is a boot option or not. 545 545 546 546 @param[in] DevicePath Points to device path. 547 547 548 548 @retval TURE The image pointed by DevicePath is a boot option. 549 549 @retval FALSE The image pointed by DevicePath is not a boot option. … … 563 563 UINT8 *OptionPtr; 564 564 EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath; 565 565 566 566 // 567 567 // Get BootOrder 568 568 // 569 569 BootOrderListSize = 0; 570 BootOrderList = NULL; 570 BootOrderList = NULL; 571 571 Status = gRT->GetVariable ( 572 L"BootOrder", 573 &gEfiGlobalVariableGuid, 574 NULL, 575 &BootOrderListSize, 572 L"BootOrder", 573 &gEfiGlobalVariableGuid, 574 NULL, 575 &BootOrderListSize, 576 576 NULL 577 577 ); … … 580 580 ASSERT (BootOrderList != NULL); 581 581 Status = gRT->GetVariable ( 582 L"BootOrder", 583 &gEfiGlobalVariableGuid, 584 NULL, 585 &BootOrderListSize, 582 L"BootOrder", 583 &gEfiGlobalVariableGuid, 584 NULL, 585 &BootOrderListSize, 586 586 BootOrderList 587 587 ); 588 588 } 589 589 590 590 if (EFI_ERROR (Status)) { 591 591 // … … 609 609 // Check whether the image is forbidden. 610 610 // 611 611 612 612 OptionPtr = OptionBuffer; 613 613 // … … 625 625 // 626 626 OptionPtr += StrSize ((UINT16 *) OptionPtr); 627 627 628 628 // 629 629 // Now OptionPtr points to Device Path. … … 651 651 Add the image info to a deferred image list. 652 652 653 @param[in] ImageDevicePath A pointer to the device path of a image. 654 @param[in] Image Points to the first byte of the image, or NULL if the 653 @param[in] ImageDevicePath A pointer to the device path of a image. 654 @param[in] Image Points to the first byte of the image, or NULL if the 655 655 image is not available. 656 656 @param[in] ImageSize The size of the image, or 0 if the image is not available. 657 657 658 658 **/ 659 659 VOID … … 676 676 CurImageInfo = AllocatePool ((mDeferredImage.Count + 1) * sizeof (DEFERRED_IMAGE_INFO)); 677 677 ASSERT (CurImageInfo != NULL); 678 678 679 679 CopyMem ( 680 CurImageInfo, 680 CurImageInfo, 681 681 mDeferredImage.ImageInfo, 682 682 mDeferredImage.Count * sizeof (DEFERRED_IMAGE_INFO) … … 686 686 } 687 687 mDeferredImage.Count++; 688 688 689 689 // 690 690 // Save the deferred image information. … … 705 705 Returns information about a deferred image. 706 706 707 This function returns information about a single deferred image. The deferred images are 708 numbered consecutively, starting with 0. If there is no image which corresponds to 709 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 707 This function returns information about a single deferred image. The deferred images are 708 numbered consecutively, starting with 0. If there is no image which corresponds to 709 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 710 710 iteratively calling this function until EFI_NOT_FOUND is returned. 711 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 712 because of the location of the executable image, rather than its actual contents. 711 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 712 because of the location of the executable image, rather than its actual contents. 713 713 714 714 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 715 715 @param[in] ImageIndex Zero-based index of the deferred index. 716 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 717 The device path should not be freed by the caller. 718 @param[out] Image On return, points to the first byte of the image or NULL if the 716 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 717 The device path should not be freed by the caller. 718 @param[out] Image On return, points to the first byte of the image or NULL if the 719 719 image is not available. The image should not be freed by the caller 720 unless LoadImage() has been successfully called. 720 unless LoadImage() has been successfully called. 721 721 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available. 722 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 723 or FALSE if it was not intended as a boot option. 724 722 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 723 or FALSE if it was not intended as a boot option. 724 725 725 @retval EFI_SUCCESS Image information returned successfully. 726 726 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image. 727 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 727 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 728 728 BootOption is NULL. 729 729 730 730 **/ 731 731 EFI_STATUS … … 749 749 return EFI_INVALID_PARAMETER; 750 750 } 751 751 752 752 if ((ImageDevicePath == NULL) || (BootOption == NULL)) { 753 753 return EFI_INVALID_PARAMETER; … … 757 757 return EFI_NOT_FOUND; 758 758 } 759 759 760 760 // 761 761 // Get the request deferred image. 762 // 762 // 763 763 ReqImageInfo = &mDeferredImage.ImageInfo[ImageIndex]; 764 764 765 765 *ImageDevicePath = ReqImageInfo->ImageDevicePath; 766 766 *Image = ReqImageInfo->Image; 767 767 *ImageSize = ReqImageInfo->ImageSize; 768 768 *BootOption = ReqImageInfo->BootOption; 769 769 770 770 return EFI_SUCCESS; 771 771 } … … 776 776 and installs Deferred Image Load Protocol. 777 777 778 @param[in] AuthenticationStatus This is the authentication status returned from the 778 @param[in] AuthenticationStatus This is the authentication status returned from the 779 779 security measurement services for the input file. 780 780 @param[in] File This is a pointer to the device path of the file that … … 825 825 // 826 826 // Check whether user has a logon. 827 // 827 // 828 828 CurrentUser = NULL; 829 829 if (mUserManager != NULL) { … … 840 840 } 841 841 } 842 842 843 843 // 844 844 // Still no user logon. … … 853 853 return EFI_SUCCESS; 854 854 } 855 855 856 856 DEBUG ((EFI_D_INFO, "[Security] No user identified, the image is deferred to load!\n")); 857 857 PutDefferedImageInfo (File, FileBuffer, FileSize); … … 875 875 876 876 /** 877 Locate user manager protocol when user manager is installed. 877 Locate user manager protocol when user manager is installed. 878 878 879 879 @param[in] Event The Event that is being processed, not used. 880 @param[in] Context Event Context, not used. 880 @param[in] Context Event Context, not used. 881 881 882 882 **/ … … 893 893 (VOID **) &mUserManager 894 894 ); 895 895 896 896 } 897 897 … … 913 913 { 914 914 VOID *Registration; 915 915 916 916 // 917 917 // Register user manager notification function. 918 918 // 919 919 EfiCreateProtocolNotifyEvent ( 920 &gEfiUserManagerProtocolGuid, 920 &gEfiUserManagerProtocolGuid, 921 921 TPL_CALLBACK, 922 922 FindUserManagerProtocol, … … 924 924 &Registration 925 925 ); 926 926 927 927 return RegisterSecurity2Handler ( 928 928 DxeDeferImageLoadHandler, 929 EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 930 ); 931 } 932 933 929 EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 930 ); 931 } 932 933 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.h
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 68 68 Returns information about a deferred image. 69 69 70 This function returns information about a single deferred image. The deferred images are 71 numbered consecutively, starting with 0. If there is no image which corresponds to 72 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 70 This function returns information about a single deferred image. The deferred images are 71 numbered consecutively, starting with 0. If there is no image which corresponds to 72 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 73 73 iteratively calling this function until EFI_NOT_FOUND is returned. 74 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 75 because of the location of the executable image, rather than its actual contents. 74 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 75 because of the location of the executable image, rather than its actual contents. 76 76 77 77 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 78 78 @param[in] ImageIndex Zero-based index of the deferred index. 79 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 80 The device path should not be freed by the caller. 81 @param[out] Image On return, points to the first byte of the image or NULL if the 79 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 80 The device path should not be freed by the caller. 81 @param[out] Image On return, points to the first byte of the image or NULL if the 82 82 image is not available. The image should not be freed by the caller 83 unless LoadImage() has been called successfully. 83 unless LoadImage() has been called successfully. 84 84 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available. 85 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 86 or FALSE if it was not intended as a boot option. 87 85 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 86 or FALSE if it was not intended as a boot option. 87 88 88 @retval EFI_SUCCESS Image information returned successfully. 89 89 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image. 90 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 90 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 91 91 BootOption is NULL. 92 92 93 93 **/ 94 94 EFI_STATUS … … 102 102 OUT BOOLEAN *BootOption 103 103 ); 104 104 105 105 #endif -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.inf
r58459 r58466 2 2 # Provides security service of deferred image load 3 3 # 4 # The platform may need to defer the execution of an image because of security 5 # considerations. These deferred images will be recorded and then reported by 4 # The platform may need to defer the execution of an image because of security 5 # considerations. These deferred images will be recorded and then reported by 6 6 # installing an instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 7 7 # … … 49 49 BaseMemoryLib 50 50 PrintLib 51 DebugLib 51 DebugLib 52 52 UefiLib 53 PcdLib 53 PcdLib 54 54 55 55 [Protocols] … … 61 61 ## NOTIFY 62 62 gEfiUserManagerProtocolGuid 63 63 64 64 [Guids] 65 65 gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES ## Variable:L"BootOrder" 66 66 67 67 [Pcd] 68 68 gEfiSecurityPkgTokenSpaceGuid.PcdDeferImageLoadPolicy ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageAuthenticationStatusLib/DxeImageAuthenticationStatusLib.c
r58464 r58466 19 19 /** 20 20 Check image authentication status returned from Section Extraction Protocol 21 22 @param[in] AuthenticationStatus This is the authentication status returned from 21 22 @param[in] AuthenticationStatus This is the authentication status returned from 23 23 the Section Extraction Protocol when reading the input file. 24 24 @param[in] File This is a pointer to the device path of the file that is -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageAuthenticationStatusLib/DxeImageAuthenticationStatusLib.inf
r58464 r58466 21 21 MODULE_TYPE = DXE_DRIVER 22 22 VERSION_STRING = 1.0 23 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 23 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 24 CONSTRUCTOR = DxeImageAuthenticationStatusLibConstructor 25 25 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
r58459 r58466 100 100 @param FileHandle Pointer to the file handle to read the PE/COFF image. 101 101 @param FileOffset Offset into the PE/COFF image to begin the read operation. 102 @param ReadSize On input, the size in bytes of the requested read operation. 102 @param ReadSize On input, the size in bytes of the requested read operation. 103 103 On output, the number of bytes actually read. 104 104 @param Buffer Output buffer that contains the data read from the PE/COFF image. 105 106 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 105 106 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 107 107 **/ 108 108 EFI_STATUS … … 118 118 119 119 if (FileHandle == NULL || ReadSize == NULL || Buffer == NULL) { 120 return EFI_INVALID_PARAMETER; 120 return EFI_INVALID_PARAMETER; 121 121 } 122 122 … … 348 348 if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 349 349 // 350 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 351 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 350 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 351 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 352 352 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 353 353 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 360 360 Magic = mNtHeader.Pe32->OptionalHeader.Magic; 361 361 } 362 362 363 363 // 364 364 // 3. Calculate the distance from the base of the image header to the image checksum address. … … 467 467 goto Done; 468 468 } 469 } 469 } 470 470 } 471 471 … … 605 605 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed image. 606 606 @param[in] AuthDataSize Size of the Authenticode Signature in bytes. 607 607 608 608 @retval EFI_UNSUPPORTED Hash algorithm is not supported. 609 609 @retval EFI_SUCCESS Hash successfully. … … 1110 1110 1111 1111 // 1112 // The policy QUERY_USER_ON_SECURITY_VIOLATION and ALLOW_EXECUTE_ON_SECURITY_VIOLATION 1112 // The policy QUERY_USER_ON_SECURITY_VIOLATION and ALLOW_EXECUTE_ON_SECURITY_VIOLATION 1113 1113 // violates the UEFI spec and has been removed. 1114 1114 // … … 1185 1185 if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 1186 1186 // 1187 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 1188 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 1187 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 1188 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 1189 1189 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 1190 1190 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 1197 1197 Magic = mNtHeader.Pe32->OptionalHeader.Magic; 1198 1198 } 1199 1199 1200 1200 if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 1201 1201 // … … 1205 1205 if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_SECURITY) { 1206 1206 SecDataDir = (EFI_IMAGE_DATA_DIRECTORY *) &mNtHeader.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]; 1207 } 1207 } 1208 1208 } else { 1209 1209 // … … 1221 1221 if (SecDataDir == NULL || SecDataDir->Size == 0) { 1222 1222 // 1223 // This image is not signed. The SHA256 hash value of the image must match a record in the security database "db", 1223 // This image is not signed. The SHA256 hash value of the image must match a record in the security database "db", 1224 1224 // and not be reflected in the security data base "dbx". 1225 1225 // … … 1249 1249 1250 1250 // 1251 // Verify the signature of the image, multiple signatures are allowed as per PE/COFF Section 4.7 1251 // Verify the signature of the image, multiple signatures are allowed as per PE/COFF Section 4.7 1252 1252 // "Attribute Certificate Table". 1253 1253 // The first certificate starts at offset (SecDataDir->VirtualAddress) from the start of the file. … … 1261 1261 break; 1262 1262 } 1263 1263 1264 1264 // 1265 1265 // Verify the image's Authenticode signature, only DER-encoded PKCS#7 signed data is supported. … … 1267 1267 if (WinCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) { 1268 1268 // 1269 // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is described in the 1269 // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is described in the 1270 1270 // Authenticode specification. 1271 1271 // … … 1300 1300 continue; 1301 1301 } 1302 1302 1303 1303 // 1304 1304 // Check the digital signature against the revoked certificate in forbidden database (dbx). … … 1339 1339 VerifyStatus = EFI_ACCESS_DENIED; 1340 1340 } 1341 1341 1342 1342 if (!EFI_ERROR (VerifyStatus)) { 1343 1343 return EFI_SUCCESS; … … 1414 1414 } 1415 1415 1416 ImageExeInfoTable->NumberOfImages = 0; 1416 ImageExeInfoTable->NumberOfImages = 0; 1417 1417 gBS->InstallConfigurationTable (&gEfiImageSecurityDatabaseGuid, (VOID *) ImageExeInfoTable); 1418 1418 … … 1441 1441 EfiCreateEventReadyToBootEx ( 1442 1442 TPL_CALLBACK, 1443 OnReadyToBoot, 1444 NULL, 1443 OnReadyToBoot, 1444 NULL, 1445 1445 &Event 1446 ); 1446 ); 1447 1447 1448 1448 return RegisterSecurity2Handler ( -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 79 79 // Set max digest size as SHA256 Output (32 bytes) by far 80 80 // 81 #define MAX_DIGEST_SIZE SHA256_DIGEST_SIZE 81 #define MAX_DIGEST_SIZE SHA256_DIGEST_SIZE 82 82 // 83 83 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
r58459 r58466 26 26 MODULE_TYPE = DXE_DRIVER 27 27 VERSION_STRING = 1.0 28 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 28 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 29 CONSTRUCTOR = DxeImageVerificationLibConstructor 30 30 … … 75 75 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 76 76 gEfiCertSha1Guid 77 77 78 78 ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 79 79 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. … … 82 82 gEfiCertX509Guid ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 83 83 gEfiCertPkcs7Guid ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the certificate. 84 84 85 85 [Pcd] 86 86 gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/Measurement.c
r58464 r58466 99 99 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 100 100 @param[in] VendorGuid A unique identifier for the vendor. 101 @param[in] VarData The content of the variable data. 102 @param[in] VarSize The size of the variable data. 103 101 @param[in] VarData The content of the variable data. 102 @param[in] VarSize The size of the variable data. 103 104 104 @retval EFI_SUCCESS Operation completed successfully. 105 105 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 153 153 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 154 154 @param[in] VendorGuid A unique identifier for the vendor. 155 @param[in] VarData The content of the variable data. 156 @param[in] VarSize The size of the variable data. 155 @param[in] VarData The content of the variable data. 156 @param[in] VarSize The size of the variable data. 157 157 158 158 @retval TRUE The data is already measured. … … 199 199 200 200 for (Index = 0; Index < sizeof(mVariableType)/sizeof(mVariableType[0]); Index++) { 201 if ((StrCmp (VariableName, mVariableType[Index].VariableName) == 0) && 201 if ((StrCmp (VariableName, mVariableType[Index].VariableName) == 0) && 202 202 (CompareGuid (VendorGuid, mVariableType[Index].VendorGuid))) { 203 203 return TRUE; … … 212 212 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 213 213 @param[in] VendorGuid A unique identifier for the vendor. 214 @param[in] VarData The content of the variable data. 215 @param[in] VarSize The size of the variable data. 216 214 @param[in] VarData The content of the variable data. 215 @param[in] VarSize The size of the variable data. 216 217 217 @retval EFI_SUCCESS Operation completed successfully. 218 218 @retval EFI_OUT_OF_RESOURCES Out of memory. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
r58464 r58466 1 1 /** @file 2 2 3 This library registers RSA 2048 SHA 256 guided section handler 3 This library registers RSA 2048 SHA 256 guided section handler 4 4 to parse RSA 2048 SHA 256 encapsulation section and extract raw data. 5 5 It uses the BaseCrypyLib based on OpenSSL to authenticate the signature. 6 6 7 7 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 16 16 **/ … … 51 51 52 52 GetInfo gets raw data size and attribute of the input guided section. 53 It first checks whether the input guid section is supported. 53 It first checks whether the input guid section is supported. 54 54 If not, EFI_INVALID_PARAMETER will return. 55 55 … … 59 59 @param SectionAttribute The attribute of the input guided section. 60 60 61 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 61 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 62 62 the attribute of the input section are successull retrieved. 63 63 @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid. … … 112 112 Extraction handler tries to extract raw data from the input guided section. 113 113 It also does authentication check for RSA 2048 SHA 256 signature in the input guided section. 114 It first checks whether the input guid section is supported. 114 It first checks whether the input guid section is supported. 115 115 If not, EFI_INVALID_PARAMETER will return. 116 116 … … 144 144 VOID *HashContext; 145 145 VOID *Rsa; 146 146 147 147 HashContext = NULL; 148 148 Rsa = NULL; 149 149 150 150 if (IS_SECTION2 (InputSection)) { 151 151 // … … 157 157 return EFI_INVALID_PARAMETER; 158 158 } 159 159 160 160 // 161 161 // Get the RSA 2048 SHA 256 information. … … 185 185 return EFI_INVALID_PARAMETER; 186 186 } 187 187 188 188 // 189 189 // Get the RSA 2048 SHA 256 information. … … 215 215 // 216 216 *AuthenticationStatus |= EFI_AUTH_STATUS_PLATFORM_OVERRIDE; 217 217 218 218 return EFI_SUCCESS; 219 219 } … … 223 223 // 224 224 Status = EFI_SUCCESS; 225 225 226 226 // 227 227 // Fail if the HashType is not SHA 256 … … 265 265 goto Done; 266 266 } 267 267 268 268 // 269 269 // Fail if the PublicKey is not one of the public keys in PcdRsa2048Sha256PublicKeyBuffer … … 300 300 goto Done; 301 301 } 302 303 // 302 303 // 304 304 // Set RSA Key Components. 305 305 // NOTE: Only N and E are needed to be set as RSA public key for signature verification. … … 348 348 PERF_START (NULL, "RsaVerify", "DXE", 0); 349 349 CryptoStatus = RsaPkcs1Verify ( 350 Rsa, 351 Digest, 352 SHA256_DIGEST_SIZE, 353 CertBlockRsa2048Sha256->Signature, 350 Rsa, 351 Digest, 352 SHA256_DIGEST_SIZE, 353 CertBlockRsa2048Sha256->Signature, 354 354 sizeof (CertBlockRsa2048Sha256->Signature) 355 355 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
r58464 r58466 1 1 ## @file 2 # This library doesn't produce any library class. The constructor function uses 2 # This library doesn't produce any library class. The constructor function uses 3 3 # ExtractGuidedSectionLib service to register an RSA 2048 SHA 256 guided section handler 4 4 # that parses RSA 2048 SHA 256 encapsulation section and extracts raw data. … … 40 40 CryptoPkg/CryptoPkg.dec 41 41 SecurityPkg/SecurityPkg.dec 42 42 43 43 [LibraryClasses] 44 44 ExtractGuidedSectionLib … … 51 51 PerformanceLib 52 52 53 [PcdEx] 53 [PcdEx] 54 54 gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer ## SOMETIMES_CONSUMES 55 55 56 56 [Protocols] 57 57 gEfiSecurityPolicyProtocolGuid ## SOMETIMES_CONSUMES (Set platform override AUTH status if exist) 58 58 59 59 [Guids] 60 60 gEfiCertTypeRsa2048Sha256Guid ## PRODUCES ## UNDEFINED # Specifies RSA 2048 SHA 256 authentication algorithm. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
r58459 r58466 10 10 11 11 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 15 15 http://opensource.org/licenses/bsd-license.php 16 16 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 18 18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 19 19 … … 61 61 Get TPM physical presence permanent flags. 62 62 63 @param[in] TcgProtocol EFI TCG Protocol instance. 64 @param[out] LifetimeLock physicalPresenceLifetimeLock permanent flag. 63 @param[in] TcgProtocol EFI TCG Protocol instance. 64 @param[out] LifetimeLock physicalPresenceLifetimeLock permanent flag. 65 65 @param[out] CmdEnable physicalPresenceCMDEnable permanent flag. 66 66 67 67 @retval EFI_SUCCESS Flags were returns successfully. 68 68 @retval other Failed to locate EFI TCG Protocol. … … 83 83 TPM_PERMANENT_FLAGS *TpmPermanentFlags; 84 84 UINT8 RecvBuffer[40]; 85 85 86 86 // 87 87 // Fill request header … … 89 89 TpmRsp = (TPM_RSP_COMMAND_HDR*)RecvBuffer; 90 90 TpmRqu = (TPM_RQU_COMMAND_HDR*)SendBuffer; 91 91 92 92 TpmRqu->tag = SwapBytes16 (TPM_TAG_RQU_COMMAND); 93 93 TpmRqu->paramSize = SwapBytes32 (sizeof (SendBuffer)); … … 100 100 WriteUnaligned32 (SendBufPtr++, SwapBytes32 (TPM_CAP_FLAG)); 101 101 WriteUnaligned32 (SendBufPtr++, SwapBytes32 (sizeof (TPM_CAP_FLAG_PERMANENT))); 102 WriteUnaligned32 (SendBufPtr, SwapBytes32 (TPM_CAP_FLAG_PERMANENT)); 103 102 WriteUnaligned32 (SendBufPtr, SwapBytes32 (TPM_CAP_FLAG_PERMANENT)); 103 104 104 Status = TcgProtocol->PassThroughToTpm ( 105 105 TcgProtocol, … … 112 112 ASSERT (TpmRsp->tag == SwapBytes16 (TPM_TAG_RSP_COMMAND)); 113 113 ASSERT (TpmRsp->returnCode == 0); 114 114 115 115 TpmPermanentFlags = (TPM_PERMANENT_FLAGS *)&RecvBuffer[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)]; 116 116 117 117 if (LifetimeLock != NULL) { 118 118 *LifetimeLock = TpmPermanentFlags->physicalPresenceLifetimeLock; … … 129 129 Issue TSC_PhysicalPresence command to TPM. 130 130 131 @param[in] TcgProtocol EFI TCG Protocol instance. 132 @param[in] PhysicalPresence The state to set the TPM's Physical Presence flags. 133 131 @param[in] TcgProtocol EFI TCG Protocol instance. 132 @param[in] PhysicalPresence The state to set the TPM's Physical Presence flags. 133 134 134 @retval EFI_SUCCESS TPM executed the command successfully. 135 135 @retval EFI_SECURITY_VIOLATION TPM returned error when executing the command. … … 155 155 TpmRqu->paramSize = SwapBytes32 (sizeof (Buffer)); 156 156 TpmRqu->ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence); 157 WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence)); 157 WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence)); 158 158 159 159 Status = TcgProtocol->PassThroughToTpm ( … … 172 172 return EFI_SECURITY_VIOLATION; 173 173 } 174 174 175 175 return Status; 176 176 } … … 179 179 Issue a TPM command for which no additional output data will be returned. 180 180 181 @param[in] TcgProtocol EFI TCG Protocol instance. 182 @param[in] Ordinal TPM command code. 183 @param[in] AdditionalParameterSize Additional parameter size. 184 @param[in] AdditionalParameters Pointer to the Additional paramaters. 185 186 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 181 @param[in] TcgProtocol EFI TCG Protocol instance. 182 @param[in] Ordinal TPM command code. 183 @param[in] AdditionalParameterSize Additional parameter size. 184 @param[in] AdditionalParameters Pointer to the Additional paramaters. 185 186 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 187 187 receiving response from TPM. 188 188 @retval Others Return code from the TPM device after command execution. … … 233 233 @param[in] CommandCode Physical presence operation value. 234 234 @param[in, out] PpiFlags The physical presence interface flags. 235 235 236 236 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Unknown physical presence operation. 237 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 237 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 238 238 receiving response from TPM. 239 239 @retval Others Return code from the TPM device after command execution. … … 398 398 PpiFlags->PPFlags |= TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_MAINTENANCE; 399 399 return 0; 400 400 401 401 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR: 402 402 // … … 424 424 TpmResponse = ExecutePhysicalPresence (TcgProtocol, PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE, PpiFlags); 425 425 PpiFlags->PPFlags &= ~TCG_VENDOR_LIB_FLAG_RESET_TRACK; 426 } 426 } 427 427 return TpmResponse; 428 428 … … 454 454 UINTN Index; 455 455 456 InputKey = 0; 456 InputKey = 0; 457 457 do { 458 458 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); … … 480 480 return TRUE; 481 481 } 482 482 483 483 return FALSE; 484 484 } … … 486 486 /** 487 487 The constructor function register UNI strings into imageHandle. 488 489 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 488 489 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 490 490 491 491 @param ImageHandle The firmware allocated handle for the EFI image. 492 492 @param SystemTable A pointer to the EFI System Table. 493 493 494 494 @retval EFI_SUCCESS The constructor successfully added string package. 495 495 @retval Other value The constructor can't add string package. … … 524 524 CHAR16 *ConfirmText; 525 525 CHAR16 *TmpStr1; 526 CHAR16 *TmpStr2; 526 CHAR16 *TmpStr2; 527 527 UINTN BufSize; 528 528 BOOLEAN CautionKey; 529 529 UINT16 Index; 530 530 CHAR16 DstStr[81]; 531 531 532 532 TmpStr2 = NULL; 533 533 CautionKey = FALSE; … … 539 539 case PHYSICAL_PRESENCE_ENABLE: 540 540 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ENABLE)); 541 541 542 542 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 543 543 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); … … 551 551 case PHYSICAL_PRESENCE_DISABLE: 552 552 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DISABLE)); 553 553 554 554 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 555 555 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); … … 564 564 FreePool (TmpStr1); 565 565 break; 566 566 567 567 case PHYSICAL_PRESENCE_ACTIVATE: 568 568 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACTIVATE)); 569 569 570 570 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 571 571 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); … … 590 590 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACCEPT_KEY)); 591 591 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 592 FreePool (TmpStr1); 592 FreePool (TmpStr1); 593 593 break; 594 594 … … 604 604 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 605 605 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 606 FreePool (TmpStr1); 606 FreePool (TmpStr1); 607 607 608 608 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 629 629 case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE: 630 630 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DEACTIVATE_DISABLE)); 631 632 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 631 632 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 633 633 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 634 634 FreePool (TmpStr1); … … 637 637 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 638 638 FreePool (TmpStr1); 639 639 640 640 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING)); 641 641 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); … … 649 649 case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_TRUE: 650 650 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ALLOW_TAKE_OWNERSHIP)); 651 652 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 651 652 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 653 653 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 654 654 FreePool (TmpStr1); … … 661 661 case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_FALSE: 662 662 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DISALLOW_TAKE_OWNERSHIP)); 663 664 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 663 664 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 665 665 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 666 666 FreePool (TmpStr1); … … 689 689 case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE_OWNER_FALSE: 690 690 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_TURN_OFF)); 691 692 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 691 692 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 693 693 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 694 694 FreePool (TmpStr1); … … 697 697 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 698 698 FreePool (TmpStr1); 699 699 700 700 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING)); 701 701 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); … … 710 710 CautionKey = TRUE; 711 711 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UNOWNED_FIELD_UPGRADE)); 712 713 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UPGRADE_HEAD_STR)); 714 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 715 FreePool (TmpStr1); 716 712 713 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UPGRADE_HEAD_STR)); 714 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 715 FreePool (TmpStr1); 716 717 717 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_MAINTAIN)); 718 718 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); … … 788 788 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 789 789 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 790 FreePool (TmpStr1); 790 FreePool (TmpStr1); 791 791 792 792 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 878 878 DstStr[80] = L'\0'; 879 879 for (Index = 0; Index < StrLen (ConfirmText); Index += 80) { 880 StrnCpy(DstStr, ConfirmText + Index, 80); 881 Print (DstStr); 882 } 883 880 StrnCpy(DstStr, ConfirmText + Index, 80); 881 Print (DstStr); 882 } 883 884 884 FreePool (TmpStr1); 885 885 FreePool (TmpStr2); … … 890 890 } 891 891 892 return FALSE; 892 return FALSE; 893 893 } 894 894 895 895 /** 896 Check if there is a valid physical presence command request. Also updates parameter value 896 Check if there is a valid physical presence command request. Also updates parameter value 897 897 to whether the requested physical presence command already confirmed by user 898 898 899 899 @param[in] TcgPpData EFI TCG Physical Presence request data. 900 @param[in] Flags The physical presence interface flags. 900 @param[in] Flags The physical presence interface flags. 901 901 @param[out] RequestConfirmed If the physical presence operation command required user confirm from UI. 902 True, it indicates the command doesn't require user confirm, or already confirmed 902 True, it indicates the command doesn't require user confirm, or already confirmed 903 903 in last boot cycle by user. 904 904 False, it indicates the command need user confirm from UI. … … 1007 1007 its data structure to be valid value. 1008 1008 1009 @param[in] TcgProtocol EFI TCG Protocol instance. 1009 @param[in] TcgProtocol EFI TCG Protocol instance. 1010 1010 @param[in] TcgPpData Point to the physical presence NV variable. 1011 1011 @param[in] Flags The physical presence interface flags. … … 1053 1053 if (!RequestConfirmed) { 1054 1054 // 1055 // Print confirm text and wait for approval. 1055 // Print confirm text and wait for approval. 1056 1056 // 1057 1057 RequestConfirmed = UserConfirm (TcgPpData->PPRequest); … … 1078 1078 sizeof (EFI_PHYSICAL_PRESENCE_FLAGS), 1079 1079 &NewFlags 1080 ); 1080 ); 1081 1081 if (EFI_ERROR (Status)) { 1082 1082 return; 1083 1083 } 1084 1084 } 1085 1085 1086 1086 // 1087 1087 // Clear request … … 1089 1089 if ((NewFlags.PPFlags & TCG_VENDOR_LIB_FLAG_RESET_TRACK) == 0) { 1090 1090 TcgPpData->LastPPRequest = TcgPpData->PPRequest; 1091 TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION; 1091 TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION; 1092 1092 } 1093 1093 … … 1125 1125 case PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE: 1126 1126 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR: 1127 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE: 1127 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE: 1128 1128 break; 1129 1129 default: … … 1143 1143 Print (L"Rebooting system to make TPM settings in effect\n"); 1144 1144 gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); 1145 ASSERT (FALSE); 1145 ASSERT (FALSE); 1146 1146 } 1147 1147 … … 1149 1149 Check and execute the pending TPM request and Lock TPM. 1150 1150 1151 The TPM request may come from OS or BIOS. This API will display request information and wait 1151 The TPM request may come from OS or BIOS. This API will display request information and wait 1152 1152 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after 1153 the TPM request is confirmed, and one or more reset may be required to make TPM request to 1153 the TPM request is confirmed, and one or more reset may be required to make TPM request to 1154 1154 take effect. At last, it will lock TPM to prevent TPM state change by malware. 1155 1155 1156 1156 This API should be invoked after console in and console out are all ready as they are required 1157 to display request information and get user input to confirm the request. This API should also 1157 to display request information and get user input to confirm the request. This API should also 1158 1158 be invoked as early as possible as TPM is locked in this function. 1159 1159 1160 1160 **/ 1161 1161 VOID … … 1173 1173 EDKII_VARIABLE_LOCK_PROTOCOL *VariableLockProtocol; 1174 1174 EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags; 1175 1175 1176 1176 Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol); 1177 1177 if (EFI_ERROR (Status)) { … … 1207 1207 1208 1208 // 1209 // This flags variable controls whether physical presence is required for TPM command. 1209 // This flags variable controls whether physical presence is required for TPM command. 1210 1210 // It should be protected from malicious software. We set it as read-only variable here. 1211 1211 // … … 1222 1222 } 1223 1223 } 1224 1224 1225 1225 // 1226 1226 // Initialize physical presence variable. … … 1263 1263 return ; 1264 1264 } 1265 1265 1266 1266 if (!CmdEnable) { 1267 1267 if (LifetimeLock) { … … 1276 1276 } 1277 1277 } 1278 1278 1279 1279 // 1280 1280 // Set operator physical presence flags … … 1284 1284 // 1285 1285 // Execute pending TPM request. 1286 // 1286 // 1287 1287 ExecutePendingTpmRequest (TcgProtocol, &TcgPpData, PpiFlags); 1288 1288 DEBUG ((EFI_D_INFO, "[TPM] PPResponse = %x\n", TcgPpData.PPResponse)); … … 1299 1299 The TPM request may come from OS. This API will check if TPM request exists and need user 1300 1300 input to confirmation. 1301 1301 1302 1302 @retval TRUE TPM needs input to confirm user physical presence. 1303 1303 @retval FALSE TPM doesn't need input to confirm user physical presence. … … 1318 1318 EFI_TCG_PROTOCOL *TcgProtocol; 1319 1319 EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags; 1320 1320 1321 1321 Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol); 1322 1322 if (EFI_ERROR (Status)) { … … 1350 1350 return FALSE; 1351 1351 } 1352 1352 1353 1353 if (TcgPpData.PPRequest == PHYSICAL_PRESENCE_NO_ACTION) { 1354 1354 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.inf
r58459 r58466 3 3 # 4 4 # This library will check and execute TPM 1.2 request from OS or BIOS. The request may 5 # ask for user confirmation before execution. This Library will also lock TPM physical 5 # ask for user confirmation before execution. This Library will also lock TPM physical 6 6 # presence at last. 7 7 # … … 27 27 MODULE_TYPE = DXE_DRIVER 28 28 VERSION_STRING = 1.0 29 LIBRARY_CLASS = TcgPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 LIBRARY_CLASS = TcgPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 30 30 CONSTRUCTOR = TcgPhysicalPresenceLibConstructor 31 31 32 32 # 33 33 # The following information is for reference only and not required by the build tools. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/PhysicalPresenceStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
r58464 r58466 17 17 18 18 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 22 22 http://opensource.org/licenses/bsd-license.php 23 23 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 25 25 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 26 26 … … 71 71 @param FileHandle Pointer to the file handle to read the PE/COFF image. 72 72 @param FileOffset Offset into the PE/COFF image to begin the read operation. 73 @param ReadSize On input, the size in bytes of the requested read operation. 73 @param ReadSize On input, the size in bytes of the requested read operation. 74 74 On output, the number of bytes actually read. 75 75 @param Buffer Output buffer that contains the data read from the PE/COFF image. 76 77 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 76 77 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 78 78 **/ 79 79 EFI_STATUS … … 158 158 // 159 159 // Read the EFI Partition Table Header 160 // 160 // 161 161 PrimaryHeader = (EFI_PARTITION_TABLE_HEADER *) AllocatePool (BlockIo->Media->BlockSize); 162 162 if (PrimaryHeader == NULL) { 163 163 return EFI_OUT_OF_RESOURCES; 164 } 164 } 165 165 Status = DiskIo->ReadDisk ( 166 166 DiskIo, … … 174 174 FreePool (PrimaryHeader); 175 175 return EFI_DEVICE_ERROR; 176 } 176 } 177 177 // 178 178 // Read the partition entry. … … 195 195 return EFI_DEVICE_ERROR; 196 196 } 197 197 198 198 // 199 199 // Count the valid partition … … 203 203 for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) { 204 204 if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mTrEEZeroGuid)) { 205 NumberOfPartition++; 205 NumberOfPartition++; 206 206 } 207 207 PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry); … … 210 210 // 211 211 // Prepare Data for Measurement 212 // 213 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 212 // 213 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 214 214 + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry); 215 215 TreeEvent = (TrEE_EVENT *) AllocateZeroPool (EventSize + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event)); … … 225 225 TreeEvent->Header.PCRIndex = 5; 226 226 TreeEvent->Header.EventType = EV_EFI_GPT_EVENT; 227 GptData = (EFI_GPT_DATA *) TreeEvent->Event; 227 GptData = (EFI_GPT_DATA *) TreeEvent->Event; 228 228 229 229 // 230 230 // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition 231 // 231 // 232 232 CopyMem ((UINT8 *)GptData, (UINT8*)PrimaryHeader, sizeof (EFI_PARTITION_TABLE_HEADER)); 233 233 GptData->NumberOfPartitions = NumberOfPartition; … … 287 287 @retval EFI_SUCCESS Successfully measure image. 288 288 @retval EFI_OUT_OF_RESOURCES No enough resource to measure image. 289 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 289 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 290 290 @retval other error value 291 291 … … 382 382 383 383 /** 384 The security handler is used to abstract platform-specific policy 385 from the DXE core response to an attempt to use a file that returns a 386 given status for the authentication check from the section extraction protocol. 387 388 The possible responses in a given SAP implementation may include locking 389 flash upon failure to authenticate, attestation logging for all signed drivers, 390 and other exception operations. The File parameter allows for possible logging 384 The security handler is used to abstract platform-specific policy 385 from the DXE core response to an attempt to use a file that returns a 386 given status for the authentication check from the section extraction protocol. 387 388 The possible responses in a given SAP implementation may include locking 389 flash upon failure to authenticate, attestation logging for all signed drivers, 390 and other exception operations. The File parameter allows for possible logging 391 391 within the SAP of the driver. 392 392 393 393 If File is NULL, then EFI_INVALID_PARAMETER is returned. 394 394 395 If the file specified by File with an authentication status specified by 395 If the file specified by File with an authentication status specified by 396 396 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. 397 397 398 If the file specified by File with an authentication status specified by 399 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 398 If the file specified by File with an authentication status specified by 399 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 400 400 then EFI_ACCESS_DENIED is returned. 401 401 402 If the file specified by File with an authentication status specified by 403 AuthenticationStatus is not safe for the DXE Core to use right now, but it 404 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 402 If the file specified by File with an authentication status specified by 403 AuthenticationStatus is not safe for the DXE Core to use right now, but it 404 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 405 405 returned. 406 406 … … 454 454 ProtocolCapability.Size = (UINT8) sizeof (ProtocolCapability); 455 455 Status = TreeProtocol->GetCapability ( 456 TreeProtocol, 456 TreeProtocol, 457 457 &ProtocolCapability 458 458 ); … … 469 469 // 470 470 OrigDevicePathNode = DuplicateDevicePath (File); 471 471 472 472 // 473 473 // 1. Check whether this device path support BlockIo protocol. … … 490 490 // 491 491 // Check whether it is a gpt partition or not 492 // 493 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 492 // 493 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 494 494 ((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->SignatureType == SIGNATURE_TYPE_GUID) { 495 495 … … 527 527 } 528 528 } 529 529 530 530 // 531 531 // 2. Measure PE image. … … 561 561 do { 562 562 Status = gBS->HandleProtocol( 563 TempHandle, 563 TempHandle, 564 564 &gEfiFirmwareVolumeBlockProtocolGuid, 565 565 (VOID**)&FvbProtocol … … 620 620 goto Finish; 621 621 } 622 622 623 623 // 624 624 // Measure only application if Application flag is set 625 625 // Measure drivers and applications if Application flag is not set 626 626 // 627 if ((!ApplicationRequired) || 628 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 627 if ((!ApplicationRequired) || 628 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 629 629 // 630 630 // Print the image path to be measured. 631 // 631 // 632 632 DEBUG_CODE_BEGIN (); 633 633 CHAR16 *ToText; … … 648 648 Status = TrEEMeasurePeImage ( 649 649 TreeProtocol, 650 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 651 FileSize, 652 (UINTN) ImageContext.ImageAddress, 653 ImageContext.ImageType, 650 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 651 FileSize, 652 (UINTN) ImageContext.ImageAddress, 653 ImageContext.ImageType, 654 654 DevicePathNode 655 655 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
r58464 r58466 2 2 # Provides security service for TPM 2.0 measured boot 3 3 # 4 # This library instance hooks LoadImage() API to measure every image that 4 # This library instance hooks LoadImage() API to measure every image that 5 5 # is not measured in PEI phase. And, it will also measure GPT partition. 6 6 # 7 7 # Caution: This module requires additional review when modified. 8 8 # This library will have external input - PE/COFF image and GPT partition. 9 # This external input must be validated carefully to avoid security issues such 9 # This external input must be validated carefully to avoid security issues such 10 10 # as buffer overflow or integer overflow. 11 11 # … … 27 27 MODULE_TYPE = DXE_DRIVER 28 28 VERSION_STRING = 1.0 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 30 30 CONSTRUCTOR = DxeTpm2MeasureBootLibConstructor 31 31 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
r58459 r58466 1 1 /** @file 2 The library instance provides security service of TPM measure boot. 2 The library instance provides security service of TPM measure boot. 3 3 4 4 Caution: This file requires additional review when modified. … … 17 17 18 18 Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 22 22 http://opensource.org/licenses/bsd-license.php 23 23 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 25 25 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 26 26 … … 70 70 @param FileHandle Pointer to the file handle to read the PE/COFF image. 71 71 @param FileOffset Offset into the PE/COFF image to begin the read operation. 72 @param ReadSize On input, the size in bytes of the requested read operation. 72 @param ReadSize On input, the size in bytes of the requested read operation. 73 73 On output, the number of bytes actually read. 74 74 @param Buffer Output buffer that contains the data read from the PE/COFF image. 75 76 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 75 76 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 77 77 **/ 78 78 EFI_STATUS … … 159 159 // 160 160 // Read the EFI Partition Table Header 161 // 161 // 162 162 PrimaryHeader = (EFI_PARTITION_TABLE_HEADER *) AllocatePool (BlockIo->Media->BlockSize); 163 163 if (PrimaryHeader == NULL) { 164 164 return EFI_OUT_OF_RESOURCES; 165 } 165 } 166 166 Status = DiskIo->ReadDisk ( 167 167 DiskIo, … … 175 175 FreePool (PrimaryHeader); 176 176 return EFI_DEVICE_ERROR; 177 } 177 } 178 178 // 179 179 // Read the partition entry. … … 196 196 return EFI_DEVICE_ERROR; 197 197 } 198 198 199 199 // 200 200 // Count the valid partition … … 204 204 for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) { 205 205 if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mZeroGuid)) { 206 NumberOfPartition++; 206 NumberOfPartition++; 207 207 } 208 208 PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry); … … 211 211 // 212 212 // Prepare Data for Measurement 213 // 214 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 213 // 214 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 215 215 + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry); 216 216 TcgEvent = (TCG_PCR_EVENT *) AllocateZeroPool (EventSize + sizeof (TCG_PCR_EVENT_HDR)); … … 224 224 TcgEvent->EventType = EV_EFI_GPT_EVENT; 225 225 TcgEvent->EventSize = EventSize; 226 GptData = (EFI_GPT_DATA *) TcgEvent->Event; 226 GptData = (EFI_GPT_DATA *) TcgEvent->Event; 227 227 228 228 // 229 229 // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition 230 // 230 // 231 231 CopyMem ((UINT8 *)GptData, (UINT8*)PrimaryHeader, sizeof (EFI_PARTITION_TABLE_HEADER)); 232 232 GptData->NumberOfPartitions = NumberOfPartition; … … 289 289 @retval EFI_SUCCESS Successfully measure image. 290 290 @retval EFI_OUT_OF_RESOURCES No enough resource to measure image. 291 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 291 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 292 292 @retval other error value 293 293 … … 419 419 if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 420 420 // 421 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 422 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 421 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 422 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 423 423 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 424 424 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 431 431 Magic = Hdr.Pe32->OptionalHeader.Magic; 432 432 } 433 433 434 434 // 435 435 // 3. Calculate the distance from the base of the image header to the image checksum address. … … 454 454 if (!HashStatus) { 455 455 goto Finish; 456 } 456 } 457 457 458 458 // … … 483 483 goto Finish; 484 484 } 485 } 485 } 486 486 } else { 487 487 // … … 497 497 // 498 498 // Use PE32+ offset 499 // 499 // 500 500 HashBase = (UINT8 *) &Hdr.Pe32Plus->OptionalHeader.CheckSum + sizeof (UINT32); 501 501 HashSize = (UINTN) ((UINT8 *)(&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]) - HashBase); … … 526 526 HashSize = Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - (UINTN) (HashBase - ImageAddress); 527 527 } 528 528 529 529 if (HashSize != 0) { 530 530 HashStatus = Sha1Update (Sha1Ctx, HashBase, HashSize); … … 689 689 690 690 /** 691 The security handler is used to abstract platform-specific policy 692 from the DXE core response to an attempt to use a file that returns a 693 given status for the authentication check from the section extraction protocol. 694 695 The possible responses in a given SAP implementation may include locking 696 flash upon failure to authenticate, attestation logging for all signed drivers, 697 and other exception operations. The File parameter allows for possible logging 691 The security handler is used to abstract platform-specific policy 692 from the DXE core response to an attempt to use a file that returns a 693 given status for the authentication check from the section extraction protocol. 694 695 The possible responses in a given SAP implementation may include locking 696 flash upon failure to authenticate, attestation logging for all signed drivers, 697 and other exception operations. The File parameter allows for possible logging 698 698 within the SAP of the driver. 699 699 700 700 If File is NULL, then EFI_INVALID_PARAMETER is returned. 701 701 702 If the file specified by File with an authentication status specified by 702 If the file specified by File with an authentication status specified by 703 703 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. 704 704 705 If the file specified by File with an authentication status specified by 706 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 705 If the file specified by File with an authentication status specified by 706 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 707 707 then EFI_ACCESS_DENIED is returned. 708 708 709 If the file specified by File with an authentication status specified by 710 AuthenticationStatus is not safe for the DXE Core to use right now, but it 711 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 709 If the file specified by File with an authentication status specified by 710 AuthenticationStatus is not safe for the DXE Core to use right now, but it 711 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 712 712 returned. 713 713 … … 763 763 ProtocolCapability.Size = (UINT8) sizeof (ProtocolCapability); 764 764 Status = TcgProtocol->StatusCheck ( 765 TcgProtocol, 765 TcgProtocol, 766 766 &ProtocolCapability, 767 767 &TCGFeatureFlags, … … 780 780 // 781 781 OrigDevicePathNode = DuplicateDevicePath (File); 782 782 783 783 // 784 784 // 1. Check whether this device path support BlockIo protocol. … … 801 801 // 802 802 // Check whether it is a gpt partition or not 803 // 804 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 803 // 804 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 805 805 ((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->SignatureType == SIGNATURE_TYPE_GUID) { 806 806 … … 837 837 } 838 838 } 839 839 840 840 // 841 841 // 2. Measure PE image. … … 871 871 do { 872 872 Status = gBS->HandleProtocol( 873 TempHandle, 873 TempHandle, 874 874 &gEfiFirmwareVolumeBlockProtocolGuid, 875 875 (VOID**)&FvbProtocol … … 930 930 goto Finish; 931 931 } 932 932 933 933 // 934 934 // Measure only application if Application flag is set 935 935 // Measure drivers and applications if Application flag is not set 936 936 // 937 if ((!ApplicationRequired) || 938 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 937 if ((!ApplicationRequired) || 938 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 939 939 // 940 940 // Print the image path to be measured. 941 // 941 // 942 942 DEBUG_CODE_BEGIN (); 943 943 CHAR16 *ToText; … … 958 958 Status = TcgMeasurePeImage ( 959 959 TcgProtocol, 960 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 961 FileSize, 962 (UINTN) ImageContext.ImageAddress, 963 ImageContext.ImageType, 960 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 961 FileSize, 962 (UINTN) ImageContext.ImageAddress, 963 ImageContext.ImageType, 964 964 DevicePathNode 965 965 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf
r58459 r58466 2 2 # Provides security service for TPM 1.2 measured boot 3 3 # 4 # This library instance hooks LoadImage() API to measure every image that 4 # This library instance hooks LoadImage() API to measure every image that 5 5 # is not measured in PEI phase. And, it will also measure GPT partition. 6 6 # 7 7 # Caution: This module requires additional review when modified. 8 8 # This library will have external input - PE/COFF image and GPT partition. 9 # This external input must be validated carefully to avoid security issues such 9 # This external input must be validated carefully to avoid security issues such 10 10 # as buffer overflow or integer overflow. 11 11 # … … 27 27 MODULE_TYPE = DXE_DRIVER 28 28 VERSION_STRING = 1.0 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 30 30 CONSTRUCTOR = DxeTpmMeasureBootLibConstructor 31 31 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.c
r58464 r58466 172 172 **/ 173 173 EFI_STATUS 174 EFIAPI 174 EFIAPI 175 175 TpmMeasureAndLogData ( 176 176 IN UINT32 PcrIndex, -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
r58464 r58466 1 1 ## @file 2 2 # Provides TPM measurement functions for TPM1.2 and TPM 2.0 3 # 4 # This library provides TpmMeasureAndLogData() to to measure and log data, and 3 # 4 # This library provides TpmMeasureAndLogData() to to measure and log data, and 5 5 # extend the measurement result into a specific PCR. 6 6 # … … 21 21 MODULE_TYPE = UEFI_DRIVER 22 22 VERSION_STRING = 1.0 23 LIBRARY_CLASS = TpmMeasurementLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 23 LIBRARY_CLASS = TpmMeasurementLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 24 MODULE_UNI_FILE = DxeTpmMeasurementLib.uni 25 25 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTrEEPhysicalPresenceLib/DxeTrEEPhysicalPresenceLib.c
r58464 r58466 9 9 10 10 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 14 14 http://opensource.org/licenses/bsd-license.php 15 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 18 18 … … 110 110 @param[in] CommandCode Physical presence operation value. 111 111 @param[in, out] PpiFlags The physical presence interface flags. 112 112 113 113 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Unknown physical presence operation. 114 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 114 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 115 115 receiving response from TPM. 116 116 @retval Others Return code from the TPM device after command execution. … … 172 172 EFI_INPUT_KEY Key; 173 173 UINT16 InputKey; 174 175 InputKey = 0; 174 175 InputKey = 0; 176 176 do { 177 177 Status = gBS->CheckEvent (gST->ConIn->WaitForKey); … … 187 187 InputKey = Key.ScanCode; 188 188 } 189 } 189 } 190 190 } while (InputKey == 0); 191 191 … … 193 193 return TRUE; 194 194 } 195 195 196 196 return FALSE; 197 197 } … … 199 199 /** 200 200 The constructor function register UNI strings into imageHandle. 201 202 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 201 202 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 203 203 204 204 @param ImageHandle The firmware allocated handle for the EFI image. 205 205 @param SystemTable A pointer to the EFI System Table. 206 206 207 207 @retval EFI_SUCCESS The constructor successfully added string package. 208 208 @retval Other value The constructor can't add string package. … … 236 236 CHAR16 *ConfirmText; 237 237 CHAR16 *TmpStr1; 238 CHAR16 *TmpStr2; 238 CHAR16 *TmpStr2; 239 239 UINTN BufSize; 240 240 BOOLEAN CautionKey; 241 241 UINT16 Index; 242 242 CHAR16 DstStr[81]; 243 243 244 244 TmpStr2 = NULL; 245 245 CautionKey = FALSE; … … 264 264 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 265 265 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 266 FreePool (TmpStr1); 266 FreePool (TmpStr1); 267 267 268 268 TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 286 286 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 287 287 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 288 FreePool (TmpStr1); 288 FreePool (TmpStr1); 289 289 290 290 TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 312 312 DstStr[80] = L'\0'; 313 313 for (Index = 0; Index < StrLen (ConfirmText); Index += 80) { 314 StrnCpy(DstStr, ConfirmText + Index, 80); 315 Print (DstStr); 316 } 317 314 StrnCpy(DstStr, ConfirmText + Index, 80); 315 Print (DstStr); 316 } 317 318 318 FreePool (TmpStr1); 319 319 FreePool (TmpStr2); … … 324 324 } 325 325 326 return FALSE; 327 } 328 329 /** 330 Check if there is a valid physical presence command request. Also updates parameter value 326 return FALSE; 327 } 328 329 /** 330 Check if there is a valid physical presence command request. Also updates parameter value 331 331 to whether the requested physical presence command already confirmed by user 332 333 @param[in] TcgPpData EFI TrEE Physical Presence request data. 332 333 @param[in] TcgPpData EFI TrEE Physical Presence request data. 334 334 @param[in] Flags The physical presence interface flags. 335 335 @param[out] RequestConfirmed If the physical presence operation command required user confirm from UI. 336 True, it indicates the command doesn't require user confirm, or already confirmed 336 True, it indicates the command doesn't require user confirm, or already confirmed 337 337 in last boot cycle by user. 338 338 False, it indicates the command need user confirm from UI. … … 466 466 if (!RequestConfirmed) { 467 467 // 468 // Print confirm text and wait for approval. 468 // Print confirm text and wait for approval. 469 469 // 470 470 RequestConfirmed = TrEEUserConfirm (TcgPpData->PPRequest … … 478 478 NewFlags = Flags; 479 479 if (RequestConfirmed) { 480 TcgPpData->PPResponse = TrEEExecutePhysicalPresence (PlatformAuth, TcgPpData->PPRequest, 480 TcgPpData->PPResponse = TrEEExecutePhysicalPresence (PlatformAuth, TcgPpData->PPRequest, 481 481 &NewFlags); 482 482 } … … 493 493 sizeof (EFI_TREE_PHYSICAL_PRESENCE_FLAGS), 494 494 &NewFlags 495 ); 495 ); 496 496 } 497 497 … … 501 501 if ((NewFlags.PPFlags & TREE_VENDOR_LIB_FLAG_RESET_TRACK) == 0) { 502 502 TcgPpData->LastPPRequest = TcgPpData->PPRequest; 503 TcgPpData->PPRequest = TREE_PHYSICAL_PRESENCE_NO_ACTION; 503 TcgPpData->PPRequest = TREE_PHYSICAL_PRESENCE_NO_ACTION; 504 504 } 505 505 … … 548 548 Print (L"Rebooting system to make TPM2 settings in effect\n"); 549 549 gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); 550 ASSERT (FALSE); 550 ASSERT (FALSE); 551 551 } 552 552 … … 554 554 Check and execute the pending TPM request. 555 555 556 The TPM request may come from OS or BIOS. This API will display request information and wait 556 The TPM request may come from OS or BIOS. This API will display request information and wait 557 557 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after 558 the TPM request is confirmed, and one or more reset may be required to make TPM request to 558 the TPM request is confirmed, and one or more reset may be required to make TPM request to 559 559 take effect. 560 560 561 561 This API should be invoked after console in and console out are all ready as they are required 562 to display request information and get user input to confirm the request. 562 to display request information and get user input to confirm the request. 563 563 564 564 @param[in] PlatformAuth platform auth value. NULL means no platform auth change. … … 610 610 611 611 // 612 // This flags variable controls whether physical presence is required for TPM command. 612 // This flags variable controls whether physical presence is required for TPM command. 613 613 // It should be protected from malicious software. We set it as read-only variable here. 614 614 // … … 625 625 } 626 626 } 627 627 628 628 // 629 629 // Initialize physical presence variable. … … 657 657 // 658 658 // Execute pending TPM request. 659 // 659 // 660 660 TrEEExecutePendingTpmRequest (PlatformAuth, &TcgPpData, PpiFlags); 661 661 DEBUG ((EFI_D_INFO, "[TPM2] PPResponse = %x (LastPPRequest=%x, Flags=%x)\n", TcgPpData.PPResponse, TcgPpData.LastPPRequest, PpiFlags.PPFlags)); … … 668 668 The TPM request may come from OS. This API will check if TPM request exists and need user 669 669 input to confirmation. 670 670 671 671 @retval TRUE TPM needs input to confirm user physical presence. 672 672 @retval FALSE TPM doesn't need input to confirm user physical presence. … … 717 717 return FALSE; 718 718 } 719 719 720 720 if (TcgPpData.PPRequest == TREE_PHYSICAL_PRESENCE_NO_ACTION) { 721 721 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTrEEPhysicalPresenceLib/DxeTrEEPhysicalPresenceLib.inf
r58464 r58466 26 26 MODULE_TYPE = DXE_DRIVER 27 27 VERSION_STRING = 1.0 28 LIBRARY_CLASS = TrEEPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 28 LIBRARY_CLASS = TrEEPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 29 CONSTRUCTOR = TrEEPhysicalPresenceLibConstructor 30 30 31 31 # 32 32 # The following information is for reference only and not required by the build tools. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.c
r58464 r58466 119 119 120 120 FreePool (Sha1Ctx); 121 121 122 122 Tpm2SetSha1ToDigestList (DigestList, Digest); 123 123 … … 134 134 /** 135 135 The function register SHA1 instance. 136 136 137 137 @retval EFI_SUCCESS SHA1 instance is registered, or system dose not surpport registr SHA1 instance 138 138 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.c
r58464 r58466 119 119 120 120 FreePool (Sha256Ctx); 121 121 122 122 Tpm2SetSha256ToDigestList (DigestList, Digest); 123 123 … … 134 134 /** 135 135 The function register SHA256 instance. 136 136 137 137 @retval EFI_SUCCESS SHA256 instance is registered, or system dose not surpport registr SHA256 instance 138 138 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.c
r58464 r58466 217 217 CopyMem (&mHashInterface[mHashInterfaceCount], HashInterface, sizeof(*HashInterface)); 218 218 mHashInterfaceCount ++; 219 219 220 220 return EFI_SUCCESS; 221 221 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
r58464 r58466 3 3 # 4 4 # Ihis library is BaseCrypto router. It will redirect hash request to each individual 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 6 6 # mask some hash engines. 7 7 # … … 23 23 MODULE_TYPE = DXE_DRIVER 24 24 VERSION_STRING = 1.0 25 LIBRARY_CLASS = HashLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 LIBRARY_CLASS = HashLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 26 26 27 27 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c
r58464 r58466 284 284 CopyMem (&HashInterfaceHob->HashInterface[HashInterfaceHob->HashInterfaceCount], HashInterface, sizeof(*HashInterface)); 285 285 HashInterfaceHob->HashInterfaceCount ++; 286 286 287 287 return EFI_SUCCESS; 288 288 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
r58464 r58466 3 3 # 4 4 # Ihis library is BaseCrypto router. It will redirect hash request to each individual 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 6 6 # mask some hash engines. 7 7 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.inf
r58464 r58466 2 2 # Provides hash service using TPM2 device 3 3 # 4 # This library uses TPM2 device to calculate hash. Platform can use PcdTpm2HashMask to 4 # This library uses TPM2 device to calculate hash. Platform can use PcdTpm2HashMask to 5 5 # mask some hash calculation. 6 6 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
r58464 r58466 1 1 /** @file 2 2 3 This library registers RSA 2048 SHA 256 guided section handler 3 This library registers RSA 2048 SHA 256 guided section handler 4 4 to parse RSA 2048 SHA 256 encapsulation section and extract raw data. 5 5 It uses the BaseCrypyLib based on OpenSSL to authenticate the signature. 6 6 7 7 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 16 16 **/ … … 49 49 50 50 GetInfo gets raw data size and attribute of the input guided section. 51 It first checks whether the input guid section is supported. 51 It first checks whether the input guid section is supported. 52 52 If not, EFI_INVALID_PARAMETER will return. 53 53 … … 57 57 @param SectionAttribute The attribute of the input guided section. 58 58 59 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 59 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 60 60 the attribute of the input section are successull retrieved. 61 61 @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid. … … 110 110 Extraction handler tries to extract raw data from the input guided section. 111 111 It also does authentication check for RSA 2048 SHA 256 signature in the input guided section. 112 It first checks whether the input guid section is supported. 112 It first checks whether the input guid section is supported. 113 113 If not, EFI_INVALID_PARAMETER will return. 114 114 … … 141 141 VOID *HashContext; 142 142 VOID *Rsa; 143 143 144 144 HashContext = NULL; 145 145 Rsa = NULL; 146 146 147 147 if (IS_SECTION2 (InputSection)) { 148 148 // … … 154 154 return EFI_INVALID_PARAMETER; 155 155 } 156 156 157 157 // 158 158 // Get the RSA 2048 SHA 256 information. … … 182 182 return EFI_INVALID_PARAMETER; 183 183 } 184 184 185 185 // 186 186 // Get the RSA 2048 SHA 256 information. … … 207 207 // 208 208 Status = EFI_SUCCESS; 209 209 210 210 // 211 211 // Fail if the HashType is not SHA 256 … … 249 249 goto Done; 250 250 } 251 251 252 252 // 253 253 // Fail if the PublicKey is not one of the public keys in PcdRsa2048Sha256PublicKeyBuffer … … 284 284 goto Done; 285 285 } 286 287 // 286 287 // 288 288 // Set RSA Key Components. 289 289 // NOTE: Only N and E are needed to be set as RSA public key for signature verification. … … 332 332 PERF_START (NULL, "RsaVerify", "PEI", 0); 333 333 CryptoStatus = RsaPkcs1Verify ( 334 Rsa, 335 Digest, 336 SHA256_DIGEST_SIZE, 337 CertBlockRsa2048Sha256->Signature, 334 Rsa, 335 Digest, 336 SHA256_DIGEST_SIZE, 337 CertBlockRsa2048Sha256->Signature, 338 338 sizeof (CertBlockRsa2048Sha256->Signature) 339 339 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.inf
r58464 r58466 1 1 ## @file 2 # This library doesn't produce any library class. The constructor function uses 2 # This library doesn't produce any library class. The constructor function uses 3 3 # ExtractGuidedSectionLib service to register an RSA 2048 SHA 256 guided section handler 4 4 # that parses RSA 2048 SHA 256 encapsulation section and extracts raw data. … … 50 50 PerformanceLib 51 51 52 [PcdEx] 52 [PcdEx] 53 53 gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer ## SOMETIMES_CONSUMES 54 54 55 55 [Guids] 56 56 gEfiCertTypeRsa2048Sha256Guid ## PRODUCES ## UNDEFINED # Specifies RSA 2048 SHA 256 authentication algorithm. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
r48674 r58466 1 1 /** @file 2 NULL PlatformSecureLib instance does NOT really detect whether a physical present 2 NULL PlatformSecureLib instance does NOT really detect whether a physical present 3 3 user exists but return TRUE directly. This instance can be used to verify security 4 4 related features during platform enabling and development. It should be replaced … … 6 6 7 7 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 11 http://opensource.org/licenses/bsd-license.php 12 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 … … 19 19 20 20 This function provides a platform-specific method to detect whether the platform 21 is operating by a physically present user. 21 is operating by a physically present user. 22 22 23 23 Programmatic changing of platform security policy (such as disable Secure Boot, … … 28 28 NOTE THAT: This function cannot depend on any EFI Variable Service since they are 29 29 not available when this function is called in AuthenticateVariable driver. 30 30 31 31 @retval TRUE The platform is operated by a physically present user. 32 32 @retval FALSE The platform is NOT operated by a physically present user. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
r58459 r58466 2 2 # NULL platform secure library instance that alway returns TRUE for a user physical present 3 3 # 4 # NULL PlatformSecureLib instance does NOT really detect whether a physical present 4 # NULL PlatformSecureLib instance does NOT really detect whether a physical present 5 5 # user exists but returns TRUE directly. This instance can be used to verify security 6 6 # related features during platform enabling and development. It should be replaced -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.c
r58464 r58466 3 3 4 4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 20 20 21 21 This API should be invoked in BIOS boot phase to process pending request. 22 22 23 23 Caution: This function may receive untrusted input. 24 24 25 25 If OperationRequest < 128, then ASSERT(). 26 26 … … 49 49 50 50 This API should be invoked in BIOS boot phase to process pending request. 51 51 52 52 Caution: This function may receive untrusted input. 53 53 … … 83 83 84 84 Caution: This function may receive untrusted input. 85 85 86 86 If OperationRequest < 128, then ASSERT(). 87 87 … … 110 110 111 111 Caution: This function may receive untrusted input. 112 112 113 113 If OperationRequest < 128, then ASSERT(). 114 114 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.inf
r58464 r58466 33 33 MdePkg/MdePkg.dec 34 34 SecurityPkg/SecurityPkg.dec 35 35 36 36 [LibraryClasses] 37 37 DebugLib -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
r58464 r58466 67 67 /** 68 68 Send NV DefineSpace command to TPM1.2. 69 69 70 70 @param PubInfo The public parameters of the NV area. 71 71 @param EncAuth The encrypted AuthData, only valid if the attributes require subsequent authorization. … … 197 197 /** 198 198 Send NV WriteValue command to TPM1.2. 199 199 200 200 @param NvIndex The index of the area to set. 201 201 @param Offset The offset into the NV Area. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
r58464 r58466 1 1 ## @file 2 2 # Provides TPM 1.2 TIS functions 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 1.2 command. Choosing this library means platform uses and 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 1.2 command. Choosing this library means platform uses and 6 6 # only uses TPM 1.2 device. 7 7 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
r58464 r58466 1 1 /** @file 2 2 TIS (TPM Interface Specification) functions used by TPM1.2. 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 153 153 154 154 /// 155 /// When this bit is 1, TPM is in the Ready state, 155 /// When this bit is 1, TPM is in the Ready state, 156 156 /// indicating it is ready to receive a new command. 157 157 /// … … 201 201 { 202 202 UINT8 RegRead; 203 203 204 204 RegRead = MmioRead8 ((UINTN)&TisReg->Access); 205 205 return (BOOLEAN)(RegRead != (UINT8)-1); … … 238 238 239 239 /** 240 Get BurstCount by reading the burstCount field of a TIS regiger 240 Get BurstCount by reading the burstCount field of a TIS regiger 241 241 in the time of default TIS_TIMEOUT_D. 242 242 … … 282 282 283 283 /** 284 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 284 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 285 285 to Status Register in time. 286 286 … … 313 313 314 314 /** 315 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 315 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 316 316 to ACCESS Register in the time of default TIS_TIMEOUT_A. 317 317 … … 329 329 { 330 330 EFI_STATUS Status; 331 331 332 332 if (TisReg == NULL) { 333 333 return EFI_INVALID_PARAMETER; 334 334 } 335 335 336 336 if (!Tpm12TisPcPresenceCheck (TisReg)) { 337 337 return EFI_NOT_FOUND; … … 351 351 Send a command to TPM for execution and return response data. 352 352 353 @param[in] TisReg TPM register space base address. 354 @param[in] BufferIn Buffer for command data. 355 @param[in] SizeIn Size of command data. 356 @param[in, out] BufferOut Buffer for response data. 357 @param[in, out] SizeOut Size of response data. 358 353 @param[in] TisReg TPM register space base address. 354 @param[in] BufferIn Buffer for command data. 355 @param[in] SizeIn Size of command data. 356 @param[in, out] BufferOut Buffer for response data. 357 @param[in, out] SizeOut Size of response data. 358 359 359 @retval EFI_SUCCESS Operation completed successfully. 360 360 @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small. … … 531 531 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 532 532 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 533 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 533 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 534 534 **/ 535 535 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.c
r58464 r58466 22 22 #include <IndustryStandard/Tpm12.h> 23 23 24 EFI_TCG_PROTOCOL *mTcgProtocol = NULL; 24 EFI_TCG_PROTOCOL *mTcgProtocol = NULL; 25 25 26 26 /** … … 34 34 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 35 35 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 36 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 36 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 37 37 **/ 38 38 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf
r58464 r58466 22 22 MODULE_TYPE = BASE 23 23 VERSION_STRING = 1.0 24 LIBRARY_CLASS = Tpm12DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 LIBRARY_CLASS = Tpm12DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 25 26 26 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
r58464 r58466 49 49 This command returns various information regarding the TPM and its current state. 50 50 51 The capability parameter determines the category of data returned. The property parameter 52 selects the first value of the selected category to be returned. If there is no property 51 The capability parameter determines the category of data returned. The property parameter 52 selects the first value of the selected category to be returned. If there is no property 53 53 that corresponds to the value of property, the next higher value is returned, if it exists. 54 The moreData parameter will have a value of YES if there are more values of the requested 54 The moreData parameter will have a value of YES if there are more values of the requested 55 55 type that were not returned. 56 If no next capability exists, the TPM will return a zero-length list and moreData will have 56 If no next capability exists, the TPM will return a zero-length list and moreData will have 57 57 a value of NO. 58 58 59 NOTE: 60 To simplify this function, leave returned CapabilityData for caller to unpack since there are 59 NOTE: 60 To simplify this function, leave returned CapabilityData for caller to unpack since there are 61 61 many capability categories and only few categories will be used in firmware. It means the caller 62 62 need swap the byte order for the feilds in CapabilityData. 63 63 64 64 @param[in] Capability Group selection; determines the format of the response. 65 @param[in] Property Further definition of information. 65 @param[in] Property Further definition of information. 66 66 @param[in] PropertyCount Number of properties of the indicated type to return. 67 67 @param[out] MoreData Flag to indicate if there are more values of this type. 68 68 @param[out] CapabilityData The capability data. 69 69 70 70 @retval EFI_SUCCESS Operation completed successfully. 71 71 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 96 96 SendBuffer.Property = SwapBytes32 (Property); 97 97 SendBuffer.PropertyCount = SwapBytes32 (PropertyCount); 98 98 99 99 SendBufferSize = (UINT32) sizeof (SendBuffer); 100 100 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); 101 101 102 102 // 103 103 // send Tpm command … … 121 121 // 122 122 CopyMem (CapabilityData, &RecvBuffer.CapabilityData, RecvBufferSize - sizeof (TPM2_RESPONSE_HEADER) - sizeof (UINT8)); 123 123 124 124 return EFI_SUCCESS; 125 125 } … … 131 131 132 132 @param[out] Family The Family of TPM. (a 4-octet character string) 133 133 134 134 @retval EFI_SUCCESS Operation completed successfully. 135 135 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 143 143 TPMS_CAPABILITY_DATA TpmCap; 144 144 TPMI_YES_NO MoreData; 145 EFI_STATUS Status; 146 147 Status = Tpm2GetCapability ( 148 TPM_CAP_TPM_PROPERTIES, 149 TPM_PT_FAMILY_INDICATOR, 150 1, 151 &MoreData, 145 EFI_STATUS Status; 146 147 Status = Tpm2GetCapability ( 148 TPM_CAP_TPM_PROPERTIES, 149 TPM_PT_FAMILY_INDICATOR, 150 1, 151 &MoreData, 152 152 &TpmCap 153 153 ); … … 166 166 167 167 @param[out] ManufactureId The manufacture ID of TPM. 168 168 169 169 @retval EFI_SUCCESS Operation completed successfully. 170 170 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 178 178 TPMS_CAPABILITY_DATA TpmCap; 179 179 TPMI_YES_NO MoreData; 180 EFI_STATUS Status; 181 182 Status = Tpm2GetCapability ( 183 TPM_CAP_TPM_PROPERTIES, 184 TPM_PT_MANUFACTURER, 185 1, 186 &MoreData, 180 EFI_STATUS Status; 181 182 Status = Tpm2GetCapability ( 183 TPM_CAP_TPM_PROPERTIES, 184 TPM_PT_MANUFACTURER, 185 1, 186 &MoreData, 187 187 &TpmCap 188 188 ); … … 202 202 @param[out] FirmwareVersion1 The FirmwareVersion1. 203 203 @param[out] FirmwareVersion2 The FirmwareVersion2. 204 204 205 205 @retval EFI_SUCCESS Operation completed successfully. 206 206 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 215 215 TPMS_CAPABILITY_DATA TpmCap; 216 216 TPMI_YES_NO MoreData; 217 EFI_STATUS Status; 218 219 Status = Tpm2GetCapability ( 220 TPM_CAP_TPM_PROPERTIES, 221 TPM_PT_FIRMWARE_VERSION_1, 222 1, 223 &MoreData, 217 EFI_STATUS Status; 218 219 Status = Tpm2GetCapability ( 220 TPM_CAP_TPM_PROPERTIES, 221 TPM_PT_FIRMWARE_VERSION_1, 222 1, 223 &MoreData, 224 224 &TpmCap 225 225 ); … … 230 230 231 231 Status = Tpm2GetCapability ( 232 TPM_CAP_TPM_PROPERTIES, 233 TPM_PT_FIRMWARE_VERSION_2, 234 1, 235 &MoreData, 232 TPM_CAP_TPM_PROPERTIES, 233 TPM_PT_FIRMWARE_VERSION_2, 234 1, 235 &MoreData, 236 236 &TpmCap 237 237 ); … … 251 251 @param[out] MaxCommandSize The maximum value for commandSize in a command. 252 252 @param[out] MaxResponseSize The maximum value for responseSize in a command. 253 253 254 254 @retval EFI_SUCCESS Operation completed successfully. 255 255 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 267 267 268 268 Status = Tpm2GetCapability ( 269 TPM_CAP_TPM_PROPERTIES, 270 TPM_PT_MAX_COMMAND_SIZE, 271 1, 272 &MoreData, 269 TPM_CAP_TPM_PROPERTIES, 270 TPM_PT_MAX_COMMAND_SIZE, 271 1, 272 &MoreData, 273 273 &TpmCap 274 274 ); … … 280 280 281 281 Status = Tpm2GetCapability ( 282 TPM_CAP_TPM_PROPERTIES, 283 TPM_PT_MAX_RESPONSE_SIZE, 284 1, 285 &MoreData, 282 TPM_CAP_TPM_PROPERTIES, 283 TPM_PT_MAX_RESPONSE_SIZE, 284 1, 285 &MoreData, 286 286 &TpmCap 287 287 ); … … 291 291 292 292 *MaxResponseSize = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value); 293 return EFI_SUCCESS; 293 return EFI_SUCCESS; 294 294 } 295 295 296 296 /** 297 297 This command returns Returns a list of TPMS_ALG_PROPERTIES. Each entry is an 298 algorithm ID and a set of properties of the algorithm. 298 algorithm ID and a set of properties of the algorithm. 299 299 300 300 This function parse the value got from TPM2_GetCapability and return the list. 301 301 302 302 @param[out] AlgList List of algorithm. 303 303 304 304 @retval EFI_SUCCESS Operation completed successfully. 305 305 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 315 315 UINTN Index; 316 316 EFI_STATUS Status; 317 318 Status = Tpm2GetCapability ( 319 TPM_CAP_ALGS, 320 1, 321 MAX_CAP_ALGS, 322 &MoreData, 323 &TpmCap 324 ); 325 if (EFI_ERROR (Status)) { 326 return Status; 327 } 328 317 318 Status = Tpm2GetCapability ( 319 TPM_CAP_ALGS, 320 1, 321 MAX_CAP_ALGS, 322 &MoreData, 323 &TpmCap 324 ); 325 if (EFI_ERROR (Status)) { 326 return Status; 327 } 328 329 329 CopyMem (AlgList, &TpmCap.data.algorithms, sizeof (TPML_ALG_PROPERTY)); 330 330 … … 344 344 345 345 @param[out] LockoutCounter The LockoutCounter of TPM. 346 346 347 347 @retval EFI_SUCCESS Operation completed successfully. 348 348 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 356 356 TPMS_CAPABILITY_DATA TpmCap; 357 357 TPMI_YES_NO MoreData; 358 EFI_STATUS Status; 359 360 Status = Tpm2GetCapability ( 361 TPM_CAP_TPM_PROPERTIES, 362 TPM_PT_LOCKOUT_COUNTER, 363 1, 364 &MoreData, 358 EFI_STATUS Status; 359 360 Status = Tpm2GetCapability ( 361 TPM_CAP_TPM_PROPERTIES, 362 TPM_PT_LOCKOUT_COUNTER, 363 1, 364 &MoreData, 365 365 &TpmCap 366 366 ); … … 379 379 380 380 @param[out] LockoutInterval The LockoutInterval of TPM. 381 381 382 382 @retval EFI_SUCCESS Operation completed successfully. 383 383 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 391 391 TPMS_CAPABILITY_DATA TpmCap; 392 392 TPMI_YES_NO MoreData; 393 EFI_STATUS Status; 394 395 Status = Tpm2GetCapability ( 396 TPM_CAP_TPM_PROPERTIES, 397 TPM_PT_LOCKOUT_INTERVAL, 398 1, 399 &MoreData, 393 EFI_STATUS Status; 394 395 Status = Tpm2GetCapability ( 396 TPM_CAP_TPM_PROPERTIES, 397 TPM_PT_LOCKOUT_INTERVAL, 398 1, 399 &MoreData, 400 400 &TpmCap 401 401 ); … … 415 415 @param[out] InputBufferSize The InputBufferSize of TPM. 416 416 the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER) 417 417 418 418 @retval EFI_SUCCESS Operation completed successfully. 419 419 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 427 427 TPMS_CAPABILITY_DATA TpmCap; 428 428 TPMI_YES_NO MoreData; 429 EFI_STATUS Status; 430 431 Status = Tpm2GetCapability ( 432 TPM_CAP_TPM_PROPERTIES, 433 TPM_PT_INPUT_BUFFER, 434 1, 435 &MoreData, 429 EFI_STATUS Status; 430 431 Status = Tpm2GetCapability ( 432 TPM_CAP_TPM_PROPERTIES, 433 TPM_PT_INPUT_BUFFER, 434 1, 435 &MoreData, 436 436 &TpmCap 437 437 ); … … 450 450 451 451 @param[out] Pcrs The Pcr Selection 452 452 453 453 @retval EFI_SUCCESS Operation completed successfully. 454 454 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 466 466 467 467 Status = Tpm2GetCapability ( 468 TPM_CAP_PCRS, 469 0, 470 1, 471 &MoreData, 468 TPM_CAP_PCRS, 469 0, 470 1, 471 &MoreData, 472 472 &TpmCap 473 473 ); … … 492 492 493 493 @param[out] AlgorithmSet The AlgorithmSet of TPM. 494 494 495 495 @retval EFI_SUCCESS Operation completed successfully. 496 496 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 504 504 TPMS_CAPABILITY_DATA TpmCap; 505 505 TPMI_YES_NO MoreData; 506 EFI_STATUS Status; 507 508 Status = Tpm2GetCapability ( 509 TPM_CAP_TPM_PROPERTIES, 510 TPM_PT_ALGORITHM_SET, 511 1, 512 &MoreData, 506 EFI_STATUS Status; 507 508 Status = Tpm2GetCapability ( 509 TPM_CAP_TPM_PROPERTIES, 510 TPM_PT_ALGORITHM_SET, 511 1, 512 &MoreData, 513 513 &TpmCap 514 514 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Context.c
r58464 r58466 37 37 38 38 @param[in] FlushHandle The handle of the item to flush. 39 39 40 40 @retval EFI_SUCCESS Operation completed successfully. 41 41 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 60 60 61 61 SendBuffer.FlushHandle = SwapBytes32 (FlushHandle); 62 62 63 63 SendBufferSize = (UINT32) sizeof (SendBuffer); 64 64 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2EnhancedAuthorization.c
r58464 r58466 88 88 @param[out] Timeout Time value used to indicate to the TPM when the ticket expires. 89 89 @param[out] PolicyTicket A ticket that includes a value indicating when the authorization expires. 90 90 91 91 @retval EFI_SUCCESS Operation completed successfully. 92 92 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 121 121 SendBuffer.AuthHandle = SwapBytes32 (AuthHandle); 122 122 SendBuffer.PolicySession = SwapBytes32 (PolicySession); 123 123 124 124 // 125 125 // Add in Auth session … … 149 149 CopyMem (Buffer, PolicyRef->buffer, PolicyRef->size); 150 150 Buffer += PolicyRef->size; 151 151 152 152 WriteUnaligned32 ((UINT32 *)Buffer, SwapBytes32((UINT32)Expiration)); 153 153 Buffer += sizeof(UINT32); … … 201 201 @param[in] PolicySession Handle for the policy session being extended. 202 202 @param[in] HashList the list of hashes to check for a match. 203 203 204 204 @retval EFI_SUCCESS Operation completed successfully. 205 205 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 266 266 @param[in] PolicySession Handle for the policy session being extended. 267 267 @param[in] Code The allowed commandCode. 268 268 269 269 @retval EFI_SUCCESS Operation completed successfully. 270 270 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 322 322 @param[in] PolicySession Handle for the policy session. 323 323 @param[out] PolicyHash the current value of the policyHash of policySession. 324 324 325 325 @retval EFI_SUCCESS Operation completed successfully. 326 326 @retval EFI_DEVICE_ERROR The command was unsuccessful. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c
r58464 r58466 74 74 75 75 Buffer = (UINT8 *)AuthSessionOut; 76 76 77 77 // 78 78 // Add in Auth session -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Hierarchy.c
r58464 r58466 207 207 @param[in] AuthHandle TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP} 208 208 @param[in] AuthSession Auth Session context 209 209 210 210 @retval EFI_SUCCESS Operation completed successfully. 211 211 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 432 432 // 433 433 Status = Tpm2SubmitCommand ( 434 CmdSize, 435 (UINT8 *)&Cmd, 434 CmdSize, 435 (UINT8 *)&Cmd, 436 436 &ResultBufSize, 437 437 ResultBuf … … 518 518 // 519 519 Status = Tpm2SubmitCommand ( 520 CmdSize, 521 (UINT8 *)&Cmd, 520 CmdSize, 521 (UINT8 *)&Cmd, 522 522 &ResultBufSize, 523 523 ResultBuf … … 604 604 // 605 605 Status = Tpm2SubmitCommand ( 606 CmdSize, 607 (UINT8 *)&Cmd, 606 CmdSize, 607 (UINT8 *)&Cmd, 608 608 &ResultBufSize, 609 609 ResultBuf … … 700 700 // 701 701 Status = Tpm2SubmitCommand ( 702 CmdSize, 703 (UINT8 *)&Cmd, 702 CmdSize, 703 (UINT8 *)&Cmd, 704 704 &ResultBufSize, 705 705 ResultBuf -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Integrity.c
r58464 r58466 121 121 // 122 122 Buffer = (UINT8 *)&Cmd.AuthSessionPcr; 123 123 124 124 // sessionInfoSize 125 125 SessionInfoSize = CopyAuthSessionCommand (NULL, Buffer); 126 126 Buffer += SessionInfoSize; 127 127 Cmd.AuthorizationSize = SwapBytes32(SessionInfoSize); 128 128 129 129 //Digest Count 130 130 WriteUnaligned32 ((UINT32 *)Buffer, SwapBytes32(Digests->count)); 131 131 Buffer += sizeof(UINT32); 132 132 133 133 //Digest 134 134 for (Index = 0; Index < Digests->count; Index++) { … … 242 242 CopyMem (Buffer, EventData->buffer, EventData->size); 243 243 Buffer += EventData->size; 244 244 245 245 CmdSize = (UINT32)((UINTN)Buffer - (UINTN)&Cmd); 246 246 Cmd.Header.paramSize = SwapBytes32(CmdSize); … … 307 307 @param[out] PcrSelectionOut The PCR in the returned list. 308 308 @param[out] PcrValues The contents of the PCR indicated in pcrSelect. 309 309 310 310 @retval EFI_SUCCESS Operation completed successfully. 311 311 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 334 334 SendBuffer.Header.tag = SwapBytes16(TPM_ST_NO_SESSIONS); 335 335 SendBuffer.Header.commandCode = SwapBytes32(TPM_CC_PCR_Read); 336 336 337 337 SendBuffer.PcrSelectionIn.count = SwapBytes32(PcrSelectionIn->count); 338 338 for (Index = 0; Index < PcrSelectionIn->count; Index++) { … … 419 419 @param[out] SizeNeeded number of octets required to satisfy the request 420 420 @param[out] SizeAvailable Number of octets available. Computed before the allocation 421 421 422 422 @retval EFI_SUCCESS Operation completed successfully. 423 423 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 486 486 // 487 487 Status = Tpm2SubmitCommand ( 488 CmdSize, 489 (UINT8 *)&Cmd, 488 CmdSize, 489 (UINT8 *)&Cmd, 490 490 &ResultBufSize, 491 491 ResultBuf -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2NVStorage.c
r58464 r58466 163 163 @param[out] NvPublic The public area of the index. 164 164 @param[out] NvName The Name of the nvIndex. 165 165 166 166 @retval EFI_SUCCESS Operation completed successfully. 167 167 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 193 193 194 194 SendBuffer.NvIndex = SwapBytes32 (NvIndex); 195 195 196 196 SendBufferSize = (UINT32) sizeof (SendBuffer); 197 197 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); … … 257 257 CopyMem (NvName, (UINT8 *)&RecvBuffer + sizeof(TPM2_RESPONSE_HEADER) + sizeof(UINT16) + NvPublicSize, NvNameSize); 258 258 NvName->size = NvNameSize; 259 259 260 260 return EFI_SUCCESS; 261 261 } … … 270 270 @param[in] Auth The authorization data. 271 271 @param[in] NvPublic The public area of the index. 272 272 273 273 @retval EFI_SUCCESS Operation completed successfully. 274 274 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 382 382 return EFI_DEVICE_ERROR; 383 383 } 384 384 385 385 return EFI_SUCCESS; 386 386 } … … 392 392 @param[in] NvIndex The NV Index. 393 393 @param[in] AuthSession Auth Session context 394 394 395 395 @retval EFI_SUCCESS Operation completed successfully. 396 396 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 486 486 @param[in] Offset Byte offset into the area. 487 487 @param[in,out] OutData The data read. 488 488 489 489 @retval EFI_SUCCESS Operation completed successfully. 490 490 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 591 591 OutData->size = SwapBytes16 (RecvBuffer.Data.size); 592 592 CopyMem (OutData->buffer, &RecvBuffer.Data.buffer, OutData->size); 593 593 594 594 return EFI_SUCCESS; 595 595 } … … 603 603 @param[in] InData The data to write. 604 604 @param[in] Offset The offset into the NV Area. 605 605 606 606 @retval EFI_SUCCESS Operation completed successfully. 607 607 @retval EFI_DEVICE_ERROR The command was unsuccessful. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c
r58464 r58466 91 91 An Event sequence starts if this is TPM_ALG_NULL. 92 92 @param[out] SequenceHandle A handle to reference the sequence 93 93 94 94 @retval EFI_SUCCESS Operation completed successfully. 95 95 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 179 179 @param[in] SequenceHandle Handle for the sequence object 180 180 @param[in] Buffer Data to be added to hash 181 181 182 182 @retval EFI_SUCCESS Operation completed successfully. 183 183 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 278 278 @param[in] Buffer Data to be added to the Event 279 279 @param[out] Results List of digests computed for the PCR 280 280 281 281 @retval EFI_SUCCESS Operation completed successfully. 282 282 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 404 404 @param[in] Buffer Data to be added to the hash/HMAC 405 405 @param[out] Result The returned HMAC or digest in a sized buffer 406 406 407 407 @retval EFI_SUCCESS Operation completed successfully. 408 408 @retval EFI_DEVICE_ERROR Unexpected device behavior. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Session.c
r58464 r58466 54 54 @param[out] SessionHandle Handle for the newly created session. 55 55 @param[out] NonceTPM The initial nonce from the TPM, used in the computation of the sessionKey. 56 56 57 57 @retval EFI_SUCCESS Operation completed successfully. 58 58 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 137 137 WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16 (AuthHash)); 138 138 Buffer += sizeof(UINT16); 139 139 140 140 SendBufferSize = (UINT32) ((UINTN)Buffer - (UINTN)&SendBuffer); 141 141 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.c
r58464 r58466 29 29 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 30 30 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 31 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 31 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 32 32 **/ 33 33 EFI_STATUS … … 63 63 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 64 64 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 65 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 65 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 66 66 **/ 67 67 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf
r58464 r58466 1 1 ## @file 2 2 # Provides TPM 2.0 TIS functions for DTPM 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 2.0 command. Choosing this library means platform uses and 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 2.0 command. Choosing this library means platform uses and 6 6 # only uses TPM 2.0 DTPM device. 7 7 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.c
r58464 r58466 32 32 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 33 33 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 34 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 34 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 35 35 **/ 36 36 EFI_STATUS … … 64 64 /** 65 65 The function register DTPM2.0 instance. 66 66 67 67 @retval EFI_SUCCESS DTPM2.0 instance is registered, or system dose not surpport registr DTPM2.0 instance 68 68 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
r58464 r58466 2 2 # Provides a DTPM instance for TPM 2.0 3 3 # 4 # This library can be registered to Tpm 2.0 device router, to be active TPM 2.0 4 # This library can be registered to Tpm 2.0 device router, to be active TPM 2.0 5 5 # engine, based on platform setting. 6 6 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c
r58464 r58466 1 1 /** @file 2 2 TIS (TPM Interface Specification) functions used by dTPM2.0 library. 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 157 157 158 158 /// 159 /// When this bit is 1, TPM is in the Ready state, 159 /// When this bit is 1, TPM is in the Ready state, 160 160 /// indicating it is ready to receive a new command. 161 161 /// … … 207 207 { 208 208 UINT8 RegRead; 209 209 210 210 RegRead = MmioRead8 ((UINTN)&TisReg->Access); 211 211 return (BOOLEAN)(RegRead != (UINT8)-1); … … 244 244 245 245 /** 246 Get BurstCount by reading the burstCount field of a TIS regiger 246 Get BurstCount by reading the burstCount field of a TIS regiger 247 247 in the time of default TIS_TIMEOUT_D. 248 248 … … 288 288 289 289 /** 290 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 290 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 291 291 to Status Register in time. 292 292 … … 319 319 320 320 /** 321 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 321 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 322 322 to ACCESS Register in the time of default TIS_TIMEOUT_A. 323 323 … … 335 335 { 336 336 EFI_STATUS Status; 337 337 338 338 if (TisReg == NULL) { 339 339 return EFI_INVALID_PARAMETER; 340 340 } 341 341 342 342 if (!TisPcPresenceCheck (TisReg)) { 343 343 return EFI_NOT_FOUND; … … 357 357 Send a command to TPM for execution and return response data. 358 358 359 @param[in] TisReg TPM register space base address. 360 @param[in] BufferIn Buffer for command data. 361 @param[in] SizeIn Size of command data. 362 @param[in, out] BufferOut Buffer for response data. 363 @param[in, out] SizeOut Size of response data. 364 359 @param[in] TisReg TPM register space base address. 360 @param[in] BufferIn Buffer for command data. 361 @param[in] SizeIn Size of command data. 362 @param[in, out] BufferOut Buffer for response data. 363 @param[in, out] SizeOut Size of response data. 364 365 365 @retval EFI_SUCCESS Operation completed successfully. 366 366 @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small. … … 542 542 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 543 543 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 544 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 544 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 545 545 **/ 546 546 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.c
r58464 r58466 33 33 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 34 34 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 36 36 **/ 37 37 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
r58464 r58466 23 23 MODULE_TYPE = DXE_DRIVER 24 24 VERSION_STRING = 1.0 25 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 26 26 27 27 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterPei.c
r58464 r58466 55 55 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 56 56 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 57 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 57 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 58 58 **/ 59 59 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.c
r58464 r58466 21 21 #include <IndustryStandard/Tpm20.h> 22 22 23 EFI_TREE_PROTOCOL *mTreeProtocol = NULL; 23 EFI_TREE_PROTOCOL *mTreeProtocol = NULL; 24 24 25 25 /** … … 33 33 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 34 34 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 36 36 **/ 37 37 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.inf
r58464 r58466 22 22 MODULE_TYPE = DXE_DRIVER 23 23 VERSION_STRING = 1.0 24 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 25 26 26 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/CommonHeader.h
r48674 r58466 3 3 4 4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TisPc.c
r58459 r58466 3 3 4 4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 29 29 { 30 30 UINT8 RegRead; 31 31 32 32 RegRead = MmioRead8 ((UINTN)&TisReg->Access); 33 33 return (BOOLEAN)(RegRead != (UINT8)-1); … … 67 67 68 68 /** 69 Get BurstCount by reading the burstCount field of a TIS regiger 69 Get BurstCount by reading the burstCount field of a TIS regiger 70 70 in the time of default TIS_TIMEOUT_D. 71 71 … … 112 112 113 113 /** 114 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 114 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 115 115 to Status Register in time. 116 116 … … 144 144 145 145 /** 146 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 146 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 147 147 to ACCESS Register in the time of default TIS_TIMEOUT_A. 148 148 … … 161 161 { 162 162 EFI_STATUS Status; 163 163 164 164 if (TisReg == NULL) { 165 165 return EFI_INVALID_PARAMETER; 166 166 } 167 167 168 168 if (!TisPcPresenceCheck (TisReg)) { 169 169 return EFI_NOT_FOUND; -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TpmComm.c
r48674 r58466 3 3 4 4 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 22 22 @param[in] DataLen Size of the raw data. 23 23 @param[out] Digest Pointer to a buffer that stores the final digest. 24 24 25 25 @retval EFI_SUCCESS Always successfully calculate the final digest. 26 26 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
r58459 r58466 2 2 # Provides some common functions for the TCG feature 3 3 # 4 # This instance provides basic TPM Interface Specification (TIS) functions 4 # This instance provides basic TPM Interface Specification (TIS) functions 5 5 # and TPM hashall function. 6 6 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TrEEPpVendorLibNull/TrEEPpVendorLibNull.c
r58464 r58466 3 3 4 4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 20 20 21 21 This API should be invoked in BIOS boot phase to process pending request. 22 22 23 23 Caution: This function may receive untrusted input. 24 24 25 25 If OperationRequest < 128, then ASSERT(). 26 26 … … 51 51 52 52 This API should be invoked in BIOS boot phase to process pending request. 53 53 54 54 Caution: This function may receive untrusted input. 55 55 … … 85 85 86 86 Caution: This function may receive untrusted input. 87 87 88 88 If OperationRequest < 128, then ASSERT(). 89 89 … … 112 112 113 113 Caution: This function may receive untrusted input. 114 114 115 115 If OperationRequest < 128, then ASSERT(). 116 116 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TrEEPpVendorLibNull/TrEEPpVendorLibNull.inf
r58464 r58466 33 33 MdePkg/MdePkg.dec 34 34 SecurityPkg/SecurityPkg.dec 35 35 36 36 [LibraryClasses] 37 37 DebugLib -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/AesCore.c
r58464 r58466 1 1 /** @file 2 2 Core Primitive Implementation of the Advanced Encryption Standard (AES) algorithm. 3 Refer to FIPS PUB 197 ("Advanced Encryption Standard (AES)") for detailed algorithm 4 description of AES. 3 Refer to FIPS PUB 197 ("Advanced Encryption Standard (AES)") for detailed algorithm 4 description of AES. 5 5 6 6 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> … … 30 30 // 31 31 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 AesForwardTable[] = { 32 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 32 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 33 33 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 34 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 34 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 35 35 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 36 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 36 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 37 37 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 38 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 38 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 39 39 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 40 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 40 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 41 41 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 42 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 42 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 43 43 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 44 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 44 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 45 45 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 46 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 46 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 47 47 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 48 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 48 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 49 49 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 50 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 50 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 51 51 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 52 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 52 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 53 53 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 54 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 54 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 55 55 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 56 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 56 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 57 57 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 58 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 58 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 59 59 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 60 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 60 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 61 61 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 62 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 62 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 63 63 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 64 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 64 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 65 65 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 66 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 66 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 67 67 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 68 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 68 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 69 69 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 70 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 70 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 71 71 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 72 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 72 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 73 73 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 74 74 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a … … 114 114 115 115 /** 116 AES Key Expansion. 116 AES Key Expansion. 117 117 This function expands the cipher key into encryption schedule. 118 118 … … 162 162 LOAD32H (Ek[Index1], Key + Index2); 163 163 } 164 164 165 165 // 166 166 // Initialize the encryption key scheduler … … 182 182 } else { 183 183 // 184 // Different routine for key expansion If Cipher Key is 256 bits, 184 // Different routine for key expansion If Cipher Key is 256 bits, 185 185 // 186 186 for (Index1 = 1; Index1 < 4 && (Index1 + Index2) < Nw; Index1++) { … … 194 194 (AES_FT1((Temp) & 0xFF) & 0x000000FF); 195 195 } 196 196 197 197 for (Index1 = 5; Index1 < Nk && (Index1 + Index2) < Nw; Index1++) { 198 198 Ek[Index1 + Index2] = Ek[Index1 + Index2 - Nk] ^ Ek[Index1 + Index2 - 1]; … … 260 260 261 261 // 262 // AES Cipher transformation rounds (Nr - 1 rounds), in which SubBytes(), 263 // ShiftRows() and MixColumns() operations were combined by a sequence of 262 // AES Cipher transformation rounds (Nr - 1 rounds), in which SubBytes(), 263 // ShiftRows() and MixColumns() operations were combined by a sequence of 264 264 // table lookups to speed up the execution. 265 265 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/AsmRdRand.asm
r58464 r58466 20 20 ; Notes: 21 21 ; 22 ; Visual Studio coding practices do not use inline asm since multiple compilers and 22 ; Visual Studio coding practices do not use inline asm since multiple compilers and 23 23 ; architectures are supported assembler not recognizing rdrand instruction so using DB's. 24 24 ; … … 28 28 .model flat, C 29 29 .code 30 30 31 31 ;------------------------------------------------------------------------------ 32 32 ; Generate a 16 bit random number -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/GccRdRand.c
r58464 r58466 36 36 __asm__ __volatile__ ( 37 37 ".byte 0x66; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1" 38 :"=a" (*Rand), 38 :"=a" (*Rand), 39 39 "=qm" (Carry) 40 ); 40 ); 41 41 42 42 return (BOOLEAN) Carry; … … 62 62 __asm__ __volatile__ ( 63 63 ".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1" 64 :"=a" (*Rand), 64 :"=a" (*Rand), 65 65 "=qm" (Carry) 66 66 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/RdRandWord.c
r58464 r58466 34 34 35 35 // 36 // Generating a 64-bit rand on a 32-bit system by 36 // Generating a 64-bit rand on a 32-bit system by 37 37 // mapping two 32-bit RDRAND instructions. 38 38 // … … 97 97 return Status; 98 98 } 99 99 100 100 RandBuffer++; 101 101 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/RdRand.c
r58464 r58466 43 43 Status = EFI_UNSUPPORTED; 44 44 IsIntelCpu = FALSE; 45 45 46 46 // 47 47 // Checks whether the current processor is an Intel product by CPUID. … … 103 103 } 104 104 } 105 105 106 106 return EFI_NOT_READY; 107 107 } … … 141 141 } 142 142 } 143 143 144 144 return EFI_NOT_READY; 145 145 } … … 179 179 } 180 180 } 181 181 182 182 return EFI_NOT_READY; 183 183 } … … 215 215 216 216 // 217 // Compute the address of the first word aligned (32/64-bit) block in the 217 // Compute the address of the first word aligned (32/64-bit) block in the 218 218 // destination buffer, depending on whether we are in 32- or 64-bit mode. 219 219 // … … 286 286 delays to ensure reseeding and performs AES-CBC-MAC over the data to compute the 287 287 seed value. 288 288 289 289 @param[out] SeedBuffer Pointer to a 128bit buffer to store the random seed. 290 290 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/RdRand.h
r58464 r58466 30 30 31 31 // 32 // The maximun number of retries to obtain one available random number. 32 // The maximun number of retries to obtain one available random number. 33 33 // 34 34 #define RETRY_LIMIT 10 … … 142 142 IN BOOLEAN NeedRetry 143 143 ); 144 144 145 145 /** 146 146 Calls RDRAND to request a word-length random number. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c
r58464 r58466 1 /** @file 1 /** @file 2 2 RNG Driver to produce the UEFI Random Number Generator protocol. 3 3 4 The driver will use the new RDRAND instruction to produce high-quality, high-performance 4 The driver will use the new RDRAND instruction to produce high-quality, high-performance 5 5 entropy and random number. 6 6 … … 16 16 17 17 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 18 This program and the accompanying materials 19 are licensed and made available under the terms and conditions of the BSD License 20 which accompanies this distribution. The full text of the license may be found at 18 This program and the accompanying materials 19 are licensed and made available under the terms and conditions of the BSD License 20 which accompanies this distribution. The full text of the license may be found at 21 21 http://opensource.org/licenses/bsd-license.php 22 22 23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 24 24 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 25 25 … … 40 40 41 41 @param[in] This A pointer to the EFI_RNG_PROTOCOL instance. 42 @param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAlgorithmList. 42 @param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAlgorithmList. 43 43 On output with a return code of EFI_SUCCESS, the size 44 44 in bytes of the data returned in RNGAlgorithmList. On output … … 89 89 } 90 90 *RNGAlgorithmListSize = RequiredSize; 91 91 92 92 return Status; 93 93 } … … 151 151 if (CompareGuid (RNGAlgorithm, &gEfiRngAlgorithmRaw)) { 152 152 // 153 // When a DRBG is used on the output of a entropy source, 153 // When a DRBG is used on the output of a entropy source, 154 154 // its security level must be at least 256 bits according to UEFI Spec. 155 155 // … … 157 157 return EFI_INVALID_PARAMETER; 158 158 } 159 159 160 160 Status = RdRandGenerateEntropy (RNGValueLength, RNGValue); 161 161 return Status; … … 215 215 NULL 216 216 ); 217 217 218 218 return Status; 219 219 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
r58464 r58466 60 60 UefiBootServicesTableLib 61 61 BaseLib 62 DebugLib 62 DebugLib 63 63 UefiDriverEntryPoint 64 64 TimerLib -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/X64/AsmRdRand.asm
r58464 r58466 20 20 ; Notes: 21 21 ; 22 ; Visual Studio coding practices do not use inline asm since multiple compilers and 22 ; Visual Studio coding practices do not use inline asm since multiple compilers and 23 23 ; architectures are supported assembler not recognizing rdrand instruction so using DB's. 24 24 ; … … 26 26 27 27 .code 28 28 29 29 ;------------------------------------------------------------------------------ 30 30 ; Generate a 16 bit random number … … 71 71 RdRand64Step PROC 72 72 ; rdrand rax ; generate a 64 bit RN into rax, CF=1 if RN generated ok, otherwise CF=0 73 db 048h, 0fh, 0c7h, 0f0h ; rdrand r64: "REX.W + 0F C7 /6 ModRM:r/m(w)" 73 db 048h, 0fh, 0c7h, 0f0h ; rdrand r64: "REX.W + 0F C7 /6 ModRM:r/m(w)" 74 74 jb rn64_ok ; jmp if CF=1 75 75 xor rax, rax ; reg=0 if CF=0 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/X64/GccRdRand.c
r58464 r58466 38 38 :"=a" (*Rand), 39 39 "=qm" (Carry) 40 ); 40 ); 41 41 42 42 return (BOOLEAN) Carry; … … 62 62 __asm__ __volatile__ ( 63 63 ".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1" 64 :"=a" (*Rand), 64 :"=a" (*Rand), 65 65 "=qm" (Carry) 66 66 ); … … 88 88 __asm__ __volatile__ ( 89 89 ".byte 0x48; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1" 90 :"=a" (*Rand), 90 :"=a" (*Rand), 91 91 "=qm" (Carry) 92 92 ); 93 93 94 94 return (BOOLEAN) Carry; 95 95 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/X64/RdRandWord.c
r58464 r58466 63 63 return Status; 64 64 } 65 65 66 66 RandBuffer++; 67 67 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/SecurityPkg.dec
-
Property svn:eol-style
set to
native
r58459 r58466 29 29 [LibraryClasses] 30 30 ## @libraryclass Provides hash interfaces from different implementations. 31 # 31 # 32 32 HashLib|Include/Library/HashLib.h 33 33 34 34 ## @libraryclass Provides a platform specific interface to detect physically present user. 35 35 # 36 36 PlatformSecureLib|Include/Library/PlatformSecureLib.h 37 37 38 38 ## @libraryclass Provides interfaces to handle TPM 1.2 request. 39 39 # 40 40 TcgPhysicalPresenceLib|Include/Library/TcgPhysicalPresenceLib.h 41 41 42 42 ## @libraryclass Provides support for TCG PP >= 128 Vendor Specific PPI Operation. 43 43 # 44 44 TcgPpVendorLib|Include/Library/TcgPpVendorLib.h 45 45 46 46 ## @libraryclass Provides interfaces for other modules to send TPM 2.0 command. 47 47 # 48 48 Tpm2CommandLib|Include/Library/Tpm2CommandLib.h 49 49 50 50 ## @libraryclass Provides interfaces on how to access TPM 2.0 hardware device. 51 51 # 52 52 Tpm2DeviceLib|Include/Library/Tpm2DeviceLib.h 53 53 54 54 ## @libraryclass Provides interfaces for other modules to send TPM 1.2 command. 55 55 # 56 56 Tpm12CommandLib|Include/Library/Tpm12CommandLib.h 57 57 58 58 ## @libraryclass Provides interfaces on how to access TPM 1.2 hardware device. 59 59 # 60 60 Tpm12DeviceLib|Include/Library/Tpm12DeviceLib.h 61 61 62 62 ## @libraryclass Provides TPM Interface Specification (TIS) interfaces for TPM command. 63 63 # 64 64 TpmCommLib|Include/Library/TpmCommLib.h 65 65 66 66 ## @libraryclass Provides common interfaces about TPM measurement for other modules. 67 67 # 68 68 TpmMeasurementLib|Include/Library/TpmMeasurementLib.h 69 69 70 70 ## @libraryclass Provides interfaces to handle TPM 2.0 request. 71 71 # 72 72 TrEEPhysicalPresenceLib|Include/Library/TrEEPhysicalPresenceLib.h 73 73 74 74 ## @libraryclass Provides support for TrEE PP >= 128 Vendor Specific PPI Operation. 75 75 # … … 100 100 101 101 ## GUID used to "VendorKeysNv" variable to record the out of band secure boot keys modification. 102 # This variable is a read-only NV variable that indicates whether someone other than the platform vendor has used a 102 # This variable is a read-only NV variable that indicates whether someone other than the platform vendor has used a 103 103 # mechanism not defined by the UEFI Specification to transition the system to setup mode or to update secure boot keys. 104 104 # Include/Guid/AuthenticatedVariableFormat.h … … 108 108 # Include/Guid/AuthenticatedVariableFormat.h 109 109 gEfiCertDbGuid = { 0xd9bee56e, 0x75dc, 0x49d9, { 0xb4, 0xd7, 0xb5, 0x34, 0x21, 0xf, 0x63, 0x7a } } 110 110 111 111 ## Hob GUID used to pass a TCG_PCR_EVENT from a TPM PEIM to a TPM DXE Driver. 112 112 # Include/Guid/TcgEventHob.h … … 124 124 # Include/Guid/PhysicalPresenceData.h 125 125 gEfiPhysicalPresenceGuid = { 0xf6499b1, 0xe9ad, 0x493d, { 0xb9, 0xc2, 0x2f, 0x90, 0x81, 0x5c, 0x6c, 0xbc }} 126 126 127 127 ## GUID used for form browser, password credential and provider identifier. 128 128 # Include/Guid/PwdCredentialProviderHii.h … … 144 144 # Include/Guid/TcgConfigHii.h 145 145 gTcgConfigFormSetGuid = { 0xb0f901e4, 0xc424, 0x45de, { 0x90, 0x81, 0x95, 0xe2, 0xb, 0xde, 0x6f, 0xb5 }} 146 146 147 147 ## GUID used for FormSet. 148 148 # Include/Guid/SecureBootConfigHii.h … … 156 156 # Include/Guid/TpmInstance.h 157 157 gEfiTpmDeviceInstanceNoneGuid = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } 158 158 159 159 ## GUID value used for PcdTpmInstanceGuid to indicate TPM 1.2 device is selected to support. 160 160 # Include/Guid/TpmInstance.h 161 161 gEfiTpmDeviceInstanceTpm12Guid = { 0x8b01e5b6, 0x4f19, 0x46e8, { 0xab, 0x93, 0x1c, 0x53, 0x67, 0x1b, 0x90, 0xcc } } 162 162 163 163 ## GUID value used for PcdTpmInstanceGuid to indicate discrete TPM 2.0 device is selected to support. 164 164 # Include/Guid/TpmInstance.h 165 165 gEfiTpmDeviceInstanceTpm20DtpmGuid = { 0x286bf25a, 0xc2c3, 0x408c, { 0xb3, 0xb4, 0x25, 0xe6, 0x75, 0x8b, 0x73, 0x17 } } 166 166 167 167 ## GUID used to select supported TPM instance from UI. 168 168 # Include/Guid/TpmInstance.h … … 232 232 # 0x00000005 Query user when there is security violation.<BR> 233 233 # @Prompt Set policy for the image from fixed media. 234 # @ValidRange 0x80000001 | 0x00000000 - 0x00000005 234 # @ValidRange 0x80000001 | 0x00000000 - 0x00000005 235 235 gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04|UINT32|0x00000003 236 236 237 ## Defer Image Load policy settings. The policy is bitwise. 238 # If a bit is set, the image from corresponding device will be trusted when loading. Or 237 ## Defer Image Load policy settings. The policy is bitwise. 238 # If a bit is set, the image from corresponding device will be trusted when loading. Or 239 239 # the image will be deferred. The deferred image will be checked after user is identified.<BR><BR> 240 240 # BIT0 - Image from unknown device. <BR> … … 244 244 # BIT4 - Image from fixed media device which includes hard disk.<BR> 245 245 # @Prompt Set policy whether trust image before user identification. 246 # @ValidRange 0x80000002 | 0x00000000 - 0x0000001F 246 # @ValidRange 0x80000002 | 0x00000000 - 0x0000001F 247 247 gEfiSecurityPkgTokenSpaceGuid.PcdDeferImageLoadPolicy|0x0000001F|UINT32|0x0000004 248 248 … … 255 255 # Note: This PCD is not been used. 256 256 # @Prompt Max variable size for append operation. 257 gEfiSecurityPkgTokenSpaceGuid.PcdMaxAppendVariableSize|0x2000|UINT32|0x30000005 257 gEfiSecurityPkgTokenSpaceGuid.PcdMaxAppendVariableSize|0x2000|UINT32|0x30000005 258 258 259 259 ## Specifies the type of TCG platform that contains TPM chip.<BR><BR> … … 261 261 # If 1, TCG platform type is PC server.<BR> 262 262 # @Prompt Select platform type. 263 # @ValidRange 0x80000001 | 0x00 - 0x1 263 # @ValidRange 0x80000001 | 0x00 - 0x1 264 264 gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass|0|UINT8|0x00000006 265 265 266 266 ## Progress Code for TPM device subclass definitions.<BR><BR> 267 267 # EFI_PERIPHERAL_TPM = (EFI_PERIPHERAL | 0x000D0000) = 0x010D0000<BR> … … 272 272 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] 273 273 ## Indicates the presence or absence of the platform operator during firmware booting. 274 # If platform operator is not physical presence during boot. TPM will be locked and the TPM commands 274 # If platform operator is not physical presence during boot. TPM will be locked and the TPM commands 275 275 # that required operator physical presence can not run.<BR><BR> 276 276 # TRUE - The platform operator is physically present.<BR> … … 280 280 281 281 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] 282 ## Indicates whether TPM physical presence is locked during platform initialization. 282 ## Indicates whether TPM physical presence is locked during platform initialization. 283 283 # Once it is locked, it can not be unlocked for TPM life time.<BR><BR> 284 284 # TRUE - Lock TPM physical presence asserting method.<BR> … … 312 312 # If 1, initialization needed.<BR> 313 313 # @Prompt TPM 2.0 device initialization policy.<BR> 314 # @ValidRange 0x80000001 | 0x00 - 0x1 314 # @ValidRange 0x80000001 | 0x00 - 0x1 315 315 gEfiSecurityPkgTokenSpaceGuid.PcdTpm2InitializationPolicy|1|UINT8|0x0001000A 316 316 … … 319 319 # If 1, initialization needed.<BR> 320 320 # @Prompt TPM 1.2 device initialization policy. 321 # @ValidRange 0x80000001 | 0x00 - 0x1 321 # @ValidRange 0x80000001 | 0x00 - 0x1 322 322 gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy|1|UINT8|0x0001000B 323 323 … … 326 326 # if 1, SelfTest needed.<BR> 327 327 # @Prompt TPM 2.0 device selftest. 328 # @ValidRange 0x80000001 | 0x00 - 0x1 328 # @ValidRange 0x80000001 | 0x00 - 0x1 329 329 gEfiSecurityPkgTokenSpaceGuid.PcdTpm2SelfTestPolicy|1|UINT8|0x0001000C 330 330 … … 333 333 # if 1, SCRTM measurement done by BIOS.<BR> 334 334 # @Prompt SCRTM policy setting for TPM 2.0 device. 335 # @ValidRange 0x80000001 | 0x00 - 0x1 335 # @ValidRange 0x80000001 | 0x00 - 0x1 336 336 gEfiSecurityPkgTokenSpaceGuid.PcdTpm2ScrtmPolicy|1|UINT8|0x0001000D 337 337 … … 340 340 # if 1, SCRTM measurement done by BIOS.<BR> 341 341 # @Prompt SCRTM policy setting for TPM 1.2 device 342 # @ValidRange 0x80000001 | 0x00 - 0x1 342 # @ValidRange 0x80000001 | 0x00 - 0x1 343 343 gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy|1|UINT8|0x0001000E 344 344 … … 358 358 # BIT3 - SHA512.<BR> 359 359 # @Prompt Hash mask for TPM 2.0 360 # @ValidRange 0x80000001 | 0x00000000 - 0x0000000F 360 # @ValidRange 0x80000001 | 0x00000000 - 0x0000000F 361 361 gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x0000000F|UINT32|0x00010010 362 362 … … 376 376 # 377 377 gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer|{0x91, 0x29, 0xc4, 0xbd, 0xea, 0x6d, 0xda, 0xb3, 0xaa, 0x6f, 0x50, 0x16, 0xfc, 0xdb, 0x4b, 0x7e, 0x3c, 0xd6, 0xdc, 0xa4, 0x7a, 0x0e, 0xdd, 0xe6, 0x15, 0x8c, 0x73, 0x96, 0xa2, 0xd4, 0xa6, 0x4d}|VOID*|0x00010013 378 378 379 379 [UserExtensions.TianoCore."ExtraFiles"] 380 380 SecurityPkgExtra.uni -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/SecurityPkg.dsc
r58459 r58466 25 25 [LibraryClasses] 26 26 DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf 27 DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 27 DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 28 28 BaseLib|MdePkg/Library/BaseLib/BaseLib.inf 29 29 SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf … … 117 117 Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf 118 118 Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.inf 119 119 120 120 [PcdsDynamicDefault.common.DEFAULT] 121 121 gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0xb6, 0xe5, 0x01, 0x8b, 0x19, 0x4f, 0xe8, 0x46, 0xab, 0x93, 0x1c, 0x53, 0x67, 0x1b, 0x90, 0xcc} … … 173 173 SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf 174 174 SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.inf 175 175 176 176 [Components.IA32, Components.X64, Components.IPF] 177 177 # SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderDxe.inf … … 233 233 234 234 [Components.IPF] 235 SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/EsalVariableDxeSal.inf 235 SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/EsalVariableDxeSal.inf 236 236 237 237 [BuildOptions] -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.c
r58459 r58466 2 2 TCG MOR (Memory Overwrite Request) Control Driver. 3 3 4 This driver initilize MemoryOverwriteRequestControl variable. It 4 This driver initilize MemoryOverwriteRequestControl variable. It 5 5 will clear MOR_CLEAR_MEMORY_BIT bit if it is set. 6 6 7 7 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 11 http://opensource.org/licenses/bsd-license.php 12 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 … … 38 38 EFI_STATUS Status; 39 39 UINTN DataSize; 40 40 41 41 if (MOR_CLEAR_MEMORY_VALUE (mMorControl) == 0x0) { 42 42 // … … 49 49 // 50 50 DEBUG ((EFI_D_INFO, "TcgMor: Clear MorClearMemory bit\n")); 51 mMorControl &= 0xFE; 51 mMorControl &= 0xFE; 52 52 53 53 DataSize = sizeof (mMorControl); 54 54 Status = gRT->SetVariable ( 55 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 56 &gEfiMemoryOverwriteControlDataGuid, 55 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 56 &gEfiMemoryOverwriteControlDataGuid, 57 57 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 58 DataSize, 58 DataSize, 59 59 &mMorControl 60 60 ); … … 71 71 @param[in] SystemTable A Pointer to the EFI System Table. 72 72 73 @retval EFI_SUCEESS 73 @retval EFI_SUCEESS 74 74 @return Others Some error occurs. 75 75 **/ … … 91 91 DataSize = sizeof (mMorControl); 92 92 Status = gRT->GetVariable ( 93 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 94 &gEfiMemoryOverwriteControlDataGuid, 95 NULL, 96 &DataSize, 93 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 94 &gEfiMemoryOverwriteControlDataGuid, 95 NULL, 96 &DataSize, 97 97 &mMorControl 98 98 ); … … 103 103 mMorControl = 0; 104 104 Status = gRT->SetVariable ( 105 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 106 &gEfiMemoryOverwriteControlDataGuid, 105 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 106 &gEfiMemoryOverwriteControlDataGuid, 107 107 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 108 DataSize, 108 DataSize, 109 109 &mMorControl 110 110 ); … … 121 121 &Event 122 122 ); 123 } 124 123 } 124 125 125 return Status; 126 126 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.h
r58459 r58466 3 3 4 4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/PhysicalPresencePei/PhysicalPresencePei.c
r48674 r58466 1 1 /** @file 2 This driver produces PEI_LOCK_PHYSICAL_PRESENCE_PPI to indicate 3 whether TPM need be locked or not. It can be replaced by a platform 2 This driver produces PEI_LOCK_PHYSICAL_PRESENCE_PPI to indicate 3 whether TPM need be locked or not. It can be replaced by a platform 4 4 specific driver. 5 5 6 6 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 10 http://opensource.org/licenses/bsd-license.php 11 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 14 … … 71 71 72 72 // 73 // The CRTM has sensed the physical presence assertion of the user. For example, 74 // the user has pressed the startup button or inserted a USB dongle. The details 73 // The CRTM has sensed the physical presence assertion of the user. For example, 74 // the user has pressed the startup button or inserted a USB dongle. The details 75 75 // of the implementation are vendor-specific. Here we read a PCD value to indicate 76 76 // whether operator physical presence. 77 // 77 // 78 78 if (!PcdGetBool (PcdTpmPhysicalPresence)) { 79 79 return TRUE; … … 81 81 82 82 // 83 // Check the pending TPM requests. Lock TPM physical presence if there is no TPM 84 // request. 83 // Check the pending TPM requests. Lock TPM physical presence if there is no TPM 84 // request. 85 85 // 86 86 Status = PeiServicesLocatePpi ( … … 92 92 if (!EFI_ERROR (Status)) { 93 93 DataSize = sizeof (EFI_PHYSICAL_PRESENCE); 94 Status = Variable->GetVariable ( 95 Variable, 94 Status = Variable->GetVariable ( 95 Variable, 96 96 PHYSICAL_PRESENCE_VARIABLE, 97 97 &gEfiPhysicalPresenceGuid, … … 116 116 Entry point of this module. 117 117 118 It installs lock physical presence PPI. 118 It installs lock physical presence PPI. 119 119 120 120 @param[in] FileHandle Handle of the file being invoked. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/PhysicalPresencePei/PhysicalPresencePei.inf
r58459 r58466 3 3 # 4 4 # This module produces PEI_LOCK_PHYSICAL_PRESENCE_PPI to indicate whether 5 # TPM physical presence needs to be locked. It can be replaced by a 5 # TPM physical presence needs to be locked. It can be replaced by a 6 6 # platform specific module. 7 7 # … … 55 55 gEfiSecurityPkgTokenSpaceGuid.PcdTpmPhysicalPresence ## SOMETIMES_CONSUMES 56 56 57 [Depex] 57 [Depex] 58 58 gEfiPeiMemoryDiscoveredPpiGuid AND 59 59 gEfiPeiReadOnlyVariable2PpiGuid AND -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfig.vfr
-
Property svn:eol-style
set to
native
r58459 r58466 3 3 4 4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 68 68 endif 69 69 // 70 // Clear (TPM_ORD_ForceClear) command is not available when disabled or deactivated. 70 // Clear (TPM_ORD_ForceClear) command is not available when disabled or deactivated. 71 71 // 72 72 suppressif ideqval TCG_CONFIGURATION.TpmEnable == 0 OR … … 77 77 78 78 option text = STRING_TOKEN(STR_ENABLE), value = PHYSICAL_PRESENCE_ENABLE, flags = RESET_REQUIRED; 79 option text = STRING_TOKEN(STR_TPM_ENABLE_ACTIVATE), value = PHYSICAL_PRESENCE_ENABLE_ACTIVATE, flags = RESET_REQUIRED; 79 option text = STRING_TOKEN(STR_TPM_ENABLE_ACTIVATE), value = PHYSICAL_PRESENCE_ENABLE_ACTIVATE, flags = RESET_REQUIRED; 80 80 option text = STRING_TOKEN(STR_TPM_ENABLE_ACTIVATE_CLEAR), value = PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR, flags = RESET_REQUIRED; 81 81 option text = STRING_TOKEN(STR_TPM_ENABLE_ACTIVATE_CLEAR_E_A), value = PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE, flags = RESET_REQUIRED; -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDriver.c
r58459 r58466 3 3 4 4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 54 54 TcgProtocol = NULL; 55 55 } 56 56 57 57 Status = gBS->OpenProtocol ( 58 58 ImageHandle, … … 66 66 return EFI_ALREADY_STARTED; 67 67 } 68 68 69 69 // 70 70 // Create a private data structure. … … 74 74 return EFI_OUT_OF_RESOURCES; 75 75 } 76 76 77 77 PrivateData->TcgProtocol = TcgProtocol; 78 78 79 79 // 80 80 // Install TCG configuration form … … 87 87 // 88 88 // Install private GUID. 89 // 89 // 90 90 Status = gBS->InstallMultipleProtocolInterfaces ( 91 91 &ImageHandle, … … 104 104 if (PrivateData != NULL) { 105 105 UninstallTcgConfigForm (PrivateData); 106 } 107 106 } 107 108 108 return Status; 109 109 } … … 131 131 &gEfiCallerIdGuid, 132 132 (VOID **) &PrivateData 133 ); 133 ); 134 134 if (EFI_ERROR (Status)) { 135 return Status; 135 return Status; 136 136 } 137 137 138 138 ASSERT (PrivateData->Signature == TCG_CONFIG_PRIVATE_DATA_SIGNATURE); 139 139 … … 144 144 NULL 145 145 ); 146 146 147 147 UninstallTcgConfigForm (PrivateData); 148 148 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf
r58459 r58466 59 59 ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence" 60 60 gEfiPhysicalPresenceGuid 61 61 62 62 gEfiIfrTianoGuid ## SOMETIMES_PRODUCES ## GUID # HII opcode 63 63 ## PRODUCES ## HII … … 79 79 gEfiVariableArchProtocolGuid AND 80 80 gEfiVariableWriteArchProtocolGuid 81 81 82 82 [UserExtensions.TianoCore."ExtraFiles"] 83 83 TcgConfigDxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.c
r58459 r58466 3 3 4 4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 41 41 END_DEVICE_PATH_TYPE, 42 42 END_ENTIRE_DEVICE_PATH_SUBTYPE, 43 { 43 { 44 44 (UINT8) (END_DEVICE_PATH_LENGTH), 45 45 (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) … … 74 74 75 75 ASSERT (TcgProtocol != NULL); 76 76 77 77 // 78 78 // Get TPM Permanent flags (TpmEnable, TpmActivate) … … 83 83 *(UINT32*)&CmdBuf[2] = SwapBytes32 (TpmSendSize); 84 84 *(UINT32*)&CmdBuf[6] = SwapBytes32 (TPM_ORD_GetCapability); 85 85 86 86 *(UINT32*)&CmdBuf[10] = SwapBytes32 (TPM_CAP_FLAG); 87 87 *(UINT32*)&CmdBuf[14] = SwapBytes32 (sizeof (TPM_CAP_FLAG_PERMANENT)); … … 94 94 sizeof (CmdBuf), 95 95 CmdBuf 96 ); 96 ); 97 97 TpmRsp = (TPM_RSP_COMMAND_HDR *) &CmdBuf[0]; 98 98 if (EFI_ERROR (Status) || (TpmRsp->tag != SwapBytes16 (TPM_TAG_RSP_COMMAND)) || (TpmRsp->returnCode != 0)) { 99 99 return EFI_DEVICE_ERROR; 100 100 } 101 101 102 102 TpmPermanentFlags = (TPM_PERMANENT_FLAGS *) &CmdBuf[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)]; 103 103 … … 110 110 } 111 111 } 112 113 return EFI_SUCCESS; 112 113 return EFI_SUCCESS; 114 114 } 115 115 … … 179 179 // 180 180 // Convert buffer data to <ConfigResp> by helper function BlockToConfig() 181 // 181 // 182 182 ZeroMem (&Configuration, sizeof (TCG_CONFIGURATION)); 183 183 … … 337 337 if (EFI_ERROR (Status)) { 338 338 return Status; 339 } 340 339 } 340 341 341 PpData.PPRequest = PpRequest; 342 342 Status = gRT->SetVariable ( … … 397 397 SavePpRequest (Value->u8); 398 398 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; 399 399 400 400 return EFI_SUCCESS; 401 401 } … … 455 455 ConfigAccess, 456 456 NULL 457 ); 457 ); 458 458 459 459 return EFI_OUT_OF_RESOURCES; 460 460 } 461 461 462 462 PrivateData->HiiHandle = HiiHandle; 463 463 464 return EFI_SUCCESS; 464 return EFI_SUCCESS; 465 465 } 466 466 … … 498 498 PrivateData->DriverHandle = NULL; 499 499 } 500 500 501 501 FreePool (PrivateData); 502 502 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.h
r58459 r58466 4 4 5 5 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 60 60 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; 61 61 EFI_HII_HANDLE HiiHandle; 62 EFI_HANDLE DriverHandle; 62 EFI_HANDLE DriverHandle; 63 63 64 64 EFI_TCG_PROTOCOL *TcgProtocol; -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigNvData.h
r58459 r58466 3 3 4 4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TcgDxe.c
r58459 r58466 1 /** @file 1 /** @file 2 2 This module implements TCG EFI Protocol. 3 3 4 4 Caution: This module requires additional review when modified. 5 5 This driver will have external input - TcgDxePassThroughToTpm … … 10 10 11 11 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR> 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 15 15 http://opensource.org/licenses/bsd-license.php 16 16 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 18 18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 19 19 … … 91 91 // The following EFI_TCG_SERVER_ACPI_TABLE default setting is just one example, 92 92 // the TPM device connectes to LPC, and also defined the ACPI _UID as 0xFF, 93 // this _UID can be changed and should match with the _UID setting of the TPM 94 // ACPI device object 93 // this _UID can be changed and should match with the _UID setting of the TPM 94 // ACPI device object 95 95 // 96 96 EFI_TCG_SERVER_ACPI_TABLE mTcgServerAcpiTemplate = { … … 214 214 215 215 /** 216 This service provides EFI protocol capability information, state information 216 This service provides EFI protocol capability information, state information 217 217 about the TPM, and Event Log state information. 218 218 219 219 @param[in] This Indicates the calling context 220 @param[out] ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY 221 structure and fills in the fields with the EFI protocol 220 @param[out] ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY 221 structure and fills in the fields with the EFI protocol 222 222 capability information and the current TPM state information. 223 @param[out] TCGFeatureFlags This is a pointer to the feature flags. No feature 224 flags are currently defined so this parameter 225 MUST be set to 0. However, in the future, 226 feature flags may be defined that, for example, 223 @param[out] TCGFeatureFlags This is a pointer to the feature flags. No feature 224 flags are currently defined so this parameter 225 MUST be set to 0. However, in the future, 226 feature flags may be defined that, for example, 227 227 enable hash algorithm agility. 228 228 @param[out] EventLogLocation This is a pointer to the address of the event log in memory. 229 @param[out] EventLogLastEntry If the Event Log contains more than one entry, 230 this is a pointer to the address of the start of 231 the last entry in the event log in memory. 229 @param[out] EventLogLastEntry If the Event Log contains more than one entry, 230 this is a pointer to the address of the start of 231 the last entry in the event log in memory. 232 232 233 233 @retval EFI_SUCCESS Operation completed successfully. 234 234 @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability. 235 235 236 236 **/ 237 237 EFI_STATUS … … 278 278 /** 279 279 This service abstracts the capability to do a hash operation on a data buffer. 280 280 281 281 @param[in] This Indicates the calling context 282 282 @param[in] HashData Pointer to the data buffer to be hashed … … 284 284 @param[in] AlgorithmId Identification of the Algorithm to use for the hashing operation 285 285 @param[in, out] HashedDataLen Resultant length of the hashed data 286 @param[in, out] HashedDataResult Resultant buffer of the hashed data 287 286 @param[in, out] HashedDataResult Resultant buffer of the hashed data 287 288 288 @retval EFI_SUCCESS Operation completed successfully. 289 289 @retval EFI_INVALID_PARAMETER HashDataLen is NULL. … … 292 292 @retval EFI_UNSUPPORTED AlgorithmId not supported. 293 293 @retval EFI_BUFFER_TOO_SMALL *HashedDataLen < sizeof (TCG_DIGEST). 294 294 295 295 **/ 296 296 EFI_STATUS … … 327 327 if (*HashedDataResult == NULL) { 328 328 *HashedDataResult = AllocatePool ((UINTN) *HashedDataLen); 329 } 329 } 330 330 331 331 return TpmCommHashAll ( … … 343 343 344 344 @param[in] TcgData TCG_DXE_DATA structure. 345 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 346 @param[in] NewEventData Pointer to the new event data. 347 345 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 346 @param[in] NewEventData Pointer to the new event data. 347 348 348 @retval EFI_SUCCESS The new event log entry was added. 349 349 @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. … … 383 383 384 384 @param[in] This Indicates the calling context 385 @param[in] TCGLogData Pointer to the start of the data buffer containing 386 the TCG_PCR_EVENT data structure. All fields in 385 @param[in] TCGLogData Pointer to the start of the data buffer containing 386 the TCG_PCR_EVENT data structure. All fields in 387 387 this structure are properly filled by the caller. 388 388 @param[in, out] EventNumber The event number of the event just logged 389 @param[in] Flags Indicate additional flags. Only one flag has been 390 defined at this time, which is 0x01 and means the 391 extend operation should not be performed. All 392 other bits are reserved. 393 389 @param[in] Flags Indicate additional flags. Only one flag has been 390 defined at this time, which is 0x01 and means the 391 extend operation should not be performed. All 392 other bits are reserved. 393 394 394 @retval EFI_SUCCESS Operation completed successfully. 395 395 @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action. 396 396 397 397 **/ 398 398 EFI_STATUS … … 412 412 413 413 TcgData = TCG_DXE_DATA_FROM_THIS (This); 414 414 415 415 if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) { 416 416 return EFI_DEVICE_ERROR; … … 436 436 @retval EFI_UNSUPPORTED Current Task Priority Level >= EFI_TPL_CALLBACK. 437 437 @retval EFI_TIMEOUT The TIS timed-out. 438 438 439 439 **/ 440 440 EFI_STATUS … … 450 450 TCG_DXE_DATA *TcgData; 451 451 452 if (TpmInputParameterBlock == NULL || 453 TpmOutputParameterBlock == NULL || 452 if (TpmInputParameterBlock == NULL || 453 TpmOutputParameterBlock == NULL || 454 454 TpmInputParameterBlockSize == 0 || 455 455 TpmOutputParameterBlockSize == 0) { … … 474 474 475 475 @param[in] TcgData TCG_DXE_DATA structure. 476 @param[in] HashData Physical address of the start of the data buffer 476 @param[in] HashData Physical address of the start of the data buffer 477 477 to be hashed, extended, and logged. 478 478 @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData 479 @param[in, out] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 480 @param[in] NewEventData Pointer to the new event data. 479 @param[in, out] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 480 @param[in] NewEventData Pointer to the new event data. 481 481 482 482 @retval EFI_SUCCESS Operation completed successfully. … … 542 542 543 543 @param[in] This Indicates the calling context 544 @param[in] HashData Physical address of the start of the data buffer 544 @param[in] HashData Physical address of the start of the data buffer 545 545 to be hashed, extended, and logged. 546 546 @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData 547 547 @param[in] AlgorithmId Identification of the Algorithm to use for the hashing operation 548 @param[in, out] TCGLogData The physical address of the start of the data 548 @param[in, out] TCGLogData The physical address of the start of the data 549 549 buffer containing the TCG_PCR_EVENT data structure. 550 550 @param[in, out] EventNumber The event number of the event just logged. 551 @param[out] EventLogLastEntry Physical address of the first byte of the entry 552 just placed in the Event Log. If the Event Log was 553 empty when this function was called then this physical 554 address will be the same as the physical address of 551 @param[out] EventLogLastEntry Physical address of the first byte of the entry 552 just placed in the Event Log. If the Event Log was 553 empty when this function was called then this physical 554 address will be the same as the physical address of 555 555 the start of the Event Log. 556 556 … … 559 559 @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK. 560 560 @retval EFI_DEVICE_ERROR The command was unsuccessful. 561 561 562 562 **/ 563 563 EFI_STATUS … … 581 581 582 582 TcgData = TCG_DXE_DATA_FROM_THIS (This); 583 583 584 584 if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) { 585 585 return EFI_DEVICE_ERROR; 586 586 } 587 587 588 588 if (AlgorithmId != TPM_ALG_SHA) { 589 589 return EFI_UNSUPPORTED; 590 590 } 591 591 592 592 if (HashData == 0 && HashDataLen > 0) { 593 593 return EFI_INVALID_PARAMETER; … … 649 649 EFI_PEI_HOB_POINTERS GuidHob; 650 650 EFI_PHYSICAL_ADDRESS Lasa; 651 651 652 652 if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_CLIENT) { 653 653 Lasa = mTcgClientAcpiTemplate.Lasa; 654 654 655 655 Status = gBS->AllocatePages ( 656 656 AllocateMaxAddress, … … 664 664 mTcgClientAcpiTemplate.Lasa = Lasa; 665 665 // 666 // To initialize them as 0xFF is recommended 666 // To initialize them as 0xFF is recommended 667 667 // because the OS can know the last entry for that. 668 668 // 669 669 SetMem ((VOID *)(UINTN)mTcgClientAcpiTemplate.Lasa, EFI_TCG_LOG_AREA_SIZE, 0xFF); 670 670 mTcgClientAcpiTemplate.Laml = EFI_TCG_LOG_AREA_SIZE; 671 671 672 672 } else { 673 673 Lasa = mTcgServerAcpiTemplate.Lasa; 674 674 675 675 Status = gBS->AllocatePages ( 676 676 AllocateMaxAddress, … … 684 684 mTcgServerAcpiTemplate.Lasa = Lasa; 685 685 // 686 // To initialize them as 0xFF is recommended 686 // To initialize them as 0xFF is recommended 687 687 // because the OS can know the last entry for that. 688 688 // … … 692 692 693 693 GuidHob.Raw = GetHobList (); 694 while (!EFI_ERROR (Status) && 694 while (!EFI_ERROR (Status) && 695 695 (GuidHob.Raw = GetNextGuidHob (&gTcgEventEntryHobGuid, GuidHob.Raw)) != NULL) { 696 696 TcgEvent = GET_GUID_HOB_DATA (GuidHob.Guid); … … 709 709 Measure and log an action string, and extend the measurement result into PCR[5]. 710 710 711 @param[in] String A specific string that indicates an Action event. 712 711 @param[in] String A specific string that indicates an Action event. 712 713 713 @retval EFI_SUCCESS Operation completed successfully. 714 714 @retval EFI_DEVICE_ERROR The operation was unsuccessful. … … 788 788 if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) { 789 789 // 790 // Tcg Server spec. 790 // Tcg Server spec. 791 791 // Measure each processor EFI_CPU_PHYSICAL_LOCATION with EV_TABLE_OF_DEVICES to PCR[1] 792 792 // … … 820 820 Measure and log Separator event, and extend the measurement result into a specific PCR. 821 821 822 @param[in] PCRIndex PCR index. 822 @param[in] PCRIndex PCR index. 823 823 824 824 @retval EFI_SUCCESS Operation completed successfully. … … 856 856 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 857 857 @param[in] VendorGuid A unique identifier for the vendor. 858 @param[out] VarSize The size of the variable data. 858 @param[out] VarSize The size of the variable data. 859 859 860 860 @return A pointer to the buffer to return the contents of the variable.Otherwise NULL. … … 905 905 Measure and log an EFI variable, and extend the measurement result into a specific PCR. 906 906 907 @param[in] PCRIndex PCR Index. 908 @param[in] EventType Event type. 907 @param[in] PCRIndex PCR Index. 908 @param[in] EventType Event type. 909 909 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 910 910 @param[in] VendorGuid A unique identifier for the vendor. 911 @param[in] VarData The content of the variable data. 912 @param[in] VarSize The size of the variable data. 913 911 @param[in] VarData The content of the variable data. 912 @param[in] VarSize The size of the variable data. 913 914 914 @retval EFI_SUCCESS Operation completed successfully. 915 915 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 974 974 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 975 975 @param[in] VendorGuid A unique identifier for the vendor. 976 @param[out] VarSize The size of the variable data. 977 @param[out] VarData Pointer to the content of the variable. 978 976 @param[out] VarSize The size of the variable data. 977 @param[out] VarData Pointer to the content of the variable. 978 979 979 @retval EFI_SUCCESS Operation completed successfully. 980 980 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 1158 1158 Install TCG ACPI Table when ACPI Table Protocol is available. 1159 1159 1160 A system's firmware uses an ACPI table to identify the system's TCG capabilities 1161 to the Post-Boot environment. The information in this ACPI table is not guaranteed 1162 to be valid until the Host Platform transitions from pre-boot state to post-boot state. 1160 A system's firmware uses an ACPI table to identify the system's TCG capabilities 1161 to the Post-Boot environment. The information in this ACPI table is not guaranteed 1162 to be valid until the Host Platform transitions from pre-boot state to post-boot state. 1163 1163 1164 1164 @param[in] Event Event whose notification function is being invoked … … 1191 1191 mTcgClientAcpiTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision); 1192 1192 // 1193 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1193 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1194 1194 // service of the ACPI table protocol to install it. 1195 1195 // … … 1211 1211 mTcgServerAcpiTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision); 1212 1212 // 1213 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1213 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1214 1214 // service of the ACPI table protocol to install it. 1215 1215 // … … 1301 1301 Get TPM Deactivated state. 1302 1302 1303 @param[out] TPMDeactivatedFlag Returns TPM Deactivated state. 1303 @param[out] TPMDeactivatedFlag Returns TPM Deactivated state. 1304 1304 1305 1305 @retval EFI_SUCCESS Operation completed successfully. … … 1333 1333 It publishes EFI TCG Protocol. 1334 1334 1335 @param[in] ImageHandle The firmware allocated handle for the EFI image. 1335 @param[in] ImageHandle The firmware allocated handle for the EFI image. 1336 1336 @param[in] SystemTable A pointer to the EFI System Table. 1337 1337 1338 1338 @retval EFI_SUCCESS The entry point is executed successfully. 1339 1339 @retval other Some error occurs when executing this entry point. … … 1412 1412 1413 1413 // 1414 // Measure Exit Boot Service failed 1414 // Measure Exit Boot Service failed 1415 1415 // 1416 1416 Status = gBS->CreateEventEx ( … … 1428 1428 // 1429 1429 EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, InstallAcpiTable, NULL, &Registration); 1430 1430 1431 1431 return Status; 1432 1432 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TcgDxe.inf
r58459 r58466 58 58 ## SOMETIMES_CONSUMES ## GUID # Handoff Table for measurement. 59 59 gEfiSmbiosTableGuid 60 60 61 61 gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES ## Variable:L"BootXXXX" 62 62 gTcgEventEntryHobGuid ## SOMETIMES_CONSUMES ## HOB … … 70 70 gEfiAcpiTableProtocolGuid ## NOTIFY 71 71 gEfiMpServiceProtocolGuid ## SOMETIMES_CONSUMES 72 72 73 73 [Pcd] 74 74 gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TisDxe.c
r58459 r58466 1 /** @file 1 /** @file 2 2 TIS (TPM Interface Specification) functions used by TPM Dxe driver. 3 3 4 4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 26 26 Send command to TPM for execution. 27 27 28 @param[in] TisReg TPM register space base address. 29 @param[in] TpmBuffer Buffer for TPM command data. 30 @param[in] DataLength TPM command data length. 31 28 @param[in] TisReg TPM register space base address. 29 @param[in] TpmBuffer Buffer for TPM command data. 30 @param[in] DataLength TPM command data length. 31 32 32 @retval EFI_SUCCESS Operation completed successfully. 33 33 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 76 76 Receive response data of last command from TPM. 77 77 78 @param[in] TisReg TPM register space base address. 79 @param[out] TpmBuffer Buffer for response data. 80 @param[out] RespSize Response data length. 81 78 @param[in] TisReg TPM register space base address. 79 @param[out] TpmBuffer Buffer for response data. 80 @param[out] RespSize Response data length. 81 82 82 @retval EFI_SUCCESS Operation completed successfully. 83 83 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 165 165 Format TPM command data according to the format control character. 166 166 167 @param[in] FmtChar Format control character. 168 @param[in, out] ap List of arguments. 169 @param[in] TpmBuffer Buffer for TPM command data. 170 @param[out] DataLength TPM command data length. 171 167 @param[in] FmtChar Format control character. 168 @param[in, out] ap List of arguments. 169 @param[in] TpmBuffer Buffer for TPM command data. 170 @param[out] DataLength TPM command data length. 171 172 172 @retval EFI_SUCCESS Operation completed successfully. 173 173 @retval EFI_INVALID_PARAMETER Invalid format control character. … … 252 252 Format reponse data according to the format control character. 253 253 254 @param[in] FmtChar Format control character. 255 @param[in, out] ap List of arguments. 256 @param[out] TpmBuffer Buffer for reponse data. 257 @param[in, out] DataIndex Data offset in reponse data buffer. 258 @param[in] RespSize Response data length. 259 @param[out] DataFinished Reach the end of Response data. 260 254 @param[in] FmtChar Format control character. 255 @param[in, out] ap List of arguments. 256 @param[out] TpmBuffer Buffer for reponse data. 257 @param[in, out] DataIndex Data offset in reponse data buffer. 258 @param[in] RespSize Response data length. 259 @param[out] DataFinished Reach the end of Response data. 260 261 261 @retval EFI_SUCCESS Operation completed successfully. 262 262 @retval EFI_INVALID_PARAMETER Invalid format control character. … … 300 300 Size = VA_ARG (*ap, UINTN); 301 301 // 302 // If overflowed, which means Size is big enough for Response data. 303 // skip this check. Copy the whole data 302 // If overflowed, which means Size is big enough for Response data. 303 // skip this check. Copy the whole data 304 304 // 305 305 if ((UINT32) (~0)- *DataIndex >= (UINT32)Size) { … … 358 358 Send formatted command to TPM for execution and return formatted data from response. 359 359 360 @param[in] TisReg TPM Handle. 361 @param[in] Fmt Format control string. 360 @param[in] TisReg TPM Handle. 361 @param[in] Fmt Format control string. 362 362 @param[in] ... The variable argument list. 363 363 364 364 @retval EFI_SUCCESS Operation completed successfully. 365 365 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 421 421 goto Error; 422 422 } 423 423 424 424 // 425 425 // Get the formatted data from the TpmCommandBuf. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TpmComm.c
r58459 r58466 1 /** @file 1 /** @file 2 2 Utility functions used by TPM Dxe driver. 3 3 4 4 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 23 23 Extend a TPM PCR. 24 24 25 @param[in] TpmHandle TPM handle. 26 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 25 @param[in] TpmHandle TPM handle. 26 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 27 27 @param[in] PcrIndex The PCR to be updated. 28 @param[out] NewPcrValue New PCR value after extend. 29 28 @param[out] NewPcrValue New PCR value after extend. 29 30 30 @retval EFI_SUCCESS Operation completed successfully. 31 31 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 76 76 Get TPM capability flags. 77 77 78 @param[in] TpmHandle TPM handle. 79 @param[in] FlagSubcap Flag subcap. 78 @param[in] TpmHandle TPM handle. 79 @param[in] FlagSubcap Flag subcap. 80 80 @param[out] FlagBuffer Pointer to the buffer for returned flag structure. 81 @param[in] FlagSize Size of the buffer. 82 81 @param[in] FlagSize Size of the buffer. 82 83 83 @retval EFI_SUCCESS Operation completed successfully. 84 84 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 126 126 Add a new entry to the Event Log. 127 127 128 @param[in, out] EventLogPtr Pointer to the Event Log data. 129 @param[in, out] LogSize Size of the Event Log. 128 @param[in, out] EventLogPtr Pointer to the Event Log data. 129 @param[in, out] LogSize Size of the Event Log. 130 130 @param[in] MaxSize Maximum size of the Event Log. 131 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 132 @param[in] NewEventData Pointer to the new event data. 133 131 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 132 @param[in] NewEventData Pointer to the new event data. 133 134 134 @retval EFI_SUCCESS The new event log entry was added. 135 135 @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TpmComm.h
r48674 r58466 1 /** @file 1 /** @file 2 2 Definitions and function prototypes used by TPM DXE driver. 3 3 4 4 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 19 19 Add a new entry to the Event Log. 20 20 21 @param[in, out] EventLogPtr Pointer to the Event Log data. 22 @param[in, out] LogSize Size of the Event Log. 21 @param[in, out] EventLogPtr Pointer to the Event Log data. 22 @param[in, out] LogSize Size of the Event Log. 23 23 @param[in] MaxSize Maximum size of the Event Log. 24 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 25 @param[in] NewEventData Pointer to the new event data. 26 24 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 25 @param[in] NewEventData Pointer to the new event data. 26 27 27 @retval EFI_SUCCESS The new event log entry was added. 28 28 @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. … … 41 41 Extend a TPM PCR. 42 42 43 @param[in] TpmHandle TPM handle. 44 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 43 @param[in] TpmHandle TPM handle. 44 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 45 45 @param[in] PcrIndex The PCR to be updated. 46 @param[out] NewPcrValue New PCR value after extend. 47 46 @param[out] NewPcrValue New PCR value after extend. 47 48 48 @retval EFI_SUCCESS Operation completed successfully. 49 49 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 61 61 Get TPM capability flags. 62 62 63 @param[in] TpmHandle TPM handle. 64 @param[in] FlagSubcap Flag subcap. 63 @param[in] TpmHandle TPM handle. 64 @param[in] FlagSubcap Flag subcap. 65 65 @param[out] FlagBuffer Pointer to the buffer for returned flag structure. 66 @param[in] FlagSize Size of the buffer. 67 66 @param[in] FlagSize Size of the buffer. 67 68 68 @retval EFI_SUCCESS Operation completed successfully. 69 69 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 81 81 Send formatted command to TPM for execution and return formatted data from response. 82 82 83 @param[in] TisReg TPM Handle. 84 @param[in] Fmt Format control string. 83 @param[in] TisReg TPM Handle. 84 @param[in] Fmt Format control string. 85 85 @param[in] ... The variable argument list. 86 86 87 87 @retval EFI_SUCCESS Operation completed successfully. 88 88 @retval EFI_TIMEOUT The register can't run into the expected status in time. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TcgPei.c
r58459 r58466 3 3 4 4 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 130 130 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, 131 131 &gEfiPeiFirmwareVolumeInfoPpiGuid, 132 FirmwareVolmeInfoPpiNotifyCallback 132 FirmwareVolmeInfoPpiNotifyCallback 133 133 }, 134 134 { 135 135 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, 136 136 &gEfiPeiFirmwareVolumeInfo2PpiGuid, 137 FirmwareVolmeInfoPpiNotifyCallback 137 FirmwareVolmeInfoPpiNotifyCallback 138 138 }, 139 139 { … … 146 146 /** 147 147 Record all measured Firmware Volum Information into a Guid Hob 148 Guid Hob payload layout is 148 Guid Hob payload layout is 149 149 150 150 UINT32 *************************** FIRMWARE_BLOB number … … 166 166 IN VOID *Ppi 167 167 ) 168 { 168 { 169 169 MEASURED_HOB_DATA *MeasuredHobData; 170 170 … … 172 172 173 173 // 174 // Create a Guid hob to save all measured Fv 174 // Create a Guid hob to save all measured Fv 175 175 // 176 176 MeasuredHobData = BuildGuidHob( … … 205 205 206 206 @param[in] PeiServices Describes the list of possible PEI Services. 207 @param[in] HashData Physical address of the start of the data buffer 207 @param[in] HashData Physical address of the start of the data buffer 208 208 to be hashed, extended, and logged. 209 209 @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData. 210 210 @param[in] TpmHandle TPM handle. 211 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 212 @param[in] NewEventData Pointer to the new event data. 211 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 212 @param[in] NewEventData Pointer to the new event data. 213 213 214 214 @retval EFI_SUCCESS Operation completed successfully. … … 229 229 EFI_STATUS Status; 230 230 VOID *HobData; 231 231 232 232 if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) { 233 233 return EFI_DEVICE_ERROR; … … 323 323 324 324 /** 325 Measure FV image. 326 Add it into the measured FV list after the FV is measured successfully. 325 Measure FV image. 326 Add it into the measured FV list after the FV is measured successfully. 327 327 328 328 @param[in] FvBase Base address of FV image. 329 329 @param[in] FvLength Length of FV image. 330 330 331 @retval EFI_SUCCESS Fv image is measured successfully 331 @retval EFI_SUCCESS Fv image is measured successfully 332 332 or it has been already measured. 333 333 @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. … … 371 371 } 372 372 } 373 373 374 374 // 375 375 // Measure and record the FV to the TPM … … 430 430 EFI_FV_INFO VolumeInfo; 431 431 EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi; 432 432 433 433 FvInstances = 0; 434 434 while (TRUE) { … … 442 442 break; 443 443 } 444 444 445 445 // 446 446 // Measure and record the firmware volume that is dispatched by PeiCore … … 452 452 // 453 453 Status = PeiServicesLocatePpi ( 454 &VolumeInfo.FvFormat, 455 0, 454 &VolumeInfo.FvFormat, 455 0, 456 456 NULL, 457 457 (VOID**)&FvPpi … … 497 497 // 498 498 Status = PeiServicesLocatePpi ( 499 &Fv->FvFormat, 500 0, 499 &Fv->FvFormat, 500 0, 501 501 NULL, 502 502 (VOID**)&FvPpi … … 505 505 return EFI_SUCCESS; 506 506 } 507 507 508 508 // 509 509 // This is an FV from an FFS file, and the parent FV must have already been measured, … … 511 511 // 512 512 if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) { 513 513 514 514 ASSERT (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)); 515 515 if (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) { … … 572 572 if (PcdGetBool (PcdPhysicalPresenceLifetimeLock) && !LifetimeLock) { 573 573 // 574 // Lock TPM LifetimeLock is required, and LifetimeLock is not locked yet. 574 // Lock TPM LifetimeLock is required, and LifetimeLock is not locked yet. 575 575 // 576 576 PhysicalPresenceValue = TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK; … … 588 588 } else { 589 589 PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_HW_DISABLE; 590 } 591 590 } 591 592 592 Status = TpmCommPhysicalPresence ( 593 593 PeiServices, … … 599 599 } 600 600 } 601 601 602 602 // 603 603 // 2. Lock physical presence if it is required. … … 632 632 // 633 633 // Lock physical presence 634 // 634 // 635 635 Status = TpmCommPhysicalPresence ( 636 636 PeiServices, … … 665 665 return FALSE; 666 666 } 667 return (BOOLEAN)(!Deactivated); 667 return (BOOLEAN)(!Deactivated); 668 668 } 669 669 … … 688 688 689 689 Status = PeiServicesLocatePpi ( 690 &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, 691 0, 690 &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, 691 0, 692 692 NULL, 693 693 (VOID**)&mMeasurementExcludedFvPpi … … 712 712 713 713 Status = MeasureMainBios (PeiServices, TpmHandle); 714 } 714 } 715 715 716 716 // … … 718 718 // 1). for the FvInfoPpi services to measure and record 719 719 // the additional Fvs to TPM 720 // 2). for the OperatorPresencePpi service to determine whether to 720 // 2). for the OperatorPresencePpi service to determine whether to 721 721 // lock the TPM 722 722 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TcgPei.inf
r58459 r58466 75 75 76 76 [Pcd] 77 gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceLifetimeLock ## SOMETIMES_CONSUMES 78 gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceCmdEnable ## SOMETIMES_CONSUMES 77 gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceLifetimeLock ## SOMETIMES_CONSUMES 78 gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceCmdEnable ## SOMETIMES_CONSUMES 79 79 gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceHwEnable ## SOMETIMES_CONSUMES 80 80 gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TisPei.c
r48674 r58466 1 1 /** @file 2 2 TIS (TPM Interface Specification) functions used by TPM PEI driver. 3 3 4 4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 25 25 26 26 @param[in] PeiServices Describes the list of possible PEI Services. 27 @param[in] TisReg TPM register space base address. 28 @param[in] BufferIn Buffer for command data. 29 @param[in] SizeIn Size of command data. 30 @param[in, out] BufferOut Buffer for response data. 31 @param[in, out] SizeOut Size of response data. 32 27 @param[in] TisReg TPM register space base address. 28 @param[in] BufferIn Buffer for command data. 29 @param[in] SizeIn Size of command data. 30 @param[in, out] BufferOut Buffer for response data. 31 @param[in, out] SizeOut Size of response data. 32 33 33 @retval EFI_SUCCESS Operation completed successfully. 34 34 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 128 128 goto Exit; 129 129 } 130 130 131 131 CopyMem (&Data32, (BufferOut + 2), sizeof (UINT32)); 132 132 TpmOutSize = SwapBytes32 (Data32); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TpmComm.c
r58459 r58466 1 1 /** @file 2 2 Utility functions used by TPM PEI driver. 3 3 4 4 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 19 19 20 20 @param[in] PeiServices Describes the list of possible PEI Services. 21 @param[in] TisReg TPM register space base address. 22 @param[in] BufferIn Buffer for command data. 23 @param[in] SizeIn Size of command data. 24 @param[in, out] BufferOut Buffer for response data. 25 @param[in, out] SizeOut size of response data. 26 21 @param[in] TisReg TPM register space base address. 22 @param[in] BufferIn Buffer for command data. 23 @param[in] SizeIn Size of command data. 24 @param[in, out] BufferOut Buffer for response data. 25 @param[in, out] SizeOut size of response data. 26 27 27 @retval EFI_SUCCESS Operation completed successfully. 28 28 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 45 45 46 46 @param[in] PeiServices Describes the list of possible PEI Services. 47 @param[in] TpmHandle TPM handle. 48 @param[in] BootMode Boot mode. 49 47 @param[in] TpmHandle TPM handle. 48 @param[in] BootMode Boot mode. 49 50 50 @retval EFI_SUCCESS Operation completed successfully. 51 51 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 89 89 90 90 @param[in] PeiServices Describes the list of possible PEI Services. 91 @param[in] TpmHandle TPM handle. 92 91 @param[in] TpmHandle TPM handle. 92 93 93 @retval EFI_SUCCESS Operation completed successfully. 94 94 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 115 115 TpmSendSize = sizeof (TPM_CMD_SELF_TEST); 116 116 SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND); 117 SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize); 117 SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize); 118 118 SendBuffer.Hdr.ordinal = SwapBytes32 (TPM_ORD_ContinueSelfTest); 119 119 Status = TisTpmCommand (PeiServices, TpmHandle, (UINT8 *)&SendBuffer, TpmSendSize, RecvBuffer, &TpmRecvSize); … … 125 125 126 126 @param[in] PeiServices Describes the list of possible PEI Services. 127 @param[in] TpmHandle TPM handle. 127 @param[in] TpmHandle TPM handle. 128 128 @param[out] Deactivated Returns deactivated flag. 129 @param[out] LifetimeLock Returns physicalPresenceLifetimeLock permanent flag. 129 @param[out] LifetimeLock Returns physicalPresenceLifetimeLock permanent flag. 130 130 @param[out] CmdEnable Returns physicalPresenceCMDEnable permanent flag. 131 131 132 132 @retval EFI_SUCCESS Operation completed successfully. 133 133 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 158 158 TpmSendSize = sizeof (TPM_CMD_GET_CAPABILITY); 159 159 SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND); 160 SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize); 160 SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize); 161 161 SendBuffer.Hdr.ordinal = SwapBytes32 (TPM_ORD_GetCapability); 162 162 SendBuffer.Capability = SwapBytes32 (TPM_CAP_FLAG); … … 186 186 187 187 @param[in] PeiServices Describes the list of possible PEI Services. 188 @param[in] TpmHandle TPM handle. 189 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 188 @param[in] TpmHandle TPM handle. 189 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 190 190 @param[in] PcrIndex The PCR to be updated. 191 @param[out] NewPcrValue New PCR value after extend. 192 191 @param[out] NewPcrValue New PCR value after extend. 192 193 193 @retval EFI_SUCCESS Operation completed successfully. 194 194 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 239 239 240 240 @param[in] PeiServices Describes the list of possible PEI Services. 241 @param[in] TpmHandle TPM handle. 242 @param[in] PhysicalPresence The state to set the TPMs Physical Presence flags. 243 241 @param[in] TpmHandle TPM handle. 242 @param[in] PhysicalPresence The state to set the TPMs Physical Presence flags. 243 244 244 @retval EFI_SUCCESS Operation completed successfully. 245 245 @retval EFI_TIMEOUT The register can't run into the expected status in time. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TpmComm.h
r48674 r58466 1 1 /** @file 2 2 The header file for TPM PEI driver. 3 3 4 4 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 58 58 59 59 @param[in] PeiServices Describes the list of possible PEI Services. 60 @param[in] TpmHandle TPM handle. 61 @param[in] BootMode Boot mode. 62 60 @param[in] TpmHandle TPM handle. 61 @param[in] BootMode Boot mode. 62 63 63 @retval EFI_SUCCESS Operation completed successfully. 64 64 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 78 78 79 79 @param[in] PeiServices Describes the list of possible PEI Services. 80 @param[in] TpmHandle TPM handle. 81 80 @param[in] TpmHandle TPM handle. 81 82 82 @retval EFI_SUCCESS Operation completed successfully. 83 83 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 96 96 97 97 @param[in] PeiServices Describes the list of possible PEI Services. 98 @param[in] TpmHandle TPM handle. 98 @param[in] TpmHandle TPM handle. 99 99 @param[out] Deactivated Returns deactivated flag. 100 @param[out] LifetimeLock Returns physicalPresenceLifetimeLock permanent flag. 100 @param[out] LifetimeLock Returns physicalPresenceLifetimeLock permanent flag. 101 101 @param[out] CmdEnable Returns physicalPresenceCMDEnable permanent flag. 102 102 103 103 @retval EFI_SUCCESS Operation completed successfully. 104 104 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 120 120 121 121 @param[in] PeiServices Describes the list of possible PEI Services. 122 @param[in] TpmHandle TPM handle. 123 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 122 @param[in] TpmHandle TPM handle. 123 @param[in] DigestToExtend The 160 bit value representing the event to be recorded. 124 124 @param[in] PcrIndex The PCR to be updated. 125 @param[out] NewPcrValue New PCR value after extend. 126 125 @param[out] NewPcrValue New PCR value after extend. 126 127 127 @retval EFI_SUCCESS Operation completed successfully. 128 128 @retval EFI_TIMEOUT The register can't run into the expected status in time. … … 145 145 146 146 @param[in] PeiServices Describes the list of possible PEI Services. 147 @param[in] TpmHandle TPM handle. 148 @param[in] PhysicalPresence The state to set the TPMs Physical Presence flags. 149 147 @param[in] TpmHandle TPM handle. 148 @param[in] PhysicalPresence The state to set the TPMs Physical Presence flags. 149 150 150 @retval EFI_SUCCESS Operation completed successfully. 151 151 @retval EFI_TIMEOUT The register can't run into the expected status in time. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.c
r58459 r58466 10 10 11 11 Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR> 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 15 15 http://opensource.org/licenses/bsd-license.php 16 16 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 18 18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 19 19 … … 81 81 mTcgNvs->PhysicalPresence.LastRequest = PpData.LastPPRequest; 82 82 mTcgNvs->PhysicalPresence.Response = PpData.PPResponse; 83 } else if ((mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS) 83 } else if ((mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS) 84 84 || (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) { 85 85 if (EFI_ERROR (Status)) { … … 108 108 } 109 109 110 if (EFI_ERROR (Status)) { 110 if (EFI_ERROR (Status)) { 111 111 mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE; 112 112 return EFI_SUCCESS; … … 187 187 RequestConfirmed = TRUE; 188 188 } 189 break; 189 break; 190 190 191 191 case PHYSICAL_PRESENCE_SET_NO_PPI_PROVISION_FALSE: … … 200 200 // This command requires UI to prompt user for Auth data 201 201 // 202 mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; 202 mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; 203 203 return EFI_SUCCESS; 204 204 default: … … 210 210 } else { 211 211 mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED; 212 } 212 } 213 213 if (mTcgNvs->PhysicalPresence.Request >= TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) { 214 214 mTcgNvs->PhysicalPresence.ReturnCode = TcgPpVendorLibGetUserConfirmationStatusFunction (mTcgNvs->PhysicalPresence.Request, Flags.PPFlags); 215 215 } 216 } 216 } 217 217 218 218 return EFI_SUCCESS; … … 282 282 &MorControl 283 283 ); 284 if (EFI_ERROR (Status)) { 284 if (EFI_ERROR (Status)) { 285 285 mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE; 286 286 DEBUG ((EFI_D_ERROR, "[TPM] Set MOR variable failure! Status = %r\n", Status)); … … 320 320 OpRegion <= (AML_OP_REGION_32_8 *) ((UINT8 *) Table + Table->Length); 321 321 OpRegion = (AML_OP_REGION_32_8 *) ((UINT8 *) OpRegion + 1)) { 322 if ((OpRegion->OpRegionOp == AML_EXT_REGION_OP) && 322 if ((OpRegion->OpRegionOp == AML_EXT_REGION_OP) && 323 323 (OpRegion->NameString == Name) && 324 324 (OpRegion->DWordPrefix == AML_DWORD_PREFIX) && … … 404 404 The driver's entry point. 405 405 406 It install callbacks for TPM physical presence and MemoryClear, and locate 406 It install callbacks for TPM physical presence and MemoryClear, and locate 407 407 SMM variable to be used in the callback function. 408 408 409 @param[in] ImageHandle The firmware allocated handle for the EFI image. 409 @param[in] ImageHandle The firmware allocated handle for the EFI image. 410 410 @param[in] SystemTable A pointer to the EFI System Table. 411 411 412 412 @retval EFI_SUCCESS The entry point is executed successfully. 413 413 @retval Others Some error occurs when executing this entry point. … … 454 454 } 455 455 mTcgNvs->MemoryClear.SoftwareSmi = (UINT8) SwContext.SwSmiInputValue; 456 456 457 457 // 458 458 // Locate SmmVariableProtocol. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.h
r58459 r58466 1 1 /** @file 2 2 The header file for TCG SMM driver. 3 3 4 4 Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.inf
r58459 r58466 2 2 # Implements ACPI metholds for the TCG feature 3 3 # 4 # This driver implements TPM definition block in ACPI table and registers SMI 5 # callback functions for physical presence and MemoryClear to handle the requests 4 # This driver implements TPM definition block in ACPI table and registers SMI 5 # callback functions for physical presence and MemoryClear to handle the requests 6 6 # from ACPI method. 7 7 # … … 61 61 ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl" 62 62 gEfiMemoryOverwriteControlDataGuid 63 63 64 64 gEfiTpmDeviceInstanceTpm12Guid ## PRODUCES ## GUID # TPM device identifier 65 65 … … 78 78 gEfiSmmVariableProtocolGuid AND 79 79 gEfiTcgProtocolGuid 80 80 81 81 [UserExtensions.TianoCore."ExtraFiles"] 82 82 TcgSmmExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/Tpm.asl
-
Property svn:eol-style
set to
native
r58459 r58466 1 1 /** @file 2 The TPM definition block in ACPI table for physical presence 2 The TPM definition block in ACPI table for physical presence 3 3 and MemoryClear. 4 4 5 5 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 50 50 OperationRegion (SMIP, SystemIO, 0xB2, 1) 51 51 Field (SMIP, ByteAcc, NoLock, Preserve) 52 { 52 { 53 53 IOB2, 8 54 54 } … … 83 83 84 84 Method (PTS, 1, Serialized) 85 { 85 { 86 86 // 87 87 // Detect Sx state for MOR, only S4, S5 need to handle 88 88 // 89 89 If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3))) 90 { 90 { 91 91 // 92 92 // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect. … … 98 98 // 99 99 Store (0x02, MCIP) 100 100 101 101 // 102 102 // Triggle the SMI interrupt … … 106 106 } 107 107 Return (0) 108 } 108 } 109 109 110 110 Method (_STA, 0) … … 156 156 157 157 Name(TPM2, Package (0x02){ 158 Zero,159 Zero160 })161 162 Name(TPM3, Package (0x03){163 Zero,164 158 Zero, 165 159 Zero 166 160 }) 167 161 162 Name(TPM3, Package (0x03){ 163 Zero, 164 Zero, 165 Zero 166 }) 167 168 168 // 169 169 // TCG Physical Presence Interface 170 170 // 171 171 Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj 172 { 172 { 173 173 // 174 174 // Switch by function index … … 195 195 // b) Submit TPM Operation Request to Pre-OS Environment 196 196 // 197 197 198 198 Store (DerefOf (Index (Arg2, 0x00)), PPRQ) 199 199 Store (0x02, PPIP) 200 200 201 201 // 202 202 // Triggle the SMI interrupt … … 212 212 // c) Get Pending TPM Operation Requested By the OS 213 213 // 214 214 215 215 Store (PPRQ, Index (TPM2, 0x01)) 216 216 Return (TPM2) … … 229 229 // 230 230 Store (0x05, PPIP) 231 231 232 232 // 233 233 // Triggle the SMI interrupt 234 234 // 235 235 Store (PPIN, IOB2) 236 236 237 237 Store (LPPR, Index (TPM3, 0x01)) 238 238 Store (PPRP, Index (TPM3, 0x02)) … … 257 257 Store (7, PPIP) 258 258 Store (DerefOf (Index (Arg2, 0x00)), PPRQ) 259 260 // 261 // Triggle the SMI interrupt 262 // 263 Store (PPIN, IOB2) 259 260 // 261 // Triggle the SMI interrupt 262 // 263 Store (PPIN, IOB2) 264 264 Return (FRET) 265 265 } … … 271 271 Store (8, PPIP) 272 272 Store (DerefOf (Index (Arg2, 0x00)), PPRQ) 273 273 274 274 // 275 275 // Triggle the SMI interrupt 276 276 // 277 277 Store (PPIN, IOB2) 278 278 279 279 Return (FRET) 280 280 } … … 305 305 // 306 306 Store (DerefOf (Index (Arg2, 0x00)), MORD) 307 307 308 308 // 309 309 // Triggle the SMI through ACPI _DSM method. 310 310 // 311 311 Store (0x01, MCIP) 312 312 313 313 // 314 314 // Triggle the SMI interrupt … … 319 319 Default {BreakPoint} 320 320 } 321 Return (1) 321 Return (1) 322 322 } 323 323 -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TpmDetection.c
r58464 r58466 3 3 4 4 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 41 41 { 42 42 UINT8 RegRead; 43 43 44 44 RegRead = MmioRead8 ((UINTN)PcdGet64 (PcdTpmBaseAddress)); 45 45 if (RegRead == 0xFF) { -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfig.vfr
r58464 r58466 3 3 4 4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigDriver.c
r58464 r58466 3 3 4 4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 55 55 return EFI_ALREADY_STARTED; 56 56 } 57 57 58 58 // 59 59 // Create a private data structure. … … 64 64 // 65 65 // Install private GUID. 66 // 66 // 67 67 Status = gBS->InstallMultipleProtocolInterfaces ( 68 68 &ImageHandle, … … 156 156 ASSERT_EFI_ERROR (Status); 157 157 } 158 158 159 159 // 160 160 // Install TrEE configuration form … … 170 170 if (PrivateData != NULL) { 171 171 UninstallTrEEConfigForm (PrivateData); 172 } 173 172 } 173 174 174 return Status; 175 175 } … … 197 197 &gEfiCallerIdGuid, 198 198 (VOID **) &PrivateData 199 ); 200 if (EFI_ERROR (Status)) { 201 return Status; 202 } 203 199 ); 200 if (EFI_ERROR (Status)) { 201 return Status; 202 } 203 204 204 ASSERT (PrivateData->Signature == TREE_CONFIG_PRIVATE_DATA_SIGNATURE); 205 205 … … 210 210 NULL 211 211 ); 212 212 213 213 UninstallTrEEConfigForm (PrivateData); 214 214 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigDxe.inf
r58464 r58466 1 1 ## @file 2 2 # TPM device configuration for TPM 2.0 3 # 3 # 4 4 # By this module, user may select TPM device, clear TPM state, etc. 5 5 # NOTE: This module is only for reference only, each platform should have its own setup page. … … 62 62 ## SOMETIMES_CONSUMES ## Variable:L"TrEEPhysicalPresence" 63 63 gEfiTrEEPhysicalPresenceGuid 64 64 65 65 ## PRODUCES ## HII 66 66 ## SOMETIMES_PRODUCES ## Variable:L"TREE_CONFIGURATION" … … 84 84 gEfiVariableArchProtocolGuid AND 85 85 gEfiVariableWriteArchProtocolGuid 86 86 87 87 [UserExtensions.TianoCore."ExtraFiles"] 88 88 TrEEConfigDxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigImpl.c
r58464 r58466 4 4 5 5 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 45 45 END_DEVICE_PATH_TYPE, 46 46 END_ENTIRE_DEVICE_PATH_SUBTYPE, 47 { 47 { 48 48 (UINT8) (END_DEVICE_PATH_LENGTH), 49 49 (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) … … 126 126 if (EFI_ERROR (Status)) { 127 127 return Status; 128 } 129 128 } 129 130 130 PpData.PPRequest = PpRequest; 131 131 Status = gRT->SetVariable ( … … 212 212 return EFI_INVALID_PARAMETER; 213 213 } 214 214 215 215 if (Action == EFI_BROWSER_ACTION_CHANGED) { 216 216 if (QuestionId == KEY_TPM_DEVICE) { … … 279 279 ConfigAccess, 280 280 NULL 281 ); 281 ); 282 282 283 283 return EFI_OUT_OF_RESOURCES; 284 284 } 285 285 286 286 PrivateData->HiiHandle = HiiHandle; 287 287 … … 304 304 } 305 305 306 return EFI_SUCCESS; 306 return EFI_SUCCESS; 307 307 } 308 308 … … 340 340 PrivateData->DriverHandle = NULL; 341 341 } 342 342 343 343 FreePool (PrivateData); 344 344 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigImpl.h
r58464 r58466 4 4 5 5 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 60 60 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; 61 61 EFI_HII_HANDLE HiiHandle; 62 EFI_HANDLE DriverHandle; 62 EFI_HANDLE DriverHandle; 63 63 64 64 UINT8 TpmDeviceDetected; -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigNvData.h
r58464 r58466 3 3 4 4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigPei.inf
r58464 r58466 68 68 gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## PRODUCES 69 69 gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy ## PRODUCES 70 gEfiSecurityPkgTokenSpaceGuid.PcdTpmAutoDetection ## CONSUMES 70 gEfiSecurityPkgTokenSpaceGuid.PcdTpmAutoDetection ## CONSUMES 71 71 gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## SOMETIMES_CONSUMES 72 72 … … 74 74 gEfiPeiMasterBootModePpiGuid AND 75 75 gEfiPeiReadOnlyVariable2PpiGuid 76 76 77 77 [UserExtensions.TianoCore."ExtraFiles"] 78 78 TrEEConfigPeiExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigPeim.c
r58464 r58466 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c
r58464 r58466 1 1 /** @file 2 2 This module implements measuring PeCoff image for TrEE Protocol. 3 3 4 4 Caution: This file requires additional review when modified. 5 5 This driver will have external input - PE/COFF image. … … 8 8 9 9 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 10 This program and the accompanying materials 11 are licensed and made available under the terms and conditions of the BSD License 12 which accompanies this distribution. The full text of the license may be found at 10 This program and the accompanying materials 11 are licensed and made available under the terms and conditions of the BSD License 12 which accompanies this distribution. The full text of the license may be found at 13 13 http://opensource.org/licenses/bsd-license.php 14 14 15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 17 … … 114 114 if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 115 115 // 116 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 117 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 116 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 117 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 118 118 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 119 119 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 126 126 Magic = Hdr.Pe32->OptionalHeader.Magic; 127 127 } 128 128 129 129 // 130 130 // 3. Calculate the distance from the base of the image header to the image checksum address. … … 149 149 if (EFI_ERROR (Status)) { 150 150 goto Finish; 151 } 151 } 152 152 153 153 // … … 178 178 goto Finish; 179 179 } 180 } 180 } 181 181 } else { 182 182 // … … 192 192 // 193 193 // Use PE32+ offset 194 // 194 // 195 195 HashBase = (UINT8 *) &Hdr.Pe32Plus->OptionalHeader.CheckSum + sizeof (UINT32); 196 196 HashSize = (UINTN) ((UINT8 *)(&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]) - HashBase); … … 221 221 HashSize = Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - (UINTN) (HashBase - ImageAddress); 222 222 } 223 223 224 224 if (HashSize != 0) { 225 225 Status = HashUpdate (HashHandle, HashBase, HashSize); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
r58464 r58466 1 1 /** @file 2 2 This module implements TrEE Protocol. 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 109 109 // The following EFI_TCG_SERVER_ACPI_TABLE default setting is just one example, 110 110 // the TPM device connectes to LPC, and also defined the ACPI _UID as 0xFF, 111 // this _UID can be changed and should match with the _UID setting of the TPM 112 // ACPI device object 111 // this _UID can be changed and should match with the _UID setting of the TPM 112 // ACPI device object 113 113 // 114 114 EFI_TCG_SERVER_ACPI_TABLE mTcgServerAcpiTemplate = { … … 350 350 @retval EFI_SUCCESS Operation completed successfully. 351 351 @retval EFI_DEVICE_ERROR The command was unsuccessful. 352 The ProtocolCapability variable will not be populated. 352 The ProtocolCapability variable will not be populated. 353 353 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. 354 354 The ProtocolCapability variable will not be populated. 355 355 @retval EFI_BUFFER_TOO_SMALL The ProtocolCapability variable is too small to hold the full response. 356 It will be partially populated (required Size field will be set). 356 It will be partially populated (required Size field will be set). 357 357 **/ 358 358 EFI_STATUS … … 398 398 399 399 DEBUG ((EFI_D_INFO, "EventLogFormat: (0x%x)\n", EventLogFormat)); 400 400 401 401 switch (EventLogFormat) { 402 402 case TREE_EVENT_LOG_FORMAT_TCG_1_2: … … 423 423 /** 424 424 The EFI_TREE_PROTOCOL Get Event Log function call allows a caller to 425 retrieve the address of a given event log and its last entry. 425 retrieve the address of a given event log and its last entry. 426 426 427 427 @param[in] This Indicates the calling context … … 511 511 Add a new entry to the Event Log. 512 512 513 @param[in, out] EventLogPtr Pointer to the Event Log data. 514 @param[in, out] LogSize Size of the Event Log. 513 @param[in, out] EventLogPtr Pointer to the Event Log data. 514 @param[in, out] LogSize Size of the Event Log. 515 515 @param[in] MaxSize Maximum size of the Event Log. 516 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR/TCG_PCR_EVENT_EX data structure. 516 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR/TCG_PCR_EVENT_EX data structure. 517 517 @param[in] NewEventHdrSize New event header size. 518 @param[in] NewEventData Pointer to the new event data. 518 @param[in] NewEventData Pointer to the new event data. 519 519 @param[in] NewEventSize New event data size. 520 520 521 521 @retval EFI_SUCCESS The new event log entry was added. 522 522 @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. … … 569 569 570 570 @param[in] EventLogFormat The type of the event log for which the information is requested. 571 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR/TCG_PCR_EVENT_EX data structure. 571 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR/TCG_PCR_EVENT_EX data structure. 572 572 @param[in] NewEventHdrSize New event header size. 573 @param[in] NewEventData Pointer to the new event data. 573 @param[in] NewEventData Pointer to the new event data. 574 574 @param[in] NewEventSize New event data size. 575 575 … … 614 614 NewEventSize 615 615 ); 616 616 617 617 if (Status == EFI_DEVICE_ERROR) { 618 618 return EFI_DEVICE_ERROR; … … 722 722 723 723 @param[in] Flags Bitmap providing additional information. 724 @param[in] HashData Physical address of the start of the data buffer 724 @param[in] HashData Physical address of the start of the data buffer 725 725 to be hashed, extended, and logged. 726 726 @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData 727 @param[in, out] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 728 @param[in] NewEventData Pointer to the new event data. 727 @param[in, out] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 728 @param[in] NewEventData Pointer to the new event data. 729 729 730 730 @retval EFI_SUCCESS Operation completed successfully. … … 744 744 EFI_STATUS Status; 745 745 TPML_DIGEST_VALUES DigestList; 746 746 747 747 if (!mTcgDxeData.BsCap.TrEEPresentFlag) { 748 748 return EFI_DEVICE_ERROR; … … 776 776 The EFI_TREE_PROTOCOL HashLogExtendEvent function call provides callers with 777 777 an opportunity to extend and optionally log events without requiring 778 knowledge of actual TPM commands. 778 knowledge of actual TPM commands. 779 779 The extend operation will occur even if this function cannot create an event 780 log entry (e.g. due to the event log being full). 780 log entry (e.g. due to the event log being full). 781 781 782 782 @param[in] This Indicates the calling context 783 783 @param[in] Flags Bitmap providing additional information. 784 @param[in] DataToHash Physical address of the start of the data buffer to be hashed. 784 @param[in] DataToHash Physical address of the start of the data buffer to be hashed. 785 785 @param[in] DataToHashLen The length in bytes of the buffer referenced by DataToHash. 786 786 @param[in] Event Pointer to data buffer containing information about the event. … … 872 872 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 873 873 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. 874 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 874 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 875 875 **/ 876 876 EFI_STATUS … … 961 961 mTcgDxeData.EventLogAreaStruct[Index].Laml = EFI_TCG_LOG_AREA_SIZE; 962 962 // 963 // To initialize them as 0xFF is recommended 963 // To initialize them as 0xFF is recommended 964 964 // because the OS can know the last entry for that. 965 965 // … … 985 985 GuidHob.Raw = GetHobList (); 986 986 Status = EFI_SUCCESS; 987 while (!EFI_ERROR (Status) && 987 while (!EFI_ERROR (Status) && 988 988 (GuidHob.Raw = GetNextGuidHob (mTreeEventInfo[Index].EventGuid, GuidHob.Raw)) != NULL) { 989 989 TcgEvent = GET_GUID_HOB_DATA (GuidHob.Guid); … … 1009 1009 Measure and log an action string, and extend the measurement result into PCR[5]. 1010 1010 1011 @param[in] String A specific string that indicates an Action event. 1012 1011 @param[in] String A specific string that indicates an Action event. 1012 1013 1013 @retval EFI_SUCCESS Operation completed successfully. 1014 1014 @retval EFI_DEVICE_ERROR The operation was unsuccessful. … … 1086 1086 if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) { 1087 1087 // 1088 // Tcg Server spec. 1088 // Tcg Server spec. 1089 1089 // Measure each processor EFI_CPU_PHYSICAL_LOCATION with EV_TABLE_OF_DEVICES to PCR[1] 1090 1090 // … … 1118 1118 Measure and log Separator event, and extend the measurement result into a specific PCR. 1119 1119 1120 @param[in] PCRIndex PCR index. 1120 @param[in] PCRIndex PCR index. 1121 1121 1122 1122 @retval EFI_SUCCESS Operation completed successfully. … … 1150 1150 Measure and log an EFI variable, and extend the measurement result into a specific PCR. 1151 1151 1152 @param[in] PCRIndex PCR Index. 1153 @param[in] EventType Event type. 1152 @param[in] PCRIndex PCR Index. 1153 @param[in] EventType Event type. 1154 1154 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 1155 1155 @param[in] VendorGuid A unique identifier for the vendor. 1156 @param[in] VarData The content of the variable data. 1157 @param[in] VarSize The size of the variable data. 1158 1156 @param[in] VarData The content of the variable data. 1157 @param[in] VarSize The size of the variable data. 1158 1159 1159 @retval EFI_SUCCESS Operation completed successfully. 1160 1160 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 1234 1234 Read then Measure and log an EFI variable, and extend the measurement result into a specific PCR. 1235 1235 1236 @param[in] PCRIndex PCR Index. 1237 @param[in] EventType Event type. 1236 @param[in] PCRIndex PCR Index. 1237 @param[in] EventType Event type. 1238 1238 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 1239 1239 @param[in] VendorGuid A unique identifier for the vendor. 1240 @param[out] VarSize The size of the variable data. 1241 @param[out] VarData Pointer to the content of the variable. 1242 1240 @param[out] VarSize The size of the variable data. 1241 @param[out] VarData Pointer to the content of the variable. 1242 1243 1243 @retval EFI_SUCCESS Operation completed successfully. 1244 1244 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 1292 1292 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 1293 1293 @param[in] VendorGuid A unique identifier for the vendor. 1294 @param[out] VarSize The size of the variable data. 1295 @param[out] VarData Pointer to the content of the variable. 1296 1294 @param[out] VarSize The size of the variable data. 1295 @param[out] VarData Pointer to the content of the variable. 1296 1297 1297 @retval EFI_SUCCESS Operation completed successfully. 1298 1298 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 1323 1323 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 1324 1324 @param[in] VendorGuid A unique identifier for the vendor. 1325 @param[out] VarSize The size of the variable data. 1326 @param[out] VarData Pointer to the content of the variable. 1327 1325 @param[out] VarSize The size of the variable data. 1326 @param[out] VarData Pointer to the content of the variable. 1327 1328 1328 @retval EFI_SUCCESS Operation completed successfully. 1329 1329 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 1617 1617 Install TCG ACPI Table when ACPI Table Protocol is available. 1618 1618 1619 A system's firmware uses an ACPI table to identify the system's TCG capabilities 1620 to the Post-Boot environment. The information in this ACPI table is not guaranteed 1621 to be valid until the Host Platform transitions from pre-boot state to post-boot state. 1619 A system's firmware uses an ACPI table to identify the system's TCG capabilities 1620 to the Post-Boot environment. The information in this ACPI table is not guaranteed 1621 to be valid until the Host Platform transitions from pre-boot state to post-boot state. 1622 1622 1623 1623 @param[in] Event Event whose notification function is being invoked … … 1650 1650 mTcgClientAcpiTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision); 1651 1651 // 1652 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1652 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1653 1653 // service of the ACPI table protocol to install it. 1654 1654 // … … 1670 1670 mTcgServerAcpiTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision); 1671 1671 // 1672 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1672 // The ACPI table must be checksumed before calling the InstallAcpiTable() 1673 1673 // service of the ACPI table protocol to install it. 1674 1674 // … … 1761 1761 /** 1762 1762 The function install TrEE protocol. 1763 1763 1764 1764 @retval EFI_SUCCESS TrEE protocol is installed. 1765 1765 @retval other Some error occurs. … … 1786 1786 The driver's entry point. It publishes EFI TrEE Protocol. 1787 1787 1788 @param[in] ImageHandle The firmware allocated handle for the EFI image. 1788 @param[in] ImageHandle The firmware allocated handle for the EFI image. 1789 1789 @param[in] SystemTable A pointer to the EFI System Table. 1790 1790 1791 1791 @retval EFI_SUCCESS The entry point is executed successfully. 1792 1792 @retval other Some error occurs when executing this entry point. … … 1820 1820 return EFI_DEVICE_ERROR; 1821 1821 } 1822 1822 1823 1823 Status = Tpm2RequestUseTpm (); 1824 1824 if (EFI_ERROR (Status)) { … … 1826 1826 return Status; 1827 1827 } 1828 1828 1829 1829 // 1830 1830 // Fill information … … 1922 1922 1923 1923 // 1924 // Measure Exit Boot Service failed 1924 // Measure Exit Boot Service failed 1925 1925 // 1926 1926 Status = gBS->CreateEventEx ( -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf
r58464 r58466 64 64 ## SOMETIMES_CONSUMES ## GUID # Handoff Table for measurement. 65 65 gEfiSmbiosTableGuid 66 66 67 67 ## SOMETIMES_CONSUMES ## Variable:L"SecureBoot" 68 68 ## SOMETIMES_CONSUMES ## Variable:L"PK" … … 74 74 ## SOMETIMES_CONSUMES ## Variable:L"dbx" 75 75 gEfiImageSecurityDatabaseGuid 76 76 77 77 gTcgEventEntryHobGuid ## SOMETIMES_CONSUMES ## HOB 78 78 gTpmErrorHobGuid ## SOMETIMES_CONSUMES ## HOB -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEPei/TrEEPei.c
r58464 r58466 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 117 117 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, 118 118 &gEfiPeiFirmwareVolumeInfoPpiGuid, 119 FirmwareVolmeInfoPpiNotifyCallback 119 FirmwareVolmeInfoPpiNotifyCallback 120 120 }, 121 121 { 122 122 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, 123 123 &gEfiPeiFirmwareVolumeInfo2PpiGuid, 124 FirmwareVolmeInfoPpiNotifyCallback 124 FirmwareVolmeInfoPpiNotifyCallback 125 125 }, 126 126 { … … 170 170 /** 171 171 Record all measured Firmware Volum Information into a Guid Hob 172 Guid Hob payload layout is 172 Guid Hob payload layout is 173 173 174 174 UINT32 *************************** FIRMWARE_BLOB number … … 190 190 IN VOID *Ppi 191 191 ) 192 { 192 { 193 193 MEASURED_HOB_DATA *MeasuredHobData; 194 194 … … 196 196 197 197 // 198 // Create a Guid hob to save all measured Fv 198 // Create a Guid hob to save all measured Fv 199 199 // 200 200 MeasuredHobData = BuildGuidHob( … … 278 278 279 279 @param[in] Flags Bitmap providing additional information. 280 @param[in] HashData Physical address of the start of the data buffer 280 @param[in] HashData Physical address of the start of the data buffer 281 281 to be hashed, extended, and logged. 282 282 @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData. 283 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 284 @param[in] NewEventData Pointer to the new event data. 283 @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure. 284 @param[in] NewEventData Pointer to the new event data. 285 285 286 286 @retval EFI_SUCCESS Operation completed successfully. … … 316 316 } 317 317 } 318 318 319 319 if (Status == EFI_DEVICE_ERROR) { 320 320 DEBUG ((EFI_D_ERROR, "HashLogExtendEvent - %r. Disable TPM.\n", Status)); … … 363 363 364 364 /** 365 Measure FV image. 366 Add it into the measured FV list after the FV is measured successfully. 365 Measure FV image. 366 Add it into the measured FV list after the FV is measured successfully. 367 367 368 368 @param[in] FvBase Base address of FV image. 369 369 @param[in] FvLength Length of FV image. 370 370 371 @retval EFI_SUCCESS Fv image is measured successfully 371 @retval EFI_SUCCESS Fv image is measured successfully 372 372 or it has been already measured. 373 373 @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. … … 407 407 } 408 408 } 409 409 410 410 // 411 411 // Measure and record the FV to the TPM … … 473 473 break; 474 474 } 475 475 476 476 // 477 477 // Measure and record the firmware volume that is dispatched by PeiCore … … 483 483 // 484 484 Status = PeiServicesLocatePpi ( 485 &VolumeInfo.FvFormat, 486 0, 485 &VolumeInfo.FvFormat, 486 0, 487 487 NULL, 488 488 (VOID**)&FvPpi … … 529 529 // 530 530 Status = PeiServicesLocatePpi ( 531 &Fv->FvFormat, 532 0, 531 &Fv->FvFormat, 532 0, 533 533 NULL, 534 534 (VOID**)&FvPpi … … 537 537 return EFI_SUCCESS; 538 538 } 539 539 540 540 // 541 541 // This is an FV from an FFS file, and the parent FV must have already been measured, … … 543 543 // 544 544 if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) { 545 545 546 546 ASSERT (mMeasuredChildFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)); 547 547 if (mMeasuredChildFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) { … … 582 582 583 583 Status = PeiServicesLocatePpi ( 584 &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, 585 0, 584 &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, 585 0, 586 586 NULL, 587 587 (VOID**)&mMeasurementExcludedFvPpi … … 593 593 mMeasuredChildFvInfo = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported)); 594 594 ASSERT (mMeasuredChildFvInfo != NULL); 595 595 596 596 if (PcdGet8 (PcdTpm2ScrtmPolicy) == 1) { 597 597 Status = MeasureCRTMVersion (); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/Tpm.asl
-
Property svn:eol-style
set to
native
r58464 r58466 1 1 /** @file 2 The TPM2 definition block in ACPI table for TrEE physical presence 2 The TPM2 definition block in ACPI table for TrEE physical presence 3 3 and MemoryClear. 4 4 5 5 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 31 31 // 32 32 Name (_HID, "MSFT0101") 33 33 34 34 // 35 35 // Readable name of this device, don't know if this way is correct yet … … 49 49 OperationRegion (SMIP, SystemIO, 0xB2, 1) 50 50 Field (SMIP, ByteAcc, NoLock, Preserve) 51 { 51 { 52 52 IOB2, 8 53 53 } … … 82 82 83 83 Method (PTS, 1, Serialized) 84 { 84 { 85 85 // 86 86 // Detect Sx state for MOR, only S4, S5 need to handle 87 87 // 88 88 If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3))) 89 { 89 { 90 90 // 91 91 // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect. … … 97 97 // 98 98 Store (0x02, MCIP) 99 99 100 100 // 101 101 // Triggle the SMI interrupt … … 105 105 } 106 106 Return (0) 107 } 107 } 108 108 109 109 Method (_STA, 0) … … 155 155 156 156 Name(TPM2, Package (0x02){ 157 Zero,158 Zero159 })160 161 Name(TPM3, Package (0x03){162 Zero,163 157 Zero, 164 158 Zero 165 159 }) 166 160 161 Name(TPM3, Package (0x03){ 162 Zero, 163 Zero, 164 Zero 165 }) 166 167 167 // 168 168 // TCG Physical Presence Interface 169 169 // 170 170 Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj 171 { 171 { 172 172 // 173 173 // Switch by function index … … 194 194 // b) Submit TPM Operation Request to Pre-OS Environment 195 195 // 196 196 197 197 Store (DerefOf (Index (Arg2, 0x00)), PPRQ) 198 198 Store (0x02, PPIP) 199 199 200 200 // 201 201 // Triggle the SMI interrupt … … 211 211 // c) Get Pending TPM Operation Requested By the OS 212 212 // 213 213 214 214 Store (PPRQ, Index (TPM2, 0x01)) 215 215 Return (TPM2) … … 228 228 // 229 229 Store (0x05, PPIP) 230 230 231 231 // 232 232 // Triggle the SMI interrupt 233 233 // 234 234 Store (PPIN, IOB2) 235 235 236 236 Store (LPPR, Index (TPM3, 0x01)) 237 237 Store (PPRP, Index (TPM3, 0x02)) … … 256 256 Store (7, PPIP) 257 257 Store (DerefOf (Index (Arg2, 0x00)), PPRQ) 258 259 // 260 // Triggle the SMI interrupt 261 // 262 Store (PPIN, IOB2) 258 259 // 260 // Triggle the SMI interrupt 261 // 262 Store (PPIN, IOB2) 263 263 Return (FRET) 264 264 } … … 270 270 Store (8, PPIP) 271 271 Store (DerefOf (Index (Arg2, 0x00)), PPRQ) 272 272 273 273 // 274 274 // Triggle the SMI interrupt 275 275 // 276 276 Store (PPIN, IOB2) 277 277 278 278 Return (FRET) 279 279 } … … 304 304 // 305 305 Store (DerefOf (Index (Arg2, 0x00)), MORD) 306 306 307 307 // 308 308 // Triggle the SMI through ACPI _DSM method. 309 309 // 310 310 Store (0x01, MCIP) 311 311 312 312 // 313 313 // Triggle the SMI interrupt … … 318 318 Default {BreakPoint} 319 319 } 320 Return (1) 320 Return (1) 321 321 } 322 322 -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/TrEESmm.c
r58464 r58466 11 11 12 12 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 13 This program and the accompanying materials 14 are licensed and made available under the terms and conditions of the BSD License 15 which accompanies this distribution. The full text of the license may be found at 13 This program and the accompanying materials 14 are licensed and made available under the terms and conditions of the BSD License 15 which accompanies this distribution. The full text of the license may be found at 16 16 http://opensource.org/licenses/bsd-license.php 17 17 18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 19 19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 20 20 … … 98 98 mTcgNvs->PhysicalPresence.LastRequest = PpData.LastPPRequest; 99 99 mTcgNvs->PhysicalPresence.Response = PpData.PPResponse; 100 } else if ((mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS) 100 } else if ((mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS) 101 101 || (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) { 102 102 if (EFI_ERROR (Status)) { … … 126 126 } 127 127 128 if (EFI_ERROR (Status)) { 128 if (EFI_ERROR (Status)) { 129 129 mTcgNvs->PhysicalPresence.ReturnCode = TREE_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE; 130 130 DEBUG ((EFI_D_ERROR, "[TPM2] Set PP variable failure! Status = %r\n", Status)); … … 195 195 } else { 196 196 if (mTcgNvs->PhysicalPresence.Request < TREE_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) { 197 mTcgNvs->PhysicalPresence.ReturnCode = TREE_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; 197 mTcgNvs->PhysicalPresence.ReturnCode = TREE_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; 198 198 return EFI_SUCCESS; 199 199 } … … 206 206 } else { 207 207 mTcgNvs->PhysicalPresence.ReturnCode = TREE_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED; 208 } 208 } 209 209 if (mTcgNvs->PhysicalPresence.Request >= TREE_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) { 210 210 mTcgNvs->PhysicalPresence.ReturnCode = TrEEPpVendorLibGetUserConfirmationStatusFunction (mTcgNvs->PhysicalPresence.Request, Flags.PPFlags); 211 211 } 212 } 212 } 213 213 214 214 return EFI_SUCCESS; … … 278 278 &MorControl 279 279 ); 280 if (EFI_ERROR (Status)) { 280 if (EFI_ERROR (Status)) { 281 281 mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE; 282 282 DEBUG ((EFI_D_ERROR, "[TPM] Set MOR variable failure! Status = %r\n", Status)); … … 316 316 OpRegion <= (AML_OP_REGION_32_8 *) ((UINT8 *) Table + Table->Length); 317 317 OpRegion = (AML_OP_REGION_32_8 *) ((UINT8 *) OpRegion + 1)) { 318 if ((OpRegion->OpRegionOp == AML_EXT_REGION_OP) && 318 if ((OpRegion->OpRegionOp == AML_EXT_REGION_OP) && 319 319 (OpRegion->NameString == Name) && 320 320 (OpRegion->DWordPrefix == AML_DWORD_PREFIX) && … … 453 453 The driver's entry point. 454 454 455 It install callbacks for TPM physical presence and MemoryClear, and locate 455 It install callbacks for TPM physical presence and MemoryClear, and locate 456 456 SMM variable to be used in the callback function. 457 457 458 @param[in] ImageHandle The firmware allocated handle for the EFI image. 458 @param[in] ImageHandle The firmware allocated handle for the EFI image. 459 459 @param[in] SystemTable A pointer to the EFI System Table. 460 460 461 461 @retval EFI_SUCCESS The entry point is executed successfully. 462 462 @retval Others Some error occurs when executing this entry point. … … 503 503 } 504 504 mTcgNvs->MemoryClear.SoftwareSmi = (UINT8) SwContext.SwSmiInputValue; 505 505 506 506 // 507 507 // Locate SmmVariableProtocol. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/TrEESmm.h
r58464 r58466 1 1 /** @file 2 2 The header file for TrEE SMM driver. 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/TrEESmm.inf
r58464 r58466 2 2 # Provides ACPI metholds for TPM 2.0 support 3 3 # 4 # This driver implements TPM 2.0 definition block in ACPI table and 5 # registers SMI callback functions for TrEE physical presence and 4 # This driver implements TPM 2.0 definition block in ACPI table and 5 # registers SMI callback functions for TrEE physical presence and 6 6 # MemoryClear to handle the requests from ACPI method. 7 7 # … … 59 59 60 60 ## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl" 61 ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl" 61 ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl" 62 62 gEfiMemoryOverwriteControlDataGuid 63 63 64 64 gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCES ## GUID # TPM device identifier 65 65 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.c
r58459 r58466 1 1 /** @file 2 2 Password Credential Provider driver implementation. 3 3 4 4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 98 98 // 99 99 NewTable = (CREDENTIAL_TABLE *) AllocateZeroPool ( 100 sizeof (CREDENTIAL_TABLE) + 100 sizeof (CREDENTIAL_TABLE) + 101 101 (Count - 1) * sizeof (PASSWORD_INFO) 102 102 ); 103 ASSERT (NewTable != NULL); 103 ASSERT (NewTable != NULL); 104 104 105 105 NewTable->MaxCount = Count; … … 110 110 // 111 111 CopyMem ( 112 &NewTable->UserInfo, 113 &mPwdTable->UserInfo, 112 &NewTable->UserInfo, 113 &mPwdTable->UserInfo, 114 114 mPwdTable->Count * sizeof (PASSWORD_INFO) 115 115 ); … … 123 123 124 124 @param[in] Index The index of the password in table. If index is found in 125 table, update the info, else add the into to table. 126 @param[in] Info The new password info to add into table.If Info is NULL, 125 table, update the info, else add the into to table. 126 @param[in] Info The new password info to add into table.If Info is NULL, 127 127 delete the info by Index. 128 128 … … 151 151 if (Index != mPwdTable->Count) { 152 152 NewPasswordInfo = &mPwdTable->UserInfo[mPwdTable->Count]; 153 } 153 } 154 154 } else { 155 155 // … … 214 214 Var = NULL; 215 215 Status = gRT->GetVariable ( 216 L"PwdCredential", 217 &gPwdCredentialProviderGuid, 218 NULL, 216 L"PwdCredential", 217 &gPwdCredentialProviderGuid, 218 NULL, 219 219 &VarSize, 220 220 Var … … 226 226 } 227 227 Status = gRT->GetVariable ( 228 L"PwdCredential", 229 &gPwdCredentialProviderGuid, 230 NULL, 228 L"PwdCredential", 229 &gPwdCredentialProviderGuid, 230 NULL, 231 231 &VarSize, 232 232 Var … … 236 236 return Status; 237 237 } 238 238 239 239 // 240 240 // Create the password credential table. … … 242 242 mPwdTable = AllocateZeroPool ( 243 243 sizeof (CREDENTIAL_TABLE) - sizeof (PASSWORD_INFO) + 244 PASSWORD_TABLE_INC * sizeof (PASSWORD_INFO) + 244 PASSWORD_TABLE_INC * sizeof (PASSWORD_INFO) + 245 245 VarSize 246 246 ); … … 270 270 @retval TRUE Hash the password successfully. 271 271 @retval FALSE Failed to hash the password. 272 272 273 273 **/ 274 274 BOOLEAN … … 282 282 UINTN HashSize; 283 283 VOID *Hash; 284 284 285 285 HashSize = Sha1GetContextSize (); 286 286 Hash = AllocatePool (HashSize); 287 287 ASSERT (Hash != NULL); 288 288 289 289 Status = Sha1Init (Hash); 290 290 if (!Status) { 291 291 goto Done; 292 292 } 293 293 294 294 Status = Sha1Update (Hash, Password, PasswordSize); 295 295 if (!Status) { 296 296 goto Done; 297 297 } 298 298 299 299 Status = Sha1Final (Hash, Credential); 300 300 301 301 Done: 302 302 FreePool (Hash); … … 325 325 CHAR16 *QuestionStr; 326 326 CHAR16 *LineStr; 327 327 328 328 PasswordLen = 0; 329 329 while (TRUE) { … … 346 346 FreePool (QuestionStr); 347 347 FreePool (LineStr); 348 348 349 349 // 350 350 // Check key stroke … … 357 357 PasswordLen--; 358 358 } 359 } else if ((Key.UnicodeChar == CHAR_NULL) || 360 (Key.UnicodeChar == CHAR_TAB) || 359 } else if ((Key.UnicodeChar == CHAR_NULL) || 360 (Key.UnicodeChar == CHAR_TAB) || 361 361 (Key.UnicodeChar == CHAR_LINEFEED)) { 362 362 continue; … … 371 371 } 372 372 } 373 373 374 374 PasswordLen = PasswordLen * sizeof (CHAR16); 375 375 GenerateCredential (Password, PasswordLen, (UINT8 *)Credential); … … 392 392 UINTN Index; 393 393 CHAR8 *Pwd; 394 394 395 395 // 396 396 // Check password credential. … … 412 412 Find a user infomation record by the information record type. 413 413 414 This function searches all user information records of User from beginning 414 This function searches all user information records of User from beginning 415 415 until either the information is found, or there are no more user infomation 416 416 records. A match occurs when a Info.InfoType field matches the user information 417 417 record type. 418 418 419 @param[in] User Points to the user profile record to search. 419 @param[in] User Points to the user profile record to search. 420 420 @param[in] InfoType The infomation type to be searched. 421 421 @param[out] Info Points to the user info found, the caller is responsible 422 422 to free. 423 423 424 424 @retval EFI_SUCCESS Find the user information successfully. 425 425 @retval Others Fail to find the user information. … … 438 438 EFI_USER_INFO_HANDLE UserInfoHandle; 439 439 EFI_USER_MANAGER_PROTOCOL *UserManager; 440 440 441 441 // 442 442 // Find user information by information type. … … 501 501 *Info = UserInfo; 502 502 return EFI_SUCCESS; 503 } 503 } 504 504 } 505 505 … … 570 570 } 571 571 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; 572 } 572 } 573 573 return EFI_SUCCESS; 574 574 } … … 714 714 Enroll a user on a credential provider. 715 715 716 This function enrolls a user on this credential provider. If the user exists on 717 this credential provider, update the user information on this credential provider; 716 This function enrolls a user on this credential provider. If the user exists on 717 this credential provider, update the user information on this credential provider; 718 718 otherwise add the user information on credential provider. 719 719 720 720 @param[in] This Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL. 721 721 @param[in] User The user profile to enroll. 722 722 723 723 @retval EFI_SUCCESS User profile was successfully enrolled. 724 724 @retval EFI_ACCESS_DENIED Current user profile does not permit enrollment on the 725 725 user profile handle. Either the user profile cannot enroll 726 on any user profile or cannot enroll on a user profile 726 on any user profile or cannot enroll on a user profile 727 727 other than the current user profile. 728 728 @retval EFI_UNSUPPORTED This credential provider does not support enrollment in … … 731 731 error. 732 732 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile handle. 733 733 734 734 **/ 735 735 EFI_STATUS … … 767 767 } 768 768 769 CopyMem (PwdInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); 769 CopyMem (PwdInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); 770 770 FreePool (UserInfo); 771 771 772 772 // 773 773 // Get password from user. 774 // 774 // 775 775 while (TRUE) { 776 776 // … … 789 789 if (CompareMem (PwdInfo.Password, Password, CREDENTIAL_LEN) == 0) { 790 790 break; 791 } 791 } 792 792 793 793 QuestionStr = GetStringById (STRING_TOKEN (STR_PASSWORD_MISMATCH)); 794 PromptStr = GetStringById (STRING_TOKEN (STR_INPUT_PASSWORD_AGAIN)); 794 PromptStr = GetStringById (STRING_TOKEN (STR_INPUT_PASSWORD_AGAIN)); 795 795 CreatePopUp ( 796 796 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, … … 807 807 // 808 808 // Check whether User is ever enrolled in the provider. 809 // 809 // 810 810 for (Index = 0; Index < mPwdTable->Count; Index++) { 811 811 UserId = (UINT8 *) &mPwdTable->UserInfo[Index].UserId; … … 813 813 // 814 814 // User already exists, update the password. 815 // 815 // 816 816 break; 817 817 } 818 818 } 819 819 820 820 // 821 821 // Enroll the User to the provider. … … 835 835 This function returns information about the form used when interacting with the 836 836 user during user identification. The form is the first enabled form in the form-set 837 class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If 837 class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If 838 838 the user credential provider does not require a form to identify the user, then this 839 839 function should return EFI_NOT_FOUND. … … 843 843 @param[out] FormSetId On return, holds the identifier of the form set which contains 844 844 the form used during user identification. 845 @param[out] FormId On return, holds the identifier of the form used during user 845 @param[out] FormId On return, holds the identifier of the form used during user 846 846 identification. 847 847 848 848 @retval EFI_SUCCESS Form returned successfully. 849 849 @retval EFI_NOT_FOUND Form not returned. 850 850 @retval EFI_INVALID_PARAMETER Hii is NULL or FormSetId is NULL or FormId is NULL. 851 851 852 852 **/ 853 853 EFI_STATUS … … 860 860 ) 861 861 { 862 if ((This == NULL) || (Hii == NULL) || 862 if ((This == NULL) || (Hii == NULL) || 863 863 (FormSetId == NULL) || (FormId == NULL)) { 864 864 return EFI_INVALID_PARAMETER; … … 868 868 *FormId = FORMID_GET_PASSWORD_FORM; 869 869 CopyGuid (FormSetId, &gPwdCredentialProviderGuid); 870 870 871 871 return EFI_SUCCESS; 872 872 } … … 878 878 This optional function returns a bitmap that is less than or equal to the number 879 879 of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND 880 is returned. 880 is returned. 881 881 882 882 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 883 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 884 bitmap information will be returned. On exit, points to the 883 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 884 bitmap information will be returned. On exit, points to the 885 885 width of the bitmap returned. 886 886 @param[in, out] Height On entry, points to the desired bitmap height. If NULL then no 887 bitmap information will be returned. On exit, points to the 887 bitmap information will be returned. On exit, points to the 888 888 height of the bitmap returned 889 @param[out] Hii On return, holds the HII database handle. 890 @param[out] Image On return, holds the HII image identifier. 891 889 @param[out] Hii On return, holds the HII database handle. 890 @param[out] Image On return, holds the HII image identifier. 891 892 892 @retval EFI_SUCCESS Image identifier returned successfully. 893 893 @retval EFI_NOT_FOUND Image identifier not returned. 894 894 @retval EFI_INVALID_PARAMETER Hii is NULL or Image is NULL. 895 895 896 896 **/ 897 897 EFI_STATUS … … 904 904 OUT EFI_IMAGE_ID *Image 905 905 ) 906 { 906 { 907 907 if ((This == NULL) || (Hii == NULL) || (Image == NULL)) { 908 908 return EFI_INVALID_PARAMETER; … … 916 916 917 917 This function returns a string which describes the credential provider. If no 918 such string exists, then EFI_NOT_FOUND is returned. 918 such string exists, then EFI_NOT_FOUND is returned. 919 919 920 920 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 921 921 @param[out] Hii On return, holds the HII database handle. 922 922 @param[out] String On return, holds the HII string identifier. 923 923 924 924 @retval EFI_SUCCESS String identifier returned successfully. 925 925 @retval EFI_NOT_FOUND String identifier not returned. 926 926 @retval EFI_INVALID_PARAMETER Hii is NULL or String is NULL. 927 927 928 928 **/ 929 929 EFI_STATUS … … 938 938 return EFI_INVALID_PARAMETER; 939 939 } 940 940 941 941 // 942 942 // Set Hii handle and String ID. … … 953 953 954 954 This function returns the user identifier of the user authenticated by this credential 955 provider. This function is called after the credential-related information has been 955 provider. This function is called after the credential-related information has been 956 956 submitted on a form, OR after a call to Default() has returned that this credential is 957 957 ready to log on. 958 958 959 959 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 960 @param[in] User The user profile handle of the user profile currently being 960 @param[in] User The user profile handle of the user profile currently being 961 961 considered by the user identity manager. If NULL, then no user 962 962 profile is currently under consideration. 963 @param[out] Identifier On return, points to the user identifier. 964 963 @param[out] Identifier On return, points to the user identifier. 964 965 965 @retval EFI_SUCCESS User identifier returned successfully. 966 966 @retval EFI_NOT_READY No user identifier can be returned. … … 969 969 @retval EFI_NOT_FOUND User is not NULL, and the specified user handle can't be 970 970 found in user profile database 971 971 972 972 **/ 973 973 EFI_STATUS … … 998 998 return EFI_NOT_READY; 999 999 } 1000 1000 1001 1001 if (User == NULL) { 1002 1002 // 1003 1003 // Return the user ID whose password matches the input password. 1004 // 1004 // 1005 1005 CopyMem ( 1006 Identifier, 1007 &mPwdTable->UserInfo[mPwdTable->ValidIndex - 1].UserId, 1006 Identifier, 1007 &mPwdTable->UserInfo[mPwdTable->ValidIndex - 1].UserId, 1008 1008 sizeof (EFI_USER_INFO_IDENTIFIER) 1009 ); 1009 ); 1010 1010 return EFI_SUCCESS; 1011 1011 } 1012 1012 1013 1013 // 1014 1014 // Get the User's ID. … … 1022 1022 return EFI_NOT_FOUND; 1023 1023 } 1024 1024 1025 1025 // 1026 1026 // Check whether the input password matches one in PwdTable. … … 1036 1036 FreePool (UserInfo); 1037 1037 return EFI_SUCCESS; 1038 } 1039 } 1040 } 1041 1042 FreePool (UserInfo); 1038 } 1039 } 1040 } 1041 1042 FreePool (UserInfo); 1043 1043 return EFI_NOT_READY; 1044 1044 } … … 1048 1048 Indicate that user interface interaction has begun for the specified credential. 1049 1049 1050 This function is called when a credential provider is selected by the user. If 1050 This function is called when a credential provider is selected by the user. If 1051 1051 AutoLogon returns FALSE, then the user interface will be constructed by the User 1052 Identity Manager. 1052 Identity Manager. 1053 1053 1054 1054 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1055 @param[out] AutoLogon On return, points to the credential provider's capabilities 1056 after the credential provider has been selected by the user. 1057 1055 @param[out] AutoLogon On return, points to the credential provider's capabilities 1056 after the credential provider has been selected by the user. 1057 1058 1058 @retval EFI_SUCCESS Credential provider successfully selected. 1059 1059 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. 1060 1060 1061 1061 **/ 1062 1062 EFI_STATUS … … 1082 1082 1083 1083 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1084 1084 1085 1085 @retval EFI_SUCCESS Credential provider successfully deselected. 1086 1086 1087 1087 **/ 1088 1088 EFI_STATUS … … 1102 1102 Return the default logon behavior for this user credential. 1103 1103 1104 This function reports the default login behavior regarding this credential provider. 1104 This function reports the default login behavior regarding this credential provider. 1105 1105 1106 1106 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1107 1107 @param[out] AutoLogon On return, holds whether the credential provider should be used 1108 by default to automatically log on the user. 1109 1108 by default to automatically log on the user. 1109 1110 1110 @retval EFI_SUCCESS Default information successfully returned. 1111 1111 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. 1112 1112 1113 1113 **/ 1114 1114 EFI_STATUS … … 1123 1123 } 1124 1124 *AutoLogon = 0; 1125 1125 1126 1126 return EFI_SUCCESS; 1127 1127 } … … 1131 1131 Return information attached to the credential provider. 1132 1132 1133 This function returns user information. 1133 This function returns user information. 1134 1134 1135 1135 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1136 @param[in] UserInfo Handle of the user information data record. 1136 @param[in] UserInfo Handle of the user information data record. 1137 1137 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On 1138 1138 exit, holds the user information. If the buffer is too small … … 1140 1140 and InfoSize is updated to contain the number of bytes actually 1141 1141 required. 1142 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 1143 size of the user information. 1144 1142 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 1143 size of the user information. 1144 1145 1145 @retval EFI_SUCCESS Information returned successfully. 1146 1146 @retval EFI_BUFFER_TOO_SMALL The size specified by InfoSize is too small to hold all of the 1147 1147 user information. The size required is returned in *InfoSize. 1148 1148 @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL. 1149 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 1150 1149 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 1150 1151 1151 **/ 1152 1152 EFI_STATUS … … 1161 1161 EFI_USER_INFO *CredentialInfo; 1162 1162 UINTN Index; 1163 1163 1164 1164 if ((This == NULL) || (InfoSize == NULL) || (Info == NULL)) { 1165 1165 return EFI_INVALID_PARAMETER; … … 1169 1169 return EFI_NOT_FOUND; 1170 1170 } 1171 1171 1172 1172 // 1173 1173 // Find information handle in credential info table. … … 1183 1183 return EFI_BUFFER_TOO_SMALL; 1184 1184 } 1185 CopyMem (Info, CredentialInfo, CredentialInfo->InfoSize); 1186 return EFI_SUCCESS; 1187 } 1188 } 1189 1185 CopyMem (Info, CredentialInfo, CredentialInfo->InfoSize); 1186 return EFI_SUCCESS; 1187 } 1188 } 1189 1190 1190 return EFI_NOT_FOUND; 1191 1191 } … … 1198 1198 information record handle, point UserInfo at a NULL. Each subsequent call will retrieve 1199 1199 another user information record handle until there are no more, at which point UserInfo 1200 will point to NULL. 1200 will point to NULL. 1201 1201 1202 1202 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 1204 1204 to start enumeration. On exit, points to the next user information 1205 1205 handle or NULL if there is no more user information. 1206 1206 1207 1207 @retval EFI_SUCCESS User information returned. 1208 1208 @retval EFI_NOT_FOUND No more user information found. 1209 1209 @retval EFI_INVALID_PARAMETER UserInfo is NULL. 1210 1210 1211 1211 **/ 1212 1212 EFI_STATUS … … 1222 1222 UINTN Index; 1223 1223 UINTN ProvStrLen; 1224 1224 1225 1225 if ((This == NULL) || (UserInfo == NULL)) { 1226 1226 return EFI_INVALID_PARAMETER; … … 1244 1244 Info = AllocateZeroPool (InfoLen); 1245 1245 ASSERT (Info != NULL); 1246 1246 1247 1247 Info->InfoType = EFI_USER_INFO_CREDENTIAL_PROVIDER_RECORD; 1248 1248 Info->InfoSize = (UINT32) InfoLen; … … 1250 1250 CopyGuid (&Info->Credential, &gPwdCredentialProviderGuid); 1251 1251 CopyGuid ((EFI_GUID *)(Info + 1), &gPwdCredentialProviderGuid); 1252 1252 1253 1253 mPwdInfoHandle->Info[0] = Info; 1254 1254 mPwdInfoHandle->Count++; … … 1262 1262 Info = AllocateZeroPool (InfoLen); 1263 1263 ASSERT (Info != NULL); 1264 1264 1265 1265 Info->InfoType = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD; 1266 1266 Info->InfoSize = (UINT32) InfoLen; … … 1279 1279 Info = AllocateZeroPool (InfoLen); 1280 1280 ASSERT (Info != NULL); 1281 1281 1282 1282 Info->InfoType = EFI_USER_INFO_CREDENTIAL_TYPE_RECORD; 1283 1283 Info->InfoSize = (UINT32) InfoLen; … … 1285 1285 CopyGuid (&Info->Credential, &gPwdCredentialProviderGuid); 1286 1286 CopyGuid ((EFI_GUID *)(Info + 1), &gEfiUserCredentialClassPasswordGuid); 1287 1287 1288 1288 mPwdInfoHandle->Info[2] = Info; 1289 1289 mPwdInfoHandle->Count++; 1290 1290 1291 1291 // 1292 1292 // The fourth information, Credential Provider type name info. … … 1297 1297 Info = AllocateZeroPool (InfoLen); 1298 1298 ASSERT (Info != NULL); 1299 1299 1300 1300 Info->InfoType = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD; 1301 1301 Info->InfoSize = (UINT32) InfoLen; … … 1304 1304 CopyMem ((UINT8*)(Info + 1), ProvNameStr, ProvStrLen); 1305 1305 FreePool (ProvNameStr); 1306 1306 1307 1307 mPwdInfoHandle->Info[3] = Info; 1308 1308 mPwdInfoHandle->Count++; 1309 1309 } 1310 1310 1311 1311 if (*UserInfo == NULL) { 1312 1312 // … … 1316 1316 return EFI_SUCCESS; 1317 1317 } 1318 1318 1319 1319 // 1320 1320 // Find information handle in credential info table. … … 1333 1333 return EFI_NOT_FOUND; 1334 1334 } 1335 1335 1336 1336 Index++; 1337 1337 *UserInfo = (EFI_USER_INFO_HANDLE)mPwdInfoHandle->Info[Index]; 1338 return EFI_SUCCESS; 1338 return EFI_SUCCESS; 1339 1339 } 1340 1340 } … … 1347 1347 Delete a user on this credential provider. 1348 1348 1349 This function deletes a user on this credential provider. 1349 This function deletes a user on this credential provider. 1350 1350 1351 1351 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 1353 1353 1354 1354 @retval EFI_SUCCESS User profile was successfully deleted. 1355 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 1356 Either the user profile cannot delete on any user profile or cannot delete 1357 on a user profile other than the current user profile. 1355 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 1356 Either the user profile cannot delete on any user profile or cannot delete 1357 on a user profile other than the current user profile. 1358 1358 @retval EFI_UNSUPPORTED This credential provider does not support deletion in the pre-OS. 1359 1359 @retval EFI_DEVICE_ERROR The new credential could not be deleted because of a device error. … … 1372 1372 UINT8 *NewUserId; 1373 1373 UINTN Index; 1374 1374 1375 1375 if ((This == NULL) || (User == NULL)) { 1376 1376 return EFI_INVALID_PARAMETER; … … 1392 1392 // 1393 1393 // Find the user by user identifier in mPwdTable. 1394 // 1394 // 1395 1395 for (Index = 0; Index < mPwdTable->Count; Index++) { 1396 1396 UserId = (UINT8 *) &mPwdTable->UserInfo[Index].UserId; … … 1440 1440 return Status; 1441 1441 } 1442 1442 1443 1443 // 1444 1444 // Init Form Browser. … … 1448 1448 return Status; 1449 1449 } 1450 1450 1451 1451 // 1452 1452 // Install protocol interfaces for the password credential provider. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.h
r48674 r58466 1 1 /** @file 2 2 Password Credential Provider driver header file. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 93 93 Enroll a user on a credential provider. 94 94 95 This function enrolls a user on this credential provider. If the user exists on 96 this credential provider, update the user information on this credential provider; 95 This function enrolls a user on this credential provider. If the user exists on 96 this credential provider, update the user information on this credential provider; 97 97 otherwise delete the user information on credential provider. 98 98 99 99 @param[in] This Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL. 100 100 @param[in] User The user profile to enroll. 101 101 102 102 @retval EFI_SUCCESS User profile was successfully enrolled. 103 103 @retval EFI_ACCESS_DENIED Current user profile does not permit enrollment on the 104 104 user profile handle. Either the user profile cannot enroll 105 on any user profile or cannot enroll on a user profile 105 on any user profile or cannot enroll on a user profile 106 106 other than the current user profile. 107 107 @retval EFI_UNSUPPORTED This credential provider does not support enrollment in … … 110 110 error. 111 111 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile handle. 112 112 113 113 **/ 114 114 EFI_STATUS … … 124 124 This function returns information about the form used when interacting with the 125 125 user during user identification. The form is the first enabled form in the form-set 126 class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If 126 class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If 127 127 the user credential provider does not require a form to identify the user, then this 128 128 function should return EFI_NOT_FOUND. … … 132 132 @param[out] FormSetId On return, holds the identifier of the form set which contains 133 133 the form used during user identification. 134 @param[out] FormId On return, holds the identifier of the form used during user 134 @param[out] FormId On return, holds the identifier of the form used during user 135 135 identification. 136 136 137 137 @retval EFI_SUCCESS Form returned successfully. 138 138 @retval EFI_NOT_FOUND Form not returned. 139 139 @retval EFI_INVALID_PARAMETER Hii is NULL or FormSetId is NULL or FormId is NULL. 140 140 141 141 **/ 142 142 EFI_STATUS … … 154 154 This optional function returns a bitmap which is less than or equal to the number 155 155 of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND 156 is returned. 156 is returned. 157 157 158 158 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 159 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 160 bitmap information will be returned. On exit, points to the 159 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 160 bitmap information will be returned. On exit, points to the 161 161 width of the bitmap returned. 162 162 @param[in, out] Height On entry, points to the desired bitmap height. If NULL then no 163 bitmap information will be returned. On exit, points to the 163 bitmap information will be returned. On exit, points to the 164 164 height of the bitmap returned 165 @param[out] Hii On return, holds the HII database handle. 166 @param[out] Image On return, holds the HII image identifier. 167 165 @param[out] Hii On return, holds the HII database handle. 166 @param[out] Image On return, holds the HII image identifier. 167 168 168 @retval EFI_SUCCESS Image identifier returned successfully. 169 169 @retval EFI_NOT_FOUND Image identifier not returned. 170 170 @retval EFI_INVALID_PARAMETER Hii is NULL or Image is NULL. 171 171 172 172 **/ 173 173 EFI_STATUS … … 185 185 186 186 This function returns a string which describes the credential provider. If no 187 such string exists, then EFI_NOT_FOUND is returned. 187 such string exists, then EFI_NOT_FOUND is returned. 188 188 189 189 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 190 190 @param[out] Hii On return, holds the HII database handle. 191 191 @param[out] String On return, holds the HII string identifier. 192 192 193 193 @retval EFI_SUCCESS String identifier returned successfully. 194 194 @retval EFI_NOT_FOUND String identifier not returned. 195 195 @retval EFI_INVALID_PARAMETER Hii is NULL or String is NULL. 196 196 197 197 **/ 198 198 EFI_STATUS … … 208 208 209 209 This function returns the user identifier of the user authenticated by this credential 210 provider. This function is called after the credential-related information has been 210 provider. This function is called after the credential-related information has been 211 211 submitted on a form OR after a call to Default() has returned that this credential is 212 212 ready to log on. 213 213 214 214 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 215 @param[in] User The user profile handle of the user profile currently being 215 @param[in] User The user profile handle of the user profile currently being 216 216 considered by the user identity manager. If NULL, then no user 217 217 profile is currently under consideration. 218 @param[out] Identifier On return, points to the user identifier. 219 218 @param[out] Identifier On return, points to the user identifier. 219 220 220 @retval EFI_SUCCESS User identifier returned successfully. 221 221 @retval EFI_NOT_READY No user identifier can be returned. … … 224 224 @retval EFI_NOT_FOUND User is not NULL, and the specified user handle can't be 225 225 found in user profile database 226 226 227 227 **/ 228 228 EFI_STATUS … … 237 237 Indicate that user interface interaction has begun for the specified credential. 238 238 239 This function is called when a credential provider is selected by the user. If 239 This function is called when a credential provider is selected by the user. If 240 240 AutoLogon returns FALSE, then the user interface will be constructed by the User 241 Identity Manager. 241 Identity Manager. 242 242 243 243 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 244 @param[out] AutoLogon On return, points to the credential provider's capabilities 245 after the credential provider has been selected by the user. 246 244 @param[out] AutoLogon On return, points to the credential provider's capabilities 245 after the credential provider has been selected by the user. 246 247 247 @retval EFI_SUCCESS Credential provider successfully selected. 248 248 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. 249 249 250 250 **/ 251 251 EFI_STATUS … … 262 262 263 263 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 264 264 265 265 @retval EFI_SUCCESS Credential provider successfully deselected. 266 266 267 267 **/ 268 268 EFI_STATUS … … 275 275 Return the default logon behavior for this user credential. 276 276 277 This function reports the default login behavior regarding this credential provider. 277 This function reports the default login behavior regarding this credential provider. 278 278 279 279 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 280 280 @param[out] AutoLogon On return, holds whether the credential provider should be used 281 by default to automatically log on the user. 282 281 by default to automatically log on the user. 282 283 283 @retval EFI_SUCCESS Default information successfully returned. 284 284 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. … … 295 295 Return information attached to the credential provider. 296 296 297 This function returns user information. 297 This function returns user information. 298 298 299 299 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 300 @param[in] UserInfo Handle of the user information data record. 300 @param[in] UserInfo Handle of the user information data record. 301 301 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On 302 302 exit, holds the user information. If the buffer is too small … … 304 304 and InfoSize is updated to contain the number of bytes actually 305 305 required. 306 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 307 size of the user information. 308 306 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 307 size of the user information. 308 309 309 @retval EFI_SUCCESS Information returned successfully. 310 310 @retval EFI_BUFFER_TOO_SMALL The size specified by InfoSize is too small to hold all of the 311 311 user information. The size required is returned in *InfoSize. 312 312 @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL. 313 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 314 313 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 314 315 315 **/ 316 316 EFI_STATUS … … 330 330 information record handle, point UserInfo at a NULL. Each subsequent call will retrieve 331 331 another user information record handle until there are no more, at which point UserInfo 332 will point to NULL. 332 will point to NULL. 333 333 334 334 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 336 336 to start enumeration. On exit, points to the next user information 337 337 handle or NULL if there is no more user information. 338 338 339 339 @retval EFI_SUCCESS User information returned. 340 340 @retval EFI_NOT_FOUND No more user information found. 341 341 @retval EFI_INVALID_PARAMETER UserInfo is NULL. 342 342 343 343 **/ 344 344 EFI_STATUS … … 352 352 Delete a user on this credential provider. 353 353 354 This function deletes a user on this credential provider. 354 This function deletes a user on this credential provider. 355 355 356 356 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 358 358 359 359 @retval EFI_SUCCESS User profile was successfully deleted. 360 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 361 Either the user profile cannot delete on any user profile or cannot delete 362 on a user profile other than the current user profile. 360 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 361 Either the user profile cannot delete on any user profile or cannot delete 362 on a user profile other than the current user profile. 363 363 @retval EFI_UNSUPPORTED This credential provider does not support deletion in the pre-OS. 364 364 @retval EFI_DEVICE_ERROR The new credential could not be deleted because of a device error. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderData.h
r48674 r58466 1 1 /** @file 2 2 Data structure used by the Password Credential Provider driver. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 25 25 // 26 26 // Key defination 27 // 27 // 28 28 #define KEY_GET_PASSWORD 0x1000 29 29 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderDxe.inf
r58459 r58466 45 45 UefiLib 46 46 BaseCryptLib 47 47 48 48 [Guids] 49 49 gEfiUserCredentialClassPasswordGuid ## SOMETIMES_CONSUMES ## GUID 50 50 51 51 ## PRODUCES ## Variable:L"PwdCredential" 52 52 ## CONSUMES ## Variable:L"PwdCredential" … … 54 54 ## SOMETIMES_CONSUMES ## GUID # The credential provider identifier 55 55 gPwdCredentialProviderGuid 56 56 57 57 [Protocols] 58 58 gEfiDevicePathProtocolGuid ## PRODUCES … … 60 60 gEfiUserCredential2ProtocolGuid ## PRODUCES 61 61 gEfiUserManagerProtocolGuid ## SOMETIMES_CONSUMES 62 62 63 63 [UserExtensions.TianoCore."ExtraFiles"] 64 64 PwdCredentialProviderExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderVfr.Vfr
-
Property svn:eol-style
set to
native
r58459 r58466 3 3 4 4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 15 15 #include "PwdCredentialProviderData.h" 16 16 17 formset 17 formset 18 18 guid = PWD_CREDENTIAL_PROVIDER_GUID, 19 title = STRING_TOKEN(STR_CREDENTIAL_TITLE), 20 help = STRING_TOKEN(STR_NULL_STRING), 19 title = STRING_TOKEN(STR_CREDENTIAL_TITLE), 20 help = STRING_TOKEN(STR_NULL_STRING), 21 21 classguid = PWD_CREDENTIAL_PROVIDER_GUID, 22 23 form formid = FORMID_GET_PASSWORD_FORM, 22 23 form formid = FORMID_GET_PASSWORD_FORM, 24 24 title = STRING_TOKEN(STR_FORM_TITLE); 25 26 text 27 help = STRING_TOKEN(STR_NULL_STRING), 25 26 text 27 help = STRING_TOKEN(STR_NULL_STRING), 28 28 text = STRING_TOKEN(STR_INPUT_PASSWORD), 29 29 flags = INTERACTIVE, … … 31 31 32 32 endform; 33 33 34 34 endformset; -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProvider.c
r58459 r58466 1 1 /** @file 2 2 Usb Credential Provider driver implemenetation. 3 3 4 4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 79 79 Count * sizeof (USB_INFO) 80 80 ); 81 ASSERT (NewTable != NULL); 81 ASSERT (NewTable != NULL); 82 82 83 83 NewTable->MaxCount = Count; … … 88 88 // 89 89 CopyMem ( 90 &NewTable->UserInfo, 91 &mUsbTable->UserInfo, 90 &NewTable->UserInfo, 91 &mUsbTable->UserInfo, 92 92 mUsbTable->Count * sizeof (USB_INFO) 93 93 ); … … 101 101 102 102 @param[in] Index The index of the password in table. If index is found in 103 table, update the info, else add the into to table. 104 @param[in] Info The new credential info to add into table. If Info is NULL, 103 table, update the info, else add the into to table. 104 @param[in] Info The new credential info to add into table. If Info is NULL, 105 105 delete the info by Index. 106 106 … … 118 118 EFI_STATUS Status; 119 119 USB_INFO *NewUsbInfo; 120 120 121 121 NewUsbInfo = NULL; 122 122 if (Index < mUsbTable->Count) { … … 128 128 if (Index != mUsbTable->Count) { 129 129 NewUsbInfo = &mUsbTable->UserInfo[mUsbTable->Count]; 130 } 130 } 131 131 } else { 132 132 // … … 191 191 Var = NULL; 192 192 Status = gRT->GetVariable ( 193 L"UsbCredential", 194 &gUsbCredentialProviderGuid, 195 NULL, 193 L"UsbCredential", 194 &gUsbCredentialProviderGuid, 195 NULL, 196 196 &VarSize, 197 197 Var … … 203 203 } 204 204 Status = gRT->GetVariable ( 205 L"UsbCredential", 206 &gUsbCredentialProviderGuid, 207 NULL, 205 L"UsbCredential", 206 &gUsbCredentialProviderGuid, 207 NULL, 208 208 &VarSize, 209 209 Var … … 213 213 return Status; 214 214 } 215 215 216 216 // 217 217 // Init Usb credential table. … … 219 219 mUsbTable = AllocateZeroPool ( 220 220 sizeof (CREDENTIAL_TABLE) - sizeof (USB_INFO) + 221 USB_TABLE_INC * sizeof (USB_INFO) + 221 USB_TABLE_INC * sizeof (USB_INFO) + 222 222 VarSize 223 223 ); … … 307 307 continue; 308 308 } 309 309 310 310 Status = SimpleFileSystem->OpenVolume ( 311 311 SimpleFileSystem, … … 315 315 continue; 316 316 } 317 317 318 318 Status = RootFs->Open ( 319 319 RootFs, … … 325 325 if (!EFI_ERROR (Status)) { 326 326 break; 327 } 327 } 328 328 } 329 329 } … … 336 336 goto Done; 337 337 } 338 338 339 339 // 340 340 // Figure out how big the file is. … … 353 353 } 354 354 355 FileInfo = AllocateZeroPool (ScratchBufferSize); 355 FileInfo = AllocateZeroPool (ScratchBufferSize); 356 356 if (FileInfo == NULL) { 357 357 DEBUG ((DEBUG_ERROR, "Can not allocate enough memory for the token file!\n")); … … 371 371 goto Done; 372 372 } 373 373 374 374 // 375 375 // Allocate a buffer for the file. 376 376 // 377 377 *BufferSize = (UINT32) FileInfo->FileSize; 378 *Buffer = AllocateZeroPool (*BufferSize); 378 *Buffer = AllocateZeroPool (*BufferSize); 379 379 if (*Buffer == NULL) { 380 380 DEBUG ((DEBUG_ERROR, "Can not allocate a buffer for the file!\n")); … … 382 382 goto Done; 383 383 } 384 384 385 385 // 386 386 // Load file into the allocated memory. … … 393 393 goto Done; 394 394 } 395 395 396 396 // 397 397 // Close file. … … 417 417 Hash the data to get credential. 418 418 419 @param[in] Buffer Points to the data buffer 419 @param[in] Buffer Points to the data buffer 420 420 @param[in] BufferSize The size of data in buffer, in bytes. 421 421 @param[out] Credential Points to the hashed result … … 423 423 @retval TRUE Hash the data successfully. 424 424 @retval FALSE Failed to hash the data. 425 425 426 426 **/ 427 427 BOOLEAN … … 435 435 UINTN HashSize; 436 436 VOID *Hash; 437 437 438 438 HashSize = Sha1GetContextSize (); 439 439 Hash = AllocatePool (HashSize); 440 440 ASSERT (Hash != NULL); 441 441 442 442 Status = Sha1Init (Hash); 443 443 if (!Status) { 444 444 goto Done; 445 445 } 446 446 447 447 Status = Sha1Update (Hash, Buffer, BufferSize); 448 448 if (!Status) { 449 449 goto Done; 450 450 } 451 451 452 452 Status = Sha1Final (Hash, Credential); 453 453 454 454 Done: 455 455 FreePool (Hash); … … 465 465 @retval EFI_SUCCESS Read a Token successfully. 466 466 @retval Others Fails to read a Token. 467 467 468 468 **/ 469 469 EFI_STATUS … … 485 485 return Status; 486 486 } 487 487 488 488 if (!GenerateCredential (Buffer, BufSize, Token)) { 489 489 DEBUG ((DEBUG_ERROR, "Generate credential from read data failed!\n")); … … 491 491 return EFI_SECURITY_VIOLATION; 492 492 } 493 494 FreePool (Buffer); 493 494 FreePool (Buffer); 495 495 return EFI_SUCCESS; 496 496 } … … 500 500 Find a user infomation record by the information record type. 501 501 502 This function searches all user information records of User from beginning 502 This function searches all user information records of User from beginning 503 503 until either the information is found or there are no more user infomation 504 504 record. A match occurs when a Info.InfoType field matches the user information 505 505 record type. 506 506 507 @param[in] User Points to the user profile record to search. 507 @param[in] User Points to the user profile record to search. 508 508 @param[in] InfoType The infomation type to be searched. 509 509 @param[out] Info Points to the user info found, the caller is responsible 510 510 to free. 511 511 512 512 @retval EFI_SUCCESS Find the user information successfully. 513 513 @retval Others Fail to find the user information. … … 526 526 EFI_USER_INFO_HANDLE UserInfoHandle; 527 527 EFI_USER_MANAGER_PROTOCOL *UserManager; 528 528 529 529 // 530 530 // Find user information by information type. … … 589 589 *Info = UserInfo; 590 590 return EFI_SUCCESS; 591 } 591 } 592 592 } 593 593 … … 612 612 { 613 613 USB_PROVIDER_CALLBACK_INFO *CallbackInfo; 614 614 615 615 // 616 616 // Initialize driver private data. … … 620 620 return EFI_OUT_OF_RESOURCES; 621 621 } 622 622 623 623 CallbackInfo->DriverHandle = NULL; 624 624 … … 644 644 Enroll a user on a credential provider. 645 645 646 This function enrolls a user on this credential provider. If the user exists on 647 this credential provider, update the user information on this credential provider; 646 This function enrolls a user on this credential provider. If the user exists on 647 this credential provider, update the user information on this credential provider; 648 648 otherwise add the user information on credential provider. 649 649 650 650 @param[in] This Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL. 651 651 @param[in] User The user profile to enroll. 652 652 653 653 @retval EFI_SUCCESS User profile was successfully enrolled. 654 654 @retval EFI_ACCESS_DENIED Current user profile does not permit enrollment on the 655 655 user profile handle. Either the user profile cannot enroll 656 on any user profile or cannot enroll on a user profile 656 on any user profile or cannot enroll on a user profile 657 657 other than the current user profile. 658 658 @retval EFI_UNSUPPORTED This credential provider does not support enrollment in … … 661 661 error. 662 662 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile handle. 663 663 664 664 **/ 665 665 EFI_STATUS … … 682 682 return EFI_INVALID_PARAMETER; 683 683 } 684 684 685 685 // 686 686 // Get User Identifier … … 696 696 } 697 697 698 CopyMem (UsbInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); 698 CopyMem (UsbInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); 699 699 FreePool (UserInfo); 700 700 701 701 // 702 702 // Get Token and User ID to UsbInfo. … … 705 705 if (EFI_ERROR (Status)) { 706 706 QuestionStr = GetStringById (STRING_TOKEN (STR_READ_USB_TOKEN_ERROR)); 707 PromptStr = GetStringById (STRING_TOKEN (STR_INSERT_USB_TOKEN)); 707 PromptStr = GetStringById (STRING_TOKEN (STR_INSERT_USB_TOKEN)); 708 708 CreatePopUp ( 709 709 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, … … 717 717 FreePool (PromptStr); 718 718 return Status; 719 } 719 } 720 720 721 721 // 722 722 // Check whether User is ever enrolled in the provider. 723 // 723 // 724 724 for (Index = 0; Index < mUsbTable->Count; Index++) { 725 725 UserId = (UINT8 *) &mUsbTable->UserInfo[Index].UserId; … … 727 727 // 728 728 // User already exists, update the password. 729 // 729 // 730 730 break; 731 731 } 732 732 } 733 733 734 734 // 735 735 // Enroll the User to the provider. … … 749 749 This function returns information about the form used when interacting with the 750 750 user during user identification. The form is the first enabled form in the form-set 751 class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If 751 class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If 752 752 the user credential provider does not require a form to identify the user, then this 753 753 function should return EFI_NOT_FOUND. … … 757 757 @param[out] FormSetId On return, holds the identifier of the form set which contains 758 758 the form used during user identification. 759 @param[out] FormId On return, holds the identifier of the form used during user 759 @param[out] FormId On return, holds the identifier of the form used during user 760 760 identification. 761 761 762 762 @retval EFI_SUCCESS Form returned successfully. 763 763 @retval EFI_NOT_FOUND Form not returned. 764 764 @retval EFI_INVALID_PARAMETER Hii is NULL or FormSetId is NULL or FormId is NULL. 765 765 766 766 **/ 767 767 EFI_STATUS … … 774 774 ) 775 775 { 776 if ((This == NULL) || (Hii == NULL) || 776 if ((This == NULL) || (Hii == NULL) || 777 777 (FormSetId == NULL) || (FormId == NULL)) { 778 778 return EFI_INVALID_PARAMETER; … … 787 787 This optional function returns a bitmap which is less than or equal to the number 788 788 of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND 789 is returned. 789 is returned. 790 790 791 791 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 792 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 793 bitmap information will be returned. On exit, points to the 792 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 793 bitmap information will be returned. On exit, points to the 794 794 width of the bitmap returned. 795 795 @param[in, out] Height On entry, points to the desired bitmap height. If NULL then no 796 bitmap information will be returned. On exit, points to the 796 bitmap information will be returned. On exit, points to the 797 797 height of the bitmap returned. 798 @param[out] Hii On return, holds the HII database handle. 799 @param[out] Image On return, holds the HII image identifier. 800 798 @param[out] Hii On return, holds the HII database handle. 799 @param[out] Image On return, holds the HII image identifier. 800 801 801 @retval EFI_SUCCESS Image identifier returned successfully. 802 802 @retval EFI_NOT_FOUND Image identifier not returned. 803 803 @retval EFI_INVALID_PARAMETER Hii is NULL or Image is NULL. 804 804 805 805 **/ 806 806 EFI_STATUS … … 825 825 826 826 This function returns a string which describes the credential provider. If no 827 such string exists, then EFI_NOT_FOUND is returned. 827 such string exists, then EFI_NOT_FOUND is returned. 828 828 829 829 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 830 830 @param[out] Hii On return, holds the HII database handle. 831 831 @param[out] String On return, holds the HII string identifier. 832 832 833 833 @retval EFI_SUCCESS String identifier returned successfully. 834 834 @retval EFI_NOT_FOUND String identifier not returned. 835 835 @retval EFI_INVALID_PARAMETER Hii is NULL or String is NULL. 836 836 837 837 **/ 838 838 EFI_STATUS … … 861 861 862 862 This function returns the user identifier of the user authenticated by this credential 863 provider. This function is called after the credential-related information has been 863 provider. This function is called after the credential-related information has been 864 864 submitted on a form OR after a call to Default() has returned that this credential is 865 865 ready to log on. 866 866 867 867 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 868 @param[in] User The user profile handle of the user profile currently being 868 @param[in] User The user profile handle of the user profile currently being 869 869 considered by the user identity manager. If NULL, then no user 870 870 profile is currently under consideration. 871 @param[out] Identifier On return, points to the user identifier. 872 871 @param[out] Identifier On return, points to the user identifier. 872 873 873 @retval EFI_SUCCESS User identifier returned successfully. 874 874 @retval EFI_NOT_READY No user identifier can be returned. … … 877 877 @retval EFI_NOT_FOUND User is not NULL, and the specified user handle can't be 878 878 found in user profile database. 879 879 880 880 **/ 881 881 EFI_STATUS … … 892 892 UINT8 *UserId; 893 893 UINT8 *NewUserId; 894 UINT8 *UserToken; 894 UINT8 *UserToken; 895 895 UINT8 ReadToken[HASHED_CREDENTIAL_LEN]; 896 896 EFI_INPUT_KEY Key; 897 897 CHAR16 *QuestionStr; 898 898 CHAR16 *PromptStr; 899 899 900 900 if ((This == NULL) || (Identifier == NULL)) { 901 901 return EFI_INVALID_PARAMETER; 902 902 } 903 903 904 904 if (User == NULL) { 905 905 // … … 909 909 return EFI_NOT_READY; 910 910 } 911 911 912 912 // 913 913 // No user selected, get token first and verify the user existed in user database. … … 917 917 return EFI_NOT_READY; 918 918 } 919 919 920 920 for (Index = 0; Index < mUsbTable->Count; Index++) { 921 921 // … … 930 930 } 931 931 932 return EFI_NOT_READY; 933 } 934 935 // 936 // User is not NULL here. Read a token, and check whether the token matches with 937 // the selected user's Token. If not, try to find a token in token DB to matches 932 return EFI_NOT_READY; 933 } 934 935 // 936 // User is not NULL here. Read a token, and check whether the token matches with 937 // the selected user's Token. If not, try to find a token in token DB to matches 938 938 // with read token. 939 // 940 939 // 940 941 941 Status = GetToken (ReadToken); 942 942 if (EFI_ERROR (Status)) { … … 962 962 if (EFI_ERROR (Status)) { 963 963 return EFI_NOT_FOUND; 964 } 965 964 } 965 966 966 // 967 967 // Check the selected user's Token with the read token. … … 982 982 FreePool (UserInfo); 983 983 return EFI_SUCCESS; 984 } 985 } 986 } 987 988 FreePool (UserInfo); 989 984 } 985 } 986 } 987 988 FreePool (UserInfo); 989 990 990 return EFI_NOT_READY; 991 991 } … … 995 995 Indicate that user interface interaction has begun for the specified credential. 996 996 997 This function is called when a credential provider is selected by the user. If 997 This function is called when a credential provider is selected by the user. If 998 998 AutoLogon returns FALSE, then the user interface will be constructed by the User 999 Identity Manager. 999 Identity Manager. 1000 1000 1001 1001 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1002 @param[out] AutoLogon On return, points to the credential provider's capabilities 1003 after the credential provider has been selected by the user. 1004 1002 @param[out] AutoLogon On return, points to the credential provider's capabilities 1003 after the credential provider has been selected by the user. 1004 1005 1005 @retval EFI_SUCCESS Credential provider successfully selected. 1006 1006 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. 1007 1007 1008 1008 **/ 1009 1009 EFI_STATUS … … 1030 1030 1031 1031 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1032 1032 1033 1033 @retval EFI_SUCCESS Credential provider successfully deselected. 1034 1034 1035 1035 **/ 1036 1036 EFI_STATUS … … 1050 1050 Return the default logon behavior for this user credential. 1051 1051 1052 This function reports the default login behavior regarding this credential provider. 1052 This function reports the default login behavior regarding this credential provider. 1053 1053 1054 1054 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1055 1055 @param[out] AutoLogon On return, holds whether the credential provider should be used 1056 by default to automatically log on the user. 1057 1056 by default to automatically log on the user. 1057 1058 1058 @retval EFI_SUCCESS Default information successfully returned. 1059 1059 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. 1060 1060 1061 1061 **/ 1062 1062 EFI_STATUS … … 1079 1079 Return information attached to the credential provider. 1080 1080 1081 This function returns user information. 1081 This function returns user information. 1082 1082 1083 1083 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 1084 @param[in] UserInfo Handle of the user information data record. 1084 @param[in] UserInfo Handle of the user information data record. 1085 1085 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On 1086 1086 exit, holds the user information. If the buffer is too small … … 1088 1088 and InfoSize is updated to contain the number of bytes actually 1089 1089 required. 1090 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 1091 size of the user information. 1092 1090 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 1091 size of the user information. 1092 1093 1093 @retval EFI_SUCCESS Information returned successfully. 1094 1094 @retval EFI_BUFFER_TOO_SMALL The size specified by InfoSize is too small to hold all of the 1095 1095 user information. The size required is returned in *InfoSize. 1096 1096 @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL. 1097 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 1098 1097 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 1098 1099 1099 **/ 1100 1100 EFI_STATUS … … 1109 1109 EFI_USER_INFO *CredentialInfo; 1110 1110 UINTN Index; 1111 1111 1112 1112 if ((This == NULL) || (InfoSize == NULL) || (Info == NULL)) { 1113 1113 return EFI_INVALID_PARAMETER; … … 1117 1117 return EFI_NOT_FOUND; 1118 1118 } 1119 1119 1120 1120 // 1121 1121 // Find information handle in credential info table. … … 1131 1131 return EFI_BUFFER_TOO_SMALL; 1132 1132 } 1133 1134 CopyMem (Info, CredentialInfo, CredentialInfo->InfoSize); 1135 return EFI_SUCCESS; 1136 } 1137 } 1138 1133 1134 CopyMem (Info, CredentialInfo, CredentialInfo->InfoSize); 1135 return EFI_SUCCESS; 1136 } 1137 } 1138 1139 1139 return EFI_NOT_FOUND; 1140 1140 } … … 1147 1147 information record handle, point UserInfo at a NULL. Each subsequent call will retrieve 1148 1148 another user information record handle until there are no more, at which point UserInfo 1149 will point to NULL. 1149 will point to NULL. 1150 1150 1151 1151 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 1153 1153 to start enumeration. On exit, points to the next user information 1154 1154 handle or NULL if there is no more user information. 1155 1155 1156 1156 @retval EFI_SUCCESS User information returned. 1157 1157 @retval EFI_NOT_FOUND No more user information found. 1158 1158 @retval EFI_INVALID_PARAMETER UserInfo is NULL. 1159 1159 1160 1160 **/ 1161 1161 EFI_STATUS … … 1171 1171 UINTN Index; 1172 1172 UINTN ProvStrLen; 1173 1173 1174 1174 if ((This == NULL) || (UserInfo == NULL)) { 1175 1175 return EFI_INVALID_PARAMETER; … … 1193 1193 Info = AllocateZeroPool (InfoLen); 1194 1194 ASSERT (Info != NULL); 1195 1195 1196 1196 Info->InfoType = EFI_USER_INFO_CREDENTIAL_PROVIDER_RECORD; 1197 1197 Info->InfoSize = (UINT32) InfoLen; … … 1199 1199 CopyGuid (&Info->Credential, &gUsbCredentialProviderGuid); 1200 1200 CopyGuid ((EFI_GUID *)(Info + 1), &gUsbCredentialProviderGuid); 1201 1201 1202 1202 mUsbInfoHandle->Info[0] = Info; 1203 1203 mUsbInfoHandle->Count++; … … 1211 1211 Info = AllocateZeroPool (InfoLen); 1212 1212 ASSERT (Info != NULL); 1213 1213 1214 1214 Info->InfoType = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD; 1215 1215 Info->InfoSize = (UINT32) InfoLen; … … 1218 1218 CopyMem ((UINT8*)(Info + 1), ProvNameStr, ProvStrLen); 1219 1219 FreePool (ProvNameStr); 1220 1220 1221 1221 mUsbInfoHandle->Info[1] = Info; 1222 1222 mUsbInfoHandle->Count++; … … 1228 1228 Info = AllocateZeroPool (InfoLen); 1229 1229 ASSERT (Info != NULL); 1230 1230 1231 1231 Info->InfoType = EFI_USER_INFO_CREDENTIAL_TYPE_RECORD; 1232 1232 Info->InfoSize = (UINT32) InfoLen; … … 1234 1234 CopyGuid (&Info->Credential, &gUsbCredentialProviderGuid); 1235 1235 CopyGuid ((EFI_GUID *)(Info + 1), &gEfiUserCredentialClassSecureCardGuid); 1236 1236 1237 1237 mUsbInfoHandle->Info[2] = Info; 1238 1238 mUsbInfoHandle->Count++; 1239 1239 1240 1240 // 1241 1241 // The fourth information, Credential Provider type name info. … … 1246 1246 Info = AllocateZeroPool (InfoLen); 1247 1247 ASSERT (Info != NULL); 1248 1248 1249 1249 Info->InfoType = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD; 1250 1250 Info->InfoSize = (UINT32) InfoLen; … … 1253 1253 CopyMem ((UINT8*)(Info + 1), ProvNameStr, ProvStrLen); 1254 1254 FreePool (ProvNameStr); 1255 1255 1256 1256 mUsbInfoHandle->Info[3] = Info; 1257 1257 mUsbInfoHandle->Count++; 1258 1258 } 1259 1259 1260 1260 if (*UserInfo == NULL) { 1261 1261 // … … 1265 1265 return EFI_SUCCESS; 1266 1266 } 1267 1267 1268 1268 // 1269 1269 // Find information handle in credential info table. … … 1284 1284 Index++; 1285 1285 *UserInfo = (EFI_USER_INFO_HANDLE)mUsbInfoHandle->Info[Index]; 1286 return EFI_SUCCESS; 1286 return EFI_SUCCESS; 1287 1287 } 1288 1288 } … … 1296 1296 Delete a user on this credential provider. 1297 1297 1298 This function deletes a user on this credential provider. 1298 This function deletes a user on this credential provider. 1299 1299 1300 1300 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 1302 1302 1303 1303 @retval EFI_SUCCESS User profile was successfully deleted. 1304 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 1305 Either the user profile cannot delete on any user profile or cannot delete 1306 on a user profile other than the current user profile. 1304 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 1305 Either the user profile cannot delete on any user profile or cannot delete 1306 on a user profile other than the current user profile. 1307 1307 @retval EFI_UNSUPPORTED This credential provider does not support deletion in the pre-OS. 1308 1308 @retval EFI_DEVICE_ERROR The new credential could not be deleted because of a device error. … … 1321 1321 UINT8 *NewUserId; 1322 1322 UINTN Index; 1323 1323 1324 1324 if ((This == NULL) || (User == NULL)) { 1325 1325 return EFI_INVALID_PARAMETER; … … 1341 1341 // 1342 1342 // Find the user by user identifier in mPwdTable. 1343 // 1343 // 1344 1344 for (Index = 0; Index < mUsbTable->Count; Index++) { 1345 1345 UserId = (UINT8 *) &mUsbTable->UserInfo[Index].UserId; … … 1389 1389 return Status; 1390 1390 } 1391 1391 1392 1392 // 1393 1393 // Init Form Browser … … 1397 1397 return Status; 1398 1398 } 1399 1399 1400 1400 // 1401 1401 // Install protocol interfaces for the Usb Credential Provider. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProvider.h
r48674 r58466 1 1 /** @file 2 2 Usb Credential Provider driver header file. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 81 81 Enroll a user on a credential provider. 82 82 83 This function enrolls and deletes a user profile using this credential provider. 84 If a user profile is successfully enrolled, it calls the User Manager Protocol 85 function Notify() to notify the user manager driver that credential information 86 has changed. If an enrolled user does exist, delete the user on the credential 83 This function enrolls and deletes a user profile using this credential provider. 84 If a user profile is successfully enrolled, it calls the User Manager Protocol 85 function Notify() to notify the user manager driver that credential information 86 has changed. If an enrolled user does exist, delete the user on the credential 87 87 provider. 88 88 89 89 @param[in] This Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL. 90 90 @param[in] User The user profile to enroll. 91 91 92 92 @retval EFI_SUCCESS User profile was successfully enrolled. 93 93 @retval EFI_ACCESS_DENIED Current user profile does not permit enrollment on the 94 94 user profile handle. Either the user profile cannot enroll 95 on any user profile or cannot enroll on a user profile 95 on any user profile or cannot enroll on a user profile 96 96 other than the current user profile. 97 97 @retval EFI_UNSUPPORTED This credential provider does not support enrollment in … … 100 100 error. 101 101 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile handle. 102 102 103 103 **/ 104 104 EFI_STATUS … … 112 112 Returns the user interface information used during user identification. 113 113 114 This function enrolls a user on this credential provider. If the user exists on 115 this credential provider, update the user information on this credential provider; 114 This function enrolls a user on this credential provider. If the user exists on 115 this credential provider, update the user information on this credential provider; 116 116 otherwise delete the user information on credential provider. 117 117 … … 120 120 @param[out] FormSetId On return, holds the identifier of the form set which contains 121 121 the form used during user identification. 122 @param[out] FormId On return, holds the identifier of the form used during user 122 @param[out] FormId On return, holds the identifier of the form used during user 123 123 identification. 124 124 125 125 @retval EFI_SUCCESS Form returned successfully. 126 126 @retval EFI_NOT_FOUND Form not returned. 127 127 @retval EFI_INVALID_PARAMETER Hii is NULL or FormSetId is NULL or FormId is NULL. 128 128 129 129 **/ 130 130 EFI_STATUS … … 142 142 This optional function returns a bitmap which is less than or equal to the number 143 143 of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND 144 is returned. 144 is returned. 145 145 146 146 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 147 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 148 bitmap information will be returned. On exit, points to the 147 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no 148 bitmap information will be returned. On exit, points to the 149 149 width of the bitmap returned. 150 150 @param[in, out] Height On entry, points to the desired bitmap height. If NULL then no 151 bitmap information will be returned. On exit, points to the 151 bitmap information will be returned. On exit, points to the 152 152 height of the bitmap returned. 153 @param[out] Hii On return, holds the HII database handle. 154 @param[out] Image On return, holds the HII image identifier. 155 153 @param[out] Hii On return, holds the HII database handle. 154 @param[out] Image On return, holds the HII image identifier. 155 156 156 @retval EFI_SUCCESS Image identifier returned successfully. 157 157 @retval EFI_NOT_FOUND Image identifier not returned. 158 158 @retval EFI_INVALID_PARAMETER Hii is NULL or Image is NULL. 159 159 160 160 **/ 161 161 EFI_STATUS … … 173 173 174 174 This function returns a string which describes the credential provider. If no 175 such string exists, then EFI_NOT_FOUND is returned. 175 such string exists, then EFI_NOT_FOUND is returned. 176 176 177 177 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 178 178 @param[out] Hii On return, holds the HII database handle. 179 179 @param[out] String On return, holds the HII string identifier. 180 180 181 181 @retval EFI_SUCCESS String identifier returned successfully. 182 182 @retval EFI_NOT_FOUND String identifier not returned. 183 183 @retval EFI_INVALID_PARAMETER Hii is NULL or String is NULL. 184 184 185 185 **/ 186 186 EFI_STATUS … … 196 196 197 197 This function returns the user identifier of the user authenticated by this credential 198 provider. This function is called after the credential-related information has been 198 provider. This function is called after the credential-related information has been 199 199 submitted on a form OR after a call to Default() has returned that this credential is 200 200 ready to log on. 201 201 202 202 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 203 @param[in] User The user profile handle of the user profile currently being 203 @param[in] User The user profile handle of the user profile currently being 204 204 considered by the user identity manager. If NULL, then no user 205 205 profile is currently under consideration. 206 @param[out] Identifier On return, points to the user identifier. 207 206 @param[out] Identifier On return, points to the user identifier. 207 208 208 @retval EFI_SUCCESS User identifier returned successfully. 209 209 @retval EFI_NOT_READY No user identifier can be returned. … … 212 212 @retval EFI_NOT_FOUND User is not NULL, and the specified user handle can't be 213 213 found in user profile database. 214 214 215 215 **/ 216 216 EFI_STATUS … … 225 225 Indicate that user interface interaction has begun for the specified credential. 226 226 227 This function is called when a credential provider is selected by the user. If 227 This function is called when a credential provider is selected by the user. If 228 228 AutoLogon returns FALSE, then the user interface will be constructed by the User 229 Identity Manager. 229 Identity Manager. 230 230 231 231 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 232 @param[out] AutoLogon On return, points to the credential provider's capabilities 233 after the credential provider has been selected by the user. 234 232 @param[out] AutoLogon On return, points to the credential provider's capabilities 233 after the credential provider has been selected by the user. 234 235 235 @retval EFI_SUCCESS Credential provider successfully selected. 236 236 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. 237 237 238 238 **/ 239 239 EFI_STATUS … … 250 250 251 251 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 252 252 253 253 @retval EFI_SUCCESS Credential provider successfully deselected. 254 254 255 255 **/ 256 256 EFI_STATUS … … 263 263 Return the default logon behavior for this user credential. 264 264 265 This function reports the default login behavior regarding this credential provider. 265 This function reports the default login behavior regarding this credential provider. 266 266 267 267 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 268 268 @param[out] AutoLogon On return, holds whether the credential provider should be used 269 by default to automatically log on the user. 270 269 by default to automatically log on the user. 270 271 271 @retval EFI_SUCCESS Default information successfully returned. 272 272 @retval EFI_INVALID_PARAMETER AutoLogon is NULL. … … 283 283 Return information attached to the credential provider. 284 284 285 This function returns user information. 285 This function returns user information. 286 286 287 287 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. 288 @param[in] UserInfo Handle of the user information data record. 288 @param[in] UserInfo Handle of the user information data record. 289 289 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On 290 290 exit, holds the user information. If the buffer is too small … … 292 292 and InfoSize is updated to contain the number of bytes actually 293 293 required. 294 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 295 size of the user information. 296 294 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the 295 size of the user information. 296 297 297 @retval EFI_SUCCESS Information returned successfully. 298 298 @retval EFI_BUFFER_TOO_SMALL The size specified by InfoSize is too small to hold all of the 299 299 user information. The size required is returned in *InfoSize. 300 300 @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL. 301 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 302 301 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. 302 303 303 **/ 304 304 EFI_STATUS … … 317 317 information record handle, point UserInfo at a NULL. Each subsequent call will retrieve 318 318 another user information record handle until there are no more, at which point UserInfo 319 will point to NULL. 319 will point to NULL. 320 320 321 321 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 323 323 to start enumeration. On exit, points to the next user information 324 324 handle or NULL if there is no more user information. 325 325 326 326 @retval EFI_SUCCESS User information returned. 327 327 @retval EFI_NOT_FOUND No more user information found. 328 328 @retval EFI_INVALID_PARAMETER UserInfo is NULL. 329 329 330 330 **/ 331 331 EFI_STATUS … … 339 339 Delete a user on this credential provider. 340 340 341 This function deletes a user on this credential provider. 341 This function deletes a user on this credential provider. 342 342 343 343 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL. … … 345 345 346 346 @retval EFI_SUCCESS User profile was successfully deleted. 347 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 348 Either the user profile cannot delete on any user profile or cannot delete 349 on a user profile other than the current user profile. 347 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle. 348 Either the user profile cannot delete on any user profile or cannot delete 349 on a user profile other than the current user profile. 350 350 @retval EFI_UNSUPPORTED This credential provider does not support deletion in the pre-OS. 351 351 @retval EFI_DEVICE_ERROR The new credential could not be deleted because of a device error. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProviderDxe.inf
r58459 r58466 2 2 # Provides a USB credential provider implementation 3 3 # 4 # This module reads a token from a token file that is saved in the root 4 # This module reads a token from a token file that is saved in the root 5 5 # folder of a USB stick. The token file name can be specified by the PCD 6 6 # PcdFixedUsbCredentialProviderTokenFileName. … … 46 46 UefiLib 47 47 BaseCryptLib 48 48 49 49 [Guids] 50 50 ## PRODUCES ## Variable:L"UsbCredential" … … 53 53 ## SOMETIMES_CONSUMES ## GUID # The credential provider identifier 54 54 gUsbCredentialProviderGuid 55 55 56 56 gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## GUID 57 57 gEfiUserCredentialClassSecureCardGuid ## SOMETIMES_CONSUMES ## GUID 58 58 59 59 [Pcd] 60 gEfiSecurityPkgTokenSpaceGuid.PcdFixedUsbCredentialProviderTokenFileName ## SOMETIMES_CONSUMES 60 gEfiSecurityPkgTokenSpaceGuid.PcdFixedUsbCredentialProviderTokenFileName ## SOMETIMES_CONSUMES 61 61 62 62 [Protocols] … … 65 65 gEfiBlockIoProtocolGuid ## SOMETIMES_CONSUMES 66 66 gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES 67 67 68 68 [UserExtensions.TianoCore."ExtraFiles"] 69 69 UsbCredentialProviderExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProviderStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/LoadDeferredImage.c
r48674 r58466 1 1 /** @file 2 2 Load the deferred images after user is identified. 3 3 4 4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 40 40 EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; 41 41 VOID *DriverImage; 42 UINTN ImageSize; 42 UINTN ImageSize; 43 43 BOOLEAN BootOption; 44 44 EFI_HANDLE ImageHandle; … … 78 78 // 79 79 Status = DeferredImage->GetImageInfo( 80 DeferredImage, 81 DriverIndex, 82 &ImageDevicePath, 80 DeferredImage, 81 DriverIndex, 82 &ImageDevicePath, 83 83 (VOID **) &DriverImage, 84 &ImageSize, 84 &ImageSize, 85 85 &BootOption 86 86 ); 87 87 if (EFI_ERROR (Status)) { 88 88 break; 89 } 89 } 90 90 91 91 // … … 107 107 gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL); 108 108 Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData); 109 109 110 110 // 111 111 // Clear the Watchdog Timer after the image returns. … … 116 116 } while (TRUE); 117 117 } 118 FreePool (HandleBuf); 118 FreePool (HandleBuf); 119 119 } 120 120 … … 135 135 136 136 mDeferredImageHandle = ImageHandle; 137 137 138 138 Status = gBS->CreateEventEx ( 139 139 EVT_NOTIFY_SIGNAL, -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.c
r58459 r58466 1 1 /** @file 2 2 This driver manages user information and produces user manager protocol. 3 3 4 4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 81 81 Find the specified user in the user database. 82 82 83 This function searches the specified user from the beginning of the user database. 84 And if NextUser is TRUE, return the next User in the user database. 85 86 @param[in, out] User On entry, points to the user profile entry to search. 83 This function searches the specified user from the beginning of the user database. 84 And if NextUser is TRUE, return the next User in the user database. 85 86 @param[in, out] User On entry, points to the user profile entry to search. 87 87 On return, points to the user profile entry or NULL if not found. 88 88 @param[in] NextUser If FALSE, find the user in user profile database specifyed by User 89 If TRUE, find the next user in user profile database specifyed 90 by User. 91 @param[out] ProfileIndex A pointer to the index of user profile database that matches the 89 If TRUE, find the next user in user profile database specifyed 90 by User. 91 @param[out] ProfileIndex A pointer to the index of user profile database that matches the 92 92 user specifyed by User. 93 93 94 94 @retval EFI_NOT_FOUND User was NULL, or User was not found, or the next user was not found. 95 95 @retval EFI_SUCCESS User or the next user are found in user profile database 96 96 97 97 **/ 98 98 EFI_STATUS … … 111 111 return EFI_NOT_FOUND; 112 112 } 113 113 114 114 // 115 115 // Check whether the user profile is in the user profile database. … … 152 152 Find the specified user information record in the specified User profile. 153 153 154 This function searches the specified user information record from the beginning of the user 155 profile. And if NextInfo is TRUE, return the next info in the user profile. 156 157 @param[in] User Points to the user profile entry. 154 This function searches the specified user information record from the beginning of the user 155 profile. And if NextInfo is TRUE, return the next info in the user profile. 156 157 @param[in] User Points to the user profile entry. 158 158 @param[in, out] Info On entry, points to the user information record or NULL to start 159 159 searching with the first user information record. 160 On return, points to the user information record or NULL if not found. 160 On return, points to the user information record or NULL if not found. 161 161 @param[in] NextInfo If FALSE, find the user information record in profile specifyed by User. 162 If TRUE, find the next user information record in profile specifyed 163 by User. 162 If TRUE, find the next user information record in profile specifyed 163 by User. 164 164 @param[out] Offset A pointer to the offset of the information record in the user profile. 165 165 … … 167 167 @retval EFI_NOT_FOUND Info was not found, or the next Info was not found. 168 168 @retval EFI_SUCCESS Info or the next info are found in user profile. 169 169 170 170 **/ 171 171 EFI_STATUS … … 184 184 return EFI_INVALID_PARAMETER; 185 185 } 186 186 187 187 // 188 188 // Check user profile entry … … 207 207 InfoLen += ALIGN_VARIABLE (UserInfo->InfoSize); 208 208 } 209 209 210 210 // 211 211 // Check whether to find the next user information. … … 245 245 Find a user infomation record by the information record type. 246 246 247 This function searches all user information records of User. The search starts with the 248 user information record following Info and continues until either the information is found 247 This function searches all user information records of User. The search starts with the 248 user information record following Info and continues until either the information is found 249 249 or there are no more user infomation record. 250 250 A match occurs when a Info.InfoType field matches the user information record type. 251 251 252 @param[in] User Points to the user profile record to search. 252 @param[in] User Points to the user profile record to search. 253 253 @param[in, out] Info On entry, points to the user information record or NULL to start 254 254 searching with the first user information record. … … 257 257 258 258 @retval EFI_SUCCESS User information was found. Info points to the user information record. 259 @retval EFI_NOT_FOUND User information was not found. 259 @retval EFI_NOT_FOUND User information was not found. 260 260 @retval EFI_INVALID_PARAMETER User is NULL or Info is NULL. 261 261 262 262 **/ 263 263 EFI_STATUS … … 275 275 return EFI_INVALID_PARAMETER; 276 276 } 277 277 278 278 // 279 279 // Check whether the user has the specified user information. … … 289 289 return EFI_NOT_FOUND; 290 290 } 291 291 292 292 while (InfoLen < User->UserProfileSize) { 293 293 UserInfo = (EFI_USER_INFO *) (User->ProfileInfo + InfoLen); … … 309 309 Find a user using a user information record. 310 310 311 This function searches all user profiles for the specified user information record. The 312 search starts with the user information record handle following UserInfo and continues 311 This function searches all user profiles for the specified user information record. The 312 search starts with the user information record handle following UserInfo and continues 313 313 until either the information is found or there are no more user profiles. 314 A match occurs when the Info.InfoType field matches the user information record type and the 314 A match occurs when the Info.InfoType field matches the user information record type and the 315 315 user information record data matches the portion of Info passed the EFI_USER_INFO header. 316 316 317 @param[in, out] User On entry, points to the previously returned user profile record, 318 or NULL to start searching with the first user profile. 317 @param[in, out] User On entry, points to the previously returned user profile record, 318 or NULL to start searching with the first user profile. 319 319 On return, points to the user profile entry, or NULL if not found. 320 @param[in, out] UserInfo On entry, points to the previously returned user information record, 321 or NULL to start searching with the first. 320 @param[in, out] UserInfo On entry, points to the previously returned user information record, 321 or NULL to start searching with the first. 322 322 On return, points to the user information record, or NULL if not found. 323 @param[in] Info Points to the buffer containing the user information to be compared 323 @param[in] Info Points to the buffer containing the user information to be compared 324 324 to the user information record. 325 325 @param[in] InfoSize The size of Info, in bytes. Same as Info->InfoSize. 326 326 327 @retval EFI_SUCCESS User information was found. User points to the user profile record, 327 @retval EFI_SUCCESS User information was found. User points to the user profile record, 328 328 and UserInfo points to the user information record. 329 @retval EFI_NOT_FOUND User information was not found. 329 @retval EFI_NOT_FOUND User information was not found. 330 330 @retval EFI_INVALID_PARAMETER User is NULL; Info is NULL; or, InfoSize is too small. 331 331 332 332 **/ 333 333 EFI_STATUS … … 362 362 *User = mUserProfileDb->UserProfile[0]; 363 363 } 364 364 365 365 // 366 366 // Check user profile handle. … … 377 377 break; 378 378 } 379 379 380 380 if (InfoSize == Info->InfoSize) { 381 381 if (CompareMem ((UINT8 *) (InfoEntry + 1), (UINT8 *) (Info + 1), InfoSize - sizeof (EFI_USER_INFO)) == 0) { … … 388 388 return EFI_SUCCESS; 389 389 } 390 } 391 } 392 390 } 391 } 392 393 393 // 394 394 // Get next user profile. … … 410 410 @retval TRUE The policy is a valid access policy. 411 411 @retval FALSE The access policy is not a valid access policy. 412 412 413 413 **/ 414 414 BOOLEAN … … 430 430 // Check access policy according to type. 431 431 // 432 CopyMem (&Access, PolicyInfo + TotalLen, sizeof (Access)); 432 CopyMem (&Access, PolicyInfo + TotalLen, sizeof (Access)); 433 433 ValueLen = Access.Size - sizeof (EFI_USER_INFO_ACCESS_CONTROL); 434 434 switch (Access.Type) { … … 492 492 @retval TRUE The policy is a valid identity policy. 493 493 @retval FALSE The access policy is not a valid identity policy. 494 494 495 495 **/ 496 496 BOOLEAN … … 602 602 @retval TRUE The info is a valid user information record. 603 603 @retval FALSE The info is not a valid user information record. 604 604 605 605 **/ 606 606 BOOLEAN … … 697 697 @retval TRUE It is a valid user profile. 698 698 @retval FALSE It is not a valid user profile. 699 699 700 700 **/ 701 701 BOOLEAN … … 711 711 return FALSE; 712 712 } 713 713 714 714 // 715 715 // Check user profile information length. … … 742 742 EFI_USER_INFO_ACCESS_ENROLL_OTHERS or 743 743 EFI_USER_INFO_ACCESS_ENROLL_SELF. 744 744 745 745 @retval TRUE Find the specified RightType in current user profile. 746 746 @retval FALSE Can't find the right in the profile. 747 747 748 748 **/ 749 749 BOOLEAN … … 882 882 @retval TRUE Success to expand user profile database. 883 883 @retval FALSE Fail to expand user profile database. 884 884 885 885 **/ 886 886 BOOLEAN … … 935 935 936 936 @param[in] User Points to user profile. 937 @param[in] ExpandSize The size of user profile. 937 @param[in] ExpandSize The size of user profile. 938 938 939 939 @retval TRUE Success to expand user profile size. 940 940 @retval FALSE Fail to expand user profile size. 941 941 942 942 **/ 943 943 BOOLEAN … … 959 959 return FALSE; 960 960 } 961 961 962 962 // 963 963 // Copy exist information. … … 981 981 @retval EFI_SUCCESS Save or delete user profile successfully. 982 982 @retval Others Fail to change the profile. 983 983 984 984 **/ 985 985 EFI_STATUS … … 998 998 return Status; 999 999 } 1000 1000 1001 1001 // 1002 1002 // Save the user profile to non-volatile memory. … … 1040 1040 return EFI_INVALID_PARAMETER; 1041 1041 } 1042 1042 1043 1043 // 1044 1044 // Check user profile handle. … … 1048 1048 return Status; 1049 1049 } 1050 1050 1051 1051 // 1052 1052 // Check user information memory size. … … 1057 1057 } 1058 1058 } 1059 1059 1060 1060 // 1061 1061 // Add new user information. … … 1083 1083 @param[in] User Point to the user profile. 1084 1084 @param[in] UserInfo Point to the user information record to get. 1085 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. 1085 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. 1086 1086 On exit, holds the user information. 1087 @param[in, out] InfoSize On entry, points to the size of Info. 1087 @param[in, out] InfoSize On entry, points to the size of Info. 1088 1088 On return, points to the size of the user information. 1089 1089 @param[in] ChkRight If TRUE, check the user info attribute. … … 1093 1093 @retval EFI_ACCESS_DENIED The information cannot be accessed by the current user. 1094 1094 @retval EFI_INVALID_PARAMETER InfoSize is NULL or UserInfo is NULL. 1095 @retval EFI_BUFFER_TOO_SMALL The number of bytes specified by *InfoSize is too small to hold the 1095 @retval EFI_BUFFER_TOO_SMALL The number of bytes specified by *InfoSize is too small to hold the 1096 1096 returned data. The actual size required is returned in *InfoSize. 1097 1097 @retval EFI_SUCCESS Information returned successfully. … … 1116 1116 return EFI_INVALID_PARAMETER; 1117 1117 } 1118 1118 1119 1119 // 1120 1120 // Find the user information to get. … … 1124 1124 return Status; 1125 1125 } 1126 1126 1127 1127 // 1128 1128 // Check information attributes. … … 1145 1145 } 1146 1146 } 1147 1147 1148 1148 // 1149 1149 // Get user information. … … 1197 1197 return EFI_ACCESS_DENIED; 1198 1198 } 1199 1199 1200 1200 // 1201 1201 // Delete the specified user information. … … 1220 1220 @param[in] User Point to the user profile. 1221 1221 @param[in, out] UserInfo On entry, points to the user information to modify, 1222 or NULL to add a new UserInfo. 1222 or NULL to add a new UserInfo. 1223 1223 On return, points to the modified user information. 1224 1224 @param[in] Info Points to the new user information. … … 1249 1249 return EFI_INVALID_PARAMETER; 1250 1250 } 1251 1251 1252 1252 // 1253 1253 // Check user information. … … 1256 1256 return EFI_ACCESS_DENIED; 1257 1257 } 1258 1258 1259 1259 if (!CheckUserInfo (Info)) { 1260 1260 return EFI_INVALID_PARAMETER; … … 1274 1274 ASSERT (OldInfo != NULL); 1275 1275 1276 if (((OldInfo->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) || 1276 if (((OldInfo->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) || 1277 1277 ((Info->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0)) { 1278 1278 // … … 1292 1292 continue; 1293 1293 } 1294 1294 1295 1295 PayloadLen = Info->InfoSize - sizeof (EFI_USER_INFO); 1296 1296 if (PayloadLen == 0) { … … 1311 1311 return Status; 1312 1312 } 1313 1313 1314 1314 // 1315 1315 // Modify existing user information. … … 1319 1319 return EFI_INVALID_PARAMETER; 1320 1320 } 1321 1322 if (((Info->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) && 1321 1322 if (((Info->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) && 1323 1323 (OldInfo->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) == 0) { 1324 1324 // 1325 // Try to add exclusive attrib in new info. 1325 // Try to add exclusive attrib in new info. 1326 1326 // Check whether there is another information with the same type in profile. 1327 1327 // … … 1339 1339 return EFI_ACCESS_DENIED; 1340 1340 } 1341 } while (TRUE); 1341 } while (TRUE); 1342 1342 } 1343 1343 … … 1358 1358 @retval EFI_SUCCESS Delete user from the user profile successfully. 1359 1359 @retval Others Fail to delete user from user profile 1360 1360 1361 1361 **/ 1362 1362 EFI_STATUS … … 1375 1375 return EFI_INVALID_PARAMETER; 1376 1376 } 1377 1377 1378 1378 // 1379 1379 // Check whether it is the current user. … … 1382 1382 return EFI_ACCESS_DENIED; 1383 1383 } 1384 1384 1385 1385 // 1386 1386 // Delete user profile from the non-volatile memory. … … 1449 1449 return EFI_SECURITY_VIOLATION; 1450 1450 } 1451 1451 1452 1452 // 1453 1453 // Create user profile entry. … … 1468 1468 1469 1469 UnicodeSPrint ( 1470 User->UserVarName, 1470 User->UserVarName, 1471 1471 sizeof (User->UserVarName), 1472 L"User%04x", 1472 L"User%04x", 1473 1473 mUserProfileDb->UserProfileNum 1474 1474 ); … … 1532 1532 UserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | EFI_USER_INFO_PUBLIC | EFI_USER_INFO_EXCLUSIVE; 1533 1533 GenerateUserId ((UINT8 *) (UserInfo + 1)); 1534 1534 1535 1535 // 1536 1536 // Add user profile to the user profile database. … … 1547 1547 @retval EFI_SUCCESS A default user profile is added successfully. 1548 1548 @retval Others Fail to add a default user profile 1549 1549 1550 1550 **/ 1551 1551 EFI_STATUS … … 1562 1562 EFI_USER_INFO_ACCESS_CONTROL *Access; 1563 1563 EFI_USER_INFO_IDENTITY_POLICY *Policy; 1564 1564 1565 1565 // 1566 1566 // Create a user profile. … … 1570 1570 return Status; 1571 1571 } 1572 1572 1573 1573 // 1574 1574 // Allocate a buffer to add all default user information. … … 1591 1591 goto Done; 1592 1592 } 1593 1593 1594 1594 // 1595 1595 // Add user profile create date record. … … 1609 1609 goto Done; 1610 1610 } 1611 1611 1612 1612 // 1613 1613 // Add user profile usage count record. … … 1623 1623 goto Done; 1624 1624 } 1625 1625 1626 1626 // 1627 1627 // Add user access right. … … 1638 1638 goto Done; 1639 1639 } 1640 1640 1641 1641 // 1642 1642 // Add user identity policy. … … 1646 1646 Policy = (EFI_USER_INFO_IDENTITY_POLICY *) (Info + 1); 1647 1647 Policy->Type = EFI_USER_INFO_IDENTITY_TRUE; 1648 Policy->Length = sizeof (EFI_USER_INFO_IDENTITY_POLICY); 1648 Policy->Length = sizeof (EFI_USER_INFO_IDENTITY_POLICY); 1649 1649 Info->InfoSize = sizeof (EFI_USER_INFO) + Policy->Length; 1650 1650 NewInfo = NULL; … … 1660 1660 Publish current user information into EFI System Configuration Table. 1661 1661 1662 By UEFI spec, the User Identity Manager will publish the current user profile 1662 By UEFI spec, the User Identity Manager will publish the current user profile 1663 1663 into the EFI System Configuration Table. Currently, only the user identifier and user 1664 1664 name are published. … … 1685 1685 if (!EFI_ERROR (Status)) { 1686 1686 // 1687 // The table existed! 1687 // The table existed! 1688 1688 // 1689 1689 return EFI_SUCCESS; … … 1707 1707 return Status; 1708 1708 } 1709 1709 1710 1710 // 1711 1711 // Allocate a buffer for user information table. 1712 1712 // 1713 1713 UserInfoTable = (EFI_USER_INFO_TABLE *) AllocateRuntimePool ( 1714 sizeof (EFI_USER_INFO_TABLE) + 1715 IdInfo->InfoSize + 1714 sizeof (EFI_USER_INFO_TABLE) + 1715 IdInfo->InfoSize + 1716 1716 NameInfo->InfoSize 1717 1717 ); … … 1721 1721 } 1722 1722 1723 UserInfoTable->Size = sizeof (EFI_USER_INFO_TABLE); 1724 1723 UserInfoTable->Size = sizeof (EFI_USER_INFO_TABLE); 1724 1725 1725 // 1726 1726 // Append the user information to the user info table … … 1740 1740 Get the user's identity type. 1741 1741 1742 The identify manager only supports the identity policy in which the credential 1742 The identify manager only supports the identity policy in which the credential 1743 1743 provider handles are connected by the operator 'AND' or 'OR'. 1744 1744 … … 1771 1771 } 1772 1772 ASSERT (IdentifyInfo != NULL); 1773 1773 1774 1774 // 1775 1775 // Search the user identify policy according to type. … … 1823 1823 return EFI_INVALID_PARAMETER; 1824 1824 } 1825 1825 1826 1826 // 1827 1827 // Check the user ID identified by the specified credential provider. … … 1843 1843 // 1844 1844 Status = UserCredential->Form ( 1845 UserCredential, 1846 &HiiHandle, 1847 &FormSetId, 1845 UserCredential, 1846 &HiiHandle, 1847 &FormSetId, 1848 1848 &FormId 1849 1849 ); 1850 if (!EFI_ERROR (Status)) { 1850 if (!EFI_ERROR (Status)) { 1851 1851 // 1852 1852 // Send form to get user input. … … 1863 1863 if (EFI_ERROR (Status)) { 1864 1864 return Status; 1865 } 1866 } 1865 } 1866 } 1867 1867 } 1868 1868 … … 1876 1876 return Status; 1877 1877 } 1878 1878 1879 1879 return EFI_SUCCESS; 1880 1880 } … … 1914 1914 return EFI_OUT_OF_RESOURCES; 1915 1915 } 1916 1916 1917 1917 // 1918 1918 // Check create date record. … … 1938 1938 } 1939 1939 } 1940 1940 1941 1941 // 1942 1942 // Update usage date record. … … 1961 1961 } 1962 1962 } 1963 1963 1964 1964 // 1965 1965 // Update usage count record. … … 2043 2043 2044 2044 @param[in] Index The index of the user in the user name list. 2045 @param[in] User Points to the user profile whose username is added. 2045 @param[in] User Points to the user profile whose username is added. 2046 2046 @param[in] OpCodeHandle Points to container for dynamic created opcodes. 2047 2047 … … 2066 2066 return Status; 2067 2067 } 2068 2068 2069 2069 // 2070 2070 // Add user name selection. … … 2090 2090 /** 2091 2091 Identify the user whose identity policy does not contain the operator 'OR'. 2092 2092 2093 2093 @param[in] User Points to the user profile. 2094 2094 2095 2095 @retval EFI_SUCCESS The specified user is identified successfully. 2096 2096 @retval Others Fail to identify the user. 2097 2097 2098 2098 **/ 2099 2099 EFI_STATUS … … 2118 2118 } 2119 2119 ASSERT (IdentifyInfo != NULL); 2120 2120 2121 2121 // 2122 2122 // Check each part of identification policy expression. … … 2213 2213 /** 2214 2214 Identify the user whose identity policy does not contain the operator 'AND'. 2215 2215 2216 2216 @param[in] User Points to the user profile. 2217 2217 2218 2218 @retval EFI_SUCCESS The specified user is identified successfully. 2219 2219 @retval Others Fail to identify the user. 2220 2220 2221 2221 **/ 2222 2222 EFI_STATUS … … 2244 2244 } 2245 2245 ASSERT (IdentifyInfo != NULL); 2246 2246 2247 2247 // 2248 2248 // Initialize the container for dynamic opcodes. … … 2354 2354 return EFI_SUCCESS; 2355 2355 } 2356 2356 2357 2357 // 2358 2358 // Initialize the container for dynamic opcodes. … … 2360 2360 StartOpCodeHandle = HiiAllocateOpCodeHandle (); 2361 2361 ASSERT (StartOpCodeHandle != NULL); 2362 2362 2363 2363 EndOpCodeHandle = HiiAllocateOpCodeHandle (); 2364 2364 ASSERT (EndOpCodeHandle != NULL); 2365 2365 2366 2366 // 2367 2367 // Create Hii Extend Label OpCode. … … 2375 2375 StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 2376 2376 StartLabel->Number = LABEL_USER_NAME; 2377 2377 2378 2378 EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 2379 2379 EndOpCodeHandle, … … 2384 2384 EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 2385 2385 EndLabel->Number = LABEL_END; 2386 2386 2387 2387 // 2388 2388 // Add all the user profile in the user profile database. … … 2392 2392 AddUserSelection ((UINT16)(LABEL_USER_NAME + Index), User, StartOpCodeHandle); 2393 2393 } 2394 2394 2395 2395 HiiUpdateForm ( 2396 2396 mCallbackInfo->HiiHandle, // HII handle … … 2400 2400 EndOpCodeHandle // Replace data 2401 2401 ); 2402 2402 2403 2403 HiiFreeOpCodeHandle (StartOpCodeHandle); 2404 2404 HiiFreeOpCodeHandle (EndOpCodeHandle); 2405 2405 2406 2406 return EFI_SUCCESS; 2407 2407 } … … 2415 2415 if (QuestionId >= LABEL_PROVIDER_NAME) { 2416 2416 // 2417 // QuestionId comes from the second Form (Select a Credential Provider if identity 2417 // QuestionId comes from the second Form (Select a Credential Provider if identity 2418 2418 // policy is OR type). Identify the user by the selected provider. 2419 2419 // … … 2426 2426 } 2427 2427 break; 2428 2428 2429 2429 case EFI_BROWSER_ACTION_CHANGING: 2430 2430 // … … 2483 2483 /** 2484 2484 This function construct user profile database from user data saved in the Flash. 2485 If no user is found in Flash, add one default user "administrator" in the user 2485 If no user is found in Flash, add one default user "administrator" in the user 2486 2486 profile database. 2487 2487 2488 2488 @retval EFI_SUCCESS Init user profile database successfully. 2489 2489 @retval Others Fail to init user profile database. 2490 2490 2491 2491 **/ 2492 2492 EFI_STATUS … … 2522 2522 return EFI_OUT_OF_RESOURCES; 2523 2523 } 2524 2524 2525 2525 // 2526 2526 // Get all user proifle entries. … … 2532 2532 // 2533 2533 UnicodeSPrint ( 2534 VarName, 2534 VarName, 2535 2535 sizeof (VarName), 2536 L"User%04x", 2536 L"User%04x", 2537 2537 Index 2538 2538 ); … … 2562 2562 break; 2563 2563 } 2564 2564 2565 2565 // 2566 2566 // Check variable attributes. … … 2570 2570 continue; 2571 2571 } 2572 2572 2573 2573 // 2574 2574 // Add user profile to the user profile database. … … 2602 2602 return Status; 2603 2603 } 2604 2604 2605 2605 // 2606 2606 // Check whether the user profile database is empty. … … 2629 2629 UINTN HandleCount; 2630 2630 EFI_HANDLE *HandleBuf; 2631 UINTN Index; 2631 UINTN Index; 2632 2632 2633 2633 if (mProviderDb != NULL) { … … 2658 2658 // 2659 2659 mProviderDb = AllocateZeroPool ( 2660 sizeof (CREDENTIAL_PROVIDER_INFO) - 2661 sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) + 2660 sizeof (CREDENTIAL_PROVIDER_INFO) - 2661 sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) + 2662 2662 HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) 2663 2663 ); … … 2816 2816 CallbackInfo->FormBrowser2 = FormBrowser2; 2817 2817 CallbackInfo->DriverHandle = NULL; 2818 2818 2819 2819 // 2820 2820 // Install Device Path Protocol and Config Access protocol to driver handle. … … 2890 2890 return Status; 2891 2891 } 2892 2892 2893 2893 // 2894 2894 // Find user with the specified user ID. … … 2909 2909 return EFI_NOT_READY; 2910 2910 } 2911 2911 2912 2912 return Status; 2913 2913 } … … 2918 2918 2919 2919 @param[in] ProtocolGuid Points to the protocol guid of sonsole . 2920 2920 2921 2921 @retval TRUE The given console is ready. 2922 2922 @retval FALSE The given console is not ready. 2923 2923 2924 2924 **/ 2925 2925 BOOLEAN 2926 2926 CheckConsole ( 2927 EFI_GUID *ProtocolGuid 2927 EFI_GUID *ProtocolGuid 2928 2928 ) 2929 2929 { … … 2931 2931 UINTN HandleCount; 2932 2932 EFI_HANDLE *HandleBuf; 2933 UINTN Index; 2933 UINTN Index; 2934 2934 EFI_DEVICE_PATH_PROTOCOL *DevicePath; 2935 2935 2936 2936 // 2937 2937 // Try to find all the handle driver. … … 2957 2957 } 2958 2958 } 2959 FreePool (HandleBuf); 2959 FreePool (HandleBuf); 2960 2960 return FALSE; 2961 2961 } … … 2967 2967 @retval TRUE The console is ready. 2968 2968 @retval FALSE The console is not ready. 2969 2969 2970 2970 **/ 2971 2971 BOOLEAN … … 2983 2983 } 2984 2984 } 2985 2985 2986 2986 return TRUE; 2987 2987 } … … 3039 3039 } 3040 3040 } 3041 3041 3042 3042 // 3043 3043 // Find and login the default & AutoLogon user. … … 3060 3060 } 3061 3061 } 3062 3062 3063 3063 if (!IsConsoleReady ()) { 3064 3064 // … … 3080 3080 NULL 3081 3081 ); 3082 3082 3083 3083 if (mIdentified) { 3084 3084 *User = (USER_PROFILE_ENTRY *) mCurrentUser; … … 3086 3086 return EFI_SUCCESS; 3087 3087 } 3088 3088 3089 3089 return EFI_ACCESS_DENIED; 3090 3090 } … … 3093 3093 /** 3094 3094 An empty function to pass error checking of CreateEventEx (). 3095 3095 3096 3096 @param Event Event whose notification function is being invoked. 3097 3097 @param Context Pointer to the notification function's context, … … 3138 3138 Create a new user profile. 3139 3139 3140 This function creates a new user profile with only a new user identifier attached and returns 3140 This function creates a new user profile with only a new user identifier attached and returns 3141 3141 its handle. The user profile is non-volatile, but the handle User can change across reboots. 3142 3142 3143 3143 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 3144 @param[out] User On return, points to the new user profile handle. 3144 @param[out] User On return, points to the new user profile handle. 3145 3145 The user profile handle is unique only during this boot. 3146 3146 3147 3147 @retval EFI_SUCCESS User profile was successfully created. 3148 @retval EFI_ACCESS_DENIED Current user does not have sufficient permissions to create a 3148 @retval EFI_ACCESS_DENIED Current user does not have sufficient permissions to create a 3149 3149 user profile. 3150 3150 @retval EFI_UNSUPPORTED Creation of new user profiles is not supported. 3151 3151 @retval EFI_INVALID_PARAMETER The User parameter is NULL. 3152 3152 3153 3153 **/ 3154 3154 EFI_STATUS … … 3173 3173 } 3174 3174 } 3175 3175 3176 3176 // 3177 3177 // Create new user profile … … 3189 3189 3190 3190 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 3191 @param[in] User User profile handle. 3191 @param[in] User User profile handle. 3192 3192 3193 3193 @retval EFI_SUCCESS User profile was successfully deleted. … … 3196 3196 @retval EFI_UNSUPPORTED Deletion of new user profiles is not supported. 3197 3197 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile. 3198 3198 3199 3199 **/ 3200 3200 EFI_STATUS … … 3210 3210 return EFI_INVALID_PARAMETER; 3211 3211 } 3212 3212 3213 3213 // 3214 3214 // Check the right of the current user. … … 3217 3217 return EFI_ACCESS_DENIED; 3218 3218 } 3219 3219 3220 3220 // 3221 3221 // Delete user profile. … … 3236 3236 Enumerate all of the enrolled users on the platform. 3237 3237 3238 This function returns the next enrolled user profile. To retrieve the first user profile handle, 3239 point User at a NULL. Each subsequent call will retrieve another user profile handle until there 3240 are no more, at which point User will point to NULL. 3238 This function returns the next enrolled user profile. To retrieve the first user profile handle, 3239 point User at a NULL. Each subsequent call will retrieve another user profile handle until there 3240 are no more, at which point User will point to NULL. 3241 3241 3242 3242 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 3243 @param[in, out] User On entry, points to the previous user profile handle or NULL to 3243 @param[in, out] User On entry, points to the previous user profile handle or NULL to 3244 3244 start enumeration. On exit, points to the next user profile handle 3245 3245 or NULL if there are no more user profiles. 3246 3246 3247 @retval EFI_SUCCESS Next enrolled user profile successfully returned. 3247 @retval EFI_SUCCESS Next enrolled user profile successfully returned. 3248 3248 @retval EFI_ACCESS_DENIED Next enrolled user profile was not successfully returned. 3249 3249 @retval EFI_INVALID_PARAMETER The User parameter is NULL. … … 3261 3261 return EFI_INVALID_PARAMETER; 3262 3262 } 3263 3263 3264 3264 Status = FindUserProfile ((USER_PROFILE_ENTRY **) User, TRUE, NULL); 3265 3265 if (EFI_ERROR (Status)) { … … 3276 3276 @param[out] CurrentUser On return, points to the current user profile handle. 3277 3277 3278 @retval EFI_SUCCESS Current user profile handle returned successfully. 3278 @retval EFI_SUCCESS Current user profile handle returned successfully. 3279 3279 @retval EFI_INVALID_PARAMETER The CurrentUser parameter is NULL. 3280 3280 3281 3281 **/ 3282 3282 EFI_STATUS … … 3286 3286 OUT EFI_USER_PROFILE_HANDLE *CurrentUser 3287 3287 ) 3288 { 3288 { 3289 3289 // 3290 3290 // Get current user profile. … … 3304 3304 Identify the user and, if authenticated, returns the user handle and changes the current 3305 3305 user profile. All user information marked as private in a previously selected profile 3306 is no longer available for inspection. 3307 Whenever the current user profile is changed then the an event with the GUID 3306 is no longer available for inspection. 3307 Whenever the current user profile is changed then the an event with the GUID 3308 3308 EFI_EVENT_GROUP_USER_PROFILE_CHANGED is signaled. 3309 3309 … … 3315 3315 @retval EFI_ACCESS_DENIED User was not successfully identified. 3316 3316 @retval EFI_INVALID_PARAMETER The User parameter is NULL. 3317 3317 3318 3318 **/ 3319 3319 EFI_STATUS … … 3334 3334 return EFI_SUCCESS; 3335 3335 } 3336 3336 3337 3337 // 3338 3338 // Identify user … … 3342 3342 return EFI_ACCESS_DENIED; 3343 3343 } 3344 3344 3345 3345 // 3346 3346 // Publish the user info into the EFI system configuration table. … … 3359 3359 3360 3360 This function searches all user profiles for the specified user information record. 3361 The search starts with the user information record handle following UserInfo and 3361 The search starts with the user information record handle following UserInfo and 3362 3362 continues until either the information is found or there are no more user profiles. 3363 3363 A match occurs when the Info.InfoType field matches the user information record … … 3365 3365 3366 3366 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 3367 @param[in, out] User On entry, points to the previously returned user profile 3367 @param[in, out] User On entry, points to the previously returned user profile 3368 3368 handle, or NULL to start searching with the first user profile. 3369 3369 On return, points to the user profile handle, or NULL if not 3370 3370 found. 3371 3371 @param[in, out] UserInfo On entry, points to the previously returned user information 3372 handle, or NULL to start searching with the first. On return, 3372 handle, or NULL to start searching with the first. On return, 3373 3373 points to the user information handle of the user information 3374 record, or NULL if not found. Can be NULL, in which case only 3375 one user information record per user can be returned. 3376 @param[in] Info Points to the buffer containing the user information to be 3377 compared to the user information record. If the user information 3378 record data is empty, then only the user information record type 3379 is compared. If InfoSize is 0, then the user information record 3374 record, or NULL if not found. Can be NULL, in which case only 3375 one user information record per user can be returned. 3376 @param[in] Info Points to the buffer containing the user information to be 3377 compared to the user information record. If the user information 3378 record data is empty, then only the user information record type 3379 is compared. If InfoSize is 0, then the user information record 3380 3380 must be empty. 3381 3381 3382 @param[in] InfoSize The size of Info, in bytes. 3382 @param[in] InfoSize The size of Info, in bytes. 3383 3383 3384 3384 @retval EFI_SUCCESS User information was found. User points to the user profile 3385 3385 handle, and UserInfo points to the user information handle. 3386 @retval EFI_NOT_FOUND User information was not found. User points to NULL, and 3386 @retval EFI_NOT_FOUND User information was not found. User points to NULL, and 3387 3387 UserInfo points to NULL. 3388 @retval EFI_INVALID_PARAMETER User is NULL. Or Info is NULL. 3389 3388 @retval EFI_INVALID_PARAMETER User is NULL. Or Info is NULL. 3389 3390 3390 **/ 3391 3391 EFI_STATUS … … 3418 3418 } 3419 3419 } 3420 Size = Info->InfoSize; 3421 3420 Size = Info->InfoSize; 3421 3422 3422 // 3423 3423 // Find user profile accdoring to user information. … … 3436 3436 return EFI_NOT_FOUND; 3437 3437 } 3438 3438 3439 3439 return EFI_SUCCESS; 3440 3440 } … … 3444 3444 Return information attached to the user. 3445 3445 3446 This function returns user information. The format of the information is described in User 3447 Information. The function may return EFI_ACCESS_DENIED if the information is marked private 3448 and the handle specified by User is not the current user profile. The function may return 3449 EFI_ACCESS_DENIED if the information is marked protected and the information is associated 3446 This function returns user information. The format of the information is described in User 3447 Information. The function may return EFI_ACCESS_DENIED if the information is marked private 3448 and the handle specified by User is not the current user profile. The function may return 3449 EFI_ACCESS_DENIED if the information is marked protected and the information is associated 3450 3450 with a credential provider for which the user has not been authenticated. 3451 3451 3452 3452 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 3453 @param[in] User Handle of the user whose profile will be retrieved. 3454 @param[in] UserInfo Handle of the user information data record. 3455 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On exit, 3456 holds the user information. If the buffer is too small to hold the 3457 information, then EFI_BUFFER_TOO_SMALL is returned and InfoSize is 3458 updated to contain the number of bytes actually required. 3459 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the size 3460 of the user information. 3453 @param[in] User Handle of the user whose profile will be retrieved. 3454 @param[in] UserInfo Handle of the user information data record. 3455 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On exit, 3456 holds the user information. If the buffer is too small to hold the 3457 information, then EFI_BUFFER_TOO_SMALL is returned and InfoSize is 3458 updated to contain the number of bytes actually required. 3459 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the size 3460 of the user information. 3461 3461 3462 3462 @retval EFI_SUCCESS Information returned successfully. 3463 @retval EFI_ACCESS_DENIED The information about the specified user cannot be accessed by the 3463 @retval EFI_ACCESS_DENIED The information about the specified user cannot be accessed by the 3464 3464 current user. 3465 @retval EFI_BUFFER_TOO_SMALL The number of bytes specified by *InfoSize is too small to hold the 3465 @retval EFI_BUFFER_TOO_SMALL The number of bytes specified by *InfoSize is too small to hold the 3466 3466 returned data. The actual size required is returned in *InfoSize. 3467 @retval EFI_NOT_FOUND User does not refer to a valid user profile or UserInfo does not refer 3467 @retval EFI_NOT_FOUND User does not refer to a valid user profile or UserInfo does not refer 3468 3468 to a valid user info handle. 3469 3469 @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL. 3470 3470 3471 3471 **/ 3472 3472 EFI_STATUS … … 3489 3489 return EFI_INVALID_PARAMETER; 3490 3490 } 3491 3491 3492 3492 if ((User == NULL) || (UserInfo == NULL)) { 3493 3493 return EFI_NOT_FOUND; 3494 3494 } 3495 3495 3496 3496 Status = GetUserInfo (User, UserInfo, Info, InfoSize, TRUE); 3497 3497 if (EFI_ERROR (Status)) { … … 3508 3508 Add or update user information. 3509 3509 3510 This function changes user information. If NULL is pointed to by UserInfo, then a new user 3511 information record is created and its handle is returned in UserInfo. Otherwise, the existing 3510 This function changes user information. If NULL is pointed to by UserInfo, then a new user 3511 information record is created and its handle is returned in UserInfo. Otherwise, the existing 3512 3512 one is replaced. 3513 If EFI_USER_INFO_IDENITTY_POLICY_RECORD is changed, it is the caller's responsibility to keep 3513 If EFI_USER_INFO_IDENITTY_POLICY_RECORD is changed, it is the caller's responsibility to keep 3514 3514 it to be synced with the information on credential providers. 3515 If EFI_USER_INFO_EXCLUSIVE is specified in Info and a user information record of the same 3515 If EFI_USER_INFO_EXCLUSIVE is specified in Info and a user information record of the same 3516 3516 type already exists in the user profile, then EFI_ACCESS_DENIED will be returned and UserInfo 3517 3517 will point to the handle of the existing record. 3518 3518 3519 3519 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 3520 @param[in] User Handle of the user whose profile will be retrieved. 3521 @param[in, out] UserInfo Handle of the user information data record. 3522 @param[in] Info On entry, points to a buffer of at least *InfoSize bytes. On exit, 3523 holds the user information. If the buffer is too small to hold the 3524 information, then EFI_BUFFER_TOO_SMALL is returned and InfoSize is 3525 updated to contain the number of bytes actually required. 3526 @param[in] InfoSize On entry, points to the size of Info. On return, points to the size 3527 of the user information. 3520 @param[in] User Handle of the user whose profile will be retrieved. 3521 @param[in, out] UserInfo Handle of the user information data record. 3522 @param[in] Info On entry, points to a buffer of at least *InfoSize bytes. On exit, 3523 holds the user information. If the buffer is too small to hold the 3524 information, then EFI_BUFFER_TOO_SMALL is returned and InfoSize is 3525 updated to contain the number of bytes actually required. 3526 @param[in] InfoSize On entry, points to the size of Info. On return, points to the size 3527 of the user information. 3528 3528 3529 3529 @retval EFI_SUCCESS Information returned successfully. 3530 3530 @retval EFI_ACCESS_DENIED The record is exclusive. 3531 @retval EFI_SECURITY_VIOLATION The current user does not have permission to change the specified 3531 @retval EFI_SECURITY_VIOLATION The current user does not have permission to change the specified 3532 3532 user profile or user information record. 3533 @retval EFI_NOT_FOUND User does not refer to a valid user profile or UserInfo does not 3533 @retval EFI_NOT_FOUND User does not refer to a valid user profile or UserInfo does not 3534 3534 refer to a valid user info handle. 3535 @retval EFI_INVALID_PARAMETER UserInfo is NULL or Info is NULL. 3535 @retval EFI_INVALID_PARAMETER UserInfo is NULL or Info is NULL. 3536 3536 **/ 3537 3537 EFI_STATUS … … 3550 3550 return EFI_INVALID_PARAMETER; 3551 3551 } 3552 3552 3553 3553 // 3554 3554 // Check the right of the current user. … … 3562 3562 return EFI_SECURITY_VIOLATION; 3563 3563 } 3564 3564 3565 3565 if (!CheckCurrentUserAccessRight (EFI_USER_INFO_ACCESS_ENROLL_OTHERS)) { 3566 3566 // … … 3582 3582 } 3583 3583 } 3584 3584 3585 3585 // 3586 3586 // Modify user information. … … 3589 3589 if (EFI_ERROR (Status)) { 3590 3590 if (Status == EFI_ACCESS_DENIED) { 3591 return EFI_ACCESS_DENIED; 3591 return EFI_ACCESS_DENIED; 3592 3592 } 3593 3593 return EFI_SECURITY_VIOLATION; … … 3600 3600 Called by credential provider to notify of information change. 3601 3601 3602 This function allows the credential provider to notify the User Identity Manager when user status 3602 This function allows the credential provider to notify the User Identity Manager when user status 3603 3603 has changed. 3604 If the User Identity Manager doesn't support asynchronous changes in credentials, then this function 3605 should return EFI_UNSUPPORTED. 3606 If current user does not exist, and the credential provider can identify a user, then make the user 3604 If the User Identity Manager doesn't support asynchronous changes in credentials, then this function 3605 should return EFI_UNSUPPORTED. 3606 If current user does not exist, and the credential provider can identify a user, then make the user 3607 3607 to be current user and signal the EFI_EVENT_GROUP_USER_PROFILE_CHANGED event. 3608 If current user already exists, and the credential provider can identify another user, then switch 3608 If current user already exists, and the credential provider can identify another user, then switch 3609 3609 current user to the newly identified user, and signal the EFI_EVENT_GROUP_USER_PROFILE_CHANGED event. 3610 If current user was identified by this credential provider and now the credential provider cannot identify 3610 If current user was identified by this credential provider and now the credential provider cannot identify 3611 3611 current user, then logout current user and signal the EFI_EVENT_GROUP_USER_PROFILE_CHANGED event. 3612 3612 3613 3613 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 3614 @param[in] Changed Handle on which is installed an instance of the EFI_USER_CREDENTIAL2_PROTOCOL 3614 @param[in] Changed Handle on which is installed an instance of the EFI_USER_CREDENTIAL2_PROTOCOL 3615 3615 where the user has changed. 3616 3616 … … 3618 3618 @retval EFI_NOT_READY The function was called while the specified credential provider was not selected. 3619 3619 @retval EFI_UNSUPPORTED The User Identity Manager doesn't support asynchronous notifications. 3620 3620 3621 3621 **/ 3622 3622 EFI_STATUS … … 3626 3626 IN EFI_HANDLE Changed 3627 3627 ) 3628 { 3628 { 3629 3629 return EFI_UNSUPPORTED; 3630 3630 } … … 3642 3642 @retval EFI_SUCCESS User information deleted successfully. 3643 3643 @retval EFI_NOT_FOUND User information record UserInfo does not exist in the user profile. 3644 @retval EFI_ACCESS_DENIED The current user does not have permission to delete this user information. 3645 3644 @retval EFI_ACCESS_DENIED The current user does not have permission to delete this user information. 3645 3646 3646 **/ 3647 3647 EFI_STATUS … … 3658 3658 return EFI_INVALID_PARAMETER; 3659 3659 } 3660 3660 3661 3661 // 3662 3662 // Check the right of the current user. … … 3667 3667 } 3668 3668 } 3669 3669 3670 3670 // 3671 3671 // Delete user information. … … 3677 3677 } 3678 3678 return EFI_ACCESS_DENIED; 3679 } 3679 } 3680 3680 return EFI_SUCCESS; 3681 3681 } … … 3685 3685 Enumerate user information of all the enrolled users on the platform. 3686 3686 3687 This function returns the next user information record. To retrieve the first user 3688 information record handle, point UserInfo at a NULL. Each subsequent call will retrieve 3689 another user information record handle until there are no more, at which point UserInfo 3690 will point to NULL. 3687 This function returns the next user information record. To retrieve the first user 3688 information record handle, point UserInfo at a NULL. Each subsequent call will retrieve 3689 another user information record handle until there are no more, at which point UserInfo 3690 will point to NULL. 3691 3691 3692 3692 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. … … 3697 3697 @retval EFI_NOT_FOUND No more user information found. 3698 3698 @retval EFI_INVALID_PARAMETER UserInfo is NULL. 3699 3699 3700 3700 **/ 3701 3701 EFI_STATUS … … 3755 3755 &gUserIdentifyManager 3756 3756 ); 3757 ASSERT_EFI_ERROR (Status); 3757 ASSERT_EFI_ERROR (Status); 3758 3758 3759 3759 LoadDeferredImageInit (ImageHandle); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.h
r48674 r58466 1 1 /** @file 2 2 The header file for User identify Manager driver. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 240 240 241 241 This function searches all user profiles for the specified user information record. 242 The search starts with the user information record handle following UserInfo and 242 The search starts with the user information record handle following UserInfo and 243 243 continues until either the information is found or there are no more user profiles. 244 244 A match occurs when the Info.InfoType field matches the user information record 245 type and the user information record data matches the portion of Info passed the 245 type and the user information record data matches the portion of Info passed the 246 246 EFI_USER_INFO header. 247 247 248 248 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL. 249 @param[in, out] User On entry, points to the previously returned user profile 249 @param[in, out] User On entry, points to the previously returned user profile 250 250 handle, or NULL to start searching with the first user profile. 251 251 On return, points to the user profile handle, or NULL if not 252 252 found. 253 253 @param[in, out] UserInfo On entry, points to the previously returned user information 254 handle, or NULL to start searching with the first. On return, 254 handle, or NULL to start searching with the first. On return, 255 255 points to the user information handle of the user information 256 record, or NULL if not found. Can be NULL, in which case only 257 one user information record per user can be returned. 258 @param[in] Info Points to the buffer containing the user information to be 259 compared to the user information record. If NULL, then only 260 the user information record type is compared. If InfoSize is 0, 256 record, or NULL if not found. Can be NULL, in which case only 257 one user information record per user can be returned. 258 @param[in] Info Points to the buffer containing the user information to be 259 compared to the user information record. If NULL, then only 260 the user information record type is compared. If InfoSize is 0, 261 261 then the user information record must be empty. 262 262 263 @param[in] InfoSize The size of Info, in bytes. 263 @param[in] InfoSize The size of Info, in bytes. 264 264 265 265 @retval EFI_SUCCESS User information was found. User points to the user profile handle, 266 266 and UserInfo points to the user information handle. 267 @retval EFI_NOT_FOUND User information was not found. User points to NULL and UserInfo 267 @retval EFI_NOT_FOUND User information was not found. User points to NULL and UserInfo 268 268 points to NULL. 269 269 270 270 **/ 271 271 EFI_STATUS … … 410 410 IN OUT EFI_USER_INFO_HANDLE *UserInfo 411 411 ); 412 412 413 413 #endif -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerData.h
r48674 r58466 1 1 /** @file 2 2 Data structure used by the user identify manager driver. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerDxe.inf
r58459 r58466 3 3 # 4 4 # This module manages user information and produces user manager protocol. 5 # 5 # 6 6 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 7 7 # This program and the accompanying materials … … 49 49 gEfiIfrTianoGuid ## SOMETIMES_CONSUMES ## GUID 50 50 gEfiEventUserProfileChangedGuid ## SOMETIMES_PRODUCES ## Event 51 51 52 52 ## SOMETIMES_PRODUCES ## Variable:L"Userxxxx" 53 53 ## SOMETIMES_CONSUMES ## Variable:L"Userxxxx" … … 65 65 gEfiHiiConfigAccessProtocolGuid ## PRODUCES 66 66 gEfiDevicePathProtocolGuid ## PRODUCES 67 67 68 68 ## PRODUCES 69 69 ## SOMETIMES_PRODUCES ## SystemTable 70 gEfiUserManagerProtocolGuid 70 gEfiUserManagerProtocolGuid 71 71 72 72 [Depex] 73 gEfiHiiDatabaseProtocolGuid AND 74 gEfiHiiStringProtocolGuid AND 75 gEfiFormBrowser2ProtocolGuid 73 gEfiHiiDatabaseProtocolGuid AND 74 gEfiHiiStringProtocolGuid AND 75 gEfiFormBrowser2ProtocolGuid 76 76 77 77 [UserExtensions.TianoCore."ExtraFiles"] -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerVfr.Vfr
-
Property svn:eol-style
set to
native
r58459 r58466 3 3 4 4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 15 15 #include "UserIdentifyManagerData.h" 16 16 17 formset 17 formset 18 18 guid = USER_IDENTIFY_MANAGER_GUID, 19 title = STRING_TOKEN(STR_TITLE), 20 help = STRING_TOKEN(STR_NULL_STRING), 19 title = STRING_TOKEN(STR_TITLE), 20 help = STRING_TOKEN(STR_NULL_STRING), 21 21 classguid = USER_IDENTIFY_MANAGER_GUID, 22 22 23 23 form formid = FORMID_USER_FORM, 24 title = STRING_TOKEN(STR_USER_SELECT); 24 title = STRING_TOKEN(STR_USER_SELECT); 25 25 26 26 suppressif TRUE; … … 33 33 34 34 label LABEL_USER_NAME; 35 label LABEL_END; 35 label LABEL_END; 36 36 endform; 37 37 38 38 form formid = FORMID_PROVIDER_FORM, 39 39 title = STRING_TOKEN(STR_PROVIDER_SELECT); 40 40 label LABEL_PROVIDER_NAME; 41 41 label LABEL_END; 42 endform; 42 endform; 43 43 endformset; -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c
r58459 r58466 1 1 /** @file 2 2 The functions for access policy modification. 3 3 4 4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 16 16 17 17 /** 18 Collect all the access policy data to mUserInfo.AccessPolicy, 18 Collect all the access policy data to mUserInfo.AccessPolicy, 19 19 and save it to user profile. 20 20 … … 39 39 mUserInfo.AccessPolicyModified = TRUE; 40 40 OffSet = 0; 41 41 42 42 // 43 43 // Save access right. … … 52 52 CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control)); 53 53 OffSet += sizeof (Control); 54 54 55 55 // 56 56 // Save access setup. … … 62 62 63 63 Control.Type = EFI_USER_INFO_ACCESS_SETUP; 64 Control.Size = (UINT32) Size; 64 Control.Size = (UINT32) Size; 65 65 CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control)); 66 66 OffSet += sizeof (Control); 67 67 68 68 if (mAccessInfo.AccessSetup == ACCESS_SETUP_NORMAL) { 69 69 CopyGuid ((EFI_GUID *) (mUserInfo.AccessPolicy + OffSet), &gEfiUserInfoAccessSetupNormalGuid); … … 74 74 } 75 75 OffSet += sizeof (EFI_GUID); 76 76 77 77 // 78 78 // Save access of boot order. … … 84 84 85 85 Control.Type = EFI_USER_INFO_ACCESS_BOOT_ORDER; 86 Control.Size = (UINT32) Size; 86 Control.Size = (UINT32) Size; 87 87 CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control)); 88 88 OffSet += sizeof (Control); … … 90 90 CopyMem ((UINT8 *) (mUserInfo.AccessPolicy + OffSet), &mAccessInfo.AccessBootOrder, sizeof (UINT32)); 91 91 OffSet += sizeof (UINT32); 92 92 93 93 // 94 94 // Save permit load. … … 101 101 102 102 Control.Type = EFI_USER_INFO_ACCESS_PERMIT_LOAD; 103 Control.Size = (UINT32) Size; 103 Control.Size = (UINT32) Size; 104 104 CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control)); 105 105 OffSet += sizeof (Control); 106 106 107 107 CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.LoadPermit, mAccessInfo.LoadPermitLen); 108 108 OffSet += mAccessInfo.LoadPermitLen; 109 109 } 110 110 111 111 // 112 112 // Save forbid load. … … 119 119 120 120 Control.Type = EFI_USER_INFO_ACCESS_FORBID_LOAD; 121 Control.Size = (UINT32) Size; 121 Control.Size = (UINT32) Size; 122 122 CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control)); 123 123 OffSet += sizeof (Control); 124 124 125 125 CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.LoadForbid, mAccessInfo.LoadForbidLen); 126 126 OffSet += mAccessInfo.LoadForbidLen; 127 127 } 128 128 129 129 // 130 130 // Save permit connect. … … 137 137 138 138 Control.Type = EFI_USER_INFO_ACCESS_PERMIT_CONNECT; 139 Control.Size = (UINT32) Size; 139 Control.Size = (UINT32) Size; 140 140 CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control)); 141 141 OffSet += sizeof (Control); 142 142 143 143 CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.ConnectPermit, mAccessInfo.ConnectPermitLen); 144 144 OffSet += mAccessInfo.ConnectPermitLen; 145 145 } 146 146 147 147 // 148 148 // Save forbid connect. … … 155 155 156 156 Control.Type = EFI_USER_INFO_ACCESS_FORBID_CONNECT; 157 Control.Size = (UINT32) Size; 157 Control.Size = (UINT32) Size; 158 158 CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control)); 159 159 OffSet += sizeof (Control); 160 160 161 161 CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.ConnectForbid, mAccessInfo.ConnectForbidLen); 162 162 OffSet += mAccessInfo.ConnectForbidLen; … … 265 265 266 266 /** 267 Check whether the DevicePath is in the device path forbid list 267 Check whether the DevicePath is in the device path forbid list 268 268 (mAccessInfo.LoadForbid). 269 269 270 270 @param[in] DevicePath Points to device path. 271 271 272 272 @retval TRUE The DevicePath is in the device path forbid list. 273 273 @retval FALSE The DevicePath is not in the device path forbid list. … … 331 331 OrderSize = 0; 332 332 Status = gRT->GetVariable ( 333 L"DriverOrder", 334 &gEfiGlobalVariableGuid, 335 NULL, 336 &OrderSize, 333 L"DriverOrder", 334 &gEfiGlobalVariableGuid, 335 NULL, 336 &OrderSize, 337 337 NULL 338 338 ); … … 347 347 348 348 Status = gRT->GetVariable ( 349 L"DriverOrder", 350 &gEfiGlobalVariableGuid, 351 NULL, 352 &OrderSize, 349 L"DriverOrder", 350 &gEfiGlobalVariableGuid, 351 NULL, 352 &OrderSize, 353 353 Order 354 354 ); … … 356 356 return ; 357 357 } 358 358 359 359 // 360 360 // Initialize the container for dynamic opcodes. … … 401 401 continue; 402 402 } 403 403 404 404 // 405 405 // Check whether the driver is already forbidden. 406 406 // 407 407 408 408 VarPtr = Var; 409 409 // … … 546 546 { 547 547 // 548 // Note: 548 // Note: 549 549 // As no architect protocol/interface to be called in ConnectController() 550 550 // to verify the device path, just add a place holder for permitted connect … … 564 564 { 565 565 // 566 // Note: 566 // Note: 567 567 // As no architect protocol/interface to be called in ConnectController() 568 568 // to verify the device path, just add a place holder for forbidden connect … … 573 573 574 574 /** 575 Delete the specified device path by DriverIndex from the forbid device path 575 Delete the specified device path by DriverIndex from the forbid device path 576 576 list (mAccessInfo.LoadForbid). 577 577 578 578 @param[in] DriverIndex The index of driver in forbidden device path list. 579 579 580 580 **/ 581 581 VOID … … 599 599 DriverIndex--; 600 600 } 601 601 602 602 // 603 603 // Specified device path found. … … 609 609 if (OffLen > 0) { 610 610 CopyMem ( 611 mAccessInfo.LoadForbid + OffSet, 612 mAccessInfo.LoadForbid + OffSet + DPSize, 611 mAccessInfo.LoadForbid + OffSet, 612 mAccessInfo.LoadForbid + OffSet + DPSize, 613 613 OffLen 614 614 ); … … 620 620 621 621 /** 622 Add the specified device path by DriverIndex to the forbid device path 622 Add the specified device path by DriverIndex to the forbid device path 623 623 list (mAccessInfo.LoadForbid). 624 624 625 625 @param[in] DriverIndex The index of driver saved in driver options. 626 626 627 627 **/ 628 628 VOID … … 646 646 return; 647 647 } 648 648 649 649 // 650 650 // Save forbid load driver. 651 651 // 652 652 653 653 VarPtr = Var; 654 654 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c
r48674 r58466 1 1 /** @file 2 2 The functions for identification policy modification. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 21 21 22 22 @param[in] NewGuid Points to the credential provider guid. 23 23 24 24 @retval TRUE The NewGuid was found in the identity policy. 25 25 @retval FALSE The NewGuid was not found. … … 53 53 Offset += Identity->Length; 54 54 } 55 55 56 56 return FALSE; 57 57 } … … 71 71 EnrollUserOnProvider ( 72 72 IN EFI_USER_INFO_IDENTITY_POLICY *Identity, 73 IN EFI_USER_PROFILE_HANDLE User 73 IN EFI_USER_PROFILE_HANDLE User 74 74 ) 75 75 { 76 76 UINTN Index; 77 77 EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential; 78 78 79 79 // 80 80 // Find the specified credential provider. … … 87 87 } 88 88 89 return EFI_NOT_FOUND; 89 return EFI_NOT_FOUND; 90 90 } 91 91 … … 104 104 DeleteUserOnProvider ( 105 105 IN EFI_USER_INFO_IDENTITY_POLICY *Identity, 106 IN EFI_USER_PROFILE_HANDLE User 106 IN EFI_USER_PROFILE_HANDLE User 107 107 ) 108 108 { 109 109 UINTN Index; 110 110 EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential; 111 111 112 112 // 113 113 // Find the specified credential provider. … … 120 120 } 121 121 122 return EFI_NOT_FOUND; 122 return EFI_NOT_FOUND; 123 123 } 124 124 … … 126 126 /** 127 127 Delete User's credental from all the providers that exist in User's identity policy. 128 128 129 129 @param[in] IdentityPolicy Point to User's identity policy. 130 130 @param[in] IdentityPolicyLen The length of the identity policy. … … 136 136 IN UINT8 *IdentityPolicy, 137 137 IN UINTN IdentityPolicyLen, 138 IN EFI_USER_PROFILE_HANDLE User 138 IN EFI_USER_PROFILE_HANDLE User 139 139 ) 140 140 { … … 159 159 /** 160 160 Remove the provider specified by Offset from the new user identification record. 161 161 162 162 @param[in] IdentityPolicy Point to user identity item in new identification policy. 163 163 @param[in] Offset The item offset in the new identification policy. … … 188 188 // 189 189 // This provider is not the last item in the identification policy, delete it and the connector. 190 // 190 // 191 191 RemainingLen = mUserInfo.NewIdentityPolicyLen - Offset - DeleteLen; 192 192 CopyMem ((UINT8 *) IdentityPolicy, (UINT8 *) IdentityPolicy + DeleteLen, RemainingLen); 193 193 } 194 mUserInfo.NewIdentityPolicyLen -= DeleteLen; 194 mUserInfo.NewIdentityPolicyLen -= DeleteLen; 195 195 } 196 196 … … 202 202 203 203 @param[in] NewGuid Points to the credential provider guid. 204 204 205 205 **/ 206 206 VOID … … 249 249 FreePool (mUserInfo.NewIdentityPolicy); 250 250 } 251 251 252 252 // 253 253 // Save credential provider. … … 326 326 @retval TRUE The policy is a valid identity policy. 327 327 @retval FALSE The policy is not a valid identity policy. 328 328 329 329 **/ 330 330 BOOLEAN … … 338 338 UINTN Offset; 339 339 UINT32 OpCode; 340 340 341 341 // 342 342 // Check policy expression. … … 350 350 Identity = (EFI_USER_INFO_IDENTITY_POLICY *) (PolicyInfo + Offset); 351 351 switch (Identity->Type) { 352 352 353 353 case EFI_USER_INFO_IDENTITY_TRUE: 354 354 break; … … 409 409 /** 410 410 Save the identity policy and update UI with it. 411 412 This funciton will verify the new identity policy, in current implementation, 411 412 This funciton will verify the new identity policy, in current implementation, 413 413 the identity policy can be: T, P & P & P & ..., P | P | P | ... 414 414 Here, "T" means "True", "P" means "Credential Provider", "&" means "and", "|" means "or". 415 Other identity policies are not supported. 415 Other identity policies are not supported. 416 416 417 417 **/ … … 440 440 return ; 441 441 } 442 442 443 443 // 444 444 // Update the informantion on credential provider. … … 448 448 return ; 449 449 } 450 450 451 451 // 452 452 // Save new identification policy. … … 462 462 Status = mUserManager->SetInfo (mUserManager, mModifyUser, &UserInfo, Info, Info->InfoSize); 463 463 FreePool (Info); 464 464 465 465 // 466 466 // Update the mUserInfo.IdentityPolicy by mUserInfo.NewIdentityPolicy … … 474 474 mUserInfo.NewIdentityPolicy = NULL; 475 475 mUserInfo.NewIdentityPolicyLen = 0; 476 mUserInfo.NewIdentityPolicyModified = FALSE; 476 mUserInfo.NewIdentityPolicyModified = FALSE; 477 477 478 478 // … … 495 495 return ; 496 496 } 497 497 498 498 // 499 499 // Check the identity policy. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileAdd.c
r48674 r58466 1 1 /** @file 2 2 The functions to add a user profile. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 18 18 /** 19 19 Get user name from the popup windows. 20 20 21 21 @param[in, out] UserNameLen On entry, point to UserName buffer lengh, in bytes. 22 22 On exit, point to input user name length, in bytes. 23 23 @param[out] UserName The buffer to hold the input user name. 24 24 25 25 @retval EFI_ABORTED It is given up by pressing 'ESC' key. 26 26 @retval EFI_NOT_READY Not a valid input at all. … … 101 101 *UserNameLen = NameLen * sizeof (CHAR16); 102 102 CopyMem (UserName, Name, *UserNameLen); 103 103 104 104 return EFI_SUCCESS; 105 105 } … … 113 113 114 114 @retval EFI_NOT_READY The usernme in mAddUserName had been used. 115 @retval EFI_SUCCESS Change the user's username successfully with 115 @retval EFI_SUCCESS Change the user's username successfully with 116 116 username in mAddUserName. 117 117 … … 128 128 EFI_USER_PROFILE_HANDLE TempUser; 129 129 EFI_USER_INFO *NewUserInfo; 130 130 131 131 NewUserInfo = AllocateZeroPool (sizeof (EFI_USER_INFO) + UserNameLen); 132 132 ASSERT (NewUserInfo != NULL); 133 133 134 134 NewUserInfo->InfoType = EFI_USER_INFO_NAME_RECORD; 135 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 136 EFI_USER_INFO_PUBLIC | 135 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 136 EFI_USER_INFO_PUBLIC | 137 137 EFI_USER_INFO_EXCLUSIVE; 138 138 NewUserInfo->InfoSize = (UINT32) (sizeof (EFI_USER_INFO) + UserNameLen); … … 182 182 EFI_USER_INFO_CREATE_DATE Date; 183 183 EFI_USER_INFO *NewUserInfo; 184 184 185 185 NewUserInfo = AllocateZeroPool ( 186 186 sizeof (EFI_USER_INFO) + … … 190 190 191 191 NewUserInfo->InfoType = EFI_USER_INFO_CREATE_DATE_RECORD; 192 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 193 EFI_USER_INFO_PUBLIC | 192 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 193 EFI_USER_INFO_PUBLIC | 194 194 EFI_USER_INFO_EXCLUSIVE; 195 195 NewUserInfo->InfoSize = sizeof (EFI_USER_INFO) + sizeof (EFI_USER_INFO_CREATE_DATE); … … 216 216 Set the default identity policy of the specified user. 217 217 218 @param[in] User Handle of a user profile. 218 @param[in] User Handle of a user profile. 219 219 220 220 **/ … … 227 227 EFI_USER_INFO_HANDLE UserInfo; 228 228 EFI_USER_INFO *NewUserInfo; 229 229 230 230 NewUserInfo = AllocateZeroPool ( 231 sizeof (EFI_USER_INFO) + 231 sizeof (EFI_USER_INFO) + 232 232 sizeof (EFI_USER_INFO_IDENTITY_POLICY) 233 233 ); 234 234 ASSERT (NewUserInfo != NULL); 235 235 236 236 Policy = (EFI_USER_INFO_IDENTITY_POLICY *) (NewUserInfo + 1); 237 237 Policy->Type = EFI_USER_INFO_IDENTITY_TRUE; … … 239 239 240 240 NewUserInfo->InfoType = EFI_USER_INFO_IDENTITY_POLICY_RECORD; 241 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 242 EFI_USER_INFO_PUBLIC | 241 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 242 EFI_USER_INFO_PUBLIC | 243 243 EFI_USER_INFO_EXCLUSIVE; 244 244 NewUserInfo->InfoSize = sizeof (EFI_USER_INFO) + Policy->Length; … … 258 258 Set the default access policy of the specified user. 259 259 260 @param[in] User Handle of a user profile. 260 @param[in] User Handle of a user profile. 261 261 262 262 **/ … … 269 269 EFI_USER_INFO_HANDLE UserInfo; 270 270 EFI_USER_INFO *NewUserInfo; 271 271 272 272 NewUserInfo = AllocateZeroPool ( 273 sizeof (EFI_USER_INFO) + 273 sizeof (EFI_USER_INFO) + 274 274 sizeof (EFI_USER_INFO_ACCESS_CONTROL) 275 275 ); 276 276 ASSERT (NewUserInfo != NULL); 277 277 278 278 Control = (EFI_USER_INFO_ACCESS_CONTROL *) (NewUserInfo + 1); 279 279 Control->Type = EFI_USER_INFO_ACCESS_ENROLL_SELF; … … 281 281 282 282 NewUserInfo->InfoType = EFI_USER_INFO_ACCESS_POLICY_RECORD; 283 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 284 EFI_USER_INFO_PUBLIC | 283 NewUserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 284 EFI_USER_INFO_PUBLIC | 285 285 EFI_USER_INFO_EXCLUSIVE; 286 286 NewUserInfo->InfoSize = sizeof (EFI_USER_INFO) + Control->Size; … … 316 316 QuestionStr = NULL; 317 317 PromptStr = NULL; 318 318 319 319 // 320 320 // Get user name to add. … … 325 325 if (Status != EFI_ABORTED) { 326 326 QuestionStr = GetStringById (STRING_TOKEN (STR_GET_USERNAME_FAILED)); 327 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 327 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 328 328 goto Done; 329 329 } … … 338 338 if (EFI_ERROR (Status)) { 339 339 QuestionStr = GetStringById (STRING_TOKEN (STR_CREATE_PROFILE_FAILED)); 340 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 340 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 341 341 } else { 342 342 // … … 346 346 if (EFI_ERROR (Status)) { 347 347 QuestionStr = GetStringById (STRING_TOKEN (STR_USER_ALREADY_EXISTED)); 348 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 348 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 349 349 goto Done; 350 350 } … … 355 355 356 356 QuestionStr = GetStringById (STRING_TOKEN (STR_CREATE_PROFILE_SUCCESS)); 357 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 357 PromptStr = GetStringById (STRING_TOKEN (STR_STROKE_KEY_CONTINUE)); 358 358 } 359 359 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileDelete.c
r48674 r58466 1 1 /** @file 2 2 The functions to delete a user profile. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 18 18 Get the username from the specified user. 19 19 20 @param[in] User Handle of a user profile. 20 @param[in] User Handle of a user profile. 21 21 22 22 @retval EFI_STRING_ID The String Id of the user's username. 23 23 24 24 **/ 25 EFI_STRING_ID 25 EFI_STRING_ID 26 26 GetUserName ( 27 27 IN EFI_USER_PROFILE_HANDLE User … … 36 36 CHAR16 UserName[USER_NAME_LENGTH]; 37 37 EFI_STRING_ID UserId; 38 38 39 39 // 40 40 // Allocate user information memory. … … 43 43 Info = AllocateZeroPool (MemSize); 44 44 ASSERT (Info != NULL); 45 45 46 46 // 47 47 // Get user name information. … … 117 117 Add a username item in form. 118 118 119 @param[in] User Points to the user profile whose username is added. 119 @param[in] User Points to the user profile whose username is added. 120 120 @param[in] Index The index of the user in the user name list 121 121 @param[in] OpCodeHandle Points to container for dynamic created opcodes. … … 138 138 return ; 139 139 } 140 140 141 141 // 142 142 // Create user name option. … … 174 174 Delete the user specified by UserIndex in user profile database. 175 175 176 @param[in] UserIndex The index of user in the user name list 176 @param[in] UserIndex The index of user in the user name list 177 177 to be deleted. 178 178 … … 198 198 goto Done; 199 199 } 200 200 201 201 while (UserIndex > 1) { 202 202 Status = mUserManager->GetNext (mUserManager, &User); … … 233 233 DeleteCredentialFromProviders ((UINT8 *)(Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO), User); 234 234 FreePool (Info); 235 235 236 236 Status = mUserManager->Delete (mUserManager, User); 237 237 if (EFI_ERROR (Status)) { … … 246 246 NULL 247 247 ); 248 return ; 248 return ; 249 249 } 250 250 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c
r48674 r58466 1 1 /** @file 2 This driver is a configuration tool for adding, deleting or modifying user 3 profiles, including gathering the necessary information to ascertain their 4 identity in the future, updating user access policy and identification 2 This driver is a configuration tool for adding, deleting or modifying user 3 profiles, including gathering the necessary information to ascertain their 4 identity in the future, updating user access policy and identification 5 5 policy, etc. 6 6 7 7 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 11 http://opensource.org/licenses/bsd-license.php 12 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 … … 71 71 72 72 /** 73 This function gets all the credential providers in the system and saved them 73 This function gets all the credential providers in the system and saved them 74 74 to mProviderInfo. 75 75 76 76 @retval EFI_SUCESS Init credential provider database successfully. 77 77 @retval Others Fail to init credential provider database. 78 78 79 79 **/ 80 80 EFI_STATUS … … 86 86 UINTN HandleCount; 87 87 EFI_HANDLE *HandleBuf; 88 UINTN Index; 89 88 UINTN Index; 89 90 90 // 91 91 // Try to find all the user credential provider driver. … … 103 103 return Status; 104 104 } 105 105 106 106 // 107 107 // Get provider infomation. … … 111 111 } 112 112 mProviderInfo = AllocateZeroPool ( 113 sizeof (CREDENTIAL_PROVIDER_INFO) - 113 sizeof (CREDENTIAL_PROVIDER_INFO) - 114 114 sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) + 115 115 HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) … … 192 192 return EFI_SUCCESS; 193 193 } 194 194 195 195 // 196 196 // Get current user … … 202 202 return EFI_NOT_READY; 203 203 } 204 204 205 205 // 206 206 // Get current user's right information. … … 210 210 CurrentAccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF; 211 211 } 212 212 213 213 // 214 214 // Init credential provider information. … … 218 218 return Status; 219 219 } 220 220 221 221 // 222 222 // Initialize the container for dynamic opcodes. … … 224 224 StartOpCodeHandle = HiiAllocateOpCodeHandle (); 225 225 ASSERT (StartOpCodeHandle != NULL); 226 226 227 227 EndOpCodeHandle = HiiAllocateOpCodeHandle (); 228 228 ASSERT (EndOpCodeHandle != NULL); 229 229 230 230 // 231 231 // Create Hii Extend Label OpCode. … … 239 239 StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 240 240 StartLabel->Number = LABEL_USER_MANAGE_FUNC; 241 241 242 242 EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 243 243 EndOpCodeHandle, … … 248 248 EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 249 249 EndLabel->Number = LABEL_END; 250 250 251 251 // 252 252 // Add user profile option. … … 264 264 ); 265 265 } 266 266 267 267 // 268 268 // Add modify user profile option. … … 276 276 KEY_MODIFY_USER // Question ID 277 277 ); 278 278 279 279 // 280 280 // Add delete user profile option … … 290 290 ); 291 291 } 292 292 293 293 HiiUpdateForm ( 294 294 mCallbackInfo->HiiHandle, // HII handle … … 298 298 EndOpCodeHandle // Replace data 299 299 ); 300 300 301 301 HiiFreeOpCodeHandle (StartOpCodeHandle); 302 302 HiiFreeOpCodeHandle (EndOpCodeHandle); 303 303 304 304 return EFI_SUCCESS; 305 305 } … … 311 311 312 312 case EFI_BROWSER_ACTION_CHANGED: 313 { 313 { 314 314 // 315 315 // Handle the request from form. … … 318 318 return EFI_INVALID_PARAMETER; 319 319 } 320 320 321 321 // 322 322 // Judge first 2 bits. … … 392 392 // Change credential provider option. 393 393 // 394 case KEY_MODIFY_PROV: 394 case KEY_MODIFY_PROV: 395 395 mProviderChoice = Value->u8; 396 396 break; … … 556 556 557 557 case EFI_BROWSER_ACTION_CHANGING: 558 { 558 { 559 559 // 560 560 // Handle the request from form. … … 563 563 return EFI_INVALID_PARAMETER; 564 564 } 565 565 566 566 // 567 567 // Judge first 2 bits. … … 666 666 DisplayLoadPermit (); 667 667 break; 668 668 669 669 // 670 670 // Forbid load device path. … … 673 673 DisplayLoadForbid (); 674 674 break; 675 675 676 676 default: 677 677 break; 678 678 } 679 679 break; 680 680 681 681 // 682 682 // Connect device path form. … … 693 693 DisplayConnectPermit (); 694 694 break; 695 695 696 696 // 697 697 // Forbid connect device path. … … 700 700 DisplayConnectForbid (); 701 701 break; 702 702 703 703 default: 704 704 break; … … 837 837 return EFI_SUCCESS; 838 838 } 839 839 840 840 // 841 841 // Initialize driver private data. … … 845 845 846 846 CallbackInfo = AllocateZeroPool (sizeof (USER_PROFILE_MANAGER_CALLBACK_INFO)); 847 ASSERT (CallbackInfo != NULL); 847 ASSERT (CallbackInfo != NULL); 848 848 849 849 CallbackInfo->Signature = USER_PROFILE_MANAGER_SIGNATURE; … … 852 852 CallbackInfo->ConfigAccess.Callback = UserProfileManagerCallback; 853 853 CallbackInfo->DriverHandle = NULL; 854 854 855 855 // 856 856 // Install Device Path Protocol and Config Access protocol to driver handle. … … 876 876 NULL 877 877 ); 878 ASSERT (CallbackInfo->HiiHandle != NULL); 878 ASSERT (CallbackInfo->HiiHandle != NULL); 879 879 mCallbackInfo = CallbackInfo; 880 880 … … 882 882 } 883 883 884 884 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h
r58459 r58466 1 1 /** @file 2 2 The header file for user profile manager driver. 3 3 4 4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 56 56 UINTN AccessPolicyLen; 57 57 UINTN IdentityPolicyLen; 58 UINTN NewIdentityPolicyLen; 58 UINTN NewIdentityPolicyLen; 59 59 UINT8 *AccessPolicy; 60 60 UINT8 *IdentityPolicy; … … 198 198 Add a username item in form. 199 199 200 @param[in] User Points to the user profile whose username is added. 200 @param[in] User Points to the user profile whose username is added. 201 201 @param[in] Index The index of the user in the user name list. 202 202 @param[in] OpCodeHandle Points to container for dynamic created opcodes. … … 217 217 218 218 @param[in] UserIndex The index of the user in display list to modify. 219 219 220 220 **/ 221 221 VOID … … 225 225 226 226 /** 227 Get the username from user input and update username string in Hii 227 Get the username from user input and update username string in Hii 228 228 database with it. 229 229 … … 254 254 /** 255 255 Save the identity policy and update UI with it. 256 257 This funciton will verify the new identity policy, in current implementation, 256 257 This funciton will verify the new identity policy, in current implementation, 258 258 the identity policy can be: T, P & P & P & ..., P | P | P | ... 259 259 Here, "T" means "True", "P" means "Credential Provider", "&" means "and", "|" means "or". 260 Other identity policies are not supported. 260 Other identity policies are not supported. 261 261 262 262 **/ … … 271 271 In this form, access right, access setu,p and access boot order are dynamically 272 272 added. Load devicepath and connect devicepath are displayed too. 273 273 274 274 **/ 275 275 VOID … … 279 279 280 280 /** 281 Collect all the access policy data to mUserInfo.AccessPolicy, 281 Collect all the access policy data to mUserInfo.AccessPolicy, 282 282 and save it to user profile. 283 283 … … 339 339 340 340 /** 341 Delete the specified device path by DriverIndex from the forbid device path 341 Delete the specified device path by DriverIndex from the forbid device path 342 342 list (mAccessInfo.LoadForbid). 343 343 344 344 @param[in] DriverIndex The index of driver in a forbidden device path list. 345 345 346 346 **/ 347 347 VOID … … 349 349 IN UINT16 DriverIndex 350 350 ); 351 352 /** 353 Add the specified device path by DriverIndex to the forbid device path 351 352 /** 353 Add the specified device path by DriverIndex to the forbid device path 354 354 list (mAccessInfo.LoadForbid). 355 355 356 356 @param[in] DriverIndex The index of driver saved in driver options. 357 357 358 358 **/ 359 359 VOID … … 364 364 /** 365 365 Get user name from the popup windows. 366 366 367 367 @param[in, out] UserNameLen On entry, point to the buffer lengh of UserName. 368 368 On exit, point to the input user name length. 369 369 @param[out] UserName The buffer to hold the input user name. 370 370 371 371 @retval EFI_ABORTED It is given up by pressing 'ESC' key. 372 372 @retval EFI_NOT_READY Not a valid input at all. … … 386 386 @param[in] InfoType The user information type to find. 387 387 @param[out] UserInfo Points to user information handle found. 388 388 389 389 @retval EFI_SUCCESS Find the user information successfully. 390 390 @retval Others Fail to find the user information. … … 419 419 @param[in] ValidLen The valid access policy length. 420 420 @param[in] ExpandLen The length that is needed to expand. 421 421 422 422 **/ 423 423 VOID … … 429 429 /** 430 430 Delete User's credental from all the providers that exist in User's identity policy. 431 431 432 432 @param[in] IdentityPolicy Point to User's identity policy. 433 433 @param[in] IdentityPolicyLen The length of the identity policy. … … 439 439 IN UINT8 *IdentityPolicy, 440 440 IN UINTN IdentityPolicyLen, 441 IN EFI_USER_PROFILE_HANDLE User 442 ); 443 441 IN EFI_USER_PROFILE_HANDLE User 442 ); 443 444 444 #endif -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerData.h
r48674 r58466 1 1 /** @file 2 2 The form data for user profile manager driver. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 48 48 49 49 // 50 // First form key (Add/modify/del user profile). 50 // First form key (Add/modify/del user profile). 51 51 // First 2 bits (bit 16~15). 52 52 // … … 78 78 // Specified key, used in VFR (KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_NAME). 79 79 // 80 #define KEY_MODIFY_USER_NAME 0x5200 80 #define KEY_MODIFY_USER_NAME 0x5200 81 81 82 82 // … … 135 135 // Device path modify key. 136 136 // 2 bits (bit 12~11). 137 // 137 // 138 138 #define KEY_LOAD_PERMIT_MODIFY 0x0000 139 139 #define KEY_LOAD_FORBID_MODIFY 0x0400 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerDxe.inf
r58459 r58466 51 51 UefiLib 52 52 DevicePathLib 53 53 54 54 [Guids] 55 55 gEfiIfrTianoGuid ## SOMETIMES_CONSUMES ## GUID … … 67 67 [Depex] 68 68 gEfiUserManagerProtocolGuid 69 69 70 70 [UserExtensions.TianoCore."ExtraFiles"] 71 71 UserProfileManagerExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerVfr.Vfr
-
Property svn:eol-style
set to
native
r58459 r58466 3 3 4 4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 18 18 #define USER_MANAGER_SUBCLASS 0x04 19 19 20 formset 20 formset 21 21 guid = USER_PROFILE_MANAGER_GUID, 22 title = STRING_TOKEN(STR_FORMSET_TITLE), 22 title = STRING_TOKEN(STR_FORMSET_TITLE), 23 23 help = STRING_TOKEN(STR_TITLE_HELP), 24 24 class = USER_MANAGER_CLASS, 25 25 subclass = USER_MANAGER_SUBCLASS, 26 26 27 27 // User manager form 28 28 form formid = FORMID_USER_MANAGE, … … 39 39 key = QUESTIONID_USER_MANAGE; 40 40 endif; 41 42 endform; 43 41 42 endform; 43 44 44 // Modify user profile form 45 45 form formid = FORMID_MODIFY_USER, … … 50 50 51 51 endform; 52 52 53 53 // Delete user profile form 54 54 form formid = FORMID_DEL_USER, 55 55 title = STRING_TOKEN(STR_DELETE_USER_TITLE); 56 56 57 57 label LABEL_USER_DEL_FUNC; 58 58 label LABEL_END; 59 60 subtitle 61 text = STRING_TOKEN(STR_NULL_STRING); 62 endform; 63 59 60 subtitle 61 text = STRING_TOKEN(STR_NULL_STRING); 62 endform; 63 64 64 // 65 65 // User profile information form … … 68 68 title = STRING_TOKEN(STR_USER_INFO); 69 69 70 text 71 help = STRING_TOKEN(STR_USER_NAME_VAL), 70 text 71 help = STRING_TOKEN(STR_USER_NAME_VAL), 72 72 text = STRING_TOKEN(STR_USER_NAME), 73 73 flags = INTERACTIVE, 74 74 key = KEY_MODIFY_USER_NAME; 75 76 text 77 help = STRING_TOKEN(STR_CREATE_DATE_VAL), 75 76 text 77 help = STRING_TOKEN(STR_CREATE_DATE_VAL), 78 78 text = STRING_TOKEN(STR_CREATE_DATE); 79 80 text 81 help = STRING_TOKEN(STR_USAGE_DATE_VAL), 79 80 text 81 help = STRING_TOKEN(STR_USAGE_DATE_VAL), 82 82 text = STRING_TOKEN(STR_USAGE_DATE); 83 84 text 85 help = STRING_TOKEN(STR_USAGE_COUNT_VAL), 83 84 text 85 help = STRING_TOKEN(STR_USAGE_COUNT_VAL), 86 86 text = STRING_TOKEN(STR_USAGE_COUNT); 87 88 label LABEL_USER_INFO_FUNC; 89 label LABEL_END; 90 91 endform; 92 87 88 label LABEL_USER_INFO_FUNC; 89 label LABEL_END; 90 91 endform; 92 93 93 // 94 94 // Identify policy modify form … … 97 97 title = STRING_TOKEN(STR_IDENTIFY_POLICY); 98 98 99 text 99 text 100 100 help = STRING_TOKEN(STR_IDENTIFY_POLICY_HELP), 101 101 text = STRING_TOKEN(STR_IDENTIFY_POLICY), 102 102 text = STRING_TOKEN(STR_IDENTIFY_POLICY_VALUE); 103 103 104 104 label LABEL_IP_MOD_FUNC; 105 105 label LABEL_END; 106 107 text 108 help = STRING_TOKEN(STR_ADD_OPTION_HELP), 106 107 text 108 help = STRING_TOKEN(STR_ADD_OPTION_HELP), 109 109 text = STRING_TOKEN(STR_ADD_OPTION), 110 110 flags = INTERACTIVE, 111 111 key = KEY_ADD_LOGICAL_OP; 112 113 subtitle 112 113 subtitle 114 114 text = STRING_TOKEN(STR_NULL_STRING); 115 115 … … 121 121 122 122 endform; 123 123 124 124 // 125 125 // Access policy modify form … … 143 143 key = KEY_CONN_DP; 144 144 145 subtitle 146 text = STRING_TOKEN(STR_NULL_STRING); 147 145 subtitle 146 text = STRING_TOKEN(STR_NULL_STRING); 147 148 148 text 149 149 help = STRING_TOKEN(STR_ACCESS_SAVE_HELP), … … 165 165 flags = INTERACTIVE, 166 166 key = KEY_LOAD_PERMIT; 167 167 168 168 goto FORMID_FORBID_LOAD_DP, 169 169 prompt = STRING_TOKEN(STR_LOAD_FORBID), … … 171 171 flags = INTERACTIVE, 172 172 key = KEY_LOAD_FORBID; 173 174 endform; 175 173 174 endform; 175 176 176 // 177 177 // Permit load device path form … … 179 179 form formid = FORMID_PERMIT_LOAD_DP, 180 180 title = STRING_TOKEN(STR_LOAD_PERMIT); 181 181 182 182 label LABEL_PERMIT_LOAD_FUNC; 183 183 label LABEL_END; 184 185 subtitle 186 text = STRING_TOKEN(STR_NULL_STRING); 187 188 endform; 189 184 185 subtitle 186 text = STRING_TOKEN(STR_NULL_STRING); 187 188 endform; 189 190 190 // 191 191 // Forbid load device path form … … 193 193 form formid = FORMID_FORBID_LOAD_DP, 194 194 title = STRING_TOKEN(STR_LOAD_FORBID); 195 195 196 196 label LABLE_FORBID_LOAD_FUNC; 197 197 label LABEL_END; 198 199 subtitle 200 text = STRING_TOKEN(STR_NULL_STRING); 201 202 endform; 203 198 199 subtitle 200 text = STRING_TOKEN(STR_NULL_STRING); 201 202 endform; 203 204 204 // 205 205 // Connect device path form … … 213 213 flags = INTERACTIVE, 214 214 key = KEY_CONNECT_PERMIT; 215 215 216 216 goto FORMID_FORBID_CONNECT_DP, 217 217 prompt = STRING_TOKEN(STR_CONNECT_FORBID), … … 219 219 flags = INTERACTIVE, 220 220 key = KEY_CONNECT_FORBID; 221 222 endform; 223 221 222 endform; 223 224 224 // 225 225 // Permit connect device path form … … 227 227 form formid = FORMID_PERMIT_CONNECT_DP, 228 228 title = STRING_TOKEN(STR_CONNECT_PERMIT); 229 230 subtitle 231 text = STRING_TOKEN(STR_NULL_STRING); 232 233 endform; 234 229 230 subtitle 231 text = STRING_TOKEN(STR_NULL_STRING); 232 233 endform; 234 235 235 // 236 236 // Forbid connect device path form … … 238 238 form formid = FORMID_FORBID_CONNECT_DP, 239 239 title = STRING_TOKEN(STR_CONNECT_FORBID); 240 241 subtitle 240 241 subtitle 242 242 text = STRING_TOKEN(STR_NULL_STRING); 243 243 244 244 endform; 245 245 246 246 endformset; -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
r48674 r58466 1 1 /** @file 2 2 The functions to modify a user profile. 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 128 128 mUserInfo.UsageDateExist = FALSE; 129 129 mUserInfo.UsageCount = 0; 130 130 131 131 mUserInfo.AccessPolicyLen = 0; 132 132 mUserInfo.AccessPolicyModified = FALSE; … … 141 141 mUserInfo.IdentityPolicy = NULL; 142 142 } 143 143 144 144 // 145 145 // Allocate user information memory. … … 150 150 return ; 151 151 } 152 152 153 153 // 154 154 // Get each user information. … … 165 165 InfoSize = MemSize; 166 166 Status = mUserManager->GetInfo ( 167 mUserManager, 168 mModifyUser, 169 UserInfo, 170 Info, 167 mUserManager, 168 mModifyUser, 169 UserInfo, 170 Info, 171 171 &InfoSize 172 172 ); … … 282 282 Str + StrLen (Str), 283 283 DateBufLen, 284 L"%2d:%2d:%2d", 284 L"%2d:%2d:%2d", 285 285 Date->Hour, 286 286 Date->Minute, 287 287 Date->Second 288 288 ); 289 289 290 290 HiiSetString (mCallbackInfo->HiiHandle, DateId, Str, NULL); 291 291 FreePool (Str); … … 309 309 CHAR16 Count[10]; 310 310 311 UnicodeSPrint (Count, 20, L"%d", CountVal); 311 UnicodeSPrint (Count, 20, L"%d", CountVal); 312 312 HiiSetString (mCallbackInfo->HiiHandle, CountId, Count, NULL); 313 313 } … … 319 319 320 320 @param[in, out] Source1 On entry, point to a Null-terminated Unicode string. 321 On exit, point to a new concatenated Unicode string 321 On exit, point to a new concatenated Unicode string 322 322 @param[in] Source2 Pointer to a Null-terminated Unicode string. 323 323 … … 381 381 EFI_HII_HANDLE HiiHandle; 382 382 EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential; 383 383 384 384 TmpStr = NULL; 385 385 386 386 // 387 387 // Resolve each policy. … … 414 414 for (Index = 0; Index < mProviderInfo->Count; Index++) { 415 415 UserCredential = mProviderInfo->Provider[Index]; 416 if (CompareGuid ((EFI_GUID *) (Identity + 1), &UserCredential->Type)) { 417 UserCredential->Title ( 418 UserCredential, 419 &HiiHandle, 420 &ProvId 421 ); 422 ProvStr = HiiGetString (HiiHandle, ProvId, NULL); 423 if (ProvStr != NULL) { 424 AddStr (&TmpStr, ProvStr); 425 FreePool (ProvStr); 426 } 427 break; 428 } 429 } 430 break; 431 432 case EFI_USER_INFO_IDENTITY_CREDENTIAL_PROVIDER: 433 for (Index = 0; Index < mProviderInfo->Count; Index++) { 434 UserCredential = mProviderInfo->Provider[Index]; 435 if (CompareGuid ((EFI_GUID *) (Identity + 1), &UserCredential->Identifier)) { 416 if (CompareGuid ((EFI_GUID *) (Identity + 1), &UserCredential->Type)) { 436 417 UserCredential->Title ( 437 418 UserCredential, … … 448 429 } 449 430 break; 431 432 case EFI_USER_INFO_IDENTITY_CREDENTIAL_PROVIDER: 433 for (Index = 0; Index < mProviderInfo->Count; Index++) { 434 UserCredential = mProviderInfo->Provider[Index]; 435 if (CompareGuid ((EFI_GUID *) (Identity + 1), &UserCredential->Identifier)) { 436 UserCredential->Title ( 437 UserCredential, 438 &HiiHandle, 439 &ProvId 440 ); 441 ProvStr = HiiGetString (HiiHandle, ProvId, NULL); 442 if (ProvStr != NULL) { 443 AddStr (&TmpStr, ProvStr); 444 FreePool (ProvStr); 445 } 446 break; 447 } 448 } 449 break; 450 450 } 451 451 … … 467 467 468 468 @param[in] UserIndex The index of the user in display list to modify. 469 469 470 470 **/ 471 471 VOID … … 528 528 UserIndex--; 529 529 } 530 530 531 531 // 532 532 // Get user profile information. … … 542 542 NULL 543 543 ); 544 544 545 545 // 546 546 // Update create date. … … 556 556 ); 557 557 } 558 558 559 559 // 560 560 // Add usage date. … … 570 570 ); 571 571 } 572 572 573 573 // 574 574 // Add usage count. 575 575 // 576 576 ResolveCount ((UINT32) mUserInfo.UsageCount, STRING_TOKEN (STR_USAGE_COUNT_VAL)); 577 577 578 578 // 579 579 // Add identity policy. … … 595 595 ); 596 596 } 597 597 598 598 // 599 599 // Add access policy. … … 644 644 645 645 // 646 // Set default value 646 // Set default value 647 647 // 648 648 mAccessInfo.AccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF; … … 654 654 mAccessInfo.ConnectPermitLen = 0; 655 655 mAccessInfo.ConnectForbidLen = 0; 656 656 657 657 // 658 658 // Get each user access policy. … … 660 660 OffSet = 0; 661 661 while (OffSet < mUserInfo.AccessPolicyLen) { 662 CopyMem (&Control, mUserInfo.AccessPolicy + OffSet, sizeof (Control)); 662 CopyMem (&Control, mUserInfo.AccessPolicy + OffSet, sizeof (Control)); 663 663 ValLen = Control.Size - sizeof (Control); 664 664 switch (Control.Type) { … … 755 755 @param[in] InfoType The user information type to find. 756 756 @param[out] UserInfo Points to user information handle found. 757 757 758 758 @retval EFI_SUCCESS Find the user information successfully. 759 759 @retval Others Fail to find the user information. … … 785 785 return EFI_OUT_OF_RESOURCES; 786 786 } 787 787 788 788 // 789 789 // Get each user information. … … 837 837 In this form, access right, access setup and access boot order are dynamically 838 838 added. Load devicepath and connect devicepath are displayed too. 839 839 840 840 **/ 841 841 VOID … … 850 850 EFI_IFR_GUID_LABEL *EndLabel; 851 851 VOID *DefaultOpCodeHandle; 852 852 853 853 // 854 854 // Initialize the container for dynamic opcodes. … … 894 894 DefaultOpCodeHandle = HiiAllocateOpCodeHandle (); 895 895 ASSERT (DefaultOpCodeHandle != NULL); 896 896 897 897 HiiCreateOneOfOptionOpCode ( 898 898 OptionsOpCodeHandle, … … 920 920 921 921 HiiCreateDefaultOpCode ( 922 DefaultOpCodeHandle, 923 EFI_HII_DEFAULT_CLASS_STANDARD, 924 EFI_IFR_NUMERIC_SIZE_1, 922 DefaultOpCodeHandle, 923 EFI_HII_DEFAULT_CLASS_STANDARD, 924 EFI_IFR_NUMERIC_SIZE_1, 925 925 mAccessInfo.AccessRight 926 926 ); 927 927 928 928 HiiCreateOneOfOpCode ( 929 929 StartOpCodeHandle, // Container for dynamic created opcodes … … 949 949 DefaultOpCodeHandle = HiiAllocateOpCodeHandle (); 950 950 ASSERT (DefaultOpCodeHandle != NULL); 951 951 952 952 HiiCreateOneOfOptionOpCode ( 953 953 OptionsOpCodeHandle, … … 957 957 ACCESS_SETUP_RESTRICTED 958 958 ); 959 959 960 960 HiiCreateOneOfOptionOpCode ( 961 961 OptionsOpCodeHandle, … … 975 975 976 976 HiiCreateDefaultOpCode ( 977 DefaultOpCodeHandle, 978 EFI_HII_DEFAULT_CLASS_STANDARD, 979 EFI_IFR_NUMERIC_SIZE_1, 977 DefaultOpCodeHandle, 978 EFI_HII_DEFAULT_CLASS_STANDARD, 979 EFI_IFR_NUMERIC_SIZE_1, 980 980 mAccessInfo.AccessSetup 981 ); 981 ); 982 982 983 983 HiiCreateOneOfOpCode ( … … 995 995 HiiFreeOpCodeHandle (DefaultOpCodeHandle); 996 996 HiiFreeOpCodeHandle (OptionsOpCodeHandle); 997 997 998 998 // 999 999 // Add boot order one-of-code. … … 1003 1003 DefaultOpCodeHandle = HiiAllocateOpCodeHandle (); 1004 1004 ASSERT (DefaultOpCodeHandle != NULL); 1005 1005 1006 1006 HiiCreateOneOfOptionOpCode ( 1007 1007 OptionsOpCodeHandle, … … 1027 1027 EFI_USER_INFO_ACCESS_BOOT_ORDER_REPLACE 1028 1028 ); 1029 1029 1030 1030 HiiCreateOneOfOptionOpCode ( 1031 1031 OptionsOpCodeHandle, … … 1037 1037 1038 1038 HiiCreateDefaultOpCode ( 1039 DefaultOpCodeHandle, 1040 EFI_HII_DEFAULT_CLASS_STANDARD, 1041 EFI_IFR_NUMERIC_SIZE_4, 1039 DefaultOpCodeHandle, 1040 EFI_HII_DEFAULT_CLASS_STANDARD, 1041 EFI_IFR_NUMERIC_SIZE_4, 1042 1042 mAccessInfo.AccessBootOrder 1043 1043 ); 1044 1044 1045 1045 HiiCreateOneOfOpCode ( 1046 1046 StartOpCodeHandle, // Container for dynamic created opcodes … … 1055 1055 DefaultOpCodeHandle // Default Opcode 1056 1056 ); 1057 HiiFreeOpCodeHandle (DefaultOpCodeHandle); 1057 HiiFreeOpCodeHandle (DefaultOpCodeHandle); 1058 1058 HiiFreeOpCodeHandle (OptionsOpCodeHandle); 1059 1059 … … 1079 1079 @param[in] ValidLen The valid access policy length. 1080 1080 @param[in] ExpandLen The length that is needed to expand. 1081 1081 1082 1082 **/ 1083 1083 VOID … … 1108 1108 1109 1109 /** 1110 Get the username from user input, and update username string in the Hii 1110 Get the username from user input, and update username string in the Hii 1111 1111 database with it. 1112 1112 … … 1143 1143 return ; 1144 1144 } 1145 1145 1146 1146 // 1147 1147 // Check whether the username had been used or not. … … 1179 1179 return ; 1180 1180 } 1181 1181 1182 1182 // 1183 1183 // Update username display in the form. … … 1185 1185 CopyMem (mUserInfo.UserName, UserName, Len); 1186 1186 HiiSetString ( 1187 mCallbackInfo->HiiHandle, 1188 STRING_TOKEN (STR_USER_NAME_VAL), 1189 mUserInfo.UserName, 1187 mCallbackInfo->HiiHandle, 1188 STRING_TOKEN (STR_USER_NAME_VAL), 1189 mUserInfo.UserName, 1190 1190 NULL 1191 1191 ); … … 1304 1304 HiiFreeOpCodeHandle (OptionsOpCodeHandle); 1305 1305 } 1306 1306 1307 1307 // 1308 1308 // Add logical connector Option OpCode. … … 1346 1346 // 1347 1347 ResolveIdentityPolicy ( 1348 mUserInfo.IdentityPolicy, 1349 mUserInfo.IdentityPolicyLen, 1348 mUserInfo.IdentityPolicy, 1349 mUserInfo.IdentityPolicyLen, 1350 1350 STRING_TOKEN (STR_IDENTIFY_POLICY_VALUE) 1351 1351 ); … … 1405 1405 return EFI_OUT_OF_RESOURCES; 1406 1406 } 1407 1407 1408 1408 // 1409 1409 // Get user access information. … … 1446 1446 break; 1447 1447 } 1448 1448 1449 1449 // 1450 1450 // Check user information. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/AuthService.c
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 62 62 ASSERT (mVariableModuleGlobal->HashContext[Physical] != NULL); 63 63 // 64 // Check "AuthVarKeyDatabase" variable's existence. 65 // If it doesn't exist, create a new one with initial value of 0 and EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 64 // Check "AuthVarKeyDatabase" variable's existence. 65 // If it doesn't exist, create a new one with initial value of 0 and EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 66 66 // 67 67 Status = FindVariable ( 68 mVariableModuleGlobal->VariableName[Physical][VAR_AUTH_KEY_DB], 69 &gEfiAuthenticatedVariableGuid, 70 &Variable, 68 mVariableModuleGlobal->VariableName[Physical][VAR_AUTH_KEY_DB], 69 &gEfiAuthenticatedVariableGuid, 70 &Variable, 71 71 &mVariableModuleGlobal->VariableGlobal[Physical], 72 72 mVariableModuleGlobal->FvbInstance … … 97 97 // 98 98 Valid = IsValidVariableHeader ( 99 Variable.CurrPtr, 100 Variable.Volatile, 101 &mVariableModuleGlobal->VariableGlobal[Physical], 102 mVariableModuleGlobal->FvbInstance, 99 Variable.CurrPtr, 100 Variable.Volatile, 101 &mVariableModuleGlobal->VariableGlobal[Physical], 102 mVariableModuleGlobal->FvbInstance, 103 103 &VariableHeader 104 104 ); … … 118 118 } 119 119 // 120 // Check "SetupMode" variable's existence. 120 // Check "SetupMode" variable's existence. 121 121 // If it doesn't exist, check PK database's existence to determine the value. 122 // Then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 122 // Then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 123 123 // 124 124 Status = FindVariable ( 125 mVariableModuleGlobal->VariableName[Physical][VAR_SETUP_MODE], 126 &gEfiGlobalVariableGuid, 127 &Variable, 125 mVariableModuleGlobal->VariableName[Physical][VAR_SETUP_MODE], 126 &gEfiGlobalVariableGuid, 127 &Variable, 128 128 &mVariableModuleGlobal->VariableGlobal[Physical], 129 129 mVariableModuleGlobal->FvbInstance … … 132 132 if (Variable.CurrPtr == 0x0) { 133 133 Status = FindVariable ( 134 mVariableModuleGlobal->VariableName[Physical][VAR_PLATFORM_KEY], 135 &gEfiGlobalVariableGuid, 136 &Variable, 134 mVariableModuleGlobal->VariableName[Physical][VAR_PLATFORM_KEY], 135 &gEfiGlobalVariableGuid, 136 &Variable, 137 137 &mVariableModuleGlobal->VariableGlobal[Physical], 138 138 mVariableModuleGlobal->FvbInstance … … 170 170 } 171 171 // 172 // Check "SignatureSupport" variable's existence. 173 // If it doesn't exist, then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 172 // Check "SignatureSupport" variable's existence. 173 // If it doesn't exist, then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 174 174 // 175 175 Status = FindVariable ( 176 EFI_SIGNATURE_SUPPORT_NAME, 177 &gEfiGlobalVariableGuid, 178 &Variable, 176 EFI_SIGNATURE_SUPPORT_NAME, 177 &gEfiGlobalVariableGuid, 178 &Variable, 179 179 &mVariableModuleGlobal->VariableGlobal[Physical], 180 180 mVariableModuleGlobal->FvbInstance … … 365 365 Rsa = RsaNew (); 366 366 ASSERT (Rsa != NULL); 367 // 367 // 368 368 // Set RSA Key Components. 369 369 // NOTE: Only N and E are needed to be set as RSA public key for signature verification. … … 381 381 // 382 382 Status = RsaPkcs1Verify ( 383 Rsa, 384 Digest, 385 SHA256_DIGEST_SIZE, 386 CertBlock->Signature, 383 Rsa, 384 Digest, 385 SHA256_DIGEST_SIZE, 386 CertBlock->Signature, 387 387 EFI_CERT_TYPE_RSA2048_SHA256_SIZE 388 388 ); … … 420 420 421 421 Status = FindVariable ( 422 Global->VariableName[VirtualMode][VAR_SETUP_MODE], 423 Global->GlobalVariableGuid[VirtualMode], 424 &Variable, 422 Global->VariableName[VirtualMode][VAR_SETUP_MODE], 423 Global->GlobalVariableGuid[VirtualMode], 424 &Variable, 425 425 &Global->VariableGlobal[VirtualMode], 426 426 Global->FvbInstance … … 460 460 461 461 @retval EFI_INVALID_PARAMETER Invalid parameter. 462 @retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation 463 check carried out by the firmware. 462 @retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation 463 check carried out by the firmware. 464 464 @retval EFI_SUCCESS The variable passed validation successfully. 465 465 … … 508 508 if (Variable->CurrPtr != 0x0) { 509 509 Valid = IsValidVariableHeader ( 510 Variable->CurrPtr, 511 Variable->Volatile, 512 &Global->VariableGlobal[VirtualMode], 513 Global->FvbInstance, 510 Variable->CurrPtr, 511 Variable->Volatile, 512 &Global->VariableGlobal[VirtualMode], 513 Global->FvbInstance, 514 514 &VariableHeader 515 515 ); … … 527 527 // 528 528 Status = FindVariable ( 529 Global->VariableName[VirtualMode][VAR_PLATFORM_KEY], 530 Global->GlobalVariableGuid[VirtualMode], 531 &PkVariable, 529 Global->VariableName[VirtualMode][VAR_PLATFORM_KEY], 530 Global->GlobalVariableGuid[VirtualMode], 531 &PkVariable, 532 532 &Global->VariableGlobal[VirtualMode], 533 533 Global->FvbInstance … … 549 549 if (!EFI_ERROR (Status)) { 550 550 Status = UpdateVariable ( 551 VariableName, 552 VendorGuid, 553 (UINT8*)Data + AUTHINFO_SIZE, 554 DataSize - AUTHINFO_SIZE, 555 Attributes, 556 0, 557 CertData->MonotonicCount, 558 VirtualMode, 551 VariableName, 552 VendorGuid, 553 (UINT8*)Data + AUTHINFO_SIZE, 554 DataSize - AUTHINFO_SIZE, 555 Attributes, 556 0, 557 CertData->MonotonicCount, 558 VirtualMode, 559 559 Global, 560 560 Variable … … 597 597 598 598 @retval EFI_INVALID_PARAMETER Invalid parameter. 599 @retval EFI_SECURITY_VIOLATION The variable did NOT pass the validation 600 check carried out by the firmware. 599 @retval EFI_SECURITY_VIOLATION The variable did NOT pass the validation 600 check carried out by the firmware. 601 601 @retval EFI_SUCCESS The variable passed validation successfully. 602 602 … … 641 641 if (Variable->CurrPtr != 0x0) { 642 642 Valid = IsValidVariableHeader ( 643 Variable->CurrPtr, 644 Variable->Volatile, 645 &Global->VariableGlobal[VirtualMode], 646 Global->FvbInstance, 643 Variable->CurrPtr, 644 Variable->Volatile, 645 &Global->VariableGlobal[VirtualMode], 646 Global->FvbInstance, 647 647 &VariableHeader 648 648 ); … … 660 660 // 661 661 Status = FindVariable ( 662 Global->VariableName[VirtualMode][VAR_KEY_EXCHANGE_KEY], 663 Global->GlobalVariableGuid[VirtualMode], 664 &KekVariable, 662 Global->VariableName[VirtualMode][VAR_KEY_EXCHANGE_KEY], 663 Global->GlobalVariableGuid[VirtualMode], 664 &KekVariable, 665 665 &Global->VariableGlobal[VirtualMode], 666 666 Global->FvbInstance … … 699 699 if (!EFI_ERROR (Status)) { 700 700 Status = UpdateVariable ( 701 VariableName, 702 VendorGuid, 703 (UINT8*)Data + AUTHINFO_SIZE, 704 DataSize - AUTHINFO_SIZE, 705 Attributes, 706 0, 707 CertData->MonotonicCount, 701 VariableName, 702 VendorGuid, 703 (UINT8*)Data + AUTHINFO_SIZE, 704 DataSize - AUTHINFO_SIZE, 705 Attributes, 706 0, 707 CertData->MonotonicCount, 708 708 VirtualMode, 709 709 Global, … … 716 716 // 717 717 Status = UpdateVariable ( 718 VariableName, 719 VendorGuid, 720 Data, 721 DataSize, 722 Attributes, 723 0, 724 0, 718 VariableName, 719 VendorGuid, 720 Data, 721 DataSize, 722 Attributes, 723 0, 724 0, 725 725 VirtualMode, 726 726 Global, … … 749 749 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 750 750 @retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 751 set, but the AuthInfo does NOT pass the validation 752 check carried out by the firmware. 751 set, but the AuthInfo does NOT pass the validation 752 check carried out by the firmware. 753 753 @retval EFI_SUCCESS The variable is not write-protected, or passed validation successfully. 754 754 … … 790 790 if (Variable->CurrPtr != 0x0) { 791 791 Valid = IsValidVariableHeader ( 792 Variable->CurrPtr, 793 Variable->Volatile, 794 &Global->VariableGlobal[VirtualMode], 795 Global->FvbInstance, 792 Variable->CurrPtr, 793 Variable->Volatile, 794 &Global->VariableGlobal[VirtualMode], 795 Global->FvbInstance, 796 796 &VariableHeader 797 797 ); … … 821 821 IsFirstTime = FALSE; 822 822 } 823 } else if (Valid && (VariableHeader.Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) { 823 } else if (Valid && (VariableHeader.Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) { 824 824 // 825 825 // If the variable is already write-protected, it always needs authentication before update. … … 865 865 return EFI_SECURITY_VIOLATION; 866 866 } 867 } 867 } 868 868 // 869 869 // Verify the certificate in Data payload. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/AuthService.h
r48674 r58466 4 4 5 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 47 47 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set. 48 48 @retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 49 set, but the AuthInfo does NOT pass the validation 50 check carried out by the firmware. 49 set, but the AuthInfo does NOT pass the validation 50 check carried out by the firmware. 51 51 @retval EFI_SUCCESS The variable is not write-protected, or passed validation successfully. 52 52 … … 100 100 101 101 @retval EFI_INVALID_PARAMETER Invalid parameter. 102 @retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation 103 check carried out by the firmware. 102 @retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation 103 check carried out by the firmware. 104 104 @retval EFI_SUCCESS The variable passed validation successfully. 105 105 … … 132 132 133 133 @retval EFI_INVALID_PARAMETER Invalid parameter. 134 @retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation 135 check carried out by the firmware. 134 @retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation 135 check carried out by the firmware. 136 136 @retval EFI_SUCCESS The variable passed validation successfully. 137 137 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/EsalVariableDxeSal.inf
r58459 r58466 30 30 # VALID_ARCHITECTURES = IPF 31 31 # 32 # VIRTUAL_ADDRESS_MAP_CALLBACK = VariableClassAddressChangeEvent 32 # VIRTUAL_ADDRESS_MAP_CALLBACK = VariableClassAddressChangeEvent 33 33 # 34 34 … … 74 74 ## PRODUCES ## Variable:L"SignatureSupport" 75 75 gEfiGlobalVariableGuid 76 76 77 77 ## PRODUCES ## GUID # Variable store header 78 78 ## CONSUMES ## GUID # Variable store header … … 80 80 ## SOMETIMES_PRODUCES ## SystemTable 81 81 gEfiAuthenticatedVariableGuid 82 82 83 83 gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event 84 84 gEfiCertRsa2048Sha256Guid ## CONSUMES ## GUID # Unique ID for the format of the CertType. … … 95 95 gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize ## CONSUMES 96 96 gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize ## CONSUMES 97 97 98 98 [FeaturePcd.common] 99 99 gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics ## CONSUMES # statistic the information of variable. 100 100 101 101 [Depex] 102 gEfiExtendedSalFvBlockServicesProtocolGuid AND gEfiFaultTolerantWriteProtocolGuid 102 gEfiExtendedSalFvBlockServicesProtocolGuid AND gEfiFaultTolerantWriteProtocolGuid 103 103 104 104 [UserExtensions.TianoCore."ExtraFiles"] -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/InitVariable.c
r48674 r58466 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 56 56 { 57 57 SAL_RETURN_REGS ReturnVal; 58 58 59 59 ReturnVal.r9 = 0; 60 60 ReturnVal.r10 = 0; -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Reclaim.c
r48674 r58466 4 4 5 5 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.c
r58459 r58466 3 3 4 4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 163 163 return EFI_INVALID_PARAMETER; 164 164 } 165 165 166 166 // 167 167 // For volatile variable, a simple memory copy is enough. … … 182 182 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO, 183 183 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI, 184 GetPhysicalAddressFunctionId, 185 Instance, 186 (UINT64) &FvVolHdr, 187 0, 188 0, 189 0, 190 0, 184 GetPhysicalAddressFunctionId, 185 Instance, 186 (UINT64) &FvVolHdr, 187 0, 188 0, 189 0, 190 0, 191 191 0 192 192 ).Status; … … 200 200 return EFI_INVALID_PARAMETER; 201 201 } 202 202 203 203 LinearOffset = (UINTN) FwVolHeader; 204 204 CurrWritePtr = StartAddress; … … 228 228 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO, 229 229 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI, 230 WriteFunctionId, 231 Instance, 232 LbaNumber, 233 (CurrWritePtr - LinearOffset), 234 (UINT64) &CurrWriteSize, 235 (UINT64) CurrBuffer, 236 0, 230 WriteFunctionId, 231 Instance, 232 LbaNumber, 233 (CurrWritePtr - LinearOffset), 234 (UINT64) &CurrWriteSize, 235 (UINT64) CurrBuffer, 236 0, 237 237 0 238 238 ).Status; … … 241 241 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO, 242 242 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI, 243 ReadFunctionId, 244 Instance, 245 LbaNumber, 246 (CurrWritePtr - LinearOffset), 247 (UINT64) &CurrWriteSize, 248 (UINT64) CurrBuffer, 249 0, 243 ReadFunctionId, 244 Instance, 245 LbaNumber, 246 (CurrWritePtr - LinearOffset), 247 (UINT64) &CurrWriteSize, 248 (UINT64) CurrBuffer, 249 0, 250 250 0 251 251 ).Status; … … 261 261 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO, 262 262 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI, 263 WriteFunctionId, 264 Instance, 265 LbaNumber, 266 (CurrWritePtr - LinearOffset), 267 (UINT64) &Size, 268 (UINT64) CurrBuffer, 269 0, 263 WriteFunctionId, 264 Instance, 265 LbaNumber, 266 (CurrWritePtr - LinearOffset), 267 (UINT64) &Size, 268 (UINT64) CurrBuffer, 269 0, 270 270 0 271 271 ).Status; … … 274 274 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO, 275 275 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI, 276 ReadFunctionId, 277 Instance, 278 LbaNumber, 279 (CurrWritePtr - LinearOffset), 280 (UINT64) &Size, 281 (UINT64) CurrBuffer, 282 0, 276 ReadFunctionId, 277 Instance, 278 LbaNumber, 279 (CurrWritePtr - LinearOffset), 280 (UINT64) &Size, 281 (UINT64) CurrBuffer, 282 0, 283 283 0 284 284 ).Status; … … 333 333 VarStoreAddress, 334 334 sizeof (VARIABLE_STORE_HEADER), 335 VarStoreHeader 335 VarStoreHeader 336 336 ); 337 337 ASSERT_EFI_ERROR (Status); … … 373 373 VariableAddress, 374 374 sizeof (VARIABLE_HEADER), 375 &LocalVariableHeader 375 &LocalVariableHeader 376 376 ); 377 377 … … 521 521 Address, 522 522 VariableHeader.NameSize, 523 VariableName 523 VariableName 524 524 ); 525 525 ASSERT_EFI_ERROR (Status); … … 572 572 Address, 573 573 VariableHeader.DataSize, 574 VariableData 574 VariableData 575 575 ); 576 576 ASSERT_EFI_ERROR (Status); … … 627 627 Gets the pointer to the first variable header in given variable store area. 628 628 629 This function gets the pointer to the first variable header in given variable 629 This function gets the pointer to the first variable header in given variable 630 630 store area. The variable store area is given by its start address. 631 631 … … 676 676 VarStoreHeaderAddress, 677 677 sizeof (VARIABLE_STORE_HEADER), 678 &VariableStoreHeader 678 &VariableStoreHeader 679 679 ); 680 680 … … 686 686 Updates variable info entry in EFI system table for statistical information. 687 687 688 Routine used to track statistical information about variable usage. 688 Routine used to track statistical information about variable usage. 689 689 The data is stored in the EFI system table so it can be accessed later. 690 VariableInfo.efi can dump out the table. Only Boot Services variable 690 VariableInfo.efi can dump out the table. Only Boot Services variable 691 691 accesses are tracked by this code. The PcdVariableCollectStatistics 692 build flag controls if this feature is enabled. 693 A read that hits in the cache will have Read and Cache true for 692 build flag controls if this feature is enabled. 693 A read that hits in the cache will have Read and Cache true for 694 694 the transaction. Data is allocated by this routine, but never 695 695 freed. … … 743 743 } 744 744 745 745 746 746 for (Entry = gVariableInfo; Entry != NULL; Entry = Entry->Next) { 747 747 if (CompareGuid (VendorGuid, &Entry->VendorGuid)) { … … 827 827 for (Index = 0, Entry = mVariableCache; Index < sizeof (mVariableCache)/sizeof (VARIABLE_CACHE_ENTRY); Index++, Entry++) { 828 828 if (CompareGuid (VendorGuid, Entry->Guid)) { 829 if (StrCmp (VariableName, Entry->Name) == 0) { 829 if (StrCmp (VariableName, Entry->Name) == 0) { 830 830 Entry->Attributes = Attributes; 831 831 if (DataSize == 0) { … … 929 929 } 930 930 } 931 931 932 932 return EFI_NOT_FOUND; 933 933 } … … 1004 1004 } 1005 1005 while (IsValidVariableHeader (Variable[Index], Volatile, Global, Instance, &VariableHeader)) { 1006 if (VariableHeader.State == VAR_ADDED || 1006 if (VariableHeader.State == VAR_ADDED || 1007 1007 VariableHeader.State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED) 1008 1008 ) { … … 1163 1163 // Collect VAR_ADDED variables, and variables in delete transition status. 1164 1164 // 1165 if (VariableHeader.State == VAR_ADDED || 1165 if (VariableHeader.State == VAR_ADDED || 1166 1166 VariableHeader.State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED) 1167 1167 ) { … … 1174 1174 1175 1175 // 1176 // Reserve the 1 Bytes with Oxff to identify the 1177 // end of the variable buffer. 1178 // 1176 // Reserve the 1 Bytes with Oxff to identify the 1177 // end of the variable buffer. 1178 // 1179 1179 MaximumBufferSize += 1; 1180 1180 ValidBuffer = AllocatePool (MaximumBufferSize); … … 1193 1193 // 1194 1194 // Reinstall all ADDED variables 1195 // 1195 // 1196 1196 Variable = GetStartPointer (VariableBase); 1197 1197 while (IsValidVariableHeader (Variable, IsVolatile, VariableGlobal, Instance, &VariableHeader)) { … … 1211 1211 // 1212 1212 // Reinstall in delete transition variables 1213 // 1213 // 1214 1214 Variable = GetStartPointer (VariableBase); 1215 1215 while (IsValidVariableHeader (Variable, IsVolatile, VariableGlobal, Instance, &VariableHeader)) { … … 1218 1218 1219 1219 // 1220 // Buffer has cached all ADDED variable. 1220 // Buffer has cached all ADDED variable. 1221 1221 // Per IN_DELETED variable, we have to guarantee that 1222 // no ADDED one in previous buffer. 1223 // 1222 // no ADDED one in previous buffer. 1223 // 1224 1224 FoundAdded = FALSE; 1225 1225 AddedVariable = GetStartPointer ((EFI_PHYSICAL_ADDRESS) ValidBuffer); … … 1328 1328 IN CHAR8 *Lang, 1329 1329 IN BOOLEAN Iso639Language 1330 ) 1330 ) 1331 1331 { 1332 1332 UINTN Index; … … 1363 1363 // 1364 1364 for (CompareLength = 0; SupportedLang[CompareLength] != '\0' && SupportedLang[CompareLength] != ';'; CompareLength++); 1365 1366 if ((CompareLength == LanguageLength) && 1365 1366 if ((CompareLength == LanguageLength) && 1367 1367 (AsciiStrnCmp (Lang, SupportedLang, CompareLength) == 0)) { 1368 1368 // … … 1466 1466 1467 1467 /** 1468 Returns a pointer to an allocated buffer that contains the best matching language 1469 from a set of supported languages. 1470 1471 This function supports both ISO 639-2 and RFC 4646 language codes, but language 1468 Returns a pointer to an allocated buffer that contains the best matching language 1469 from a set of supported languages. 1470 1471 This function supports both ISO 639-2 and RFC 4646 language codes, but language 1472 1472 code types may not be mixed in a single call to this function. This function 1473 1473 supports a variable argument list that allows the caller to pass in a prioritized … … 1477 1477 1478 1478 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that 1479 contains a set of language codes in the format 1479 contains a set of language codes in the format 1480 1480 specified by Iso639Language. 1481 1481 @param[in] Iso639Language If TRUE, then all language codes are assumed to be … … 1483 1483 codes are assumed to be in RFC 4646 language format. 1484 1484 @param[in] VirtualMode Current calling mode for this function. 1485 @param[in] ... A variable argument list that contains pointers to 1485 @param[in] ... A variable argument list that contains pointers to 1486 1486 Null-terminated ASCII strings that contain one or more 1487 1487 language codes in the format specified by Iso639Language. 1488 1488 The first language code from each of these language 1489 1489 code lists is used to determine if it is an exact or 1490 close match to any of the language codes in 1490 close match to any of the language codes in 1491 1491 SupportedLanguages. Close matches only apply to RFC 4646 1492 1492 language codes, and the matching algorithm from RFC 4647 1493 is used to determine if a close match is present. If 1493 is used to determine if a close match is present. If 1494 1494 an exact or close match is found, then the matching 1495 1495 language code from SupportedLanguages is returned. If 1496 1496 no matches are found, then the next variable argument 1497 parameter is evaluated. The variable argument list 1497 parameter is evaluated. The variable argument list 1498 1498 is terminated by a NULL. 1499 1499 1500 1500 @retval NULL The best matching language could not be found in SupportedLanguages. 1501 @retval NULL There are not enough resources available to return the best matching 1501 @retval NULL There are not enough resources available to return the best matching 1502 1502 language. 1503 @retval Other A pointer to a Null-terminated ASCII string that is the best matching 1503 @retval Other A pointer to a Null-terminated ASCII string that is the best matching 1504 1504 language in SupportedLanguages. 1505 1505 … … 1507 1507 CHAR8 * 1508 1508 VariableGetBestLanguage ( 1509 IN CONST CHAR8 *SupportedLanguages, 1509 IN CONST CHAR8 *SupportedLanguages, 1510 1510 IN BOOLEAN Iso639Language, 1511 1511 IN BOOLEAN VirtualMode, … … 1583 1583 } else { 1584 1584 // 1585 // If RFC 4646 mode, then trim Language from the right to the next '-' character 1585 // If RFC 4646 mode, then trim Language from the right to the next '-' character 1586 1586 // 1587 1587 for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--); … … 1592 1592 1593 1593 // 1594 // No matches were found 1594 // No matches were found 1595 1595 // 1596 1596 return NULL; … … 1665 1665 1666 1666 // 1667 // PlatformLang holds a single language from PlatformLangCodes, 1667 // PlatformLang holds a single language from PlatformLangCodes, 1668 1668 // so the size of PlatformLangCodes is enough for the PlatformLang. 1669 1669 // … … 1695 1695 } 1696 1696 1697 if (SetLanguageCodes 1697 if (SetLanguageCodes 1698 1698 && (Global->PlatformLangCodes[VirtualMode] != NULL) 1699 1699 && (Global->LangCodes[VirtualMode] != NULL)) { … … 1733 1733 sizeof (DataSize), 1734 1734 &DataSize 1735 ); 1735 ); 1736 1736 ASSERT_EFI_ERROR (Status); 1737 1737 } … … 1812 1812 1813 1813 Status = UpdateVariable ( 1814 PredefinedVariableName[VAR_PLATFORM_LANG], 1815 Global->GlobalVariableGuid[VirtualMode], 1816 BestPlatformLang, 1817 AsciiStrSize (BestPlatformLang), 1818 Attributes, 1814 PredefinedVariableName[VAR_PLATFORM_LANG], 1815 Global->GlobalVariableGuid[VirtualMode], 1816 BestPlatformLang, 1817 AsciiStrSize (BestPlatformLang), 1818 Attributes, 1819 1819 0, 1820 1820 0, 1821 VirtualMode, 1822 Global, 1821 VirtualMode, 1822 Global, 1823 1823 &Variable 1824 1824 ); … … 1832 1832 1833 1833 /** 1834 Update the variable region with Variable information. These are the same 1834 Update the variable region with Variable information. These are the same 1835 1835 arguments as the EFI Variable services. 1836 1836 … … 1841 1841 @param[in] Attributes Attributes of the variable. 1842 1842 @param[in] KeyIndex Index of associated public key. 1843 @param[in] MonotonicCount Value of associated monotonic count. 1843 @param[in] MonotonicCount Value of associated monotonic count. 1844 1844 @param[in] VirtualMode Current calling mode for this function. 1845 1845 @param[in] Global Context of this Extended SAL Variable Services Class call. … … 1857 1857 IN VOID *Data, 1858 1858 IN UINTN DataSize, 1859 IN UINT32 Attributes OPTIONAL, 1859 IN UINT32 Attributes OPTIONAL, 1860 1860 IN UINT32 KeyIndex OPTIONAL, 1861 1861 IN UINT64 MonotonicCount OPTIONAL, … … 1899 1899 // 1900 1900 Volatile = Variable->Volatile; 1901 1902 if (EfiAtRuntime ()) { 1903 // 1904 // If EfiAtRuntime and the variable is Volatile and Runtime Access, 1905 // the volatile is ReadOnly, and SetVariable should be aborted and 1901 1902 if (EfiAtRuntime ()) { 1903 // 1904 // If EfiAtRuntime and the variable is Volatile and Runtime Access, 1905 // the volatile is ReadOnly, and SetVariable should be aborted and 1906 1906 // return EFI_WRITE_PROTECTED. 1907 1907 // … … 1915 1915 if ((VariableHeader.Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) { 1916 1916 Status = EFI_INVALID_PARAMETER; 1917 goto Done; 1917 goto Done; 1918 1918 } 1919 1919 } … … 1922 1922 // specified causes it to be deleted. 1923 1923 // 1924 if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) { 1924 if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) { 1925 1925 State = VariableHeader.State; 1926 1926 State &= VAR_DELETED; … … 1934 1934 sizeof (UINT8), 1935 1935 &State 1936 ); 1936 ); 1937 1937 if (!EFI_ERROR (Status)) { 1938 1938 UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, FALSE, TRUE, FALSE); 1939 1939 UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data); 1940 1940 } 1941 goto Done; 1941 goto Done; 1942 1942 } 1943 1943 // … … 1972 1972 sizeof (UINT8), 1973 1973 &State 1974 ); 1974 ); 1975 1975 if (EFI_ERROR (Status)) { 1976 goto Done; 1977 } 1978 } 1976 goto Done; 1977 } 1978 } 1979 1979 } else { 1980 1980 // 1981 1981 // Create a new variable 1982 // 1983 1982 // 1983 1984 1984 // 1985 1985 // Make sure we are trying to create a new variable. 1986 // Setting a data variable with no access, or zero DataSize attributes means to delete it. 1986 // Setting a data variable with no access, or zero DataSize attributes means to delete it. 1987 1987 // 1988 1988 if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) { … … 1990 1990 goto Done; 1991 1991 } 1992 1992 1993 1993 // 1994 1994 // Only variable have NV|RT attribute can be created in Runtime … … 1998 1998 Status = EFI_INVALID_PARAMETER; 1999 1999 goto Done; 2000 } 2000 } 2001 2001 } 2002 2002 … … 2051 2051 // 2052 2052 Volatile = FALSE; 2053 2053 2054 2054 GetVarStoreHeader (VariableGlobal->NonVolatileVariableBase, FALSE, VariableGlobal, Instance, &VariableStoreHeader); 2055 if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) 2055 if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) 2056 2056 && ((HEADER_ALIGN (VarSize) + Global->HwErrVariableTotalSize) > PcdGet32(PcdHwErrStorageSize))) 2057 || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0) 2057 || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0) 2058 2058 && ((HEADER_ALIGN (VarSize) + Global->CommonVariableTotalSize) > VariableStoreHeader.Size - sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize)))) { 2059 2059 if (EfiAtRuntime ()) { … … 2073 2073 // If still no enough space, return out of resources 2074 2074 // 2075 if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) 2075 if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) 2076 2076 && ((HEADER_ALIGN (VarSize) + Global->HwErrVariableTotalSize) > PcdGet32(PcdHwErrStorageSize))) 2077 || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0) 2077 || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0) 2078 2078 && ((HEADER_ALIGN (VarSize) + Global->CommonVariableTotalSize) > VariableStoreHeader.Size - sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize)))) { 2079 2079 Status = EFI_OUT_OF_RESOURCES; … … 2084 2084 // Four steps 2085 2085 // 1. Write variable header 2086 // 2. Set variable state to header valid 2086 // 2. Set variable state to header valid 2087 2087 // 3. Write variable data 2088 2088 // 4. Set variable state to valid … … 2166 2166 // 2167 2167 // Create a volatile variable 2168 // 2168 // 2169 2169 Volatile = TRUE; 2170 2170 … … 2241 2241 This function implements EsalGetVariable function of Extended SAL Variable Services Class. 2242 2242 It is equivalent in functionality to the EFI Runtime Service GetVariable(). 2243 2243 2244 2244 @param[in] VariableName A Null-terminated Unicode string that is the name of 2245 2245 the vendor's variable. 2246 2246 @param[in] VendorGuid A unique identifier for the vendor. 2247 @param[out] Attributes If not NULL, a pointer to the memory location to return the 2247 @param[out] Attributes If not NULL, a pointer to the memory location to return the 2248 2248 attributes bitmask for the variable. 2249 2249 @param[in, out] DataSize Size of Data found. If size is less than the 2250 2250 data, this value contains the required size. 2251 @param[out] Data On input, the size in bytes of the return Data buffer. 2251 @param[out] Data On input, the size in bytes of the return Data buffer. 2252 2252 On output, the size of data returned in Data. 2253 2253 @param[in] VirtualMode Current calling mode for this function. 2254 2254 @param[in] Global Context of this Extended SAL Variable Services Class call. 2255 2255 2256 @retval EFI_SUCCESS The function completed successfully. 2256 @retval EFI_SUCCESS The function completed successfully. 2257 2257 @retval EFI_NOT_FOUND The variable was not found. 2258 @retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has 2258 @retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has 2259 2259 been updated with the size needed to complete the request. 2260 2260 @retval EFI_INVALID_PARAMETER VariableName is NULL. … … 2350 2350 UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, TRUE, FALSE, FALSE, FALSE); 2351 2351 UpdateVariableCache (VariableName, VendorGuid, VariableHeader.Attributes, VarDataSize, Data); 2352 2352 2353 2353 Status = EFI_SUCCESS; 2354 2354 goto Done; … … 2372 2372 This function implements EsalGetNextVariableName function of Extended SAL Variable Services Class. 2373 2373 It is equivalent in functionality to the EFI Runtime Service GetNextVariableName(). 2374 2374 2375 2375 @param[in, out] VariableNameSize Size of the variable 2376 2376 @param[in, out] VariableName On input, supplies the last VariableName that was returned by GetNextVariableName(). 2377 2377 On output, returns the Null-terminated Unicode string of the current variable. 2378 2378 @param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by GetNextVariableName(). 2379 On output, returns the VendorGuid of the current variable. 2379 On output, returns the VendorGuid of the current variable. 2380 2380 @param[in] VirtualMode Current calling mode for this function. 2381 2381 @param[in] Global Context of this Extended SAL Variable Services Class call. 2382 2382 2383 @retval EFI_SUCCESS The function completed successfully. 2383 @retval EFI_SUCCESS The function completed successfully. 2384 2384 @retval EFI_NOT_FOUND The next variable was not found. 2385 @retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result. 2385 @retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result. 2386 2386 VariableNameSize has been updated with the size needed to complete the request. 2387 2387 @retval EFI_INVALID_PARAMETER VariableNameSize is NULL. … … 2513 2513 This function implements EsalSetVariable function of Extended SAL Variable Services Class. 2514 2514 It is equivalent in functionality to the EFI Runtime Service SetVariable(). 2515 2515 2516 2516 @param[in] VariableName A Null-terminated Unicode string that is the name of the vendor's 2517 variable. Each VariableName is unique for each 2518 VendorGuid. VariableName must contain 1 or more 2519 Unicode characters. If VariableName is an empty Unicode 2517 variable. Each VariableName is unique for each 2518 VendorGuid. VariableName must contain 1 or more 2519 Unicode characters. If VariableName is an empty Unicode 2520 2520 string, then EFI_INVALID_PARAMETER is returned. 2521 2521 @param[in] VendorGuid A unique identifier for the vendor. … … 2527 2527 @param[in] Global Context of this Extended SAL Variable Services Class call. 2528 2528 2529 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 2529 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 2530 2530 defined by the Attributes. 2531 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the 2531 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the 2532 2532 DataSize exceeds the maximum allowed. 2533 2533 @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string. … … 2567 2567 if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) { 2568 2568 return EFI_INVALID_PARAMETER; 2569 } 2569 } 2570 2570 2571 2571 if (DataSize != 0 && Data == NULL) { … … 2586 2586 // 2587 2587 return EFI_SECURITY_VIOLATION; 2588 } 2589 PayloadSize = DataSize - AUTHINFO_SIZE; 2588 } 2589 PayloadSize = DataSize - AUTHINFO_SIZE; 2590 2590 } else { 2591 PayloadSize = DataSize; 2592 } 2593 2594 2591 PayloadSize = DataSize; 2592 } 2593 2594 2595 2595 if ((UINTN)(~0) - PayloadSize < StrSize(VariableName)){ 2596 2596 // 2597 // Prevent whole variable size overflow 2598 // 2597 // Prevent whole variable size overflow 2598 // 2599 2599 return EFI_INVALID_PARAMETER; 2600 2600 } … … 2626 2626 if (StrSize (VariableName) + PayloadSize > PcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER)) { 2627 2627 return EFI_INVALID_PARAMETER; 2628 } 2629 } 2628 } 2629 } 2630 2630 2631 2631 AcquireLockOnlyAtBootTime(&VariableGlobal->VariableServicesLock); … … 2677 2677 // 2678 2678 Status = UpdateVariable ( 2679 VariableName, 2680 VendorGuid, 2681 (UINT8*)Data + AUTHINFO_SIZE, 2682 DataSize - AUTHINFO_SIZE, 2683 Attributes, 2684 KeyIndex, 2685 MonotonicCount, 2686 VirtualMode, 2687 Global, 2679 VariableName, 2680 VendorGuid, 2681 (UINT8*)Data + AUTHINFO_SIZE, 2682 DataSize - AUTHINFO_SIZE, 2683 Attributes, 2684 KeyIndex, 2685 MonotonicCount, 2686 VirtualMode, 2687 Global, 2688 2688 &Variable 2689 2689 ); 2690 2690 } else { 2691 2691 // 2692 // Update variable as usual 2692 // Update variable as usual 2693 2693 // 2694 2694 Status = UpdateVariable ( 2695 VariableName, 2696 VendorGuid, 2697 Data, 2698 DataSize, 2699 Attributes, 2700 0, 2701 0, 2702 VirtualMode, 2703 Global, 2695 VariableName, 2696 VendorGuid, 2697 Data, 2698 DataSize, 2699 Attributes, 2700 0, 2701 0, 2702 VirtualMode, 2703 Global, 2704 2704 &Variable 2705 2705 ); … … 2721 2721 @param[in] Attributes Attributes bitmask to specify the type of variables 2722 2722 on which to return information. 2723 @param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for 2724 the EFI variables associated with the attributes specified. 2725 @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI 2723 @param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for 2724 the EFI variables associated with the attributes specified. 2725 @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI 2726 2726 variables associated with the attributes specified. 2727 @param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable 2727 @param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable 2728 2728 associated with the attributes specified. 2729 2729 @param[in] VirtualMode Current calling mode for this function … … 2732 2732 @retval EFI_SUCCESS Valid answer returned. 2733 2733 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied. 2734 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the 2735 MaximumVariableStorageSize, RemainingVariableStorageSize, 2734 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the 2735 MaximumVariableStorageSize, RemainingVariableStorageSize, 2736 2736 MaximumVariableSize are undefined. 2737 2737 **/ … … 2765 2765 return EFI_INVALID_PARAMETER; 2766 2766 } 2767 2767 2768 2768 if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) == 0) { 2769 2769 // 2770 2770 // Make sure the Attributes combination is supported by the platform. 2771 2771 // 2772 return EFI_UNSUPPORTED; 2772 return EFI_UNSUPPORTED; 2773 2773 } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) { 2774 2774 // … … 2918 2918 2919 2919 VarSize = ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase))->Size; 2920 Status = EFI_SUCCESS; 2920 Status = EFI_SUCCESS; 2921 2921 // 2922 2922 //Allowable max size of common variable storage space … … 2925 2925 2926 2926 RemainingCommonVariableSpace = CommonVariableSpace - mVariableModuleGlobal->CommonVariableTotalSize; 2927 2927 2928 2928 RemainingHwErrVariableSpace = PcdGet32 (PcdHwErrStorageSize) - mVariableModuleGlobal->HwErrVariableTotalSize; 2929 2929 // … … 2931 2931 // 2932 2932 if ((RemainingCommonVariableSpace < PcdGet32 (PcdMaxVariableSize)) 2933 || ((PcdGet32 (PcdHwErrStorageSize) != 0) && 2933 || ((PcdGet32 (PcdHwErrStorageSize) != 0) && 2934 2934 (RemainingHwErrVariableSpace < PcdGet32 (PcdMaxHardwareErrorVariableSize)))){ 2935 2935 Status = Reclaim ( … … 3057 3057 // Note that in EdkII variable driver implementation, Hardware Error Record type variable 3058 3058 // is stored with common variable in the same NV region. So the platform integrator should 3059 // ensure that the value of PcdHwErrStorageSize is less than or equal to the value of 3059 // ensure that the value of PcdHwErrStorageSize is less than or equal to the value of 3060 3060 // PcdFlashNvStorageVariableSize. 3061 3061 // … … 3134 3134 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO, 3135 3135 EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI, 3136 GetPhysicalAddressFunctionId, 3137 Instance, 3138 (UINT64) &FvVolHdr, 3139 0, 3140 0, 3141 0, 3142 0, 3136 GetPhysicalAddressFunctionId, 3137 Instance, 3138 (UINT64) &FvVolHdr, 3139 0, 3140 0, 3141 0, 3142 0, 3143 3143 0 3144 3144 ).Status; … … 3238 3238 // 3239 3239 Status = EfiCreateEventReadyToBootEx ( 3240 TPL_NOTIFY, 3241 ReclaimForOS, 3242 NULL, 3240 TPL_NOTIFY, 3241 ReclaimForOS, 3242 NULL, 3243 3243 &ReadyToBootEvent 3244 3244 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.h
r48674 r58466 3 3 4 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 64 64 65 65 /// 66 /// The maximum size of the public key database, restricted by maximum individal EFI 66 /// The maximum size of the public key database, restricted by maximum individal EFI 67 67 /// varible size, and excluding the variable header and name size. 68 68 /// … … 192 192 This function implements EsalGetVariable function of Extended SAL Variable Services Class. 193 193 It is equivalent in functionality to the EFI Runtime Service GetVariable(). 194 194 195 195 @param[in] VariableName A Null-terminated Unicode string that is the name of 196 196 the vendor's variable. 197 197 @param[in] VendorGuid A unique identifier for the vendor. 198 @param[out] Attributes If not NULL, a pointer to the memory location to return the 198 @param[out] Attributes If not NULL, a pointer to the memory location to return the 199 199 attributes bitmask for the variable. 200 200 @param[in, out] DataSize Size of Data found. If size is less than the 201 201 data, this value contains the required size. 202 @param[out] Data On input, the size in bytes of the return Data buffer. 202 @param[out] Data On input, the size in bytes of the return Data buffer. 203 203 On output, the size of data returned in Data. 204 204 @param[in] VirtualMode Current calling mode for this function. 205 205 @param[in] Global Context of this Extended SAL Variable Services Class call. 206 206 207 @retval EFI_SUCCESS The function completed successfully. 207 @retval EFI_SUCCESS The function completed successfully. 208 208 @retval EFI_NOT_FOUND The variable was not found. 209 @retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has 209 @retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has 210 210 been updated with the size needed to complete the request. 211 211 @retval EFI_INVALID_PARAMETER VariableName is NULL. … … 234 234 This function implements EsalGetNextVariableName function of Extended SAL Variable Services Class. 235 235 It is equivalent in functionality to the EFI Runtime Service GetNextVariableName(). 236 236 237 237 @param[in, out] VariableNameSize Size of the variable 238 238 @param[in, out] VariableName On input, supplies the last VariableName that was returned by GetNextVariableName(). 239 239 On output, returns the Null-terminated Unicode string of the current variable. 240 240 @param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by GetNextVariableName(). 241 On output, returns the VendorGuid of the current variable. 241 On output, returns the VendorGuid of the current variable. 242 242 @param[in] VirtualMode Current calling mode for this function. 243 243 @param[in] Global Context of this Extended SAL Variable Services Class call. 244 244 245 @retval EFI_SUCCESS The function completed successfully. 245 @retval EFI_SUCCESS The function completed successfully. 246 246 @retval EFI_NOT_FOUND The next variable was not found. 247 @retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result. 247 @retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result. 248 248 VariableNameSize has been updated with the size needed to complete the request. 249 249 @retval EFI_INVALID_PARAMETER VariableNameSize is NULL. … … 268 268 This function implements EsalSetVariable function of Extended SAL Variable Services Class. 269 269 It is equivalent in functionality to the EFI Runtime Service SetVariable(). 270 270 271 271 @param[in] VariableName A Null-terminated Unicode string that is the name of the vendor's 272 variable. Each VariableName is unique for each 273 VendorGuid. VariableName must contain 1 or more 274 Unicode characters. If VariableName is an empty Unicode 272 variable. Each VariableName is unique for each 273 VendorGuid. VariableName must contain 1 or more 274 Unicode characters. If VariableName is an empty Unicode 275 275 string, then EFI_INVALID_PARAMETER is returned. 276 276 @param[in] VendorGuid A unique identifier for the vendor. … … 282 282 @param[in] Global Context of this Extended SAL Variable Services Class call. 283 283 284 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 284 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 285 285 defined by the Attributes. 286 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the 286 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the 287 287 DataSize exceeds the maximum allowed. 288 288 @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string. … … 315 315 @param[in] Attributes Attributes bitmask to specify the type of variables 316 316 on which to return information. 317 @param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for 318 the EFI variables associated with the attributes specified. 319 @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI 317 @param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for 318 the EFI variables associated with the attributes specified. 319 @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI 320 320 variables associated with the attributes specified. 321 @param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable 321 @param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable 322 322 associated with the attributes specified. 323 323 @param[in] VirtualMode Current calling mode for this function … … 326 326 @retval EFI_SUCCESS Valid answer returned. 327 327 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied. 328 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the 329 MaximumVariableStorageSize, RemainingVariableStorageSize, 328 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the 329 MaximumVariableStorageSize, RemainingVariableStorageSize, 330 330 MaximumVariableSize are undefined. 331 331 **/ … … 437 437 438 438 /** 439 Update the variable region with Variable information. These are the same 439 Update the variable region with Variable information. These are the same 440 440 arguments as the EFI Variable services. 441 441 … … 446 446 @param[in] Attributes Attributes of the variable. 447 447 @param[in] KeyIndex Index of associated public key. 448 @param[in] MonotonicCount Value of associated monotonic count. 448 @param[in] MonotonicCount Value of associated monotonic count. 449 449 @param[in] VirtualMode Current calling mode for this function. 450 450 @param[in] Global Context of this Extended SAL Variable Services Class call. … … 462 462 IN VOID *Data, 463 463 IN UINTN DataSize, 464 IN UINT32 Attributes OPTIONAL, 464 IN UINT32 Attributes OPTIONAL, 465 465 IN UINT32 KeyIndex OPTIONAL, 466 466 IN UINT64 MonotonicCount OPTIONAL, -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/Pei/Variable.c
r58459 r58466 1 1 /** @file 2 2 Implement ReadOnly Variable Services required by PEIM and install PEI 3 ReadOnly Varaiable2 PPI. These services operates the non-volatile 3 ReadOnly Varaiable2 PPI. These services operates the non-volatile 4 4 storage space. 5 5 6 6 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 10 http://opensource.org/licenses/bsd-license.php 11 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 14 … … 34 34 /** 35 35 Provide the functionality of the variable services. 36 37 @param FileHandle Handle of the file being invoked. 36 37 @param FileHandle Handle of the file being invoked. 38 38 Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile(). 39 39 @param PeiServices General purpose services available to every PEIM. … … 193 193 { 194 194 UINTN Value; 195 195 196 196 // 197 197 // Be careful about pad size for alignment … … 451 451 452 452 NvStorageSize = PcdGet32 (PcdFlashNvStorageVariableSize); 453 NvStorageBase = (EFI_PHYSICAL_ADDRESS) (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0 ? 454 PcdGet64 (PcdFlashNvStorageVariableBase64) : 453 NvStorageBase = (EFI_PHYSICAL_ADDRESS) (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0 ? 454 PcdGet64 (PcdFlashNvStorageVariableBase64) : 455 455 PcdGet32 (PcdFlashNvStorageVariableBase) 456 456 ); … … 493 493 break; 494 494 } 495 495 496 496 VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINT8 *) FvHeader + FvHeader->HeaderLength); 497 497 … … 503 503 // If it's the first time to access variable region in flash, create a guid hob to record 504 504 // VAR_ADDED type variable info. 505 // Note that as the resource of PEI phase is limited, only store the limited number of 505 // Note that as the resource of PEI phase is limited, only store the limited number of 506 506 // VAR_ADDED type variables to reduce access time. 507 507 // … … 619 619 EFI_PHYSICAL_ADDRESS SpareAddress; 620 620 UINTN PartialSize; 621 621 622 622 if (StoreInfo->FtwLastWriteData != NULL) { 623 623 TargetAddress = StoreInfo->FtwLastWriteData->TargetAddress; … … 826 826 StoreInfo, 827 827 VariableName, 828 VendorGuid, 828 VendorGuid, 829 829 PtrTrack 830 830 ); … … 840 840 This service retrieves a variable's value using its name and GUID. 841 841 842 Read the specified variable from the UEFI variable store. If the Data 842 Read the specified variable from the UEFI variable store. If the Data 843 843 buffer is too small to hold the contents of the variable, the error 844 844 EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer … … 856 856 @retval EFI_SUCCESS The variable was read successfully. 857 857 @retval EFI_NOT_FOUND The variable could not be found. 858 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. 859 DataSize is updated with the size required for 858 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. 859 DataSize is updated with the size required for 860 860 the specified variable. 861 861 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL. … … 921 921 Return the next variable name and GUID. 922 922 923 This function is called multiple times to retrieve the VariableName 924 and VariableGuid of all variables currently available in the system. 925 On each call, the previous results are passed into the interface, 926 and, on return, the interface returns the data for the next 927 interface. When the entire variable list has been returned, 923 This function is called multiple times to retrieve the VariableName 924 and VariableGuid of all variables currently available in the system. 925 On each call, the previous results are passed into the interface, 926 and, on return, the interface returns the data for the next 927 interface. When the entire variable list has been returned, 928 928 EFI_NOT_FOUND is returned. 929 929 … … 934 934 @param VariableName On entry, a pointer to a null-terminated string that is the variable's name. 935 935 On return, points to the next variable's null-terminated name string. 936 @param VariableGuid On entry, a pointer to an EFI_GUID that is the variable's GUID. 936 @param VariableGuid On entry, a pointer to an EFI_GUID that is the variable's GUID. 937 937 On return, a pointer to the next variable's GUID. 938 938 … … 1013 1013 } 1014 1014 // 1015 // Capture the case that 1015 // Capture the case that 1016 1016 // 1. current storage is the last one, or 1017 1017 // 2. no further storage … … 1054 1054 &StoreInfoForHob, 1055 1055 GetVariableNamePtr (Variable.CurrPtr), 1056 &VariableHeader->VendorGuid, 1056 &VariableHeader->VendorGuid, 1057 1057 &VariableInHob 1058 1058 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/Pei/Variable.h
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 55 55 /** 56 56 Provide the functionality of the variable services. 57 58 @param FileHandle Handle of the file being invoked. 57 58 @param FileHandle Handle of the file being invoked. 59 59 Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile(). 60 60 @param PeiServices General purpose services available to every PEIM. … … 74 74 This service retrieves a variable's value using its name and GUID. 75 75 76 Read the specified variable from the UEFI variable store. If the Data 76 Read the specified variable from the UEFI variable store. If the Data 77 77 buffer is too small to hold the contents of the variable, the error 78 78 EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer … … 90 90 @retval EFI_SUCCESS The variable was read successfully. 91 91 @retval EFI_NOT_FOUND The variable could not be found. 92 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. 93 DataSize is updated with the size required for 92 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. 93 DataSize is updated with the size required for 94 94 the specified variable. 95 95 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL. … … 111 111 Return the next variable name and GUID. 112 112 113 This function is called multiple times to retrieve the VariableName 114 and VariableGuid of all variables currently available in the system. 115 On each call, the previous results are passed into the interface, 116 and, on return, the interface returns the data for the next 117 interface. When the entire variable list has been returned, 113 This function is called multiple times to retrieve the VariableName 114 and VariableGuid of all variables currently available in the system. 115 On each call, the previous results are passed into the interface, 116 and, on return, the interface returns the data for the next 117 interface. When the entire variable list has been returned, 118 118 EFI_NOT_FOUND is returned. 119 119 … … 124 124 On return, points to the next variable's null-terminated name string. 125 125 126 @param VariableGuid On entry, a pointer to an UEFI _GUID that is the variable's GUID. 126 @param VariableGuid On entry, a pointer to an UEFI _GUID that is the variable's GUID. 127 127 On return, a pointer to the next variable's GUID. 128 128 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
r58459 r58466 10 10 The whole SMM authentication variable design relies on the integrity of flash part and SMM. 11 11 which is assumed to be protected by platform. All variable code and metadata in flash/SMM Memory 12 may not be modified without authorization. If platform fails to protect these resources, 12 may not be modified without authorization. If platform fails to protect these resources, 13 13 the authentication service provided in this driver will be broken, and the behavior is undefined. 14 14 … … 89 89 @retval TRUE This variable is protected, only a physical present user could set this variable. 90 90 @retval FALSE This variable is not protected. 91 91 92 92 **/ 93 93 BOOLEAN … … 101 101 return TRUE; 102 102 } 103 103 104 104 return FALSE; 105 105 } … … 123 123 return TRUE; 124 124 } 125 125 126 126 return FALSE; 127 127 } … … 257 257 ASSERT ((DataSize != 0) && (Data != NULL)); 258 258 // 259 // "AuthVarKeyDatabase" is an internal variable. Its DataSize is always ensured not to exceed mPubKeyStore buffer size(See definition before) 259 // "AuthVarKeyDatabase" is an internal variable. Its DataSize is always ensured not to exceed mPubKeyStore buffer size(See definition before) 260 260 // Therefore, there is no memory overflow in underlying CopyMem. 261 261 // … … 270 270 DEBUG ((EFI_D_INFO, "Variable %s exists.\n", EFI_PLATFORM_KEY_NAME)); 271 271 } 272 272 273 273 // 274 274 // Create "SetupMode" variable with BS+RT attribute set. … … 294 294 return Status; 295 295 } 296 296 297 297 // 298 298 // Create "SignatureSupport" variable with BS+RT attribute set. … … 391 391 return Status; 392 392 } 393 393 394 394 DEBUG ((EFI_D_INFO, "Variable %s is %x\n", EFI_CUSTOM_MODE_NAME, CustomMode)); 395 395 396 396 // 397 397 // Check "certdb" variable's existence. 398 // If it doesn't exist, then create a new one with 398 // If it doesn't exist, then create a new one with 399 399 // EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set. 400 400 // … … 424 424 return Status; 425 425 } 426 } 426 } 427 427 428 428 // … … 481 481 482 482 @param[in] PubKey Input pointer to Public Key data 483 @param[in] VariableDataEntry The variable data entry 483 @param[in] VariableDataEntry The variable data entry 484 484 485 485 @return Index of new added item … … 544 544 return 0; 545 545 } 546 546 547 547 Status = Reclaim ( 548 548 mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase, … … 574 574 ASSERT ((DataSize != 0) && (Data != NULL)); 575 575 // 576 // "AuthVarKeyDatabase" is an internal used variable. Its DataSize is always ensured not to exceed mPubKeyStore buffer size(See definition before) 576 // "AuthVarKeyDatabase" is an internal used variable. Its DataSize is always ensured not to exceed mPubKeyStore buffer size(See definition before) 577 577 // Therefore, there is no memory overflow in underlying CopyMem. 578 578 // … … 582 582 if (mPubKeyNumber == mMaxKeyNumber) { 583 583 return 0; 584 } 584 } 585 585 } 586 586 … … 657 657 VOID *Rsa; 658 658 UINTN PayloadSize; 659 659 660 660 PayloadSize = DataSize - AUTHINFO_SIZE; 661 661 Rsa = NULL; … … 895 895 @return EFI_INVALID_PARAMETER Invalid signature list format. 896 896 @return EFI_SUCCESS Passed signature list format check successfully. 897 897 898 898 **/ 899 899 EFI_STATUS … … 923 923 IsPk = TRUE; 924 924 } else if ((CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && StrCmp (VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0) || 925 (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 925 (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 926 926 (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0 || StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))){ 927 927 IsPk = FALSE; … … 943 943 if (CompareGuid (&SigList->SignatureType, &mSupportSigItem[Index].SigType)) { 944 944 // 945 // The value of SignatureSize should always be 16 (size of SignatureOwner 945 // The value of SignatureSize should always be 16 (size of SignatureOwner 946 946 // component) add the data length according to signature type. 947 947 // 948 if (mSupportSigItem[Index].SigDataSize != ((UINT32) ~0) && 948 if (mSupportSigItem[Index].SigDataSize != ((UINT32) ~0) && 949 949 (SigList->SignatureSize - sizeof (EFI_GUID)) != mSupportSigItem[Index].SigDataSize) { 950 950 return EFI_INVALID_PARAMETER; … … 987 987 } 988 988 SigCount += (SigList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - SigList->SignatureHeaderSize) / SigList->SignatureSize; 989 989 990 990 SigDataSize -= SigList->SignatureListSize; 991 991 SigList = (EFI_SIGNATURE_LIST *) ((UINT8 *) SigList + SigList->SignatureListSize); … … 1008 1008 @return EFI_SUCCESS Variable is updated successfully. 1009 1009 @return Others Failed to update variable. 1010 1010 1011 1011 **/ 1012 1012 EFI_STATUS … … 1022 1022 } 1023 1023 mVendorKeyState = VENDOR_KEYS_MODIFIED; 1024 1024 1025 1025 FindVariable (EFI_VENDOR_KEYS_NV_VARIABLE_NAME, &gEfiVendorKeysNvGuid, &Variable, &mVariableModuleGlobal->VariableGlobal, FALSE); 1026 1026 Status = UpdateVariable ( … … 1094 1094 UINTN PayloadSize; 1095 1095 1096 if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0 || 1096 if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0 || 1097 1097 (Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) { 1098 1098 // … … 1254 1254 return Status; 1255 1255 } 1256 1256 1257 1257 Status = UpdateVariable ( 1258 1258 VariableName, … … 1339 1339 return EFI_SECURITY_VIOLATION; 1340 1340 } 1341 1341 1342 1342 // 1343 1343 // A time-based authenticated variable and a count-based authenticated variable 1344 1344 // can't be updated by each other. 1345 // 1346 if (Variable->CurrPtr != NULL) { 1345 // 1346 if (Variable->CurrPtr != NULL) { 1347 1347 if (((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) && 1348 1348 ((Variable->CurrPtr->Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0)) { 1349 return EFI_SECURITY_VIOLATION; 1350 } 1351 1352 if (((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) && 1349 return EFI_SECURITY_VIOLATION; 1350 } 1351 1352 if (((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) && 1353 1353 ((Variable->CurrPtr->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0)) { 1354 return EFI_SECURITY_VIOLATION; 1355 } 1356 } 1357 1354 return EFI_SECURITY_VIOLATION; 1355 } 1356 } 1357 1358 1358 // 1359 1359 // Process Time-based Authenticated variable. … … 1393 1393 IsFirstTime = FALSE; 1394 1394 } 1395 } else if ((Variable->CurrPtr != NULL) && 1395 } else if ((Variable->CurrPtr != NULL) && 1396 1396 ((Variable->CurrPtr->Attributes & (EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) != 0) 1397 1397 ) { … … 1424 1424 // 1425 1425 // 2 cases need to check here 1426 // 1. Internal PubKey variable. PubKeyIndex is always 0 1426 // 1. Internal PubKey variable. PubKeyIndex is always 0 1427 1427 // 2. Other counter-based AuthVariable. Check input PubKey. 1428 1428 // … … 1479 1479 @param[in, out] Data Pointer to original EFI_SIGNATURE_LIST. 1480 1480 @param[in] DataSize Size of Data buffer. 1481 @param[in] FreeBufSize Size of free data buffer 1481 @param[in] FreeBufSize Size of free data buffer 1482 1482 @param[in] NewData Pointer to new EFI_SIGNATURE_LIST to be appended. 1483 1483 @param[in] NewDataSize Size of NewData buffer. … … 1715 1715 // Check whether VariableName matches. 1716 1716 // 1717 if ((NameSize == StrLen (VariableName)) && 1717 if ((NameSize == StrLen (VariableName)) && 1718 1718 (CompareMem (Data + Offset, VariableName, NameSize * sizeof (CHAR16)) == 0)) { 1719 1719 Offset = Offset + NameSize * sizeof (CHAR16); … … 1724 1724 1725 1725 if (CertDataSize != NULL) { 1726 *CertDataSize = CertSize; 1726 *CertDataSize = CertSize; 1727 1727 } 1728 1728 … … 1745 1745 } 1746 1746 1747 return EFI_NOT_FOUND; 1747 return EFI_NOT_FOUND; 1748 1748 } 1749 1749 … … 1779 1779 return EFI_INVALID_PARAMETER; 1780 1780 } 1781 1781 1782 1782 // 1783 1783 // Get variable "certdb". … … 1789 1789 &mVariableModuleGlobal->VariableGlobal, 1790 1790 FALSE 1791 ); 1791 ); 1792 1792 if (EFI_ERROR (Status)) { 1793 1793 return Status; … … 1852 1852 return EFI_INVALID_PARAMETER; 1853 1853 } 1854 1854 1855 1855 // 1856 1856 // Get variable "certdb". … … 1862 1862 &mVariableModuleGlobal->VariableGlobal, 1863 1863 FALSE 1864 ); 1864 ); 1865 1865 if (EFI_ERROR (Status)) { 1866 1866 return Status; … … 1930 1930 // 1931 1931 // Set "certdb". 1932 // 1933 VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 1932 // 1933 VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 1934 1934 Status = UpdateVariable ( 1935 1935 EFI_CERT_DB_NAME, … … 1985 1985 return EFI_INVALID_PARAMETER; 1986 1986 } 1987 1987 1988 1988 // 1989 1989 // Get variable "certdb". … … 1995 1995 &mVariableModuleGlobal->VariableGlobal, 1996 1996 FALSE 1997 ); 1997 ); 1998 1998 if (EFI_ERROR (Status)) { 1999 1999 return Status; … … 2031 2031 // 2032 2032 NameSize = (UINT32) StrLen (VariableName); 2033 CertNodeSize = sizeof (AUTH_CERT_DB_DATA) + (UINT32) CertDataSize + NameSize * sizeof (CHAR16); 2033 CertNodeSize = sizeof (AUTH_CERT_DB_DATA) + (UINT32) CertDataSize + NameSize * sizeof (CHAR16); 2034 2034 NewCertDbSize = (UINT32) DataSize + CertNodeSize; 2035 2035 if (NewCertDbSize > mMaxCertDbSize) { … … 2054 2054 CopyMem (&Ptr->NameSize, &NameSize, sizeof (UINT32)); 2055 2055 CopyMem (&Ptr->CertDataSize, &CertDataSize, sizeof (UINT32)); 2056 2056 2057 2057 CopyMem ( 2058 2058 (UINT8 *) Ptr + sizeof (AUTH_CERT_DB_DATA), … … 2066 2066 CertDataSize 2067 2067 ); 2068 2068 2069 2069 // 2070 2070 // Set "certdb". 2071 // 2072 VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 2071 // 2072 VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 2073 2073 Status = UpdateVariable ( 2074 2074 EFI_CERT_DB_NAME, … … 2377 2377 goto Exit; 2378 2378 } 2379 2379 2380 2380 if ((CertStackSize != CertsSizeinDb) || 2381 2381 (CompareMem (SignerCerts, CertsInCertDb, CertsSizeinDb) != 0)) { … … 2420 2420 RootCert = Cert->SignatureData; 2421 2421 RootCertSize = CertList->SignatureSize - (sizeof (EFI_SIGNATURE_DATA) - 1); 2422 2422 2423 2423 // Verify Pkcs7 SignedData via Pkcs7Verify library. 2424 2424 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.h
r58459 r58466 10 10 The whole SMM authentication variable design relies on the integrity of flash part and SMM. 11 11 which is assumed to be protected by platform. All variable code and metadata in flash/SMM Memory 12 may not be modified without authorization. If platform fails to protect these resources, 12 may not be modified without authorization. If platform fails to protect these resources, 13 13 the authentication service provided in this driver will be broken, and the behavior is undefined. 14 14 … … 51 51 /// "certdb" variable stores the signer's certificates for non PK/KEK/DB/DBX 52 52 /// variables with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set. 53 /// 53 /// 54 54 /// 55 55 #define EFI_CERT_DB_NAME L"certdb" … … 168 168 @return EFI_INVALID_PARAMETER Invalid signature list format. 169 169 @return EFI_SUCCESS Passed signature list format check successfully. 170 170 171 171 **/ 172 172 EFI_STATUS … … 255 255 @param[in, out] Data Pointer to original EFI_SIGNATURE_LIST. 256 256 @param[in] DataSize Size of Data buffer. 257 @param[in] FreeBufSize Size of free data buffer 257 @param[in] FreeBufSize Size of free data buffer 258 258 @param[in] NewData Pointer to new EFI_SIGNATURE_LIST to be appended. 259 259 @param[in] NewDataSize Size of NewData buffer. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Measurement.c
r58464 r58466 57 57 58 58 for (Index = 0; Index < sizeof(mVariableType)/sizeof(mVariableType[0]); Index++) { 59 if ((StrCmp (VariableName, mVariableType[Index].VariableName) == 0) && 59 if ((StrCmp (VariableName, mVariableType[Index].VariableName) == 0) && 60 60 (CompareGuid (VendorGuid, mVariableType[Index].VendorGuid))) { 61 61 return TRUE; … … 70 70 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 71 71 @param[in] VendorGuid A unique identifier for the vendor. 72 @param[in] VarData The content of the variable data. 73 @param[in] VarSize The size of the variable data. 74 72 @param[in] VarData The content of the variable data. 73 @param[in] VarSize The size of the variable data. 74 75 75 @retval EFI_SUCCESS Operation completed successfully. 76 76 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 135 135 136 136 /** 137 Returns the status whether get the variable success. The function retrieves 138 variable through the UEFI Runtime Service GetVariable(). The 137 Returns the status whether get the variable success. The function retrieves 138 variable through the UEFI Runtime Service GetVariable(). The 139 139 returned buffer is allocated using AllocatePool(). The caller is responsible 140 140 for freeing this buffer with FreePool(). … … 171 171 *Size = 0; 172 172 } 173 173 174 174 Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); 175 175 if (Status != EFI_BUFFER_TOO_SMALL) { -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
r58459 r58466 593 593 Check the PubKeyIndex is a valid key or not. 594 594 595 This function will iterate the NV storage to see if this PubKeyIndex is still referenced 595 This function will iterate the NV storage to see if this PubKeyIndex is still referenced 596 596 by any valid count-based auth variabe. 597 597 598 598 @param[in] PubKeyIndex Index of the public key in public key store. 599 599 600 600 @retval TRUE The PubKeyIndex is still in use. 601 601 @retval FALSE The PubKeyIndex is not referenced by any count-based auth variabe. 602 602 603 603 **/ 604 604 BOOLEAN … … 618 618 619 619 while (IsValidVariableHeader (Variable, VariableStoreEnd)) { 620 if ((Variable->State == VAR_ADDED || Variable->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) && 620 if ((Variable->State == VAR_ADDED || Variable->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) && 621 621 Variable->PubKeyIndex == PubKeyIndex) { 622 622 return TRUE; … … 624 624 Variable = GetNextVariablePtr (Variable); 625 625 } 626 626 627 627 return FALSE; 628 628 } … … 631 631 632 632 Get the number of valid public key in PubKeyStore. 633 633 634 634 @param[in] PubKeyNumber Number of the public key in public key store. 635 635 … … 646 646 647 647 Counter = 0; 648 648 649 649 for (PubKeyIndex = 1; PubKeyIndex <= PubKeyNumber; PubKeyIndex++) { 650 650 if (IsValidPubKeyIndex (PubKeyIndex)) { … … 652 652 } 653 653 } 654 654 655 655 return Counter; 656 656 } … … 660 660 Filter the useless key in public key store. 661 661 662 This function will find out all valid public keys in public key database, save them in new allocated 662 This function will find out all valid public keys in public key database, save them in new allocated 663 663 buffer NewPubKeyStore, and give the new PubKeyIndex. The caller is responsible for freeing buffer 664 664 NewPubKeyIndex and NewPubKeyStore with FreePool(). … … 669 669 @param[out] NewPubKeyStore Saved all valid public keys in PubKeyStore. 670 670 @param[out] NewPubKeySize Buffer size of the NewPubKeyStore. 671 671 672 672 @retval EFI_SUCCESS Trim operation is complete successfully. 673 673 @retval EFI_OUT_OF_RESOURCES No enough memory resources, or no useless key in PubKeyStore. 674 674 675 675 **/ 676 676 EFI_STATUS … … 686 686 UINT32 CopiedKey; 687 687 UINT32 NewPubKeyNumber; 688 688 689 689 NewPubKeyNumber = GetValidPubKeyNumber (PubKeyNumber); 690 690 if (NewPubKeyNumber == PubKeyNumber) { … … 740 740 @param[in] NewVariableSize New variable size. 741 741 @param[in] ReclaimPubKeyStore Reclaim for public key database or not. 742 742 743 743 @return EFI_SUCCESS Reclaim operation has finished successfully. 744 744 @return EFI_OUT_OF_RESOURCES No enough memory resources or variable space. … … 874 874 NextVariable = GetNextVariablePtr (Variable); 875 875 if (Variable->State == VAR_ADDED || Variable->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) { 876 if ((StrCmp (GetVariableNamePtr (Variable), AUTHVAR_KEYDB_NAME) == 0) && 876 if ((StrCmp (GetVariableNamePtr (Variable), AUTHVAR_KEYDB_NAME) == 0) && 877 877 (CompareGuid (&Variable->VendorGuid, &gEfiAuthenticatedVariableGuid))) { 878 878 // … … 883 883 continue; 884 884 } 885 885 886 886 VariableSize = (UINTN) NextVariable - (UINTN) Variable; 887 887 CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize); … … 910 910 StrCpy (GetVariableNamePtr (Variable), GetVariableNamePtr (PubKeyHeader)); 911 911 CopyMem (GetVariableDataPtr (Variable), NewPubKeyStore, NewPubKeySize); 912 CurrPtr = (UINT8*) GetNextVariablePtr (Variable); 912 CurrPtr = (UINT8*) GetNextVariablePtr (Variable); 913 913 CommonVariableTotalSize += (UINTN) CurrPtr - (UINTN) Variable; 914 914 } else { … … 1525 1525 @param[in] Attributes Variable attributes for Variable entries. 1526 1526 @param ... The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *. 1527 A NULL terminates the list. The VariableSize of 1527 A NULL terminates the list. The VariableSize of 1528 1528 VARIABLE_ENTRY_CONSISTENCY is the variable data size as input. 1529 1529 It will be changed to variable total size as output. … … 1804 1804 VariableEntry[0].Guid = &gEfiGlobalVariableGuid; 1805 1805 VariableEntry[0].Name = EFI_LANG_VARIABLE_NAME; 1806 1806 1807 1807 VariableEntry[1].VariableSize = AsciiStrSize (BestPlatformLang); 1808 1808 VariableEntry[1].Guid = &gEfiGlobalVariableGuid; … … 2010 2010 goto Done; 2011 2011 } 2012 2012 2013 2013 // 2014 2014 // Only variable that have RT attributes can be updated/deleted in Runtime. … … 2104 2104 2105 2105 // 2106 // Set Max Common Variable Data Size as default MaxDataSize 2106 // Set Max Common Variable Data Size as default MaxDataSize 2107 2107 // 2108 2108 MaxDataSize = PcdGet32 (PcdMaxVariableSize) - DataOffset; … … 2117 2117 Status = AppendSignatureList ( 2118 2118 BufferForMerge, 2119 Variable->CurrPtr->DataSize, 2119 Variable->CurrPtr->DataSize, 2120 2120 MaxDataSize - Variable->CurrPtr->DataSize, 2121 2121 Data, … … 2531 2531 Check if a Unicode character is a hexadecimal character. 2532 2532 2533 This function checks if a Unicode character is a 2534 hexadecimal character. The valid hexadecimal character is 2533 This function checks if a Unicode character is a 2534 hexadecimal character. The valid hexadecimal character is 2535 2535 L'0' to L'9', L'a' to L'f', or L'A' to L'F'. 2536 2536 … … 2702 2702 @retval TRUE This variable is read-only variable. 2703 2703 @retval FALSE This variable is NOT read-only variable. 2704 2704 2705 2705 **/ 2706 2706 BOOLEAN … … 2723 2723 } 2724 2724 } 2725 2725 2726 2726 return FALSE; 2727 2727 } … … 3078 3078 if ((UINTN)(~0) - PayloadSize < StrSize(VariableName)){ 3079 3079 // 3080 // Prevent whole variable size overflow 3081 // 3080 // Prevent whole variable size overflow 3081 // 3082 3082 return EFI_INVALID_PARAMETER; 3083 3083 } … … 3185 3185 } else if (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp (VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0)) { 3186 3186 Status = ProcessVarWithPk (VariableName, VendorGuid, Data, DataSize, &Variable, Attributes, FALSE); 3187 } else if (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 3187 } else if (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 3188 3188 ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))) { 3189 3189 Status = ProcessVarWithPk (VariableName, VendorGuid, Data, DataSize, &Variable, Attributes, FALSE); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 229 229 @param[in] Attributes Variable attributes for Variable entries. 230 230 @param ... The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *. 231 A NULL terminates the list. The VariableSize of 231 A NULL terminates the list. The VariableSize of 232 232 VARIABLE_ENTRY_CONSISTENCY is the variable data size as input. 233 233 It will be changed to variable total size as output. … … 243 243 ... 244 244 ); 245 245 246 246 /** 247 247 Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set, … … 273 273 IN UINT64 MonotonicCount OPTIONAL, 274 274 IN OUT VARIABLE_POINTER_TRACK *Variable, 275 IN EFI_TIME *TimeStamp OPTIONAL 275 IN EFI_TIME *TimeStamp OPTIONAL 276 276 ); 277 277 … … 279 279 /** 280 280 Return TRUE if ExitBootServices () has been called. 281 281 282 282 @retval TRUE If ExitBootServices () has been called. 283 283 **/ … … 290 290 Initializes a basic mutual exclusion lock. 291 291 292 This function initializes a basic mutual exclusion lock to the released state 293 and returns the lock. Each lock provides mutual exclusion access at its task 292 This function initializes a basic mutual exclusion lock to the released state 293 and returns the lock. Each lock provides mutual exclusion access at its task 294 294 priority level. Since there is no preemption or multiprocessor support in EFI, 295 295 acquiring the lock only consists of raising to the locks TPL. … … 309 309 ); 310 310 311 311 312 312 /** 313 313 Acquires lock only at boot time. Simply returns at runtime. … … 343 343 ReleaseLockOnlyAtBootTime ( 344 344 IN EFI_LOCK *Lock 345 ); 345 ); 346 346 347 347 /** … … 355 355 @retval EFI_UNSUPPORTED The device does not support the FVB protocol. 356 356 @retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL. 357 357 358 358 **/ 359 359 EFI_STATUS … … 381 381 /** 382 382 Function returns an array of handles that support the FVB protocol 383 in a buffer allocated from pool. 383 in a buffer allocated from pool. 384 384 385 385 @param[out] NumberHandles The number of handles returned in Buffer. … … 392 392 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results. 393 393 @retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL. 394 394 395 395 **/ 396 396 EFI_STATUS … … 428 428 @param[in] NewVariableSize New variable size. 429 429 @param[in] ReclaimPubKeyStore Reclaim for public key database or not. 430 430 431 431 @return EFI_SUCCESS Reclaim operation has finished successfully. 432 432 @return EFI_OUT_OF_RESOURCES No enough memory resources or variable space. … … 448 448 /** 449 449 This function reclaims variable storage if free size is below the threshold. 450 450 451 451 **/ 452 452 VOID 453 453 ReclaimForOS( 454 454 VOID 455 ); 455 ); 456 456 457 457 … … 467 467 VOID 468 468 ); 469 469 470 470 /** 471 471 Retrive the SMM Fault Tolerent Write protocol interface. … … 512 512 data, this value contains the required size. 513 513 @param Data Data pointer. 514 514 515 515 @return EFI_INVALID_PARAMETER Invalid parameter. 516 516 @return EFI_SUCCESS Find the specified variable. … … 645 645 OUT UINT64 *RemainingVariableStorageSize, 646 646 OUT UINT64 *MaximumVariableSize 647 ); 647 ); 648 648 649 649 /** -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
r58459 r58466 2 2 # Provides authenticated variable service 3 3 # 4 # This module installs variable arch protocol and variable write arch protocol to provide 4 # This module installs variable arch protocol and variable write arch protocol to provide 5 5 # variable services: SetVariable, GetVariable, GetNextVariableName and QueryVariableInfo. 6 6 # 7 7 # Caution: This module requires additional review when modified. 8 8 # This driver will have external input - variable data. 9 # This external input must be validated carefully to avoid security issues such as 9 # This external input must be validated carefully to avoid security issues such as 10 10 # buffer overflow or integer overflow. 11 11 # … … 85 85 ## SOMETIMES_PRODUCES ## SystemTable 86 86 gEfiAuthenticatedVariableGuid 87 87 88 88 ## SOMETIMES_CONSUMES ## Variable:L"PlatformLang" 89 89 ## SOMETIMES_PRODUCES ## Variable:L"PlatformLang" … … 98 98 ## PRODUCES ## Variable:L"SecureBoot" 99 99 ## CONSUMES ## Variable:L"SignatureSupport" 100 ## PRODUCES ## Variable:L"SignatureSupport" 100 ## PRODUCES ## Variable:L"SignatureSupport" 101 101 ## PRODUCES ## Variable:L"VendorKeys" 102 102 gEfiGlobalVariableGuid 103 103 104 104 ## SOMETIMES_CONSUMES ## Variable:L"DB" 105 105 ## SOMETIMES_CONSUMES ## Variable:L"DBX" 106 106 gEfiImageSecurityDatabaseGuid 107 107 108 108 ## CONSUMES ## Variable:L"SecureBootEnable" 109 109 ## PRODUCES ## Variable:L"SecureBootEnable" 110 110 gEfiSecureBootEnableDisableGuid 111 111 112 112 ## CONSUMES ## Variable:L"CustomMode" 113 113 ## PRODUCES ## Variable:L"CustomMode" 114 114 gEfiCustomModeEnableGuid 115 115 116 116 ## CONSUMES ## Variable:L"certdb" 117 117 ## PRODUCES ## Variable:L"certdb" 118 118 gEfiCertDbGuid 119 119 120 120 ## CONSUMES ## Variable:L"VendorKeysNv" 121 121 ## PRODUCES ## Variable:L"VendorKeysNv" -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c
r58459 r58466 1 1 /** @file 2 The sample implementation for SMM variable protocol. And this driver 3 implements an SMI handler to communicate with the DXE runtime driver 2 The sample implementation for SMM variable protocol. And this driver 3 implements an SMI handler to communicate with the DXE runtime driver 4 4 to provide variable services. 5 5 … … 11 11 SmmVariableHandler() will receive untrusted input and do basic validation. 12 12 13 Each sub function VariableServiceGetVariable(), VariableServiceGetNextVariableName(), 14 VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(), 13 Each sub function VariableServiceGetVariable(), VariableServiceGetNextVariableName(), 14 VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(), 15 15 SmmVariableGetStatistics() should also do validation based on its own knowledge. 16 16 17 17 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 18 This program and the accompanying materials 19 are licensed and made available under the terms and conditions of the BSD License 20 which accompanies this distribution. The full text of the license may be found at 18 This program and the accompanying materials 19 are licensed and made available under the terms and conditions of the BSD License 20 which accompanies this distribution. The full text of the license may be found at 21 21 http://opensource.org/licenses/bsd-license.php 22 22 23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 24 24 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 25 25 … … 119 119 /** 120 120 Return TRUE if ExitBootServices () has been called. 121 121 122 122 @retval TRUE If ExitBootServices () has been called. 123 123 **/ … … 133 133 Initializes a basic mutual exclusion lock. 134 134 135 This function initializes a basic mutual exclusion lock to the released state 136 and returns the lock. Each lock provides mutual exclusion access at its task 135 This function initializes a basic mutual exclusion lock to the released state 136 and returns the lock. Each lock provides mutual exclusion access at its task 137 137 priority level. Since there is no preemption or multiprocessor support in EFI, 138 138 acquiring the lock only consists of raising to the locks TPL. … … 217 217 // 218 218 Status = gSmst->SmmLocateProtocol ( 219 &gEfiSmmFaultTolerantWriteProtocolGuid, 220 NULL, 219 &gEfiSmmFaultTolerantWriteProtocolGuid, 220 NULL, 221 221 FtwProtocol 222 222 ); … … 256 256 /** 257 257 Function returns an array of handles that support the SMM FVB protocol 258 in a buffer allocated from pool. 258 in a buffer allocated from pool. 259 259 260 260 @param[out] NumberHandles The number of handles returned in Buffer. … … 327 327 328 328 @param[in, out] InfoEntry A pointer to the buffer of variable information entry. 329 On input, point to the variable information returned last time. if 329 On input, point to the variable information returned last time. if 330 330 InfoEntry->VendorGuid is zero, return the first information. 331 331 On output, point to the next variable information. … … 334 334 335 335 @retval EFI_SUCCESS The variable information is found and returned successfully. 336 @retval EFI_UNSUPPORTED No variable inoformation exists in variable driver. The 336 @retval EFI_UNSUPPORTED No variable inoformation exists in variable driver. The 337 337 PcdVariableCollectStatistics should be set TRUE to support it. 338 338 @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the next variable information. … … 351 351 CHAR16 *InfoName; 352 352 EFI_GUID VendorGuid; 353 353 354 354 if (InfoEntry == NULL) { 355 355 return EFI_INVALID_PARAMETER; 356 356 } 357 358 VariableInfo = gVariableInfo; 357 358 VariableInfo = gVariableInfo; 359 359 if (VariableInfo == NULL) { 360 360 return EFI_UNSUPPORTED; … … 398 398 VariableInfo = VariableInfo->Next; 399 399 }; 400 400 401 401 if (VariableInfo == NULL) { 402 402 *InfoSize = 0; … … 416 416 CopyMem (InfoName, VariableInfo->Name, StrSize (VariableInfo->Name)); 417 417 *InfoSize = StatisticsInfoSize; 418 418 419 419 return EFI_SUCCESS; 420 420 } … … 428 428 Caution: This function may receive untrusted input. 429 429 This variable data and communicate buffer are external input, so this function will do basic validation. 430 Each sub function VariableServiceGetVariable(), VariableServiceGetNextVariableName(), 431 VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(), 430 Each sub function VariableServiceGetVariable(), VariableServiceGetNextVariableName(), 431 VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(), 432 432 SmmVariableGetStatistics() should also do validation based on its own knowledge. 433 433 … … 439 439 @param[in, out] CommBufferSize The size of the CommBuffer. 440 440 441 @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers 441 @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers 442 442 should still be called. 443 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should 443 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should 444 444 still be called. 445 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still 445 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still 446 446 be called. 447 447 @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced. … … 492 492 return EFI_SUCCESS; 493 493 } 494 494 495 495 SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *)CommBuffer; 496 496 497 497 switch (SmmVariableFunctionHeader->Function) { 498 498 case SMM_VARIABLE_FUNCTION_GET_VARIABLE: … … 514 514 goto EXIT; 515 515 } 516 InfoSize = OFFSET_OF(SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE, Name) 516 InfoSize = OFFSET_OF(SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE, Name) 517 517 + SmmVariableHeader->DataSize + SmmVariableHeader->NameSize; 518 518 … … 543 543 CopyMem (SmmVariableFunctionHeader->Data, mVariableBufferPayload, CommBufferPayloadSize); 544 544 break; 545 545 546 546 case SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME: 547 547 if (CommBufferPayloadSize < OFFSET_OF(SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME, Name)) { … … 588 588 CopyMem (SmmVariableFunctionHeader->Data, mVariableBufferPayload, CommBufferPayloadSize); 589 589 break; 590 590 591 591 case SMM_VARIABLE_FUNCTION_SET_VARIABLE: 592 592 if (CommBufferPayloadSize < OFFSET_OF(SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE, Name)) { … … 636 636 ); 637 637 break; 638 638 639 639 case SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO: 640 640 if (CommBufferPayloadSize < sizeof (SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO)) { … … 643 643 } 644 644 QueryVariableInfo = (SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO *) SmmVariableFunctionHeader->Data; 645 645 646 646 Status = VariableServiceQueryVariableInfo ( 647 647 QueryVariableInfo->Attributes, … … 661 661 Status = EFI_SUCCESS; 662 662 break; 663 663 664 664 case SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE: 665 665 mAtRuntime = TRUE; … … 672 672 673 673 // 674 // Do not need to check SmmVariableFunctionHeader->Data in SMRAM here. 675 // It is covered by previous CommBuffer check 676 // 677 674 // Do not need to check SmmVariableFunctionHeader->Data in SMRAM here. 675 // It is covered by previous CommBuffer check 676 // 677 678 678 if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)CommBufferSize, sizeof(UINTN))) { 679 679 DEBUG ((EFI_D_ERROR, "GetStatistics: SMM communication buffer in SMRAM!\n")); 680 680 Status = EFI_ACCESS_DENIED; 681 681 goto EXIT; 682 } 682 } 683 683 684 684 Status = SmmVariableGetStatistics (VariableInfo, &InfoSize); … … 738 738 SMM Fault Tolerant Write protocol notification event handler. 739 739 740 Non-Volatile variable write may needs FTW protocol to reclaim when 740 Non-Volatile variable write may needs FTW protocol to reclaim when 741 741 writting variable. 742 742 743 743 @param Protocol Points to the protocol's unique identifier 744 744 @param Interface Points to the interface instance … … 747 747 @retval EFI_SUCCESS SmmEventCallback runs successfully 748 748 @retval EFI_NOT_FOUND The Fvb protocol for variable is not found. 749 749 750 750 **/ 751 751 EFI_STATUS … … 762 762 EFI_PHYSICAL_ADDRESS NvStorageVariableBase; 763 763 UINTN FtwMaxBlockSize; 764 764 765 765 if (mVariableModuleGlobal->FvbInstance != NULL) { 766 766 return EFI_SUCCESS; … … 793 793 794 794 mVariableModuleGlobal->FvbInstance = FvbProtocol; 795 795 796 796 Status = VariableWriteServiceInitialize (); 797 797 if (EFI_ERROR (Status)) { 798 798 DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status)); 799 799 } 800 800 801 801 // 802 802 // Notify the variable wrapper driver the variable write service is ready … … 809 809 ); 810 810 ASSERT_EFI_ERROR (Status); 811 811 812 812 return EFI_SUCCESS; 813 813 } … … 816 816 /** 817 817 Variable Driver main entry point. The Variable driver places the 4 EFI 818 runtime services in the EFI System Table and installs arch protocols 818 runtime services in the EFI System Table and installs arch protocols 819 819 for variable read and write services being available. It also registers 820 820 a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. 821 821 822 @param[in] ImageHandle The firmware allocated handle for the EFI image. 822 @param[in] ImageHandle The firmware allocated handle for the EFI image. 823 823 @param[in] SystemTable A pointer to the EFI System Table. 824 824 825 825 @retval EFI_SUCCESS Variable service successfully initialized. 826 826 … … 872 872 Status = gSmst->SmiHandlerRegister (SmmVariableHandler, &gEfiSmmVariableProtocolGuid, &VariableHandle); 873 873 ASSERT_EFI_ERROR (Status); 874 874 875 875 // 876 876 // Notify the variable wrapper driver the variable service is ready … … 883 883 ); 884 884 ASSERT_EFI_ERROR (Status); 885 885 886 886 // 887 887 // Register EFI_SMM_END_OF_DXE_PROTOCOL_GUID notify function. … … 896 896 // 897 897 // Register FtwNotificationEvent () notify function. 898 // 898 // 899 899 Status = gSmst->SmmRegisterProtocolNotify ( 900 900 &gEfiSmmFaultTolerantWriteProtocolGuid, … … 905 905 906 906 SmmFtwNotificationEvent (NULL, NULL, NULL); 907 907 908 908 return EFI_SUCCESS; 909 909 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.inf
r58459 r58466 12 12 # Caution: This module requires additional review when modified. 13 13 # This driver will have external input - variable data and communicate buffer in SMM mode. 14 # This external input must be validated carefully to avoid security issues such as 14 # This external input must be validated carefully to avoid security issues such as 15 15 # buffer overflow or integer overflow. 16 16 # The whole SMM authentication variable design relies on the integrity of flash part and SMM. 17 17 # which is assumed to be protected by platform. All variable code and metadata in flash/SMM Memory 18 # may not be modified without authorization. If platform fails to protect these resources, 18 # may not be modified without authorization. If platform fails to protect these resources, 19 19 # the authentication service provided in this driver will be broken, and the behavior is undefined. 20 20 # … … 77 77 [Protocols] 78 78 gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES 79 79 80 80 ## PRODUCES 81 81 ## UNDEFINED # SmiHandlerRegister 82 82 gEfiSmmVariableProtocolGuid 83 83 84 84 ## CONSUMES 85 ## NOTIFY 85 ## NOTIFY 86 86 gEfiSmmFaultTolerantWriteProtocolGuid 87 87 gEfiSmmEndOfDxeProtocolGuid ## NOTIFY … … 92 92 ## SOMETIMES_CONSUMES ## HOB 93 93 gEfiAuthenticatedVariableGuid 94 94 95 95 ## SOMETIMES_CONSUMES ## Variable:L"PlatformLang" 96 96 ## SOMETIMES_PRODUCES ## Variable:L"PlatformLang" … … 108 108 ## PRODUCES ## Variable:L"VendorKeys" 109 109 gEfiGlobalVariableGuid 110 110 111 111 ## SOMETIMES_CONSUMES ## Variable:L"DB" 112 112 ## SOMETIMES_CONSUMES ## Variable:L"DBX" 113 113 gEfiImageSecurityDatabaseGuid 114 114 115 115 ## CONSUMES ## Variable:L"SecureBootEnable" 116 116 ## PRODUCES ## Variable:L"SecureBootEnable" 117 117 gEfiSecureBootEnableDisableGuid 118 118 119 119 ## CONSUMES ## Variable:L"CustomMode" 120 120 ## PRODUCES ## Variable:L"CustomMode" 121 121 gEfiCustomModeEnableGuid 122 122 123 123 ## CONSUMES ## Variable:L"certdb" 124 124 ## PRODUCES ## Variable:L"certdb" … … 128 128 ## PRODUCES ## Variable:L"VendorKeysNv" 129 129 gEfiVendorKeysNvGuid 130 130 131 131 gSmmVariableWriteGuid ## PRODUCES ## GUID # Install protocol 132 132 gEfiCertTypeRsa2048Sha256Guid ## SOMETIMES_CONSUMES ## GUID # Unique ID for the format of the CertData. … … 136 136 gEfiHardwareErrorVariableGuid ## SOMETIMES_CONSUMES ## Variable:L"HwErrRec####" 137 137 gEdkiiFaultTolerantWriteGuid ## SOMETIMES_CONSUMES ## HOB 138 138 139 139 [Pcd] 140 140 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES … … 153 153 [Depex] 154 154 TRUE 155 155 156 156 [UserExtensions.TianoCore."ExtraFiles"] 157 157 VariableSmmExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmmRuntimeDxe.c
r58459 r58466 15 15 16 16 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 17 This program and the accompanying materials 18 are licensed and made available under the terms and conditions of the BSD License 19 which accompanies this distribution. The full text of the license may be found at 17 This program and the accompanying materials 18 are licensed and made available under the terms and conditions of the BSD License 19 which accompanies this distribution. The full text of the license may be found at 20 20 http://opensource.org/licenses/bsd-license.php 21 21 22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 23 23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 24 24 … … 47 47 #include <Guid/SmmVariableCommon.h> 48 48 49 EFI_HANDLE mHandle = NULL; 49 EFI_HANDLE mHandle = NULL; 50 50 EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable = NULL; 51 51 EFI_EVENT mVirtualAddressChangeEvent = NULL; … … 128 128 @param[in] DataSize The data size to send to SMM. 129 129 @param[in] Function The function number to initialize the communicate header. 130 130 131 131 @retval EFI_INVALID_PARAMETER The data size is too big. 132 132 @retval EFI_SUCCESS Find the specified variable. … … 140 140 ) 141 141 { 142 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; 143 SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; 144 145 142 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; 143 SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; 144 145 146 146 if (DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE > mVariableBufferSize) { 147 147 return EFI_INVALID_PARAMETER; … … 151 151 CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGuid); 152 152 SmmCommunicateHeader->MessageLength = DataSize + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; 153 153 154 154 SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data; 155 155 SmmVariableFunctionHeader->Function = Function; … … 168 168 169 169 @retval EFI_SUCCESS Success is returned from the functin in SMM. 170 @retval Others Failure is returned from the function in SMM. 171 170 @retval Others Failure is returned from the function in SMM. 171 172 172 **/ 173 173 EFI_STATUS … … 178 178 EFI_STATUS Status; 179 179 UINTN CommSize; 180 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; 180 EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; 181 181 SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; 182 182 183 183 CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; 184 184 Status = mSmmCommunication->Communicate (mSmmCommunication, mVariableBufferPhysical, &CommSize); … … 271 271 data, this value contains the required size. 272 272 @param[out] Data Data pointer. 273 273 274 274 @retval EFI_INVALID_PARAMETER Invalid parameter. 275 275 @retval EFI_SUCCESS Find the specified variable. … … 471 471 goto Done; 472 472 } 473 473 474 474 CopyGuid (VendorGuid, &SmmGetNextVariableName->Guid); 475 CopyMem (VariableName, SmmGetNextVariableName->Name, SmmGetNextVariableName->NameSize); 475 CopyMem (VariableName, SmmGetNextVariableName->Name, SmmGetNextVariableName->NameSize); 476 476 477 477 Done: … … 511 511 { 512 512 EFI_STATUS Status; 513 UINTN PayloadSize; 513 UINTN PayloadSize; 514 514 SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE *SmmVariableHeader; 515 515 UINTN VariableNameSize; 516 516 517 517 // 518 518 // Check input parameters. … … 520 520 if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) { 521 521 return EFI_INVALID_PARAMETER; 522 } 522 } 523 523 524 524 if (DataSize != 0 && Data == NULL) { … … 641 641 *MaximumVariableSize = SmmQueryVariableInfo->MaximumVariableSize; 642 642 *MaximumVariableStorageSize = SmmQueryVariableInfo->MaximumVariableStorageSize; 643 *RemainingVariableStorageSize = SmmQueryVariableInfo->RemainingVariableStorageSize; 643 *RemainingVariableStorageSize = SmmQueryVariableInfo->RemainingVariableStorageSize; 644 644 645 645 Done: … … 669 669 // SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE. 670 670 // 671 InitCommunicateBuffer (NULL, 0, SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE); 671 InitCommunicateBuffer (NULL, 0, SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE); 672 672 673 673 // … … 699 699 // 700 700 InitCommunicateBuffer (NULL, 0, SMM_VARIABLE_FUNCTION_READY_TO_BOOT); 701 701 702 702 // 703 703 // Send data to SMM. … … 734 734 @param[in] Event Event whose notification function is being invoked. 735 735 @param[in] Context Pointer to the notification function's context. 736 736 737 737 **/ 738 738 VOID … … 749 749 return; 750 750 } 751 751 752 752 Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication); 753 753 ASSERT_EFI_ERROR (Status); 754 754 755 755 // 756 756 // Allocate memory for variable communicate buffer. … … 771 771 gRT->SetVariable = RuntimeServiceSetVariable; 772 772 gRT->QueryVariableInfo = RuntimeServiceQueryVariableInfo; 773 773 774 774 // 775 775 // Install the Variable Architectural Protocol on a new handle. … … 777 777 Status = gBS->InstallProtocolInterface ( 778 778 &mHandle, 779 &gEfiVariableArchProtocolGuid, 779 &gEfiVariableArchProtocolGuid, 780 780 EFI_NATIVE_INTERFACE, 781 781 NULL … … 790 790 @param[in] Event Event whose notification function is being invoked. 791 791 @param[in] Context Pointer to the notification function's context. 792 792 793 793 **/ 794 794 VOID … … 809 809 return; 810 810 } 811 811 812 812 Status = gBS->InstallProtocolInterface ( 813 813 &mHandle, 814 &gEfiVariableWriteArchProtocolGuid, 814 &gEfiVariableWriteArchProtocolGuid, 815 815 EFI_NATIVE_INTERFACE, 816 816 NULL 817 817 ); 818 ASSERT_EFI_ERROR (Status); 818 ASSERT_EFI_ERROR (Status); 819 819 } 820 820 … … 822 822 /** 823 823 Variable Driver main entry point. The Variable driver places the 4 EFI 824 runtime services in the EFI System Table and installs arch protocols 824 runtime services in the EFI System Table and installs arch protocols 825 825 for variable read and write services being available. It also registers 826 826 a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. 827 827 828 @param[in] ImageHandle The firmware allocated handle for the EFI image. 828 @param[in] ImageHandle The firmware allocated handle for the EFI image. 829 829 @param[in] SystemTable A pointer to the EFI System Table. 830 830 831 831 @retval EFI_SUCCESS Variable service successfully initialized. 832 832 … … 860 860 // 861 861 EfiCreateProtocolNotifyEvent ( 862 &gEfiSmmVariableProtocolGuid, 863 TPL_CALLBACK, 864 SmmVariableReady, 865 NULL, 862 &gEfiSmmVariableProtocolGuid, 863 TPL_CALLBACK, 864 SmmVariableReady, 865 NULL, 866 866 &SmmVariableRegistration 867 867 ); … … 871 871 // 872 872 EfiCreateProtocolNotifyEvent ( 873 &gSmmVariableWriteGuid, 874 TPL_CALLBACK, 875 SmmVariableWriteReady, 876 NULL, 873 &gSmmVariableWriteGuid, 874 TPL_CALLBACK, 875 SmmVariableWriteReady, 876 NULL, 877 877 &SmmVariableWriteRegistration 878 878 ); … … 882 882 // 883 883 EfiCreateEventReadyToBootEx ( 884 TPL_NOTIFY, 885 OnReadyToBoot, 886 NULL, 884 TPL_NOTIFY, 885 OnReadyToBoot, 886 NULL, 887 887 &OnReadyToBootEvent 888 ); 888 ); 889 889 890 890 // … … 898 898 &gEfiEventExitBootServicesGuid, 899 899 &ExitBootServiceEvent 900 ); 900 ); 901 901 902 902 // … … 911 911 &mVirtualAddressChangeEvent 912 912 ); 913 913 914 914 return EFI_SUCCESS; 915 915 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmmRuntimeDxe.inf
r58459 r58466 2 2 # Runtime DXE part corresponding to SMM authenticated variable module 3 3 # 4 # This module installs variable arch protocol and variable write arch protocol to provide 5 # variable service. This module need work together with SMM authenticated variable module. 4 # This module installs variable arch protocol and variable write arch protocol to provide 5 # variable service. This module need work together with SMM authenticated variable module. 6 6 # 7 7 # Caution: This module requires additional review when modified. 8 8 # This driver will have external input - variable data. 9 # This external input must be validated carefully to avoid security issues such as 9 # This external input must be validated carefully to avoid security issues such as 10 10 # buffer overflow or integer overflow. 11 11 # The whole SMM authentication variable design relies on the integrity of flash part and SMM. 12 12 # which is assumed to be protected by platform. All variable code and metadata in flash/SMM Memory 13 # may not be modified without authorization. If platform fails to protect these resources, 13 # may not be modified without authorization. If platform fails to protect these resources, 14 14 # the authentication service provided in this driver will be broken, and the behavior is undefined. 15 15 # … … 52 52 [LibraryClasses] 53 53 MemoryAllocationLib 54 BaseLib 54 BaseLib 55 55 UefiBootServicesTableLib 56 56 DebugLib … … 58 58 DxeServicesTableLib 59 59 UefiDriverEntryPoint 60 PcdLib 60 PcdLib 61 61 TpmMeasurementLib 62 62 … … 75 75 gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event 76 76 gEfiEventExitBootServicesGuid ## CONSUMES ## Event 77 77 78 78 ## CONSUMES ## UNDEFINED # Locate protocol 79 79 ## CONSUMES ## UNDEFINED # Protocol notify 80 80 gSmmVariableWriteGuid 81 81 82 82 83 83 ## SOMETIMES_CONSUMES ## Variable:L"PK" … … 85 85 ## SOMETIMES_CONSUMES ## Variable:L"SecureBoot" 86 86 gEfiGlobalVariableGuid 87 87 88 88 ## SOMETIMES_CONSUMES ## Variable:L"DB" 89 89 ## SOMETIMES_CONSUMES ## Variable:L"DBX" -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
-
Property svn:eol-style
set to
native
r58459 r58466 3 3 4 4 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 25 25 name = SECUREBOOT_CONFIGURATION, 26 26 guid = SECUREBOOT_CONFIG_FORM_SET_GUID; 27 27 28 28 // 29 29 // ##1 Form "Secure Boot Configuration" … … 38 38 text = STRING_TOKEN(STR_SECURE_BOOT_STATE_PROMPT), 39 39 text = STRING_TOKEN(STR_SECURE_BOOT_STATE_CONTENT); 40 40 41 41 // 42 42 // Define of Check Box: Attempt Secure Boot … … 49 49 flags = INTERACTIVE, 50 50 endcheckbox; 51 endif; 52 51 endif; 52 53 53 // 54 54 // Display of Check Box: Attempt Secure Boot … … 62 62 endcheckbox; 63 63 endif; 64 64 65 65 // 66 66 // Display of Oneof: 'Secure Boot Mode' … … 76 76 endif; 77 77 oneof name = SecureBootMode, 78 questionid = KEY_SECURE_BOOT_MODE, 78 questionid = KEY_SECURE_BOOT_MODE, 79 79 prompt = STRING_TOKEN(STR_SECURE_BOOT_MODE_PROMPT), 80 80 help = STRING_TOKEN(STR_SECURE_BOOT_MODE_HELP), … … 83 83 option text = STRING_TOKEN(STR_CUSTOM_MODE), value = SECURE_BOOT_MODE_CUSTOM, flags = 0; 84 84 endoneof; 85 85 86 86 // 87 87 // … … 98 98 endif; 99 99 endform; 100 100 101 101 // 102 102 // ##2 Form: 'Custom Secure Boot Options' … … 104 104 form formid = FORMID_SECURE_BOOT_OPTION_FORM, 105 105 title = STRING_TOKEN(STR_SECURE_BOOT_OPTION_TITLE); 106 107 subtitle text = STRING_TOKEN(STR_NULL); 108 106 107 subtitle text = STRING_TOKEN(STR_NULL); 108 109 109 goto FORMID_SECURE_BOOT_PK_OPTION_FORM, 110 110 prompt = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION), … … 112 112 flags = INTERACTIVE, 113 113 key = KEY_SECURE_BOOT_PK_OPTION; 114 115 subtitle text = STRING_TOKEN(STR_NULL); 116 114 115 subtitle text = STRING_TOKEN(STR_NULL); 116 117 117 goto FORMID_SECURE_BOOT_KEK_OPTION_FORM, 118 118 prompt = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION), … … 120 120 flags = INTERACTIVE, 121 121 key = KEY_SECURE_BOOT_KEK_OPTION; 122 123 subtitle text = STRING_TOKEN(STR_NULL); 124 122 123 subtitle text = STRING_TOKEN(STR_NULL); 124 125 125 goto FORMID_SECURE_BOOT_DB_OPTION_FORM, 126 126 prompt = STRING_TOKEN(STR_SECURE_BOOT_DB_OPTION), … … 128 128 flags = INTERACTIVE, 129 129 key = KEY_SECURE_BOOT_DB_OPTION; 130 131 subtitle text = STRING_TOKEN(STR_NULL); 132 130 131 subtitle text = STRING_TOKEN(STR_NULL); 132 133 133 goto FORMID_SECURE_BOOT_DBX_OPTION_FORM, 134 134 prompt = STRING_TOKEN(STR_SECURE_BOOT_DBX_OPTION), … … 138 138 139 139 endform; 140 140 141 141 // 142 142 // ##3 Form: 'PK Options' … … 144 144 form formid = FORMID_SECURE_BOOT_PK_OPTION_FORM, 145 145 title = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION); 146 147 subtitle text = STRING_TOKEN(STR_NULL); 148 146 147 subtitle text = STRING_TOKEN(STR_NULL); 148 149 149 // 150 150 // Define of Check Box: 'Delete PK' … … 156 156 endcheckbox; 157 157 endif; 158 158 159 159 grayoutif ideqval SECUREBOOT_CONFIGURATION.HasPk == 1; 160 160 goto FORMID_ENROLL_PK_FORM, … … 164 164 key = KEY_ENROLL_PK; 165 165 endif; 166 167 subtitle text = STRING_TOKEN(STR_NULL); 168 169 // 170 // Display of Check Box: 'Delete Pk' 166 167 subtitle text = STRING_TOKEN(STR_NULL); 168 169 // 170 // Display of Check Box: 'Delete Pk' 171 171 // 172 172 grayoutif ideqval SECUREBOOT_CONFIGURATION.HideSecureBoot == 1; 173 173 checkbox varid = SECUREBOOT_CONFIGURATION.DeletePk, 174 174 questionid = KEY_SECURE_BOOT_DELETE_PK, 175 prompt = STRING_TOKEN(STR_DELETE_PK), 175 prompt = STRING_TOKEN(STR_DELETE_PK), 176 176 help = STRING_TOKEN(STR_DELETE_PK_HELP), 177 177 flags = INTERACTIVE | RESET_REQUIRED, … … 179 179 endif; 180 180 endform; 181 181 182 182 // 183 183 // ##4 Form: 'Enroll PK' … … 185 185 form formid = FORMID_ENROLL_PK_FORM, 186 186 title = STRING_TOKEN(STR_ENROLL_PK); 187 187 188 188 subtitle text = STRING_TOKEN(STR_NULL); 189 189 … … 194 194 key = SECUREBOOT_ADD_PK_FILE_FORM_ID; 195 195 endform; 196 196 197 197 // 198 198 // ##5 Form: 'KEK Options' … … 202 202 203 203 // 204 // Display of 'Enroll KEK' 204 // Display of 'Enroll KEK' 205 205 // 206 206 goto FORMID_ENROLL_KEK_FORM, … … 208 208 help = STRING_TOKEN(STR_ENROLL_KEK_HELP), 209 209 flags = INTERACTIVE; 210 211 subtitle text = STRING_TOKEN(STR_NULL); 212 213 // 214 // Display of 'Delete KEK' 210 211 subtitle text = STRING_TOKEN(STR_NULL); 212 213 // 214 // Display of 'Delete KEK' 215 215 // 216 216 goto FORMID_DELETE_KEK_FORM, … … 219 219 flags = INTERACTIVE, 220 220 key = KEY_DELETE_KEK; 221 222 subtitle text = STRING_TOKEN(STR_NULL); 223 endform; 224 225 // 226 // ##6 Form: 'Enroll KEK' 221 222 subtitle text = STRING_TOKEN(STR_NULL); 223 endform; 224 225 // 226 // ##6 Form: 'Enroll KEK' 227 227 // 228 228 form formid = FORMID_ENROLL_KEK_FORM, … … 259 259 flags = INTERACTIVE, 260 260 key = KEY_VALUE_SAVE_AND_EXIT_KEK; 261 261 262 262 goto FORMID_SECURE_BOOT_OPTION_FORM, 263 263 prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT), … … 270 270 // 271 271 // ##7 Form: 'Delete KEK' 272 // 272 // 273 273 form formid = FORMID_DELETE_KEK_FORM, 274 274 title = STRING_TOKEN(STR_DELETE_KEK_TITLE); … … 276 276 label LABEL_KEK_DELETE; 277 277 label LABEL_END; 278 279 subtitle text = STRING_TOKEN(STR_NULL); 280 278 279 subtitle text = STRING_TOKEN(STR_NULL); 280 281 281 endform; 282 282 … … 301 301 flags = INTERACTIVE, 302 302 key = SECUREBOOT_DELETE_SIGNATURE_FROM_DB; 303 303 304 304 endform; 305 305 … … 336 336 label LABEL_END; 337 337 subtitle text = STRING_TOKEN(STR_NULL); 338 338 339 339 endform; 340 340 … … 348 348 label LABEL_END; 349 349 subtitle text = STRING_TOKEN(STR_NULL); 350 350 351 351 endform; 352 352 … … 387 387 flags = INTERACTIVE, 388 388 key = KEY_VALUE_SAVE_AND_EXIT_DB; 389 389 390 390 goto FORMID_SECURE_BOOT_OPTION_FORM, 391 391 prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT), … … 432 432 flags = INTERACTIVE, 433 433 key = KEY_VALUE_SAVE_AND_EXIT_DBX; 434 434 435 435 goto FORMID_SECURE_BOOT_OPTION_FORM, 436 436 prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT), … … 450 450 label LABEL_END; 451 451 endform; 452 452 453 453 // 454 454 // File Explorer for KEK … … 490 490 label SECUREBOOT_ADD_PK_FILE_FORM_ID; 491 491 label LABEL_END; 492 492 493 493 subtitle text = STRING_TOKEN(STR_NULL); 494 494 -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDriver.c
r48674 r58466 3 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 36 36 EFI_STATUS Status; 37 37 SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData; 38 38 39 39 // 40 40 // If already started, return. … … 51 51 return EFI_ALREADY_STARTED; 52 52 } 53 53 54 54 // 55 55 // Create a private data structure. … … 59 59 return EFI_OUT_OF_RESOURCES; 60 60 } 61 61 62 62 // 63 63 // Install SecureBoot configuration form … … 70 70 // 71 71 // Install private GUID. 72 // 72 // 73 73 Status = gBS->InstallMultipleProtocolInterfaces ( 74 74 &ImageHandle, … … 87 87 if (PrivateData != NULL) { 88 88 UninstallSecureBootConfigForm (PrivateData); 89 } 90 89 } 90 91 91 return Status; 92 92 } … … 114 114 &gEfiCallerIdGuid, 115 115 (VOID **) &PrivateData 116 ); 116 ); 117 117 if (EFI_ERROR (Status)) { 118 return Status; 118 return Status; 119 119 } 120 120 121 121 ASSERT (PrivateData->Signature == SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE); 122 122 … … 127 127 NULL 128 128 ); 129 129 130 130 UninstallSecureBootConfigForm (PrivateData); 131 131 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
r58459 r58466 63 63 ## SOMETIMES_PRODUCES ## Variable:L"CustomMode" 64 64 gEfiCustomModeEnableGuid 65 65 66 66 ## SOMETIMES_CONSUMES ## Variable:L"SecureBootEnable" 67 67 ## SOMETIMES_PRODUCES ## Variable:L"SecureBootEnable" 68 68 gEfiSecureBootEnableDisableGuid 69 69 70 70 ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 71 71 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 72 72 gEfiCertRsa2048Guid 73 73 74 74 ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 75 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 75 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 76 76 gEfiCertX509Guid 77 77 78 78 ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 79 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 79 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 80 80 gEfiCertSha1Guid 81 81 82 82 ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 83 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 83 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 84 84 gEfiCertSha256Guid 85 85 86 86 ## SOMETIMES_CONSUMES ## Variable:L"db" 87 87 ## SOMETIMES_PRODUCES ## Variable:L"db" … … 89 89 ## SOMETIMES_PRODUCES ## Variable:L"dbx" 90 90 gEfiImageSecurityDatabaseGuid 91 91 92 92 ## SOMETIMES_CONSUMES ## Variable:L"SetupMode" 93 93 ## SOMETIMES_PRODUCES ## Variable:L"PK" … … 96 96 ## SOMETIMES_CONSUMES ## Variable:L"SecureBoot" 97 97 gEfiGlobalVariableGuid 98 98 99 99 gEfiIfrTianoGuid ## PRODUCES ## GUID # HII opcode 100 100 ## PRODUCES ## HII -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
r58459 r58466 66 66 67 67 /** 68 Helper function called as part of the code needed to allocate 68 Helper function called as part of the code needed to allocate 69 69 the proper sized buffer for various EFI interfaces. 70 70 … … 123 123 124 124 /** 125 Append file name to existing file name, and allocate a new buffer 125 Append file name to existing file name, and allocate a new buffer 126 126 to hold the appended result. 127 127 … … 150 150 ASSERT (Str != NULL); 151 151 152 TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16)); 152 TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16)); 153 153 ASSERT (TmpStr != NULL); 154 154 … … 171 171 172 172 // 173 // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of two strings 173 // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of two strings 174 174 // that overlap. 175 175 // … … 183 183 184 184 // 185 // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of two strings 185 // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of two strings 186 186 // that overlap. 187 187 // … … 197 197 198 198 FreePool (TmpStr); 199 199 200 200 return Str; 201 201 } … … 355 355 356 356 @param[in, out] MenuOption Menu to be freed 357 357 358 358 **/ 359 359 VOID … … 460 460 Attributes is valid only for EFI_FILE_MODE_CREATE. 461 461 462 @param[in, out] FilePath On input, the device path to the file. 462 @param[in, out] FilePath On input, the device path to the file. 463 463 On output, the remaining device path. 464 464 @param[out] FileHandle Pointer to the file handle. … … 496 496 EFI_FILE_PROTOCOL *Handle1; 497 497 EFI_FILE_PROTOCOL *Handle2; 498 EFI_HANDLE DeviceHandle; 498 EFI_HANDLE DeviceHandle; 499 499 500 500 if ((FilePath == NULL || FileHandle == NULL)) { … … 817 817 FreePool (SimpleFsHandle); 818 818 } 819 819 820 820 // 821 821 // Remember how many file system options are here … … 827 827 828 828 /** 829 Find files under the current directory. All files and sub-directories 829 Find files under the current directory. All files and sub-directories 830 830 in current directory will be stored in DirectoryMenu for future use. 831 831 … … 893 893 return EFI_OUT_OF_RESOURCES; 894 894 } 895 895 896 896 // 897 897 // Get all files in current directory … … 935 935 ); 936 936 NewMenuEntry->HelpString = NULL; 937 937 938 938 NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY); 939 939 if (NewFileContext->IsDir) { … … 978 978 // 979 979 // Free current updated date 980 // 980 // 981 981 if (mStartOpCodeHandle != NULL) { 982 982 HiiFreeOpCodeHandle (mStartOpCodeHandle); … … 1119 1119 FreeMenu (&FsOptionMenu); 1120 1120 FindFileSystem (); 1121 1121 1122 1122 CreateMenuStringToken (PrivateData->HiiHandle, &FsOptionMenu); 1123 1123 UpdateFileExplorePage (PrivateData->HiiHandle, &FsOptionMenu, PrivateData->FeCurrentState); … … 1163 1163 PrivateData->MenuEntry = NewMenuEntry; 1164 1164 PrivateData->FileContext->FileName = NewFileContext->FileName; 1165 1165 1166 1166 TmpDevicePath = NewFileContext->DevicePath; 1167 1167 OpenFileByDevicePath ( … … 1201 1201 1202 1202 /** 1203 Clean up the dynamic opcode at label and form specified by both LabelId. 1203 Clean up the dynamic opcode at label and form specified by both LabelId. 1204 1204 1205 1205 @param[in] LabelId It is both the Form ID and Label ID for opcode deletion. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
r58459 r58466 18 18 19 19 SECUREBOOT_CONFIG_PRIVATE_DATA mSecureBootConfigPrivateDateTemplate = { 20 SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE, 20 SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE, 21 21 { 22 22 SecureBootExtractConfig, … … 72 72 73 73 // 74 // Variable Definitions 75 // 74 // Variable Definitions 75 // 76 76 UINT32 mPeCoffHeaderOffset = 0; 77 77 WIN_CERTIFICATE *mCertificate = NULL; … … 110 110 ) 111 111 { 112 UINTN Index; 112 UINTN Index; 113 113 for (Index = 0; mDerEncodedSuffix[Index] != NULL; Index++) { 114 114 if (StrCmp (FileSuffix, mDerEncodedSuffix[Index]) == 0) { … … 148 148 Create a time based data payload by concatenating the EFI_VARIABLE_AUTHENTICATION_2 149 149 descriptor with the input data. NO authentication is required in this function. 150 150 151 151 @param[in, out] DataSize On input, the size of Data buffer in bytes. 152 152 On output, the size of data returned in Data 153 153 buffer in bytes. 154 @param[in, out] Data On input, Pointer to data buffer to be wrapped or 154 @param[in, out] Data On input, Pointer to data buffer to be wrapped or 155 155 pointer to NULL to wrap an empty payload. 156 156 On output, Pointer to the new payload date buffer allocated from pool, 157 it's caller's responsibility to free the memory when finish using it. 157 it's caller's responsibility to free the memory when finish using it. 158 158 159 159 @retval EFI_SUCCESS Create time based payload successfully. … … 176 176 UINTN DescriptorSize; 177 177 EFI_TIME Time; 178 178 179 179 if (Data == NULL || DataSize == NULL) { 180 180 return EFI_INVALID_PARAMETER; 181 181 } 182 183 // 184 // In Setup mode or Custom mode, the variable does not need to be signed but the 182 183 // 184 // In Setup mode or Custom mode, the variable does not need to be signed but the 185 185 // parameters to the SetVariable() call still need to be prepared as authenticated 186 186 // variable. So we create EFI_VARIABLE_AUTHENTICATED_2 descriptor without certificate … … 189 189 Payload = *Data; 190 190 PayloadSize = *DataSize; 191 191 192 192 DescriptorSize = OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo) + OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData); 193 193 NewData = (UINT8*) AllocateZeroPool (DescriptorSize + PayloadSize); … … 214 214 Time.Pad2 = 0; 215 215 CopyMem (&DescriptorData->TimeStamp, &Time, sizeof (EFI_TIME)); 216 216 217 217 DescriptorData->AuthInfo.Hdr.dwLength = OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData); 218 218 DescriptorData->AuthInfo.Hdr.wRevision = 0x0200; 219 219 DescriptorData->AuthInfo.Hdr.wCertificateType = WIN_CERT_TYPE_EFI_GUID; 220 220 CopyGuid (&DescriptorData->AuthInfo.CertType, &gEfiCertPkcs7Guid); 221 221 222 222 if (Payload != NULL) { 223 223 FreePool(Payload); 224 224 } 225 225 226 226 *DataSize = DescriptorSize + PayloadSize; 227 227 *Data = NewData; … … 288 288 @param[in] SecureBootMode New secure boot mode: STANDARD_SECURE_BOOT_MODE or 289 289 CUSTOM_SECURE_BOOT_MODE. 290 290 291 291 @return EFI_SUCCESS The platform has switched to the special mode successfully. 292 292 @return other Fail to operate the secure boot mode. 293 293 294 294 **/ 295 295 EFI_STATUS … … 298 298 ) 299 299 { 300 return gRT->SetVariable ( 300 return gRT->SetVariable ( 301 301 EFI_CUSTOM_MODE_NAME, 302 302 &gEfiCustomModeEnableGuid, … … 312 312 @param[in] X509File FileHandle of X509 Certificate storing file. 313 313 @param[out] PkCert Point to the data buffer to store the signature list. 314 314 315 315 @return EFI_UNSUPPORTED Unsupported Key Length. 316 316 @return EFI_OUT_OF_RESOURCES There are not enough memory resourses to form the signature list. 317 317 318 318 **/ 319 319 EFI_STATUS 320 320 CreatePkX509SignatureList ( 321 IN EFI_FILE_HANDLE X509File, 322 OUT EFI_SIGNATURE_LIST **PkCert 321 IN EFI_FILE_HANDLE X509File, 322 OUT EFI_SIGNATURE_LIST **PkCert 323 323 ) 324 324 { 325 EFI_STATUS Status; 325 EFI_STATUS Status; 326 326 UINT8 *X509Data; 327 327 UINTN X509DataSize; … … 330 330 X509Data = NULL; 331 331 PkCertData = NULL; 332 X509DataSize = 0; 333 332 X509DataSize = 0; 333 334 334 Status = ReadFileContent (X509File, (VOID**) &X509Data, &X509DataSize, 0); 335 335 if (EFI_ERROR (Status)) { … … 351 351 } 352 352 353 (*PkCert)->SignatureListSize = (UINT32) (sizeof(EFI_SIGNATURE_LIST) 353 (*PkCert)->SignatureListSize = (UINT32) (sizeof(EFI_SIGNATURE_LIST) 354 354 + sizeof(EFI_SIGNATURE_DATA) - 1 355 355 + X509DataSize); … … 357 357 (*PkCert)->SignatureHeaderSize = 0; 358 358 CopyGuid (&(*PkCert)->SignatureType, &gEfiCertX509Guid); 359 PkCertData = (EFI_SIGNATURE_DATA*) ((UINTN)(*PkCert) 359 PkCertData = (EFI_SIGNATURE_DATA*) ((UINTN)(*PkCert) 360 360 + sizeof(EFI_SIGNATURE_LIST) 361 361 + (*PkCert)->SignatureHeaderSize); 362 CopyGuid (&PkCertData->SignatureOwner, &gEfiGlobalVariableGuid); 362 CopyGuid (&PkCertData->SignatureOwner, &gEfiGlobalVariableGuid); 363 363 // 364 364 // Fill the PK database with PKpub data from X509 certificate file. 365 // 365 // 366 366 CopyMem (&(PkCertData->SignatureData[0]), X509Data, X509DataSize); 367 367 368 368 ON_EXIT: 369 369 370 370 if (X509Data != NULL) { 371 371 FreePool (X509Data); 372 372 } 373 373 374 374 if (EFI_ERROR(Status) && *PkCert != NULL) { 375 375 FreePool (*PkCert); 376 376 *PkCert = NULL; 377 377 } 378 378 379 379 return Status; 380 380 } … … 390 390 @retval EFI_INVALID_PARAMETER The parameter is invalid. 391 391 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources. 392 392 393 393 **/ 394 394 EFI_STATUS 395 395 EnrollPlatformKey ( 396 396 IN SECUREBOOT_CONFIG_PRIVATE_DATA* Private 397 ) 397 ) 398 398 { 399 399 EFI_STATUS Status; … … 403 403 UINT16* FilePostFix; 404 404 UINTN NameLength; 405 405 406 406 if (Private->FileContext->FileName == NULL) { 407 407 return EFI_INVALID_PARAMETER; … … 434 434 // 435 435 Status = CreatePkX509SignatureList ( 436 Private->FileContext->FHandle, 437 &PkCert 436 Private->FileContext->FHandle, 437 &PkCert 438 438 ); 439 439 if (EFI_ERROR (Status)) { … … 441 441 } 442 442 ASSERT (PkCert != NULL); 443 443 444 444 // 445 445 // Set Platform Key variable. 446 // 447 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 446 // 447 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 448 448 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 449 449 DataSize = PkCert->SignatureListSize; … … 453 453 goto ON_EXIT; 454 454 } 455 455 456 456 Status = gRT->SetVariable( 457 EFI_PLATFORM_KEY_NAME, 458 &gEfiGlobalVariableGuid, 459 Attr, 460 DataSize, 457 EFI_PLATFORM_KEY_NAME, 458 &gEfiGlobalVariableGuid, 459 Attr, 460 DataSize, 461 461 PkCert 462 462 ); … … 467 467 goto ON_EXIT; 468 468 } 469 469 470 470 ON_EXIT: 471 471 … … 473 473 FreePool(PkCert); 474 474 } 475 475 476 476 if (Private->FileContext->FHandle != NULL) { 477 477 CloseFile (Private->FileContext->FHandle); … … 487 487 @retval EFI_SUCCESS Delete PK successfully. 488 488 @retval Others Could not allow to delete PK. 489 489 490 490 **/ 491 491 EFI_STATUS … … 533 533 EFI_SIGNATURE_DATA *KEKSigData; 534 534 UINTN KekSigListSize; 535 UINT8 *KeyBuffer; 535 UINT8 *KeyBuffer; 536 536 UINTN KeyLenInBytes; 537 537 … … 545 545 KekSigList = NULL; 546 546 KekSigListSize = 0; 547 547 548 548 // 549 549 // Form the KeKpub certificate list into EFI_SIGNATURE_LIST type. 550 550 // First, We have to parse out public key data from the pbk key file. 551 // 551 // 552 552 Status = ReadFileContent ( 553 553 Private->FileContext->FHandle, … … 566 566 goto ON_EXIT; 567 567 } 568 568 569 569 // 570 570 // Convert the Public key to fix octet string format represented in RSA PKCS#1. 571 // 571 // 572 572 KeyLenInBytes = KeyInfo->KeyLengthInBits / 8; 573 573 KeyBuffer = AllocateZeroPool (KeyLenInBytes); … … 577 577 } 578 578 Int2OctStr ( 579 (UINTN*) (KeyBlob + sizeof (CPL_KEY_INFO)), 580 KeyLenInBytes / sizeof (UINTN), 581 KeyBuffer, 579 (UINTN*) (KeyBlob + sizeof (CPL_KEY_INFO)), 580 KeyLenInBytes / sizeof (UINTN), 581 KeyBuffer, 582 582 KeyLenInBytes 583 583 ); 584 584 CopyMem(KeyBlob + sizeof(CPL_KEY_INFO), KeyBuffer, KeyLenInBytes); 585 585 586 586 // 587 587 // Form an new EFI_SIGNATURE_LIST. … … 603 603 KekSigList->SignatureSize = sizeof(EFI_SIGNATURE_DATA) - 1 + WIN_CERT_UEFI_RSA2048_SIZE; 604 604 CopyGuid (&KekSigList->SignatureType, &gEfiCertRsa2048Guid); 605 605 606 606 KEKSigData = (EFI_SIGNATURE_DATA*)((UINT8*)KekSigList + sizeof(EFI_SIGNATURE_LIST)); 607 607 CopyGuid (&KEKSigData->SignatureOwner, Private->SignatureGUID); … … 611 611 WIN_CERT_UEFI_RSA2048_SIZE 612 612 ); 613 614 // 615 // Check if KEK entry has been already existed. 616 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 613 614 // 615 // Check if KEK entry has been already existed. 616 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 617 617 // new KEK to original variable. 618 // 619 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 618 // 619 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 620 620 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 621 621 Status = CreateTimeBasedPayload (&KekSigListSize, (UINT8**) &KekSigList); … … 626 626 627 627 Status = gRT->GetVariable( 628 EFI_KEY_EXCHANGE_KEY_NAME, 629 &gEfiGlobalVariableGuid, 630 NULL, 631 &DataSize, 628 EFI_KEY_EXCHANGE_KEY_NAME, 629 &gEfiGlobalVariableGuid, 630 NULL, 631 &DataSize, 632 632 NULL 633 633 ); … … 637 637 goto ON_EXIT; 638 638 } 639 639 640 640 // 641 641 // Done. Now we have formed the correct KEKpub database item, just set it into variable storage, 642 // 642 // 643 643 Status = gRT->SetVariable( 644 EFI_KEY_EXCHANGE_KEY_NAME, 645 &gEfiGlobalVariableGuid, 646 Attr, 647 KekSigListSize, 644 EFI_KEY_EXCHANGE_KEY_NAME, 645 &gEfiGlobalVariableGuid, 646 Attr, 647 KekSigListSize, 648 648 KekSigList 649 649 ); … … 651 651 goto ON_EXIT; 652 652 } 653 653 654 654 ON_EXIT: 655 655 … … 672 672 FreePool (KekSigList); 673 673 } 674 674 675 675 return Status; 676 676 } … … 690 690 EnrollX509ToKek ( 691 691 IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private 692 ) 692 ) 693 693 { 694 694 EFI_STATUS Status; … … 728 728 // 729 729 // Fill Certificate Database parameters. 730 // 730 // 731 731 KekSigList->SignatureListSize = (UINT32) KekSigListSize; 732 732 KekSigList->SignatureHeaderSize = 0; … … 739 739 740 740 // 741 // Check if KEK been already existed. 742 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 741 // Check if KEK been already existed. 742 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 743 743 // new kek to original variable 744 // 745 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 744 // 745 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 746 746 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 747 747 Status = CreateTimeBasedPayload (&KekSigListSize, (UINT8**) &KekSigList); … … 750 750 goto ON_EXIT; 751 751 } 752 752 753 753 Status = gRT->GetVariable( 754 EFI_KEY_EXCHANGE_KEY_NAME, 755 &gEfiGlobalVariableGuid, 756 NULL, 757 &DataSize, 754 EFI_KEY_EXCHANGE_KEY_NAME, 755 &gEfiGlobalVariableGuid, 756 NULL, 757 &DataSize, 758 758 NULL 759 759 ); … … 762 762 } else if (Status != EFI_NOT_FOUND) { 763 763 goto ON_EXIT; 764 } 764 } 765 765 766 766 Status = gRT->SetVariable( 767 EFI_KEY_EXCHANGE_KEY_NAME, 768 &gEfiGlobalVariableGuid, 769 Attr, 767 EFI_KEY_EXCHANGE_KEY_NAME, 768 &gEfiGlobalVariableGuid, 769 Attr, 770 770 KekSigListSize, 771 771 KekSigList … … 796 796 Enroll new KEK into the System without PK's authentication. 797 797 The SignatureOwner GUID will be Private->SignatureGUID. 798 798 799 799 @param[in] PrivateData The module's private data. 800 800 801 801 @retval EFI_SUCCESS New KEK enrolled successful. 802 802 @retval EFI_INVALID_PARAMETER The parameter is invalid. 803 803 @retval others Fail to enroll KEK data. 804 804 805 805 **/ 806 806 EFI_STATUS 807 807 EnrollKeyExchangeKey ( 808 808 IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private 809 ) 809 ) 810 810 { 811 811 UINT16* FilePostFix; 812 812 EFI_STATUS Status; 813 813 UINTN NameLength; 814 814 815 815 if ((Private->FileContext->FileName == NULL) || (Private->SignatureGUID == NULL)) { 816 816 return EFI_INVALID_PARAMETER; … … 823 823 824 824 // 825 // Parse the file's postfix. Supports DER-encoded X509 certificate, 825 // Parse the file's postfix. Supports DER-encoded X509 certificate, 826 826 // and .pbk as RSA public key file. 827 827 // … … 845 845 846 846 @param[in] PrivateData The module's private data. 847 @param[in] VariableName Variable name of signature database, must be 847 @param[in] VariableName Variable name of signature database, must be 848 848 EFI_IMAGE_SECURITY_DATABASE or EFI_IMAGE_SECURITY_DATABASE1. 849 849 850 850 @retval EFI_SUCCESS New X509 is enrolled successfully. 851 851 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources. … … 856 856 IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private, 857 857 IN CHAR16 *VariableName 858 ) 858 ) 859 859 { 860 860 EFI_STATUS Status; … … 897 897 // 898 898 // Fill Certificate Database parameters. 899 // 899 // 900 900 SigDBCert = (EFI_SIGNATURE_LIST*) Data; 901 901 SigDBCert->SignatureListSize = (UINT32) SigDBSize; … … 909 909 910 910 // 911 // Check if signature database entry has been already existed. 912 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 911 // Check if signature database entry has been already existed. 912 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 913 913 // new signature data to original variable 914 // 915 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 914 // 915 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 916 916 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 917 917 Status = CreateTimeBasedPayload (&SigDBSize, (UINT8**) &Data); … … 922 922 923 923 Status = gRT->GetVariable( 924 VariableName, 925 &gEfiImageSecurityDatabaseGuid, 926 NULL, 927 &DataSize, 924 VariableName, 925 &gEfiImageSecurityDatabaseGuid, 926 NULL, 927 &DataSize, 928 928 NULL 929 929 ); … … 932 932 } else if (Status != EFI_NOT_FOUND) { 933 933 goto ON_EXIT; 934 } 934 } 935 935 936 936 Status = gRT->SetVariable( 937 VariableName, 938 &gEfiImageSecurityDatabaseGuid, 939 Attr, 937 VariableName, 938 &gEfiImageSecurityDatabaseGuid, 939 Attr, 940 940 SigDBSize, 941 941 Data … … 977 977 EFI_STATUS 978 978 LoadPeImage ( 979 VOID 980 ) 979 VOID 980 ) 981 981 { 982 982 EFI_IMAGE_DOS_HEADER *DosHdr; … … 993 993 { 994 994 // 995 // DOS image header is present, 995 // DOS image header is present, 996 996 // So read the PE header after the DOS image header 997 997 // … … 1018 1018 // Note the size of FileHeader field is constant for both IA32 and X64 arch 1019 1019 // 1020 if ((NtHeader32->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32) 1020 if ((NtHeader32->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32) 1021 1021 || (NtHeader32->FileHeader.Machine == EFI_IMAGE_MACHINE_EBC)) { 1022 1022 // … … 1046 1046 1047 1047 @param[in] HashAlg Hash algorithm type. 1048 1048 1049 1049 @retval TRUE Successfully hash image. 1050 1050 @retval FALSE Fail in hash image. 1051 1051 1052 1052 **/ 1053 BOOLEAN 1053 BOOLEAN 1054 1054 HashPeImage ( 1055 1055 IN UINT32 HashAlg … … 1075 1075 return FALSE; 1076 1076 } 1077 1077 1078 1078 // 1079 1079 // Initialize context of hash. … … 1083 1083 if (HashAlg == HASHALG_SHA1) { 1084 1084 mImageDigestSize = SHA1_DIGEST_SIZE; 1085 mCertType = gEfiCertSha1Guid; 1085 mCertType = gEfiCertSha1Guid; 1086 1086 } else if (HashAlg == HASHALG_SHA256) { 1087 1087 mImageDigestSize = SHA256_DIGEST_SIZE; … … 1090 1090 1091 1091 CtxSize = mHash[HashAlg].GetContextSize(); 1092 1092 1093 1093 HashCtx = AllocatePool (CtxSize); 1094 1094 ASSERT (HashCtx != NULL); … … 1107 1107 if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 1108 1108 // 1109 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 1110 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 1109 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 1110 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 1111 1111 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 1112 1112 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 1119 1119 Magic = mNtHeader.Pe32->OptionalHeader.Magic; 1120 1120 } 1121 1121 1122 1122 // 1123 1123 // 3. Calculate the distance from the base of the image header to the image checksum address. … … 1155 1155 // 1156 1156 // Use PE32+ offset. 1157 // 1157 // 1158 1158 HashBase = (UINT8 *) &mNtHeader.Pe32Plus->OptionalHeader.CheckSum + sizeof (UINT32); 1159 1159 HashSize = (UINTN) ((UINT8 *) (&mNtHeader.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]) - HashBase); … … 1278 1278 mImageSize - 1279 1279 mNtHeader.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size - 1280 SumOfBytesHashed); 1280 SumOfBytesHashed); 1281 1281 } 1282 1282 … … 1300 1300 1301 1301 /** 1302 Recognize the Hash algorithm in PE/COFF Authenticode and caculate hash of 1303 Pe/Coff image based on the authenticated image hashing in PE/COFF Specification 1302 Recognize the Hash algorithm in PE/COFF Authenticode and caculate hash of 1303 Pe/Coff image based on the authenticated image hashing in PE/COFF Specification 1304 1304 8.0 Appendix A 1305 1305 … … 1308 1308 1309 1309 **/ 1310 EFI_STATUS 1310 EFI_STATUS 1311 1311 HashPeImageByType ( 1312 1312 VOID … … 1318 1318 PkcsCertData = (WIN_CERTIFICATE_EFI_PKCS *) (mImageBase + mSecDataDir->Offset); 1319 1319 1320 for (Index = 0; Index < HASHALG_MAX; Index++) { 1320 for (Index = 0; Index < HASHALG_MAX; Index++) { 1321 1321 // 1322 1322 // Check the Hash algorithm in PE/COFF Authenticode. 1323 // According to PKCS#7 Definition: 1323 // According to PKCS#7 Definition: 1324 1324 // SignedData ::= SEQUENCE { 1325 1325 // version Version, … … 1338 1338 } 1339 1339 1340 // 1340 // 1341 1341 if (CompareMem (PkcsCertData->CertData + 32, mHash[Index].OidValue, mHash[Index].OidLength) == 0) { 1342 1342 break; … … 1359 1359 1360 1360 /** 1361 Enroll a new executable's signature into Signature Database. 1361 Enroll a new executable's signature into Signature Database. 1362 1362 1363 1363 @param[in] PrivateData The module's private data. 1364 @param[in] VariableName Variable name of signature database, must be 1364 @param[in] VariableName Variable name of signature database, must be 1365 1365 EFI_IMAGE_SECURITY_DATABASE or EFI_IMAGE_SECURITY_DATABASE1. 1366 1366 … … 1403 1403 Status = ReadFileContent( 1404 1404 Private->FileContext->FHandle, 1405 (VOID **) &mImageBase, 1406 &mImageSize, 1405 (VOID **) &mImageBase, 1406 &mImageSize, 1407 1407 0 1408 1408 ); 1409 1409 if (EFI_ERROR (Status)) { 1410 1410 goto ON_EXIT; 1411 } 1411 } 1412 1412 ASSERT (mImageBase != NULL); 1413 1413 … … 1423 1423 } 1424 1424 } else { 1425 1425 1426 1426 // 1427 1427 // Read the certificate data … … 1440 1440 goto ON_EXIT;; 1441 1441 } 1442 1442 1443 1443 } else if (mCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) { 1444 1444 … … 1456 1456 // Create a new SigDB entry. 1457 1457 // 1458 SigDBSize = sizeof(EFI_SIGNATURE_LIST) 1458 SigDBSize = sizeof(EFI_SIGNATURE_LIST) 1459 1459 + sizeof(EFI_SIGNATURE_DATA) - 1 1460 1460 + (UINT32) mImageDigestSize; … … 1465 1465 goto ON_EXIT; 1466 1466 } 1467 1467 1468 1468 // 1469 1469 // Adjust the Certificate Database parameters. 1470 // 1470 // 1471 1471 SigDBCert = (EFI_SIGNATURE_LIST*) Data; 1472 1472 SigDBCert->SignatureListSize = (UINT32) SigDBSize; … … 1479 1479 CopyMem (SigDBCertData->SignatureData, mImageDigest, mImageDigestSize); 1480 1480 1481 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 1481 Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 1482 1482 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; 1483 1483 Status = CreateTimeBasedPayload (&SigDBSize, (UINT8**) &Data); … … 1486 1486 goto ON_EXIT; 1487 1487 } 1488 1489 // 1490 // Check if SigDB variable has been already existed. 1491 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 1488 1489 // 1490 // Check if SigDB variable has been already existed. 1491 // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the 1492 1492 // new signature data to original variable 1493 // 1493 // 1494 1494 DataSize = 0; 1495 1495 Status = gRT->GetVariable( 1496 VariableName, 1497 &gEfiImageSecurityDatabaseGuid, 1498 NULL, 1499 &DataSize, 1496 VariableName, 1497 &gEfiImageSecurityDatabaseGuid, 1498 NULL, 1499 &DataSize, 1500 1500 NULL 1501 1501 ); … … 1504 1504 } else if (Status != EFI_NOT_FOUND) { 1505 1505 goto ON_EXIT; 1506 } 1506 } 1507 1507 1508 1508 // … … 1510 1510 // 1511 1511 Status = gRT->SetVariable( 1512 VariableName, 1513 &gEfiImageSecurityDatabaseGuid, 1514 Attr, 1515 SigDBSize, 1512 VariableName, 1513 &gEfiImageSecurityDatabaseGuid, 1514 Attr, 1515 SigDBSize, 1516 1516 Data 1517 1517 ); … … 1546 1546 Enroll signature into DB/DBX without KEK's authentication. 1547 1547 The SignatureOwner GUID will be Private->SignatureGUID. 1548 1548 1549 1549 @param[in] PrivateData The module's private data. 1550 @param[in] VariableName Variable name of signature database, must be 1550 @param[in] VariableName Variable name of signature database, must be 1551 1551 EFI_IMAGE_SECURITY_DATABASE or EFI_IMAGE_SECURITY_DATABASE1. 1552 1552 1553 1553 @retval EFI_SUCCESS New signature enrolled successfully. 1554 1554 @retval EFI_INVALID_PARAMETER The parameter is invalid. 1555 1555 @retval others Fail to enroll signature data. 1556 1556 1557 1557 **/ 1558 1558 EFI_STATUS … … 1560 1560 IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private, 1561 1561 IN CHAR16 *VariableName 1562 ) 1562 ) 1563 1563 { 1564 1564 UINT16* FilePostFix; … … 1574 1574 return Status; 1575 1575 } 1576 1577 // 1578 // Parse the file's postfix. 1576 1577 // 1578 // Parse the file's postfix. 1579 1579 // 1580 1580 NameLength = StrLen (Private->FileContext->FileName); … … 1606 1606 @retval EFI_SUCCESS Success to update the signature list page 1607 1607 @retval EFI_OUT_OF_RESOURCES Unable to allocate required resources. 1608 1608 1609 1609 **/ 1610 1610 EFI_STATUS … … 1625 1625 VOID *EndOpCodeHandle; 1626 1626 EFI_IFR_GUID_LABEL *StartLabel; 1627 EFI_IFR_GUID_LABEL *EndLabel; 1627 EFI_IFR_GUID_LABEL *EndLabel; 1628 1628 UINTN DataSize; 1629 1629 UINT8 *Data; … … 1641 1641 StartOpCodeHandle = NULL; 1642 1642 EndOpCodeHandle = NULL; 1643 1643 1644 1644 // 1645 1645 // Initialize the container for dynamic opcodes. … … 1648 1648 if (StartOpCodeHandle == NULL) { 1649 1649 Status = EFI_OUT_OF_RESOURCES; 1650 goto ON_EXIT; 1650 goto ON_EXIT; 1651 1651 } 1652 1652 … … 1654 1654 if (EndOpCodeHandle == NULL) { 1655 1655 Status = EFI_OUT_OF_RESOURCES; 1656 goto ON_EXIT; 1656 goto ON_EXIT; 1657 1657 } 1658 1658 … … 1682 1682 // 1683 1683 DataSize = 0; 1684 Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, Data); 1684 Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, Data); 1685 1685 if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) { 1686 1686 goto ON_EXIT; … … 1732 1732 CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize; 1733 1733 for (Index = 0; Index < CertCount; Index++) { 1734 Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList 1735 + sizeof (EFI_SIGNATURE_LIST) 1736 + CertList->SignatureHeaderSize 1734 Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList 1735 + sizeof (EFI_SIGNATURE_LIST) 1736 + CertList->SignatureHeaderSize 1737 1737 + Index * CertList->SignatureSize); 1738 1738 // 1739 // Display GUID and help 1739 // Display GUID and help 1740 1740 // 1741 1741 GuidToString (&Cert->SignatureOwner, GuidStr, 100); … … 1744 1744 StartOpCodeHandle, 1745 1745 (EFI_QUESTION_ID) (QuestionIdBase + GuidIndex++), 1746 0, 1747 0, 1748 GuidID, 1746 0, 1747 0, 1748 GuidID, 1749 1749 Help, 1750 1750 EFI_IFR_FLAG_CALLBACK, 1751 1751 0, 1752 1752 NULL 1753 ); 1753 ); 1754 1754 } 1755 1755 … … 1774 1774 HiiFreeOpCodeHandle (EndOpCodeHandle); 1775 1775 } 1776 1776 1777 1777 if (Data != NULL) { 1778 1778 FreePool (Data); … … 1787 1787 1788 1788 /** 1789 Delete a KEK entry from KEK database. 1789 Delete a KEK entry from KEK database. 1790 1790 1791 1791 @param[in] PrivateData Module's private data. … … 1794 1794 @retval EFI_SUCCESS Delete kek item successfully. 1795 1795 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources. 1796 1796 1797 1797 **/ 1798 1798 EFI_STATUS … … 1822 1822 CertList = NULL; 1823 1823 Cert = NULL; 1824 Attr = 0; 1824 Attr = 0; 1825 1825 DeleteKekIndex = QuestionId - OPTION_DEL_KEK_QUESTION_ID; 1826 1826 … … 1829 1829 return Status; 1830 1830 } 1831 1831 1832 1832 // 1833 1833 // Get original KEK variable. 1834 // 1835 DataSize = 0; 1834 // 1835 DataSize = 0; 1836 1836 Status = gRT->GetVariable (EFI_KEY_EXCHANGE_KEY_NAME, &gEfiGlobalVariableGuid, NULL, &DataSize, NULL); 1837 1837 if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) { … … 1841 1841 OldData = (UINT8*)AllocateZeroPool(DataSize); 1842 1842 if (OldData == NULL) { 1843 Status = EFI_OUT_OF_RESOURCES; 1843 Status = EFI_OUT_OF_RESOURCES; 1844 1844 goto ON_EXIT; 1845 1845 } … … 1851 1851 1852 1852 // 1853 // Allocate space for new variable. 1853 // Allocate space for new variable. 1854 1854 // 1855 1855 Data = (UINT8*) AllocateZeroPool (DataSize); … … 1881 1881 // 1882 1882 NewCertList->SignatureListSize -= CertList->SignatureSize; 1883 IsKEKItemFound = TRUE; 1883 IsKEKItemFound = TRUE; 1884 1884 } else { 1885 1885 // … … 1899 1899 Offset += CertList->SignatureListSize; 1900 1900 } 1901 1901 1902 1902 KekDataSize -= CertList->SignatureListSize; 1903 1903 CertList = (EFI_SIGNATURE_LIST*) ((UINT8*) CertList + CertList->SignatureListSize); … … 1925 1925 CopyMem (OldData + Offset, CertList, CertList->SignatureListSize); 1926 1926 Offset += CertList->SignatureListSize; 1927 } 1927 } 1928 1928 KekDataSize -= CertList->SignatureListSize; 1929 1929 CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize); … … 1940 1940 1941 1941 Status = gRT->SetVariable( 1942 EFI_KEY_EXCHANGE_KEY_NAME, 1943 &gEfiGlobalVariableGuid, 1944 Attr, 1945 DataSize, 1942 EFI_KEY_EXCHANGE_KEY_NAME, 1943 &gEfiGlobalVariableGuid, 1944 Attr, 1945 DataSize, 1946 1946 OldData 1947 1947 ); … … 1950 1950 goto ON_EXIT; 1951 1951 } 1952 1952 1953 1953 ON_EXIT: 1954 1954 if (Data != NULL) { … … 1961 1961 1962 1962 return UpdateDeletePage ( 1963 PrivateData, 1963 PrivateData, 1964 1964 EFI_KEY_EXCHANGE_KEY_NAME, 1965 1965 &gEfiGlobalVariableGuid, … … 1980 1980 @param[in] QuestionIdBase Base question id of the signature list. 1981 1981 @param[in] DeleteIndex Signature index to delete. 1982 1982 1983 1983 @retval EFI_SUCCESS Delete siganture successfully. 1984 1984 @retval EFI_NOT_FOUND Can't find the signature item, … … 2015 2015 CertList = NULL; 2016 2016 Cert = NULL; 2017 Attr = 0; 2017 Attr = 0; 2018 2018 2019 2019 Status = SetSecureBootMode(CUSTOM_SECURE_BOOT_MODE); … … 2024 2024 // 2025 2025 // Get original signature list data. 2026 // 2026 // 2027 2027 DataSize = 0; 2028 2028 Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, NULL); … … 2033 2033 OldData = (UINT8 *) AllocateZeroPool (DataSize); 2034 2034 if (OldData == NULL) { 2035 Status = EFI_OUT_OF_RESOURCES; 2035 Status = EFI_OUT_OF_RESOURCES; 2036 2036 goto ON_EXIT; 2037 2037 } … … 2040 2040 if (EFI_ERROR(Status)) { 2041 2041 goto ON_EXIT; 2042 } 2043 2044 // 2045 // Allocate space for new variable. 2042 } 2043 2044 // 2045 // Allocate space for new variable. 2046 2046 // 2047 2047 Data = (UINT8*) AllocateZeroPool (DataSize); … … 2079 2079 // 2080 2080 NewCertList->SignatureListSize -= CertList->SignatureSize; 2081 IsItemFound = TRUE; 2081 IsItemFound = TRUE; 2082 2082 } else { 2083 2083 // … … 2097 2097 Offset += CertList->SignatureListSize; 2098 2098 } 2099 2099 2100 2100 ItemDataSize -= CertList->SignatureListSize; 2101 2101 CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize); … … 2123 2123 CopyMem (OldData + Offset, (UINT8*)(CertList), CertList->SignatureListSize); 2124 2124 Offset += CertList->SignatureListSize; 2125 } 2125 } 2126 2126 ItemDataSize -= CertList->SignatureListSize; 2127 2127 CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize); … … 2138 2138 2139 2139 Status = gRT->SetVariable( 2140 VariableName, 2141 VendorGuid, 2142 Attr, 2143 DataSize, 2140 VariableName, 2141 VendorGuid, 2142 Attr, 2143 DataSize, 2144 2144 OldData 2145 2145 ); … … 2148 2148 goto ON_EXIT; 2149 2149 } 2150 2150 2151 2151 ON_EXIT: 2152 2152 if (Data != NULL) { … … 2159 2159 2160 2160 return UpdateDeletePage ( 2161 PrivateData, 2161 PrivateData, 2162 2162 VariableName, 2163 2163 VendorGuid, … … 2170 2170 /** 2171 2171 This function extracts configuration from variable. 2172 2172 2173 2173 @param[in, out] ConfigData Point to SecureBoot configuration private data. 2174 2174 … … 2177 2177 SecureBootExtractConfigFromVariable ( 2178 2178 IN OUT SECUREBOOT_CONFIGURATION *ConfigData 2179 ) 2179 ) 2180 2180 { 2181 2181 UINT8 *SecureBootEnable; … … 2186 2186 SetupMode = NULL; 2187 2187 SecureBootMode = NULL; 2188 2188 2189 2189 // 2190 2190 // If the SecureBootEnable Variable doesn't exist, hide the SecureBoot Enable/Disable … … 2201 2201 } 2202 2202 } 2203 2203 2204 2204 // 2205 2205 // If it is Physical Presence User, set the PhysicalPresent to true. … … 2210 2210 ConfigData->PhysicalPresent = FALSE; 2211 2211 } 2212 2212 2213 2213 // 2214 2214 // If there is no PK then the Delete Pk button will be gray. … … 2290 2290 return EFI_INVALID_PARAMETER; 2291 2291 } 2292 2292 2293 2293 AllocatedRequest = FALSE; 2294 2294 ConfigRequestHdr = NULL; … … 2296 2296 Size = 0; 2297 2297 SecureBoot = NULL; 2298 2298 2299 2299 ZeroMem (&Configuration, sizeof (Configuration)); 2300 2300 PrivateData = SECUREBOOT_CONFIG_PRIVATE_FROM_THIS (This); 2301 2301 *Progress = Request; 2302 2302 2303 2303 if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gSecureBootConfigFormSetGuid, mSecureBootStorageName)) { 2304 2304 return EFI_NOT_FOUND; … … 2322 2322 FreePool (SecureBoot); 2323 2323 } 2324 2324 2325 2325 BufferSize = sizeof (SECUREBOOT_CONFIGURATION); 2326 2326 ConfigRequest = Request; … … 2400 2400 UINTN BufferSize; 2401 2401 EFI_STATUS Status; 2402 2402 2403 2403 if (Configuration == NULL || Progress == NULL) { 2404 2404 return EFI_INVALID_PARAMETER; … … 2481 2481 { 2482 2482 EFI_INPUT_KEY Key; 2483 EFI_STATUS Status; 2483 EFI_STATUS Status; 2484 2484 SECUREBOOT_CONFIG_PRIVATE_DATA *Private; 2485 2485 UINTN BufferSize; … … 2506 2506 return EFI_SUCCESS; 2507 2507 } 2508 2508 2509 2509 if (Action == EFI_BROWSER_ACTION_RETRIEVE) { 2510 2510 Status = EFI_UNSUPPORTED; … … 2517 2517 return Status; 2518 2518 } 2519 2519 2520 2520 if ((Action != EFI_BROWSER_ACTION_CHANGED) && 2521 2521 (Action != EFI_BROWSER_ACTION_CHANGING) && … … 2524 2524 return EFI_UNSUPPORTED; 2525 2525 } 2526 2526 2527 2527 Private = SECUREBOOT_CONFIG_PRIVATE_FROM_THIS (This); 2528 2528 … … 2539 2539 2540 2540 HiiGetBrowserData (&gSecureBootConfigFormSetGuid, mSecureBootStorageName, BufferSize, (UINT8 *) IfrNvData); 2541 2541 2542 2542 if (Action == EFI_BROWSER_ACTION_CHANGING) { 2543 2543 … … 2596 2596 // Refresh selected file. 2597 2597 // 2598 CleanUpPage (LabelId, Private); 2598 CleanUpPage (LabelId, Private); 2599 2599 break; 2600 2600 2601 2601 case SECUREBOOT_ADD_PK_FILE_FORM_ID: 2602 2602 case FORMID_ENROLL_KEK_FORM: … … 2618 2618 break; 2619 2619 2620 case KEY_SECURE_BOOT_DELETE_PK: 2620 case KEY_SECURE_BOOT_DELETE_PK: 2621 2621 if (Value->u8) { 2622 2622 CreatePopUp ( … … 2643 2643 case KEY_DELETE_KEK: 2644 2644 UpdateDeletePage ( 2645 Private, 2645 Private, 2646 2646 EFI_KEY_EXCHANGE_KEY_NAME, 2647 2647 &gEfiGlobalVariableGuid, 2648 2648 LABEL_KEK_DELETE, 2649 2649 FORMID_DELETE_KEK_FORM, 2650 OPTION_DEL_KEK_QUESTION_ID 2650 OPTION_DEL_KEK_QUESTION_ID 2651 2651 ); 2652 2652 break; 2653 2653 2654 case SECUREBOOT_DELETE_SIGNATURE_FROM_DB: 2654 case SECUREBOOT_DELETE_SIGNATURE_FROM_DB: 2655 2655 UpdateDeletePage ( 2656 2656 Private, … … 2726 2726 EFI_IMAGE_SECURITY_DATABASE, 2727 2727 &gEfiImageSecurityDatabaseGuid, 2728 LABEL_DB_DELETE, 2728 LABEL_DB_DELETE, 2729 2729 SECUREBOOT_DELETE_SIGNATURE_FROM_DB, 2730 2730 OPTION_DEL_DB_QUESTION_ID, … … 2737 2737 EFI_IMAGE_SECURITY_DATABASE1, 2738 2738 &gEfiImageSecurityDatabaseGuid, 2739 LABEL_DBX_DELETE, 2739 LABEL_DBX_DELETE, 2740 2740 SECUREBOOT_DELETE_SIGNATURE_FROM_DBX, 2741 2741 OPTION_DEL_DBX_QUESTION_ID, … … 2749 2749 case KEY_SECURE_BOOT_ENABLE: 2750 2750 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY; 2751 break; 2751 break; 2752 2752 case KEY_VALUE_SAVE_AND_EXIT_PK: 2753 2753 Status = EnrollPlatformKey (Private); … … 2767 2767 ); 2768 2768 } else { 2769 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_RESET; 2770 } 2769 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_RESET; 2770 } 2771 2771 break; 2772 2772 … … 2780 2780 Private->FileContext->FileName = NULL; 2781 2781 } 2782 2782 2783 2783 if (Private->SignatureGUID != NULL) { 2784 2784 FreePool (Private->SignatureGUID); … … 2787 2787 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; 2788 2788 break; 2789 2789 2790 2790 case KEY_SECURE_BOOT_MODE: 2791 2791 mIsEnterSecureBootForm = FALSE; … … 2855 2855 } 2856 2856 } 2857 2857 2858 2858 if (!EFI_ERROR (Status)) { 2859 2859 BufferSize = sizeof (SECUREBOOT_CONFIGURATION); … … 2861 2861 } 2862 2862 FreePool (IfrNvData); 2863 2863 2864 2864 return EFI_SUCCESS; 2865 2865 } … … 2927 2927 PrivateData->FileContext = AllocateZeroPool (sizeof (SECUREBOOT_FILE_CONTEXT)); 2928 2928 PrivateData->MenuEntry = AllocateZeroPool (sizeof (SECUREBOOT_MENU_ENTRY)); 2929 2929 2930 2930 if (PrivateData->FileContext == NULL || PrivateData->MenuEntry == NULL) { 2931 2931 UninstallSecureBootConfigForm (PrivateData); 2932 2932 return EFI_OUT_OF_RESOURCES; 2933 2933 } 2934 2934 2935 2935 PrivateData->FeCurrentState = FileExplorerStateInActive; 2936 2936 PrivateData->FeDisplayContext = FileExplorerDisplayUnknown; 2937 2937 2938 2938 InitializeListHead (&FsOptionMenu.Head); 2939 2939 InitializeListHead (&DirectoryMenu.Head); … … 2976 2976 mEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 2977 2977 mEndLabel->Number = LABEL_END; 2978 2978 2979 2979 return EFI_SUCCESS; 2980 2980 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
r58459 r58466 317 317 CHAR16 *Name; ///< Name for Hash Algorithm 318 318 UINTN DigestLength; ///< Digest Length 319 UINT8 *OidValue; ///< Hash Algorithm OID ASN.1 Value 319 UINT8 *OidValue; ///< Hash Algorithm OID ASN.1 Value 320 320 UINTN OidLength; ///< Length of Hash OID Value 321 321 HASH_GET_CONTEXT_SIZE GetContextSize; ///< Pointer to Hash GetContentSize function … … 472 472 473 473 /** 474 Clean up the dynamic opcode at label and form specified by both LabelId. 474 Clean up the dynamic opcode at label and form specified by both LabelId. 475 475 476 476 @param[in] LabelId It is both the Form ID and Label ID for opcode deletion. … … 506 506 507 507 @param[in, out] MenuOption Menu to be freed 508 508 509 509 **/ 510 510 VOID … … 515 515 516 516 /** 517 Read file content into BufferPtr, the size of the allocate buffer 517 Read file content into BufferPtr, the size of the allocate buffer 518 518 is *FileSize plus AddtionAllocateSize. 519 519 … … 521 521 @param[in, out] BufferPtr Pointers to the pointer of allocated buffer. 522 522 @param[out] FileSize Size of input file 523 @param[in] AddtionAllocateSize Addtion size the buffer need to be allocated. 523 @param[in] AddtionAllocateSize Addtion size the buffer need to be allocated. 524 524 In case the buffer need to contain others besides the file content. 525 525 526 526 @retval EFI_SUCCESS The file was read into the buffer. 527 527 @retval EFI_INVALID_PARAMETER A parameter was invalid. … … 543 543 544 544 @param[in] FileHandle The file handle to close. 545 545 546 546 **/ 547 547 VOID … … 556 556 @param[in] Integer Pointer to the nonnegative integer to be converted 557 557 @param[in] IntSizeInWords Length of integer buffer in words 558 @param[out] OctetString Converted octet string of the specified length 558 @param[out] OctetString Converted octet string of the specified length 559 559 @param[in] OSSizeInBytes Intended length of resulting octet string in bytes 560 560 … … 588 588 EFI_STATUS 589 589 StringToGuid ( 590 IN CHAR16 *Str, 591 IN UINTN StrLen, 590 IN CHAR16 *Str, 591 IN UINTN StrLen, 592 592 OUT EFI_GUID *Guid 593 593 ); … … 600 600 @param[in] Buffer Buffer to print Guid into. 601 601 @param[in] BufferSize Size of Buffer. 602 602 603 603 @retval Number of characters printed. 604 604 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigMisc.c
r48674 r58466 16 16 17 17 /** 18 Read file content into BufferPtr, the size of the allocate buffer 18 Read file content into BufferPtr, the size of the allocate buffer 19 19 is *FileSize plus AddtionAllocateSize. 20 20 … … 22 22 @param[in, out] BufferPtr Pointers to the pointer of allocated buffer. 23 23 @param[out] FileSize Size of input file 24 @param[in] AddtionAllocateSize Addtion size the buffer need to be allocated. 24 @param[in] AddtionAllocateSize Addtion size the buffer need to be allocated. 25 25 In case the buffer need to contain others besides the file content. 26 26 27 27 @retval EFI_SUCCESS The file was read into the buffer. 28 28 @retval EFI_INVALID_PARAMETER A parameter was invalid. … … 63 63 goto ON_EXIT; 64 64 } 65 65 66 66 Status = FileHandle->SetPosition (FileHandle, 0); 67 67 if (EFI_ERROR (Status)) { … … 87 87 88 88 ON_EXIT: 89 89 90 90 *BufferPtr = Buffer; 91 91 return Status; … … 96 96 97 97 @param[in] FileHandle The file handle to close. 98 98 99 99 **/ 100 100 VOID … … 104 104 { 105 105 if (FileHandle != NULL) { 106 FileHandle->Close (FileHandle); 106 FileHandle->Close (FileHandle); 107 107 } 108 108 } … … 113 113 @param[in] Integer Pointer to the nonnegative integer to be converted 114 114 @param[in] IntSizeInWords Length of integer buffer in words 115 @param[out] OctetString Converted octet string of the specified length 115 @param[out] OctetString Converted octet string of the specified length 116 116 @param[in] OSSizeInBytes Intended length of resulting octet string in bytes 117 117 … … 139 139 *Ptr2 = *Ptr1; 140 140 } 141 141 142 142 for (; Ptr1 < (CONST UINT8 *)(Integer + IntSizeInWords) && *Ptr1 == 0; Ptr1++); 143 143 144 144 if (Ptr1 < (CONST UINT8 *)(Integer + IntSizeInWords)) { 145 145 return EFI_BUFFER_TOO_SMALL; 146 146 } 147 147 148 148 if (Ptr2 >= OctetString) { 149 149 ZeroMem (OctetString, Ptr2 - OctetString + 1); 150 150 } 151 151 152 152 return EFI_SUCCESS; 153 153 } … … 168 168 EFI_STATUS 169 169 StringToGuid ( 170 IN CHAR16 *Str, 171 IN UINTN StrLen, 170 IN CHAR16 *Str, 171 IN UINTN StrLen, 172 172 OUT EFI_GUID *Guid 173 173 ) … … 191 191 // 192 192 PtrBuffer = Buffer; 193 PtrPosition = PtrBuffer; 193 PtrPosition = PtrBuffer; 194 194 while (*PtrBuffer != L'\0') { 195 195 if (*PtrBuffer == L'-') { … … 288 288 289 289 FreePool (Buffer); 290 290 291 291 return EFI_SUCCESS; 292 292 } … … 298 298 @param[in] Buffer Buffer to print Guid into. 299 299 @param[in] BufferSize Size of Buffer. 300 300 301 301 @retval Number of characters printed. 302 302 … … 313 313 Size = UnicodeSPrint ( 314 314 Buffer, 315 BufferSize, 315 BufferSize, 316 316 L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 317 (UINTN)Guid->Data1, 317 (UINTN)Guid->Data1, 318 318 (UINTN)Guid->Data2, 319 319 (UINTN)Guid->Data3, -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h
r58459 r58466 3 3 4 4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 94 94 // Question ID 0x4000 ~ 0x4FFF is for DBX 95 95 // 96 #define OPTION_DEL_DBX_QUESTION_ID 0x4000 96 #define OPTION_DEL_DBX_QUESTION_ID 0x4000 97 97 98 98 #define FILE_OPTION_GOTO_OFFSET 0xC000 … … 113 113 BOOLEAN PhysicalPresent; //If a Physical Present User; 114 114 UINT8 SecureBootMode; //Secure Boot Mode: Standard Or Custom 115 BOOLEAN DeletePk; 115 BOOLEAN DeletePk; 116 116 BOOLEAN HasPk; //If Pk is existed it is true; 117 117 } SECUREBOOT_CONFIGURATION; -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
Note:
See TracChangeset
for help on using the changeset viewer.