VirtualBox

Ignore:
Timestamp:
Oct 29, 2015 4:30:44 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103777
Message:

EFI/Firmware: Merged in the svn:eol-style, svn:mime-type and trailing whitespace cleanup that was done after the initial UDK2014.SP1 import: svn merge /vendor/edk2/UDK2014.SP1 /vendor/edk2/current .

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
209 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware

  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/RngTest/RngTest.c

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
    13 **/       
     13**/
    1414
    1515#include <Uefi.h>
     
    2525  as the real entry point for the application.
    2626
    27   @param[in] ImageHandle    The firmware allocated handle for the EFI image. 
     27  @param[in] ImageHandle    The firmware allocated handle for the EFI image.
    2828  @param[in] SystemTable    A pointer to the EFI System Table.
    29  
     29
    3030  @retval EFI_SUCCESS       The entry point is executed successfully.
    3131  @retval other             Some error occurs when executing this entry point.
     
    5353  PtrRngAlg = NULL;
    5454  Rand      = NULL;
    55    
     55
    5656  Print (L"UEFI RNG Protocol Testing :\n");
    5757  Print (L"----------------------------\n");
     
    7272  // Rng->GetInfo() interface test.
    7373  //-----------------------------------------
    74  
     74
    7575  Print (L" -- Call RNG->GetInfo() interface : ");
    7676  RngAlgListSize = 0;
     
    9191             PtrRngAlg->Data2, PtrRngAlg->Data3, PtrRngAlg->Data4[0], PtrRngAlg->Data4[1],
    9292             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]);
    9494  }
    9595
     
    107107    goto Exit;
    108108  }
    109  
     109
    110110  //
    111111  // RNG with default algorithm
     
    118118    Print (L"[Pass]");
    119119  }
    120  
     120
    121121  //
    122122  // RNG with SP800-90-HMAC-256
     
    226226
    227227  Print (L"\n -- Exit UEFI RNG Protocol Test (Status = %r).\n", Status);
    228  
     228
    229229Exit:
    230230  if (Rand != NULL) {
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/RngTest/RngTest.inf

    r58464 r58466  
    11## @file
    22#  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.
    66#
    77#  Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
     
    5353  gEfiRngAlgorithmX931AesGuid           ## SOMETIMES_CONSUMES    ## GUID        # Unique ID of the algorithm for RNG
    5454  gEfiRngAlgorithmRaw                   ## SOMETIMES_CONSUMES    ## GUID        # Unique ID of the algorithm for RNG
    55  
     55
    5656  [UserExtensions.TianoCore."ExtraFiles"]
    5757  RngTestExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/VariableInfo/VariableInfo.c

    r48674 r58466  
    11/** @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
    44  redirection to capture the data.
    5  
     5
    66Copyright (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 
     7This program and the accompanying materials
     8are licensed and made available under the terms and conditions of the BSD License
     9which accompanies this distribution.  The full text of the license may be found at
    1010http://opensource.org/licenses/bsd-license.php
    1111
    12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1313WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1414
     
    3535/**
    3636
    37   This function get the variable statistics data from SMM variable driver. 
     37  This function get the variable statistics data from SMM variable driver.
    3838
    3939  @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
    4141                                       to a collection of data that comes from an SMM environment.
    4242  @param[in, out] SmmCommunicateSize   The size of the SmmCommunicateHeader.
    43                      
     43
    4444  @retval EFI_SUCCESS               Get the statistics data information.
    4545  @retval EFI_NOT_FOUND             Not found.
     
    6262  SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) &SmmCommunicateHeader->Data[0];
    6363  SmmVariableFunctionHeader->Function = SMM_VARIABLE_FUNCTION_GET_STATISTICS;
    64  
     64
    6565  Status = mSmmCommunication->Communicate (mSmmCommunication, SmmCommunicateHeader, SmmCommunicateSize);
    6666  ASSERT_EFI_ERROR (Status);
    67  
    68   Status = SmmVariableFunctionHeader->ReturnStatus; 
     67
     68  Status = SmmVariableFunctionHeader->ReturnStatus;
    6969  return Status;
    7070}
     
    7373/**
    7474
    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
    7777  @retval EFI_SUCCESS               Print the statistics information successfully.
    7878  @retval EFI_NOT_FOUND             Not found the statistics information.
     
    8181EFI_STATUS
    8282PrintInfoFromSmm (
    83   VOID 
     83  VOID
    8484  )
    8585{
     
    9191  SMM_VARIABLE_COMMUNICATE_HEADER                *FunctionHeader;
    9292  EFI_SMM_VARIABLE_PROTOCOL                      *Smmvariable;
    93  
     93
    9494
    9595  Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **) &Smmvariable);
     
    101101  if (EFI_ERROR (Status)) {
    102102    return Status;
    103   } 
     103  }
    104104
    105105  CommSize  = SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE;
     
    107107  CommBuffer = AllocateZeroPool (CommSize);
    108108  ASSERT (CommBuffer != NULL);
    109  
     109
    110110  Print (L"Non-Volatile SMM Variables:\n");
    111111  do {
     
    119119    }
    120120
    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)) {
    122122      break;
    123123    }
     
    132132    if (!VariableInfo->Volatile) {
    133133      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,
    136136          VariableInfo->ReadCount,
    137137          VariableInfo->CacheCount,
     
    142142    }
    143143  } while (TRUE);
    144  
     144
    145145  Print (L"Volatile SMM Variables:\n");
    146146  ZeroMem (CommBuffer, CommSize);
     
    155155    }
    156156
    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)) {
    158158      break;
    159159    }
     
    168168    if (VariableInfo->Volatile) {
    169169      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,
    172172          VariableInfo->ReadCount,
    173173          VariableInfo->CacheCount,
     
    179179  } while (TRUE);
    180180
    181   FreePool (CommBuffer); 
     181  FreePool (CommBuffer);
    182182  return Status;
    183183}
     
    185185/**
    186186  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
    188188  function.
    189189
    190   @param[in] ImageHandle    The firmware allocated handle for the EFI image. 
     190  @param[in] ImageHandle    The firmware allocated handle for the EFI image.
    191191  @param[in] SystemTable    A pointer to the EFI System Table.
    192  
     192
    193193  @retval EFI_SUCCESS       The entry point is executed successfully.
    194194  @retval other             Some error occurs when executing this entry point.
     
    216216      return Status;
    217217    }
    218   } 
     218  }
    219219
    220220  if (!EFI_ERROR (Status) && (Entry != NULL)) {
     
    224224      if (!VariableInfo->Volatile) {
    225225        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,
    228228          VariableInfo->ReadCount,
    229229          VariableInfo->CacheCount,
     
    242242      if (VariableInfo->Volatile) {
    243243        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,
    246246          VariableInfo->ReadCount,
    247247          VariableInfo->CacheCount,
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application/VariableInfo/VariableInfo.inf

    r58459 r58466  
    5050[Protocols]
    5151  gEfiSmmCommunicationProtocolGuid     ## SOMETIMES_CONSUMES
    52  
     52
    5353    ## UNDEFINED           # Used to do smm communication
    54     ## SOMETIMES_CONSUMES 
    55   gEfiSmmVariableProtocolGuid 
    56  
     54    ## SOMETIMES_CONSUMES
     55  gEfiSmmVariableProtocolGuid
     56
    5757[Guids]
    5858  gEfiAuthenticatedVariableGuid        ## SOMETIMES_CONSUMES    ## SystemTable
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/AuthenticatedVariableFormat.h

    r58459 r58466  
    11/** @file
    2   The variable data structures are related to EDKII-specific 
     2  The variable data structures are related to EDKII-specific
    33  implementation of UEFI authenticated variables.
    4   AuthenticatedVariableFormat.h defines variable data headers 
     4  AuthenticatedVariableFormat.h defines variable data headers
    55  and variable storage region headers.
    66
    77Copyright (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 
     8This program and the accompanying materials
     9are licensed and made available under the terms and conditions of the BSD License
     10which accompanies this distribution.  The full text of the license may be found at
    1111http://opensource.org/licenses/bsd-license.php
    1212
    13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1414WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
     
    118118  EFI_GUID  Signature;
    119119  ///
    120   /// Size of entire variable store, 
     120  /// Size of entire variable store,
    121121  /// including size of variable store header but not including the size of FvHeader.
    122122  ///
     
    169169  UINT64      MonotonicCount;
    170170  ///
    171   /// Associated TimeStamp value against replay attack. 
     171  /// Associated TimeStamp value against replay attack.
    172172  ///
    173173  EFI_TIME    TimeStamp;
     
    197197/// This structure contains the variable list that is put in EFI system table.
    198198/// 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.
    200200///
    201201struct _VARIABLE_INFO_ENTRY {
    202202  VARIABLE_INFO_ENTRY *Next;       ///< Pointer to next entry.
    203203  EFI_GUID            VendorGuid;  ///< Guid of Variable.
    204   CHAR16              *Name;       ///< Name of Variable. 
     204  CHAR16              *Name;       ///< Name of Variable.
    205205  UINT32              Attributes;  ///< Attributes of variable defined in UEFI spec.
    206206  UINT32              ReadCount;   ///< Number of times to read this variable.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/MeasuredFvHob.h

    r58464 r58466  
    11/** @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
    33  DXE Driver.
    4    
     4
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/PhysicalPresenceData.h

    r58459 r58466  
    22  Define the variable data structures used for TCG physical presence.
    33  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
    55  is saved to variable.
    66
    77Copyright (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 
     8This program and the accompanying materials
     9are licensed and made available under the terms and conditions of the BSD License
     10which accompanies this distribution.  The full text of the license may be found at
    1111http://opensource.org/licenses/bsd-license.php
    1212
    13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1414WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
     
    3939#define PHYSICAL_PRESENCE_DISABLE                                 2
    4040#define PHYSICAL_PRESENCE_ACTIVATE                                3
    41 #define PHYSICAL_PRESENCE_DEACTIVATE                              4 
     41#define PHYSICAL_PRESENCE_DEACTIVATE                              4
    4242#define PHYSICAL_PRESENCE_CLEAR                                   5
    4343#define PHYSICAL_PRESENCE_ENABLE_ACTIVATE                         6
     
    6161//
    6262// 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).
    6464//
    6565#define PHYSICAL_PRESENCE_FLAGS_VARIABLE  L"PhysicalPresenceFlags"
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/PwdCredentialProviderHii.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/SecureBootConfigHii.h

    r48674 r58466  
    11/** @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
    44Copyright (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. 
     5This program and the accompanying materials are licensed and made available under
     6the terms and conditions of the BSD License that accompanies this distribution.
    77The full text of the license may be found at
    8 http://opensource.org/licenses/bsd-license.php.                                           
     8http://opensource.org/licenses/bsd-license.php.
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/SecurityPkgTokenSpace.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TcgConfigHii.h

    r48674 r58466  
    11/** @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
    44Copyright (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. 
     5This program and the accompanying materials are licensed and made available under
     6the terms and conditions of the BSD License that accompanies this distribution.
    77The full text of the license may be found at
    8 http://opensource.org/licenses/bsd-license.php.                                           
     8http://opensource.org/licenses/bsd-license.php.
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TcgEventHob.h

    r58459 r58466  
    11/** @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
    44  made in the PEI Phase.
    5    
     5
    66Copyright (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 
     7This program and the accompanying materials
     8are licensed and made available under the terms and conditions of the BSD License
     9which accompanies this distribution.  The full text of the license may be found at
    1010http://opensource.org/licenses/bsd-license.php
    1111
    12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1313WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1414
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TrEEConfigHii.h

    r58464 r58466  
    11/** @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
    44Copyright (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. 
     5This program and the accompanying materials are licensed and made available under
     6the terms and conditions of the BSD License that accompanies this distribution.
    77The full text of the license may be found at
    8 http://opensource.org/licenses/bsd-license.php.                                           
     8http://opensource.org/licenses/bsd-license.php.
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/TrEEPhysicalPresenceData.h

    r58464 r58466  
    22  Define the variable data structures used for TrEE physical presence.
    33  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
    55  is saved to variable.
    66
     
    4242//
    4343// 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).
    4545//
    4646#define TREE_PHYSICAL_PRESENCE_FLAGS_VARIABLE  L"TrEEPhysicalPresenceFlags"
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/UsbCredentialProviderHii.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/UserIdentifyManagerHii.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Guid/UserProfileManagerHii.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/PlatformSecureLib.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2020
    2121  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.
    2323
    2424  Programmatic changing of platform security policy (such as disable Secure Boot,
     
    2929  NOTE THAT: This function cannot depend on any EFI Variable Service since they are
    3030  not available when this function is called in AuthenticateVariable driver.
    31  
     31
    3232  @retval  TRUE       The platform is operated by a physically present user.
    3333  @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  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    2020  Check and execute the pending TPM request and Lock TPM.
    2121
    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
    2323  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
    2525  take effect. At last, it will lock TPM to prevent TPM state change by malware.
    26  
     26
    2727  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
    2929  be invoked as early as possible as TPM is locked in this function.
    30  
     30
    3131**/
    3232VOID
     
    4141  The TPM request may come from OS. This API will check if TPM request exists and need user
    4242  input to confirmation.
    43  
     43
    4444  @retval    TRUE        TPM needs input to confirm user physical presence.
    4545  @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  
    55  The Vendor Specific PPI operation may change TPM state, BIOS TPM management
    66  flags, and may need additional boot cycle.
    7  
     7
    88  Caution: This function may receive untrusted input.
    99
    1010Copyright (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 
     11This program and the accompanying materials
     12are licensed and made available under the terms and conditions of the BSD License
     13which accompanies this distribution.  The full text of the license may be found at
    1414http://opensource.org/licenses/bsd-license.php
    1515
    16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     16THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1717WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1818
     
    6464
    6565  This API should be invoked in BIOS boot phase to process pending request.
    66  
     66
    6767  Caution: This function may receive untrusted input.
    68  
     68
    6969  If OperationRequest < 128, then ASSERT().
    7070
     
    8989
    9090  This API should be invoked in BIOS boot phase to process pending request.
    91  
     91
    9292  Caution: This function may receive untrusted input.
    9393
     
    119119
    120120  Caution: This function may receive untrusted input.
    121  
     121
    122122  If OperationRequest < 128, then ASSERT().
    123123
     
    142142
    143143  Caution: This function may receive untrusted input.
    144  
     144
    145145  If OperationRequest < 128, then ASSERT().
    146146
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm12CommandLib.h

    r58464 r58466  
    8585/**
    8686  Send NV DefineSpace command to TPM1.2.
    87  
     87
    8888  @param PubInfo           The public parameters of the NV area.
    8989  @param EncAuth           The encrypted AuthData, only valid if the attributes require subsequent authorization.
     
    101101/**
    102102  Send NV ReadValue command to TPM1.2.
    103  
     103
    104104  @param NvIndex           The index of the area to set.
    105105  @param Offset            The offset into the area.
     
    121121/**
    122122  Send NV WriteValue command to TPM1.2.
    123  
     123
    124124  @param NvIndex           The index of the area to set.
    125125  @param Offset            The offset into the NV Area.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm12DeviceLib.h

    r58464 r58466  
    2828  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    2929  @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.
    3131**/
    3232EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm2CommandLib.h

    r58464 r58466  
    2626                                An Event sequence starts if this is TPM_ALG_NULL.
    2727  @param[out] SequenceHandle    A handle to reference the sequence
    28  
     28
    2929  @retval EFI_SUCCESS      Operation completed successfully.
    3030  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    4444  @param[in] SequenceHandle    Handle for the sequence object
    4545  @param[in] Buffer            Data to be added to hash
    46  
     46
    4747  @retval EFI_SUCCESS      Operation completed successfully.
    4848  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    6565  @param[in]  Buffer            Data to be added to the Event
    6666  @param[out] Results           List of digests computed for the PCR
    67  
     67
    6868  @retval EFI_SUCCESS      Operation completed successfully.
    6969  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    8484  @param[in]  Buffer            Data to be added to the hash/HMAC
    8585  @param[out] Result            The returned HMAC or digest in a sized buffer
    86  
     86
    8787  @retval EFI_SUCCESS      Operation completed successfully.
    8888  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    167167  @param[in] AuthHandle        TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP}
    168168  @param[in] AuthSession       Auth Session context
    169  
     169
    170170  @retval EFI_SUCCESS      Operation completed successfully.
    171171  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    317317  @param[out] NvPublic           The public area of the index.
    318318  @param[out] NvName             The Name of the nvIndex.
    319  
     319
    320320  @retval EFI_SUCCESS            Operation completed successfully.
    321321  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    338338  @param[in]  Auth               The authorization data.
    339339  @param[in]  NvPublic           The public area of the index.
    340  
     340
    341341  @retval EFI_SUCCESS            Operation completed successfully.
    342342  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    358358  @param[in]  NvIndex            The NV Index.
    359359  @param[in]  AuthSession        Auth Session context
    360  
     360
    361361  @retval EFI_SUCCESS            Operation completed successfully.
    362362  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    380380  @param[in]     Offset             Byte offset into the area.
    381381  @param[in,out] OutData            The data read.
    382  
     382
    383383  @retval EFI_SUCCESS            Operation completed successfully.
    384384  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    404404  @param[in]  InData             The data to write.
    405405  @param[in]  Offset             The offset into the NV Area.
    406  
     406
    407407  @retval EFI_SUCCESS            Operation completed successfully.
    408408  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    522522  @param[out] PcrSelectionOut    The PCR in the returned list.
    523523  @param[out] PcrValues          The contents of the PCR indicated in pcrSelect.
    524  
     524
    525525  @retval EFI_SUCCESS            Operation completed successfully.
    526526  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    545545  @param[out] SizeNeeded         number of octets required to satisfy the request
    546546  @param[out] SizeAvailable      Number of octets available. Computed before the allocation
    547  
     547
    548548  @retval EFI_SUCCESS            Operation completed successfully.
    549549  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    564564  This command returns various information regarding the TPM and its current state.
    565565
    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
    568568  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
    570570  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
    572572  a value of NO.
    573573
    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
    576576  many capability categories and only few categories will be used in firmware. It means the caller
    577577  need swap the byte order for the feilds in CapabilityData.
    578578
    579579  @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.
    581581  @param[in]  PropertyCount      Number of properties of the indicated type to return.
    582582  @param[out] MoreData           Flag to indicate if there are more values of this type.
    583583  @param[out] CapabilityData     The capability data.
    584  
     584
    585585  @retval EFI_SUCCESS            Operation completed successfully.
    586586  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    602602
    603603  @param[out] Family             The Family of TPM. (a 4-octet character string)
    604  
     604
    605605  @retval EFI_SUCCESS            Operation completed successfully.
    606606  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    618618
    619619  @param[out] ManufactureId      The manufacture ID of TPM.
    620  
     620
    621621  @retval EFI_SUCCESS            Operation completed successfully.
    622622  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    635635  @param[out] FirmwareVersion1   The FirmwareVersion1.
    636636  @param[out] FirmwareVersion2   The FirmwareVersion2.
    637  
     637
    638638  @retval EFI_SUCCESS            Operation completed successfully.
    639639  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    653653  @param[out] MaxCommandSize     The maximum value for commandSize in a command.
    654654  @param[out] MaxResponseSize    The maximum value for responseSize in a command.
    655  
     655
    656656  @retval EFI_SUCCESS            Operation completed successfully.
    657657  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    666666/**
    667667  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.
    669669
    670670  This function parse the value got from TPM2_GetCapability and return the list.
    671671
    672672  @param[out] AlgList      List of algorithm.
    673  
     673
    674674  @retval EFI_SUCCESS            Operation completed successfully.
    675675  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    687687
    688688  @param[out] LockoutCounter     The LockoutCounter of TPM.
    689  
     689
    690690  @retval EFI_SUCCESS            Operation completed successfully.
    691691  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    703703
    704704  @param[out] LockoutInterval    The LockoutInterval of TPM.
    705  
     705
    706706  @retval EFI_SUCCESS            Operation completed successfully.
    707707  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    720720  @param[out] InputBufferSize    The InputBufferSize of TPM.
    721721                                 the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER)
    722  
     722
    723723  @retval EFI_SUCCESS            Operation completed successfully.
    724724  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    736736
    737737  @param[out] Pcrs    The Pcr Selection
    738  
     738
    739739  @retval EFI_SUCCESS            Operation completed successfully.
    740740  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    752752
    753753  @param[out] AlgorithmSet    The AlgorithmSet of TPM.
    754  
     754
    755755  @retval EFI_SUCCESS            Operation completed successfully.
    756756  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    809809  @param[out] SessionHandle      Handle for the newly created session.
    810810  @param[out] NonceTPM           The initial nonce from the TPM, used in the computation of the sessionKey.
    811  
     811
    812812  @retval EFI_SUCCESS            Operation completed successfully.
    813813  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    831831
    832832  @param[in]  FlushHandle        The handle of the item to flush.
    833  
     833
    834834  @retval EFI_SUCCESS            Operation completed successfully.
    835835  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    845845  The caller proves knowledge of the secret value using an authorization
    846846  session using the authValue associated with authHandle.
    847  
     847
    848848  @param[in]  AuthHandle         Handle for an entity providing the authorization
    849849  @param[in]  PolicySession      Handle for the policy session being extended.
     
    855855  @param[out] Timeout            Time value used to indicate to the TPM when the ticket expires.
    856856  @param[out] PolicyTicket       A ticket that includes a value indicating when the authorization expires.
    857  
     857
    858858  @retval EFI_SUCCESS            Operation completed successfully.
    859859  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    881881  @param[in] PolicySession      Handle for the policy session being extended.
    882882  @param[in] HashList           the list of hashes to check for a match.
    883  
     883
    884884  @retval EFI_SUCCESS            Operation completed successfully.
    885885  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    897897  @param[in]  PolicySession      Handle for the policy session being extended.
    898898  @param[in]  Code               The allowed commandCode.
    899  
     899
    900900  @retval EFI_SUCCESS            Operation completed successfully.
    901901  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    914914  @param[in]  PolicySession      Handle for the policy session.
    915915  @param[out] PolicyHash         the current value of the policyHash of policySession.
    916  
     916
    917917  @retval EFI_SUCCESS            Operation completed successfully.
    918918  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/Tpm2DeviceLib.h

    r58464 r58466  
    2828  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    2929  @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.
    3131**/
    3232EFI_STATUS
     
    6262  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    6363  @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.
    6565**/
    6666typedef
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TpmCommLib.h

    r58459 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    162162
    163163///
    164 /// When this bit is 1, TPM is in the Ready state, 
     164/// When this bit is 1, TPM is in the Ready state,
    165165/// indicating it is ready to receive a new command.
    166166///
     
    211211TisPcWaitRegisterBits (
    212212  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
    220220  in the time of default TIS_TIMEOUT_D.
    221221
     
    235235
    236236/**
    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
    238238  to Status Register in time.
    239239
     
    251251
    252252/**
    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
    254254  to ACCESS Register in the time of default TIS_TIMEOUT_D.
    255255
     
    274274  @param[in]  DataLen       Size of the raw data.
    275275  @param[out] Digest        Pointer to a buffer that stores the final digest.
    276  
     276
    277277  @retval     EFI_SUCCESS   Always successfully calculate the final digest.
    278278**/
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TpmMeasurementLib.h

    r58464 r58466  
    3232**/
    3333EFI_STATUS
    34 EFIAPI 
     34EFIAPI
    3535TpmMeasureAndLogData (
    3636  IN UINT32             PcrIndex,
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Library/TrEEPhysicalPresenceLib.h

    r58464 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    2323  Check and execute the pending TPM request.
    2424
    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
    2626  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
    2828  take effect.
    29  
     29
    3030  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.
    3232
    3333  @param  PlatformAuth                   platform auth value. NULL means no platform auth change.
     
    4444  The TPM request may come from OS. This API will check if TPM request exists and need user
    4545  input to confirmation.
    46  
     46
    4747  @retval    TRUE        TPM needs input to confirm user physical presence.
    4848  @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  
    55  The Vendor Specific PPI operation may change TPM state, BIOS TPM management
    66  flags, and may need additional boot cycle.
    7  
     7
    88  Caution: This function may receive untrusted input.
    99
    1010Copyright (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 
     11This program and the accompanying materials
     12are licensed and made available under the terms and conditions of the BSD License
     13which accompanies this distribution.  The full text of the license may be found at
    1414http://opensource.org/licenses/bsd-license.php
    1515
    16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     16THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1717WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1818
     
    6767
    6868  This API should be invoked in BIOS boot phase to process pending request.
    69  
     69
    7070  Caution: This function may receive untrusted input.
    71  
     71
    7272  If OperationRequest < 128, then ASSERT().
    7373
     
    9494
    9595  This API should be invoked in BIOS boot phase to process pending request.
    96  
     96
    9797  Caution: This function may receive untrusted input.
    9898
     
    124124
    125125  Caution: This function may receive untrusted input.
    126  
     126
    127127  If OperationRequest < 128, then ASSERT().
    128128
     
    147147
    148148  Caution: This function may receive untrusted input.
    149  
     149
    150150  If OperationRequest < 128, then ASSERT().
    151151
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Ppi/FirmwareVolumeInfoMeasurementExcluded.h

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Ppi/LockPhysicalPresence.h

    r48674 r58466  
    11/** @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
    44  PEIM.
    55
    66Copyright (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 
     7This program and the accompanying materials
     8are licensed and made available under the terms and conditions of the BSD License
     9which accompanies this distribution.  The full text of the license may be found at
    1010http://opensource.org/licenses/bsd-license.php
    1111
    12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1313WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1414
     
    1919
    2020///
    21 /// Global ID for the PEI_LOCK_PHYSICAL_PRESENCE_PPI_GUID. 
     21/// Global ID for the PEI_LOCK_PHYSICAL_PRESENCE_PPI_GUID.
    2222///
    2323#define PEI_LOCK_PHYSICAL_PRESENCE_PPI_GUID  \
     
    4747
    4848///
    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
    5252/// PEIM and consumed by the TPM PEIM.
    5353///
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Include/Ppi/TpmInitialized.h

    r58459 r58466  
    33  initialized.  PEIMs that must execute after TPM hardware initialization
    44  may use this GUID in their dependency expressions.
    5    
     5
    66Copyright (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 
     7This program and the accompanying materials
     8are licensed and made available under the terms and conditions of the BSD License
     9which accompanies this distribution.  The full text of the license may be found at
    1010http://opensource.org/licenses/bsd-license.php
    1111
    12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1313WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1414
     
    1919
    2020///
    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.
    2222///
    2323#define PEI_TPM_INITIALIZED_PPI_GUID \
     
    2929
    3030///
    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.
    3232///
    3333#define PEI_TPM_INITIALIZATION_DONE_PPI_GUID \
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    3434
    3535  @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
    3939
    4040**/
     
    4545{
    4646  EFI_STATUS                        Status;
    47   EFI_HANDLE                        DeviceHandle; 
     47  EFI_HANDLE                        DeviceHandle;
    4848  EFI_DEVICE_PATH_PROTOCOL          *TempDevicePath;
    4949  EFI_BLOCK_IO_PROTOCOL             *BlockIo;
     
    111111
    112112  //
    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
    114114  // the device path supports the Simple File System Protocol.
    115115  //
     
    130130  //
    131131  // 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.
    133133  //
    134134  TempDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)File;
    135135  while (!IsDevicePathEndType (TempDevicePath)) {
    136136    switch (DevicePathType (TempDevicePath)) {
    137    
     137
    138138    case MEDIA_DEVICE_PATH:
    139139      if (DevicePathSubType (TempDevicePath) == MEDIA_RELATIVE_OFFSET_RANGE_DP) {
     
    145145      if (DevicePathSubType(TempDevicePath) == MSG_MAC_ADDR_DP) {
    146146        return IMAGE_FROM_REMOVABLE_MEDIA;
    147       } 
     147      }
    148148      break;
    149149
     
    153153    TempDevicePath = NextDevicePathNode (TempDevicePath);
    154154  }
    155   return IMAGE_UNKNOWN; 
     155  return IMAGE_UNKNOWN;
    156156}
    157157
     
    192192    return EFI_NOT_FOUND;
    193193  }
    194  
     194
    195195  //
    196196  // Get current user access information.
     
    235235      break;
    236236    }
    237    
     237
    238238    ASSERT (Info != NULL);
    239239    if (Info->InfoType != EFI_USER_INFO_ACCESS_POLICY_RECORD) {
    240240      continue;
    241241    }
    242    
     242
    243243    //
    244244    // Get specified access information.
     
    257257    }
    258258  }
    259  
     259
    260260  if (Info != NULL) {
    261261    FreePool (Info);
     
    267267  Get file name from device path.
    268268
    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
    272272  @param[in]  DevicePath     A pointer to a device path.
    273273  @param[out] FileName       The callee allocated buffer to save the file name if file name is found.
    274274  @param[out] FileNameOffset The offset of file name in device path if file name is found.
    275  
     275
    276276  @retval     UINTN          The file name length. 0 means file name is not found.
    277277
    278278**/
    279 UINTN 
     279UINTN
    280280GetFileName (
    281281  IN  CONST EFI_DEVICE_PATH_PROTOCOL          *DevicePath,
     
    343343    NodeStr = (CHAR8 *)TmpDevicePath + sizeof (EFI_DEVICE_PATH_PROTOCOL);
    344344    NodeStrLength = DevicePathNodeLength (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof(CHAR16);
    345    
     345
    346346    if ((FirstNodeChar == '\\') && (LastNodeChar == '\\')) {
    347347      //
     
    349349      //
    350350      NodeStr += sizeof (CHAR16);
    351       NodeStrLength -= sizeof (CHAR16);     
     351      NodeStrLength -= sizeof (CHAR16);
    352352    } else if ((FirstNodeChar != '\\') && (LastNodeChar != '\\')) {
    353353      //
     
    356356      WriteUnaligned16 ((UINT16 *)(*FileName + Length), '\\');
    357357      Length += sizeof (CHAR16);
    358     } 
     358    }
    359359    CopyMem (*FileName + Length, NodeStr, NodeStrLength);
    360360    Length += NodeStrLength;
    361    
     361
    362362    LastNodeChar  = (CHAR16) ReadUnaligned16 ((UINT16 *) (NodeStr + NodeStrLength - sizeof(CHAR16)));
    363363    TmpDevicePath = NextDevicePathNode (TmpDevicePath);
    364   }   
     364  }
    365365
    366366  return Length;
     
    374374  If DevicePath2 is identical with DevicePath1, or with DevicePath1's child device
    375375  path, then TRUE returned. Otherwise, FALSE is returned.
    376  
     376
    377377  If DevicePath1 is NULL, then ASSERT().
    378378  If DevicePath2 is NULL, then ASSERT().
     
    381381  @param[in]  DevicePath2   A pointer to a device path.
    382382
    383   @retval     TRUE          Two device paths are identical , or DevicePath2 is 
     383  @retval     TRUE          Two device paths are identical , or DevicePath2 is
    384384                            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
    386386                            is not DevicePath1's child device path.
    387387
     
    411411    return FALSE;
    412412  }
    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.
    416416  // To compare the file name, copy file name to a buffer and compare the buffer.
    417417  //
     
    423423      goto Done;
    424424    }
    425     if (CompareMem (DevicePath1, DevicePath2, FileNameOffset1) != 0) {     
     425    if (CompareMem (DevicePath1, DevicePath2, FileNameOffset1) != 0) {
    426426      DevicePathEqual = FALSE;
    427427      goto Done;
     
    431431      goto Done;
    432432    }
    433     if (CompareMem (FileName1, FileName2, FileNameSize1) != 0) {     
     433    if (CompareMem (FileName1, FileName2, FileNameSize1) != 0) {
    434434      DevicePathEqual = FALSE;
    435435      goto Done;
     
    450450  if (CompareMem (DevicePath1, DevicePath2, DevicePathSize) != 0) {
    451451    DevicePathEqual = FALSE;
    452   } 
    453  
    454 Done: 
     452  }
     453
     454Done:
    455455  if (FileName1 != NULL) {
    456456    FreePool (FileName1);
     
    464464
    465465/**
    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.
    468468
    469469  @param[in] DevicePath  Points to device path.
    470470  @param[in] AccessType  The type of user access control.
    471  
     471
    472472  @retval    TURE        The DevicePath is in the specified List.
    473473  @retval    FALSE       The DevicePath is not in the specified List.
     
    483483  EFI_USER_INFO_ACCESS_CONTROL          *Access;
    484484  EFI_DEVICE_PATH_PROTOCOL              *Path;
    485   UINTN                                 OffSet; 
     485  UINTN                                 OffSet;
    486486
    487487  Status = GetAccessControl (&Access, AccessType);
    488488  if (EFI_ERROR (Status)) {
    489489    return FALSE;
    490   } 
     490  }
    491491
    492492  OffSet = 0;
    493493  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);
    495495    if (CheckDevicePath (Path, DevicePath)) {
    496496      //
     
    499499      FreePool (Access);
    500500      return TRUE;
    501     } 
     501    }
    502502    OffSet += GetDevicePathSize (Path);
    503503  }
    504  
     504
    505505  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.
    512512
    513513  @param[in] DevicePath  Points to device path
    514  
     514
    515515  @retval    TURE        The image pointed by DevicePath is permitted to load.
    516516  @retval    FALSE       The image pointed by DevicePath is forbidden to load.
     
    524524  if (IsDevicePathInList (DevicePath, EFI_USER_INFO_ACCESS_PERMIT_LOAD)) {
    525525    //
    526     // This access control overrides any restrictions put in place by the 
     526    // This access control overrides any restrictions put in place by the
    527527    // EFI_USER_INFO_ACCESS_FORBID_LOAD record.
    528528    //
    529529    return TRUE;
    530530  }
    531  
     531
    532532  if (IsDevicePathInList (DevicePath, EFI_USER_INFO_ACCESS_FORBID_LOAD)) {
    533533    //
     
    536536    return FALSE;
    537537  }
    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.
    545545
    546546  @param[in] DevicePath  Points to device path.
    547  
     547
    548548  @retval    TURE        The image pointed by DevicePath is a boot option.
    549549  @retval    FALSE       The image pointed by DevicePath is not a boot option.
     
    563563  UINT8                             *OptionPtr;
    564564  EFI_DEVICE_PATH_PROTOCOL          *OptionDevicePath;
    565  
     565
    566566  //
    567567  // Get BootOrder
    568568  //
    569569  BootOrderListSize = 0;
    570   BootOrderList     = NULL; 
     570  BootOrderList     = NULL;
    571571  Status = gRT->GetVariable (
    572                   L"BootOrder", 
    573                   &gEfiGlobalVariableGuid, 
    574                   NULL, 
    575                   &BootOrderListSize, 
     572                  L"BootOrder",
     573                  &gEfiGlobalVariableGuid,
     574                  NULL,
     575                  &BootOrderListSize,
    576576                  NULL
    577577                  );
     
    580580    ASSERT (BootOrderList != NULL);
    581581    Status = gRT->GetVariable (
    582                     L"BootOrder", 
    583                     &gEfiGlobalVariableGuid, 
    584                     NULL, 
    585                     &BootOrderListSize, 
     582                    L"BootOrder",
     583                    &gEfiGlobalVariableGuid,
     584                    NULL,
     585                    &BootOrderListSize,
    586586                    BootOrderList
    587587                    );
    588588  }
    589  
     589
    590590  if (EFI_ERROR (Status)) {
    591591    //
     
    609609    // Check whether the image is forbidden.
    610610    //
    611    
     611
    612612    OptionPtr = OptionBuffer;
    613613    //
     
    625625    //
    626626    OptionPtr += StrSize ((UINT16 *) OptionPtr);
    627  
     627
    628628    //
    629629    // Now OptionPtr points to Device Path.
     
    651651  Add the image info to a deferred image list.
    652652
    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
    655655                               image is not available.
    656656  @param[in]  ImageSize        The size of the image, or 0 if the image is not available.
    657  
     657
    658658**/
    659659VOID
     
    676676    CurImageInfo = AllocatePool ((mDeferredImage.Count + 1) * sizeof (DEFERRED_IMAGE_INFO));
    677677    ASSERT (CurImageInfo != NULL);
    678    
     678
    679679    CopyMem (
    680       CurImageInfo, 
     680      CurImageInfo,
    681681      mDeferredImage.ImageInfo,
    682682      mDeferredImage.Count * sizeof (DEFERRED_IMAGE_INFO)
     
    686686  }
    687687  mDeferredImage.Count++;
    688  
     688
    689689  //
    690690  // Save the deferred image information.
     
    705705  Returns information about a deferred image.
    706706
    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
    710710  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.
    713713
    714714  @param[in]  This             Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL.
    715715  @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
    719719                               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.
    721721  @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
    725725  @retval EFI_SUCCESS           Image information returned successfully.
    726726  @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
    728728                                BootOption is NULL.
    729  
     729
    730730**/
    731731EFI_STATUS
     
    749749    return EFI_INVALID_PARAMETER;
    750750  }
    751  
     751
    752752  if ((ImageDevicePath == NULL) || (BootOption == NULL)) {
    753753    return EFI_INVALID_PARAMETER;
     
    757757    return EFI_NOT_FOUND;
    758758  }
    759  
     759
    760760  //
    761761  // Get the request deferred image.
    762   // 
     762  //
    763763  ReqImageInfo = &mDeferredImage.ImageInfo[ImageIndex];
    764    
     764
    765765  *ImageDevicePath = ReqImageInfo->ImageDevicePath;
    766766  *Image           = ReqImageInfo->Image;
    767767  *ImageSize       = ReqImageInfo->ImageSize;
    768768  *BootOption      = ReqImageInfo->BootOption;
    769  
     769
    770770  return EFI_SUCCESS;
    771771}
     
    776776  and installs Deferred Image Load Protocol.
    777777
    778   @param[in]  AuthenticationStatus  This is the authentication status returned from the 
     778  @param[in]  AuthenticationStatus  This is the authentication status returned from the
    779779                                    security measurement services for the input file.
    780780  @param[in]  File                  This is a pointer to the device path of the file that
     
    825825  //
    826826  // Check whether user has a logon.
    827   // 
     827  //
    828828  CurrentUser = NULL;
    829829  if (mUserManager != NULL) {
     
    840840    }
    841841  }
    842  
     842
    843843  //
    844844  // Still no user logon.
     
    853853    return EFI_SUCCESS;
    854854  }
    855  
     855
    856856  DEBUG ((EFI_D_INFO, "[Security] No user identified, the image is deferred to load!\n"));
    857857  PutDefferedImageInfo (File, FileBuffer, FileSize);
     
    875875
    876876/**
    877   Locate user manager protocol when user manager is installed. 
     877  Locate user manager protocol when user manager is installed.
    878878
    879879  @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.
    881881
    882882**/
     
    893893         (VOID **) &mUserManager
    894894         );
    895  
     895
    896896}
    897897
     
    913913{
    914914  VOID                 *Registration;
    915  
     915
    916916  //
    917917  // Register user manager notification function.
    918918  //
    919919  EfiCreateProtocolNotifyEvent (
    920     &gEfiUserManagerProtocolGuid, 
     920    &gEfiUserManagerProtocolGuid,
    921921    TPL_CALLBACK,
    922922    FindUserManagerProtocol,
     
    924924    &Registration
    925925    );
    926  
     926
    927927  return RegisterSecurity2Handler (
    928928           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  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    6868  Returns information about a deferred image.
    6969
    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
    7373  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.
    7676
    7777  @param[in]  This              Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL.
    7878  @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
    8282                                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.
    8484  @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
    8888  @retval EFI_SUCCESS           Image information returned successfully.
    8989  @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
    9191                                BootOption is NULL.
    92  
     92
    9393**/
    9494EFI_STATUS
     
    102102     OUT BOOLEAN                           *BootOption
    103103  );
    104  
     104
    105105#endif
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.inf

    r58459 r58466  
    22#  Provides security service of deferred image load
    33#
    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
    66#  installing an instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL.
    77#
     
    4949  BaseMemoryLib
    5050  PrintLib
    51   DebugLib 
     51  DebugLib
    5252  UefiLib
    53   PcdLib 
     53  PcdLib
    5454
    5555[Protocols]
     
    6161  ## NOTIFY
    6262  gEfiUserManagerProtocolGuid
    63    
     63
    6464[Guids]
    6565  gEfiGlobalVariableGuid                                  ## SOMETIMES_CONSUMES  ## Variable:L"BootOrder"
    66  
     66
    6767[Pcd]
    6868  gEfiSecurityPkgTokenSpaceGuid.PcdDeferImageLoadPolicy   ## SOMETIMES_CONSUMES
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageAuthenticationStatusLib/DxeImageAuthenticationStatusLib.c

    r58464 r58466  
    1919/**
    2020  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
    2323                             the Section Extraction Protocol when reading the input file.
    2424  @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  
    2121  MODULE_TYPE                    = DXE_DRIVER
    2222  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
    2424  CONSTRUCTOR                    = DxeImageAuthenticationStatusLibConstructor
    2525
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c

    r58459 r58466  
    100100  @param  FileHandle      Pointer to the file handle to read the PE/COFF image.
    101101  @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.
    103103                          On output, the number of bytes actually read.
    104104  @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
    107107**/
    108108EFI_STATUS
     
    118118
    119119  if (FileHandle == NULL || ReadSize == NULL || Buffer == NULL) {
    120     return EFI_INVALID_PARAMETER;   
     120    return EFI_INVALID_PARAMETER;
    121121  }
    122122
     
    348348  if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
    349349    //
    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
    352352    //       Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
    353353    //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
     
    360360    Magic =  mNtHeader.Pe32->OptionalHeader.Magic;
    361361  }
    362  
     362
    363363  //
    364364  // 3.  Calculate the distance from the base of the image header to the image checksum address.
     
    467467        goto Done;
    468468      }
    469     }   
     469    }
    470470  }
    471471
     
    605605  @param[in]  AuthData            Pointer to the Authenticode Signature retrieved from signed image.
    606606  @param[in]  AuthDataSize        Size of the Authenticode Signature in bytes.
    607  
     607
    608608  @retval EFI_UNSUPPORTED             Hash algorithm is not supported.
    609609  @retval EFI_SUCCESS                 Hash successfully.
     
    11101110
    11111111  //
    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
    11131113  // violates the UEFI spec and has been removed.
    11141114  //
     
    11851185  if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
    11861186    //
    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
    11891189    //       Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
    11901190    //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
     
    11971197    Magic = mNtHeader.Pe32->OptionalHeader.Magic;
    11981198  }
    1199  
     1199
    12001200  if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
    12011201    //
     
    12051205    if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_SECURITY) {
    12061206      SecDataDir = (EFI_IMAGE_DATA_DIRECTORY *) &mNtHeader.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY];
    1207     }       
     1207    }
    12081208  } else {
    12091209    //
     
    12211221  if (SecDataDir == NULL || SecDataDir->Size == 0) {
    12221222    //
    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",
    12241224    // and not be reflected in the security data base "dbx".
    12251225    //
     
    12491249
    12501250  //
    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
    12521252  // "Attribute Certificate Table".
    12531253  // The first certificate starts at offset (SecDataDir->VirtualAddress) from the start of the file.
     
    12611261      break;
    12621262    }
    1263    
     1263
    12641264    //
    12651265    // Verify the image's Authenticode signature, only DER-encoded PKCS#7 signed data is supported.
     
    12671267    if (WinCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
    12681268      //
    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
    12701270      // Authenticode specification.
    12711271      //
     
    13001300      continue;
    13011301    }
    1302    
     1302
    13031303    //
    13041304    // Check the digital signature against the revoked certificate in forbidden database (dbx).
     
    13391339    VerifyStatus = EFI_ACCESS_DENIED;
    13401340  }
    1341  
     1341
    13421342  if (!EFI_ERROR (VerifyStatus)) {
    13431343    return EFI_SUCCESS;
     
    14141414  }
    14151415
    1416   ImageExeInfoTable->NumberOfImages = 0; 
     1416  ImageExeInfoTable->NumberOfImages = 0;
    14171417  gBS->InstallConfigurationTable (&gEfiImageSecurityDatabaseGuid, (VOID *) ImageExeInfoTable);
    14181418
     
    14411441  EfiCreateEventReadyToBootEx (
    14421442    TPL_CALLBACK,
    1443     OnReadyToBoot, 
    1444     NULL, 
     1443    OnReadyToBoot,
     1444    NULL,
    14451445    &Event
    1446     ); 
     1446    );
    14471447
    14481448  return RegisterSecurity2Handler (
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h

    r58459 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    7979// Set max digest size as SHA256 Output (32 bytes) by far
    8080//
    81 #define MAX_DIGEST_SIZE    SHA256_DIGEST_SIZE     
     81#define MAX_DIGEST_SIZE    SHA256_DIGEST_SIZE
    8282//
    8383//
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf

    r58459 r58466  
    2626  MODULE_TYPE                    = DXE_DRIVER
    2727  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
    2929  CONSTRUCTOR                    = DxeImageVerificationLibConstructor
    3030
     
    7575  ## SOMETIMES_PRODUCES   ## GUID       # Unique ID for the type of the signature.
    7676  gEfiCertSha1Guid
    77  
     77
    7878  ## SOMETIMES_CONSUMES   ## GUID       # Unique ID for the type of the signature.
    7979  ## SOMETIMES_PRODUCES   ## GUID       # Unique ID for the type of the signature.
     
    8282  gEfiCertX509Guid                      ## SOMETIMES_CONSUMES    ## GUID     # Unique ID for the type of the signature.
    8383  gEfiCertPkcs7Guid                     ## SOMETIMES_CONSUMES    ## GUID     # Unique ID for the type of the certificate.
    84  
     84
    8585[Pcd]
    8686  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy          ## SOMETIMES_CONSUMES
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/Measurement.c

    r58464 r58466  
    9999  @param[in]  VarName           A Null-terminated string that is the name of the vendor's variable.
    100100  @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
    104104  @retval EFI_SUCCESS           Operation completed successfully.
    105105  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    153153  @param[in]  VarName           A Null-terminated string that is the name of the vendor's variable.
    154154  @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.
    157157
    158158  @retval TRUE  The data is already measured.
     
    199199
    200200  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) &&
    202202        (CompareGuid (VendorGuid, mVariableType[Index].VendorGuid))) {
    203203      return TRUE;
     
    212212  @param[in]  VarName           A Null-terminated string that is the name of the vendor's variable.
    213213  @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
    217217  @retval EFI_SUCCESS           Operation completed successfully.
    218218  @retval EFI_OUT_OF_RESOURCES  Out of memory.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c

    r58464 r58466  
    11/** @file
    22
    3   This library registers RSA 2048 SHA 256 guided section handler 
     3  This library registers RSA 2048 SHA 256 guided section handler
    44  to parse RSA 2048 SHA 256 encapsulation section and extract raw data.
    55  It uses the BaseCrypyLib based on OpenSSL to authenticate the signature.
    66
    77Copyright (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.             
     8This program and the accompanying materials
     9are licensed and made available under the terms and conditions of the BSD License
     10which accompanies this distribution.  The full text of the license may be found at
     11http://opensource.org/licenses/bsd-license.php
     12
     13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
    1616**/
     
    5151
    5252  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.
    5454  If not, EFI_INVALID_PARAMETER will return.
    5555
     
    5959  @param SectionAttribute   The attribute of the input guided section.
    6060
    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
    6262                                 the attribute of the input section are successull retrieved.
    6363  @retval EFI_INVALID_PARAMETER  The GUID in InputSection does not match this instance guid.
     
    112112  Extraction handler tries to extract raw data from the input guided section.
    113113  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.
    115115  If not, EFI_INVALID_PARAMETER will return.
    116116
     
    144144  VOID                            *HashContext;
    145145  VOID                            *Rsa;
    146  
     146
    147147  HashContext = NULL;
    148148  Rsa         = NULL;
    149  
     149
    150150  if (IS_SECTION2 (InputSection)) {
    151151    //
     
    157157      return EFI_INVALID_PARAMETER;
    158158    }
    159  
     159
    160160    //
    161161    // Get the RSA 2048 SHA 256 information.
     
    185185      return EFI_INVALID_PARAMETER;
    186186    }
    187  
     187
    188188    //
    189189    // Get the RSA 2048 SHA 256 information.
     
    215215    //
    216216    *AuthenticationStatus |= EFI_AUTH_STATUS_PLATFORM_OVERRIDE;
    217    
     217
    218218    return EFI_SUCCESS;
    219219  }
     
    223223  //
    224224  Status = EFI_SUCCESS;
    225  
     225
    226226  //
    227227  // Fail if the HashType is not SHA 256
     
    265265    goto Done;
    266266  }
    267  
     267
    268268  //
    269269  // Fail if the PublicKey is not one of the public keys in PcdRsa2048Sha256PublicKeyBuffer
     
    300300    goto Done;
    301301  }
    302  
    303   // 
     302
     303  //
    304304  // Set RSA Key Components.
    305305  // NOTE: Only N and E are needed to be set as RSA public key for signature verification.
     
    348348  PERF_START (NULL, "RsaVerify", "DXE", 0);
    349349  CryptoStatus = RsaPkcs1Verify (
    350                    Rsa, 
    351                    Digest, 
    352                    SHA256_DIGEST_SIZE, 
    353                    CertBlockRsa2048Sha256->Signature, 
     350                   Rsa,
     351                   Digest,
     352                   SHA256_DIGEST_SIZE,
     353                   CertBlockRsa2048Sha256->Signature,
    354354                   sizeof (CertBlockRsa2048Sha256->Signature)
    355355                   );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf

    r58464 r58466  
    11## @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
    33#  ExtractGuidedSectionLib service to register an RSA 2048 SHA 256 guided section handler
    44#  that parses RSA 2048 SHA 256 encapsulation section and extracts raw data.
     
    4040  CryptoPkg/CryptoPkg.dec
    4141  SecurityPkg/SecurityPkg.dec
    42  
     42
    4343[LibraryClasses]
    4444  ExtractGuidedSectionLib
     
    5151  PerformanceLib
    5252
    53 [PcdEx] 
     53[PcdEx]
    5454  gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer    ## SOMETIMES_CONSUMES
    55  
     55
    5656[Protocols]
    5757  gEfiSecurityPolicyProtocolGuid                   ## SOMETIMES_CONSUMES (Set platform override AUTH status if exist)
    58  
     58
    5959[Guids]
    6060  gEfiCertTypeRsa2048Sha256Guid  ## PRODUCES       ## UNDEFINED  # Specifies RSA 2048 SHA 256 authentication algorithm.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c

    r58459 r58466  
    1010
    1111Copyright (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 
     12This program and the accompanying materials
     13are licensed and made available under the terms and conditions of the BSD License
     14which accompanies this distribution.  The full text of the license may be found at
    1515http://opensource.org/licenses/bsd-license.php
    1616
    17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     17THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1818WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1919
     
    6161  Get TPM physical presence permanent flags.
    6262
    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.
    6565  @param[out] CmdEnable     physicalPresenceCMDEnable permanent flag.
    66  
     66
    6767  @retval EFI_SUCCESS       Flags were returns successfully.
    6868  @retval other             Failed to locate EFI TCG Protocol.
     
    8383  TPM_PERMANENT_FLAGS               *TpmPermanentFlags;
    8484  UINT8                             RecvBuffer[40];
    85  
     85
    8686  //
    8787  // Fill request header
     
    8989  TpmRsp = (TPM_RSP_COMMAND_HDR*)RecvBuffer;
    9090  TpmRqu = (TPM_RQU_COMMAND_HDR*)SendBuffer;
    91  
     91
    9292  TpmRqu->tag       = SwapBytes16 (TPM_TAG_RQU_COMMAND);
    9393  TpmRqu->paramSize = SwapBytes32 (sizeof (SendBuffer));
     
    100100  WriteUnaligned32 (SendBufPtr++, SwapBytes32 (TPM_CAP_FLAG));
    101101  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
    104104  Status = TcgProtocol->PassThroughToTpm (
    105105                          TcgProtocol,
     
    112112  ASSERT (TpmRsp->tag == SwapBytes16 (TPM_TAG_RSP_COMMAND));
    113113  ASSERT (TpmRsp->returnCode == 0);
    114  
     114
    115115  TpmPermanentFlags = (TPM_PERMANENT_FLAGS *)&RecvBuffer[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)];
    116  
     116
    117117  if (LifetimeLock != NULL) {
    118118    *LifetimeLock = TpmPermanentFlags->physicalPresenceLifetimeLock;
     
    129129  Issue TSC_PhysicalPresence command to TPM.
    130130
    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
    134134  @retval EFI_SUCCESS             TPM executed the command successfully.
    135135  @retval EFI_SECURITY_VIOLATION  TPM returned error when executing the command.
     
    155155  TpmRqu->paramSize = SwapBytes32 (sizeof (Buffer));
    156156  TpmRqu->ordinal   = SwapBytes32 (TSC_ORD_PhysicalPresence);
    157   WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence)); 
     157  WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence));
    158158
    159159  Status = TcgProtocol->PassThroughToTpm (
     
    172172    return EFI_SECURITY_VIOLATION;
    173173  }
    174  
     174
    175175  return Status;
    176176}
     
    179179  Issue a TPM command for which no additional output data will be returned.
    180180
    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
    187187                                                  receiving response from TPM.
    188188  @retval Others                                  Return code from the TPM device after command execution.
     
    233233  @param[in]      CommandCode         Physical presence operation value.
    234234  @param[in, out] PpiFlags            The physical presence interface flags.
    235  
     235
    236236  @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
    238238                                                  receiving response from TPM.
    239239  @retval Others                                  Return code from the TPM device after command execution.
     
    398398      PpiFlags->PPFlags |= TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_MAINTENANCE;
    399399      return 0;
    400  
     400
    401401    case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR:
    402402      //
     
    424424        TpmResponse = ExecutePhysicalPresence (TcgProtocol, PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE, PpiFlags);
    425425        PpiFlags->PPFlags &= ~TCG_VENDOR_LIB_FLAG_RESET_TRACK;
    426       } 
     426      }
    427427      return TpmResponse;
    428428
     
    454454  UINTN                             Index;
    455455
    456   InputKey = 0; 
     456  InputKey = 0;
    457457  do {
    458458    Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
     
    480480    return TRUE;
    481481  }
    482  
     482
    483483  return FALSE;
    484484}
     
    486486/**
    487487  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.
    490490
    491491  @param  ImageHandle   The firmware allocated handle for the EFI image.
    492492  @param  SystemTable   A pointer to the EFI System Table.
    493  
     493
    494494  @retval EFI_SUCCESS   The constructor successfully added string package.
    495495  @retval Other value   The constructor can't add string package.
     
    524524  CHAR16                            *ConfirmText;
    525525  CHAR16                            *TmpStr1;
    526   CHAR16                            *TmpStr2; 
     526  CHAR16                            *TmpStr2;
    527527  UINTN                             BufSize;
    528528  BOOLEAN                           CautionKey;
    529529  UINT16                            Index;
    530530  CHAR16                            DstStr[81];
    531    
     531
    532532  TmpStr2     = NULL;
    533533  CautionKey  = FALSE;
     
    539539    case PHYSICAL_PRESENCE_ENABLE:
    540540      TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ENABLE));
    541      
     541
    542542      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));
    543543      UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
     
    551551    case PHYSICAL_PRESENCE_DISABLE:
    552552      TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DISABLE));
    553      
     553
    554554      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));
    555555      UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
     
    564564      FreePool (TmpStr1);
    565565      break;
    566      
     566
    567567    case PHYSICAL_PRESENCE_ACTIVATE:
    568568      TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACTIVATE));
    569      
     569
    570570      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));
    571571      UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
     
    590590      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACCEPT_KEY));
    591591      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    592       FreePool (TmpStr1); 
     592      FreePool (TmpStr1);
    593593      break;
    594594
     
    604604      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    605605      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    606       FreePool (TmpStr1);     
     606      FreePool (TmpStr1);
    607607
    608608      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));
     
    629629    case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE:
    630630      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));
    633633      UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
    634634      FreePool (TmpStr1);
     
    637637      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    638638      FreePool (TmpStr1);
    639      
     639
    640640      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING));
    641641      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
     
    649649    case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_TRUE:
    650650      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));
    653653      UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
    654654      FreePool (TmpStr1);
     
    661661    case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_FALSE:
    662662      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));
    665665      UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
    666666      FreePool (TmpStr1);
     
    689689    case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE_OWNER_FALSE:
    690690      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));
    693693      UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);
    694694      FreePool (TmpStr1);
     
    697697      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    698698      FreePool (TmpStr1);
    699      
     699
    700700      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING));
    701701      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
     
    710710      CautionKey = TRUE;
    711711      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
    717717      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_MAINTAIN));
    718718      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
     
    788788      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    789789      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    790       FreePool (TmpStr1); 
     790      FreePool (TmpStr1);
    791791
    792792      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));
     
    878878  DstStr[80] = L'\0';
    879879  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
    884884  FreePool (TmpStr1);
    885885  FreePool (TmpStr2);
     
    890890  }
    891891
    892   return FALSE; 
     892  return FALSE;
    893893}
    894894
    895895/**
    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
    897897  to whether the requested physical presence command already confirmed by user
    898  
     898
    899899   @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.
    901901   @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
    903903                                   in last boot cycle by user.
    904904                                   False, it indicates the command need user confirm from UI.
     
    10071007  its data structure to be valid value.
    10081008
    1009   @param[in] TcgProtocol          EFI TCG Protocol instance. 
     1009  @param[in] TcgProtocol          EFI TCG Protocol instance.
    10101010  @param[in] TcgPpData            Point to the physical presence NV variable.
    10111011  @param[in] Flags                The physical presence interface flags.
     
    10531053    if (!RequestConfirmed) {
    10541054      //
    1055       // Print confirm text and wait for approval. 
     1055      // Print confirm text and wait for approval.
    10561056      //
    10571057      RequestConfirmed = UserConfirm (TcgPpData->PPRequest);
     
    10781078                      sizeof (EFI_PHYSICAL_PRESENCE_FLAGS),
    10791079                      &NewFlags
    1080                       ); 
     1080                      );
    10811081    if (EFI_ERROR (Status)) {
    10821082      return;
    10831083    }
    10841084  }
    1085  
     1085
    10861086  //
    10871087  // Clear request
     
    10891089  if ((NewFlags.PPFlags & TCG_VENDOR_LIB_FLAG_RESET_TRACK) == 0) {
    10901090    TcgPpData->LastPPRequest = TcgPpData->PPRequest;
    1091     TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION;   
     1091    TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION;
    10921092  }
    10931093
     
    11251125    case PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE:
    11261126    case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR:
    1127     case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE:     
     1127    case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE:
    11281128      break;
    11291129    default:
     
    11431143  Print (L"Rebooting system to make TPM settings in effect\n");
    11441144  gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
    1145   ASSERT (FALSE); 
     1145  ASSERT (FALSE);
    11461146}
    11471147
     
    11491149  Check and execute the pending TPM request and Lock TPM.
    11501150
    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
    11521152  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
    11541154  take effect. At last, it will lock TPM to prevent TPM state change by malware.
    1155  
     1155
    11561156  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
    11581158  be invoked as early as possible as TPM is locked in this function.
    1159  
     1159
    11601160**/
    11611161VOID
     
    11731173  EDKII_VARIABLE_LOCK_PROTOCOL      *VariableLockProtocol;
    11741174  EFI_PHYSICAL_PRESENCE_FLAGS       PpiFlags;
    1175  
     1175
    11761176  Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol);
    11771177  if (EFI_ERROR (Status)) {
     
    12071207
    12081208  //
    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.
    12101210  // It should be protected from malicious software. We set it as read-only variable here.
    12111211  //
     
    12221222    }
    12231223  }
    1224  
     1224
    12251225  //
    12261226  // Initialize physical presence variable.
     
    12631263    return ;
    12641264  }
    1265  
     1265
    12661266  if (!CmdEnable) {
    12671267    if (LifetimeLock) {
     
    12761276    }
    12771277  }
    1278  
     1278
    12791279  //
    12801280  // Set operator physical presence flags
     
    12841284  //
    12851285  // Execute pending TPM request.
    1286   // 
     1286  //
    12871287  ExecutePendingTpmRequest (TcgProtocol, &TcgPpData, PpiFlags);
    12881288  DEBUG ((EFI_D_INFO, "[TPM] PPResponse = %x\n", TcgPpData.PPResponse));
     
    12991299  The TPM request may come from OS. This API will check if TPM request exists and need user
    13001300  input to confirmation.
    1301  
     1301
    13021302  @retval    TRUE        TPM needs input to confirm user physical presence.
    13031303  @retval    FALSE       TPM doesn't need input to confirm user physical presence.
     
    13181318  EFI_TCG_PROTOCOL             *TcgProtocol;
    13191319  EFI_PHYSICAL_PRESENCE_FLAGS  PpiFlags;
    1320  
     1320
    13211321  Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol);
    13221322  if (EFI_ERROR (Status)) {
     
    13501350    return FALSE;
    13511351  }
    1352  
     1352
    13531353  if (TcgPpData.PPRequest == PHYSICAL_PRESENCE_NO_ACTION) {
    13541354    //
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.inf

    r58459 r58466  
    33#
    44#  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
    66#  presence at last.
    77#
     
    2727  MODULE_TYPE                    = DXE_DRIVER
    2828  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
    3030  CONSTRUCTOR                    = TcgPhysicalPresenceLibConstructor
    31  
     31
    3232#
    3333# 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 to text/plain;encoding=UTF-16LE
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c

    r58464 r58466  
    1717
    1818Copyright (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 
     19This program and the accompanying materials
     20are licensed and made available under the terms and conditions of the BSD License
     21which accompanies this distribution.  The full text of the license may be found at
    2222http://opensource.org/licenses/bsd-license.php
    2323
    24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     24THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    2525WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    2626
     
    7171  @param  FileHandle      Pointer to the file handle to read the PE/COFF image.
    7272  @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.
    7474                          On output, the number of bytes actually read.
    7575  @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
    7878**/
    7979EFI_STATUS
     
    158158  //
    159159  // Read the EFI Partition Table Header
    160   // 
     160  //
    161161  PrimaryHeader = (EFI_PARTITION_TABLE_HEADER *) AllocatePool (BlockIo->Media->BlockSize);
    162162  if (PrimaryHeader == NULL) {
    163163    return EFI_OUT_OF_RESOURCES;
    164   } 
     164  }
    165165  Status = DiskIo->ReadDisk (
    166166                     DiskIo,
     
    174174    FreePool (PrimaryHeader);
    175175    return EFI_DEVICE_ERROR;
    176   } 
     176  }
    177177  //
    178178  // Read the partition entry.
     
    195195    return EFI_DEVICE_ERROR;
    196196  }
    197  
     197
    198198  //
    199199  // Count the valid partition
     
    203203  for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) {
    204204    if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mTrEEZeroGuid)) {
    205       NumberOfPartition++; 
     205      NumberOfPartition++;
    206206    }
    207207    PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry);
     
    210210  //
    211211  // 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)
    214214                        + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry);
    215215  TreeEvent = (TrEE_EVENT *) AllocateZeroPool (EventSize + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event));
     
    225225  TreeEvent->Header.PCRIndex      = 5;
    226226  TreeEvent->Header.EventType     = EV_EFI_GPT_EVENT;
    227   GptData = (EFI_GPT_DATA *) TreeEvent->Event; 
     227  GptData = (EFI_GPT_DATA *) TreeEvent->Event;
    228228
    229229  //
    230230  // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition
    231   // 
     231  //
    232232  CopyMem ((UINT8 *)GptData, (UINT8*)PrimaryHeader, sizeof (EFI_PARTITION_TABLE_HEADER));
    233233  GptData->NumberOfPartitions = NumberOfPartition;
     
    287287  @retval EFI_SUCCESS            Successfully measure image.
    288288  @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.
    290290  @retval other error value
    291291
     
    382382
    383383/**
    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
    391391  within the SAP of the driver.
    392392
    393393  If File is NULL, then EFI_INVALID_PARAMETER is returned.
    394394
    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
    396396  AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
    397397
    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,
    400400  then EFI_ACCESS_DENIED is returned.
    401401
    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
    405405  returned.
    406406
     
    454454  ProtocolCapability.Size = (UINT8) sizeof (ProtocolCapability);
    455455  Status = TreeProtocol->GetCapability (
    456                            TreeProtocol, 
     456                           TreeProtocol,
    457457                           &ProtocolCapability
    458458                           );
     
    469469  //
    470470  OrigDevicePathNode = DuplicateDevicePath (File);
    471  
     471
    472472  //
    473473  // 1. Check whether this device path support BlockIo protocol.
     
    490490        //
    491491        // 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 &&
    494494            ((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->SignatureType == SIGNATURE_TYPE_GUID) {
    495495
     
    527527    }
    528528  }
    529  
     529
    530530  //
    531531  // 2. Measure PE image.
     
    561561      do {
    562562        Status = gBS->HandleProtocol(
    563                         TempHandle, 
     563                        TempHandle,
    564564                        &gEfiFirmwareVolumeBlockProtocolGuid,
    565565                        (VOID**)&FvbProtocol
     
    620620    goto Finish;
    621621  }
    622  
     622
    623623  //
    624624  // Measure only application if Application flag is set
    625625  // Measure drivers and applications if Application flag is not set
    626626  //
    627   if ((!ApplicationRequired) || 
    628         (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 
     627  if ((!ApplicationRequired) ||
     628        (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) {
    629629    //
    630630    // Print the image path to be measured.
    631     //   
     631    //
    632632    DEBUG_CODE_BEGIN ();
    633633      CHAR16                            *ToText;
     
    648648    Status = TrEEMeasurePeImage (
    649649               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,
    654654               DevicePathNode
    655655               );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf

    r58464 r58466  
    22#  Provides security service for TPM 2.0 measured boot
    33#
    4 #  This library instance hooks LoadImage() API to measure every image that 
     4#  This library instance hooks LoadImage() API to measure every image that
    55#  is not measured in PEI phase. And, it will also measure GPT partition.
    66#
    77#  Caution: This module requires additional review when modified.
    88#  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
    1010#  as buffer overflow or integer overflow.
    1111#
     
    2727  MODULE_TYPE                    = DXE_DRIVER
    2828  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
    3030  CONSTRUCTOR                    = DxeTpm2MeasureBootLibConstructor
    3131
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c

    r58459 r58466  
    11/** @file
    2   The library instance provides security service of TPM measure boot. 
     2  The library instance provides security service of TPM measure boot.
    33
    44  Caution: This file requires additional review when modified.
     
    1717
    1818Copyright (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 
     19This program and the accompanying materials
     20are licensed and made available under the terms and conditions of the BSD License
     21which accompanies this distribution.  The full text of the license may be found at
    2222http://opensource.org/licenses/bsd-license.php
    2323
    24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     24THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    2525WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    2626
     
    7070  @param  FileHandle      Pointer to the file handle to read the PE/COFF image.
    7171  @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.
    7373                          On output, the number of bytes actually read.
    7474  @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
    7777**/
    7878EFI_STATUS
     
    159159  //
    160160  // Read the EFI Partition Table Header
    161   // 
     161  //
    162162  PrimaryHeader = (EFI_PARTITION_TABLE_HEADER *) AllocatePool (BlockIo->Media->BlockSize);
    163163  if (PrimaryHeader == NULL) {
    164164    return EFI_OUT_OF_RESOURCES;
    165   } 
     165  }
    166166  Status = DiskIo->ReadDisk (
    167167                     DiskIo,
     
    175175    FreePool (PrimaryHeader);
    176176    return EFI_DEVICE_ERROR;
    177   } 
     177  }
    178178  //
    179179  // Read the partition entry.
     
    196196    return EFI_DEVICE_ERROR;
    197197  }
    198  
     198
    199199  //
    200200  // Count the valid partition
     
    204204  for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) {
    205205    if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mZeroGuid)) {
    206       NumberOfPartition++; 
     206      NumberOfPartition++;
    207207    }
    208208    PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry);
     
    211211  //
    212212  // 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)
    215215                        + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry);
    216216  TcgEvent = (TCG_PCR_EVENT *) AllocateZeroPool (EventSize + sizeof (TCG_PCR_EVENT_HDR));
     
    224224  TcgEvent->EventType  = EV_EFI_GPT_EVENT;
    225225  TcgEvent->EventSize  = EventSize;
    226   GptData = (EFI_GPT_DATA *) TcgEvent->Event; 
     226  GptData = (EFI_GPT_DATA *) TcgEvent->Event;
    227227
    228228  //
    229229  // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition
    230   // 
     230  //
    231231  CopyMem ((UINT8 *)GptData, (UINT8*)PrimaryHeader, sizeof (EFI_PARTITION_TABLE_HEADER));
    232232  GptData->NumberOfPartitions = NumberOfPartition;
     
    289289  @retval EFI_SUCCESS            Successfully measure image.
    290290  @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.
    292292  @retval other error value
    293293
     
    419419  if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
    420420    //
    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
    423423    //       Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
    424424    //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
     
    431431    Magic = Hdr.Pe32->OptionalHeader.Magic;
    432432  }
    433  
     433
    434434  //
    435435  // 3.  Calculate the distance from the base of the image header to the image checksum address.
     
    454454  if (!HashStatus) {
    455455    goto Finish;
    456   } 
     456  }
    457457
    458458  //
     
    483483        goto Finish;
    484484      }
    485     }   
     485    }
    486486  } else {
    487487    //
     
    497497      //
    498498      // Use PE32+ offset
    499       //   
     499      //
    500500      HashBase = (UINT8 *) &Hdr.Pe32Plus->OptionalHeader.CheckSum + sizeof (UINT32);
    501501      HashSize = (UINTN) ((UINT8 *)(&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]) - HashBase);
     
    526526      HashSize = Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - (UINTN) (HashBase - ImageAddress);
    527527    }
    528    
     528
    529529    if (HashSize != 0) {
    530530      HashStatus  = Sha1Update (Sha1Ctx, HashBase, HashSize);
     
    689689
    690690/**
    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
    698698  within the SAP of the driver.
    699699
    700700  If File is NULL, then EFI_INVALID_PARAMETER is returned.
    701701
    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
    703703  AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
    704704
    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,
    707707  then EFI_ACCESS_DENIED is returned.
    708708
    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
    712712  returned.
    713713
     
    763763  ProtocolCapability.Size = (UINT8) sizeof (ProtocolCapability);
    764764  Status = TcgProtocol->StatusCheck (
    765              TcgProtocol, 
     765             TcgProtocol,
    766766             &ProtocolCapability,
    767767             &TCGFeatureFlags,
     
    780780  //
    781781  OrigDevicePathNode = DuplicateDevicePath (File);
    782  
     782
    783783  //
    784784  // 1. Check whether this device path support BlockIo protocol.
     
    801801        //
    802802        // 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 &&
    805805            ((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->SignatureType == SIGNATURE_TYPE_GUID) {
    806806
     
    837837    }
    838838  }
    839  
     839
    840840  //
    841841  // 2. Measure PE image.
     
    871871      do {
    872872        Status = gBS->HandleProtocol(
    873                         TempHandle, 
     873                        TempHandle,
    874874                        &gEfiFirmwareVolumeBlockProtocolGuid,
    875875                        (VOID**)&FvbProtocol
     
    930930    goto Finish;
    931931  }
    932  
     932
    933933  //
    934934  // Measure only application if Application flag is set
    935935  // Measure drivers and applications if Application flag is not set
    936936  //
    937   if ((!ApplicationRequired) || 
    938         (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 
     937  if ((!ApplicationRequired) ||
     938        (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) {
    939939    //
    940940    // Print the image path to be measured.
    941     //   
     941    //
    942942    DEBUG_CODE_BEGIN ();
    943943      CHAR16                            *ToText;
     
    958958    Status = TcgMeasurePeImage (
    959959               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,
    964964               DevicePathNode
    965965               );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf

    r58459 r58466  
    22#  Provides security service for TPM 1.2 measured boot
    33#
    4 #  This library instance hooks LoadImage() API to measure every image that 
     4#  This library instance hooks LoadImage() API to measure every image that
    55#  is not measured in PEI phase. And, it will also measure GPT partition.
    66#
    77#  Caution: This module requires additional review when modified.
    88#  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
    1010#  as buffer overflow or integer overflow.
    1111#
     
    2727  MODULE_TYPE                    = DXE_DRIVER
    2828  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
    3030  CONSTRUCTOR                    = DxeTpmMeasureBootLibConstructor
    3131
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.c

    r58464 r58466  
    172172**/
    173173EFI_STATUS
    174 EFIAPI 
     174EFIAPI
    175175TpmMeasureAndLogData (
    176176  IN UINT32             PcrIndex,
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf

    r58464 r58466  
    11## @file
    22#  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
    55#  extend the measurement result into a specific PCR.
    66#
     
    2121  MODULE_TYPE                    = UEFI_DRIVER
    2222  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
    2424  MODULE_UNI_FILE                = DxeTpmMeasurementLib.uni
    2525
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTrEEPhysicalPresenceLib/DxeTrEEPhysicalPresenceLib.c

    r58464 r58466  
    99
    1010Copyright (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 
     11This program and the accompanying materials
     12are licensed and made available under the terms and conditions of the BSD License
     13which accompanies this distribution.  The full text of the license may be found at
    1414http://opensource.org/licenses/bsd-license.php
    1515
    16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     16THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1717WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1818
     
    110110  @param[in]      CommandCode         Physical presence operation value.
    111111  @param[in, out] PpiFlags            The physical presence interface flags.
    112  
     112
    113113  @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
    115115                                                   receiving response from TPM.
    116116  @retval Others                                   Return code from the TPM device after command execution.
     
    172172  EFI_INPUT_KEY                     Key;
    173173  UINT16                            InputKey;
    174      
    175   InputKey = 0; 
     174
     175  InputKey = 0;
    176176  do {
    177177    Status = gBS->CheckEvent (gST->ConIn->WaitForKey);
     
    187187        InputKey = Key.ScanCode;
    188188      }
    189     }     
     189    }
    190190  } while (InputKey == 0);
    191191
     
    193193    return TRUE;
    194194  }
    195  
     195
    196196  return FALSE;
    197197}
     
    199199/**
    200200  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.
    203203
    204204  @param  ImageHandle   The firmware allocated handle for the EFI image.
    205205  @param  SystemTable   A pointer to the EFI System Table.
    206  
     206
    207207  @retval EFI_SUCCESS   The constructor successfully added string package.
    208208  @retval Other value   The constructor can't add string package.
     
    236236  CHAR16                            *ConfirmText;
    237237  CHAR16                            *TmpStr1;
    238   CHAR16                            *TmpStr2; 
     238  CHAR16                            *TmpStr2;
    239239  UINTN                             BufSize;
    240240  BOOLEAN                           CautionKey;
    241241  UINT16                            Index;
    242242  CHAR16                            DstStr[81];
    243    
     243
    244244  TmpStr2     = NULL;
    245245  CautionKey  = FALSE;
     
    264264      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    265265      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    266       FreePool (TmpStr1);     
     266      FreePool (TmpStr1);
    267267
    268268      TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));
     
    286286      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    287287      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);
    288       FreePool (TmpStr1); 
     288      FreePool (TmpStr1);
    289289
    290290      TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));
     
    312312  DstStr[80] = L'\0';
    313313  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
    318318  FreePool (TmpStr1);
    319319  FreePool (TmpStr2);
     
    324324  }
    325325
    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
    331331  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.
    334334   @param[in]  Flags                     The physical presence interface flags.
    335335   @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
    337337                                                   in last boot cycle by user.
    338338                                             False, it indicates the command need user confirm from UI.
     
    466466    if (!RequestConfirmed) {
    467467      //
    468       // Print confirm text and wait for approval. 
     468      // Print confirm text and wait for approval.
    469469      //
    470470      RequestConfirmed = TrEEUserConfirm (TcgPpData->PPRequest
     
    478478    NewFlags = Flags;
    479479    if (RequestConfirmed) {
    480       TcgPpData->PPResponse = TrEEExecutePhysicalPresence (PlatformAuth, TcgPpData->PPRequest, 
     480      TcgPpData->PPResponse = TrEEExecutePhysicalPresence (PlatformAuth, TcgPpData->PPRequest,
    481481                                                           &NewFlags);
    482482    }
     
    493493                      sizeof (EFI_TREE_PHYSICAL_PRESENCE_FLAGS),
    494494                      &NewFlags
    495                       ); 
     495                      );
    496496  }
    497497
     
    501501  if ((NewFlags.PPFlags & TREE_VENDOR_LIB_FLAG_RESET_TRACK) == 0) {
    502502    TcgPpData->LastPPRequest = TcgPpData->PPRequest;
    503     TcgPpData->PPRequest = TREE_PHYSICAL_PRESENCE_NO_ACTION;   
     503    TcgPpData->PPRequest = TREE_PHYSICAL_PRESENCE_NO_ACTION;
    504504  }
    505505
     
    548548  Print (L"Rebooting system to make TPM2 settings in effect\n");
    549549  gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
    550   ASSERT (FALSE); 
     550  ASSERT (FALSE);
    551551}
    552552
     
    554554  Check and execute the pending TPM request.
    555555
    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
    557557  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
    559559  take effect.
    560  
     560
    561561  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.
    563563
    564564  @param[in]  PlatformAuth                   platform auth value. NULL means no platform auth change.
     
    610610
    611611  //
    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.
    613613  // It should be protected from malicious software. We set it as read-only variable here.
    614614  //
     
    625625    }
    626626  }
    627  
     627
    628628  //
    629629  // Initialize physical presence variable.
     
    657657  //
    658658  // Execute pending TPM request.
    659   // 
     659  //
    660660  TrEEExecutePendingTpmRequest (PlatformAuth, &TcgPpData, PpiFlags);
    661661  DEBUG ((EFI_D_INFO, "[TPM2] PPResponse = %x (LastPPRequest=%x, Flags=%x)\n", TcgPpData.PPResponse, TcgPpData.LastPPRequest, PpiFlags.PPFlags));
     
    668668  The TPM request may come from OS. This API will check if TPM request exists and need user
    669669  input to confirmation.
    670  
     670
    671671  @retval    TRUE        TPM needs input to confirm user physical presence.
    672672  @retval    FALSE       TPM doesn't need input to confirm user physical presence.
     
    717717    return FALSE;
    718718  }
    719  
     719
    720720  if (TcgPpData.PPRequest == TREE_PHYSICAL_PRESENCE_NO_ACTION) {
    721721    //
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTrEEPhysicalPresenceLib/DxeTrEEPhysicalPresenceLib.inf

    r58464 r58466  
    2626  MODULE_TYPE                    = DXE_DRIVER
    2727  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
    2929  CONSTRUCTOR                    = TrEEPhysicalPresenceLibConstructor
    30  
     30
    3131#
    3232# 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  
    119119
    120120  FreePool (Sha1Ctx);
    121  
     121
    122122  Tpm2SetSha1ToDigestList (DigestList, Digest);
    123123
     
    134134/**
    135135  The function register SHA1 instance.
    136  
     136
    137137  @retval EFI_SUCCESS   SHA1 instance is registered, or system dose not surpport registr SHA1 instance
    138138**/
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.c

    r58464 r58466  
    119119
    120120  FreePool (Sha256Ctx);
    121  
     121
    122122  Tpm2SetSha256ToDigestList (DigestList, Digest);
    123123
     
    134134/**
    135135  The function register SHA256 instance.
    136  
     136
    137137  @retval EFI_SUCCESS   SHA256 instance is registered, or system dose not surpport registr SHA256 instance
    138138**/
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.c

    r58464 r58466  
    217217  CopyMem (&mHashInterface[mHashInterfaceCount], HashInterface, sizeof(*HashInterface));
    218218  mHashInterfaceCount ++;
    219  
     219
    220220  return EFI_SUCCESS;
    221221}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf

    r58464 r58466  
    33#
    44#  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
    66#  mask some hash engines.
    77#
     
    2323  MODULE_TYPE                    = DXE_DRIVER
    2424  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
    2626
    2727#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c

    r58464 r58466  
    284284  CopyMem (&HashInterfaceHob->HashInterface[HashInterfaceHob->HashInterfaceCount], HashInterface, sizeof(*HashInterface));
    285285  HashInterfaceHob->HashInterfaceCount ++;
    286  
     286
    287287  return EFI_SUCCESS;
    288288}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf

    r58464 r58466  
    33#
    44#  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
    66#  mask some hash engines.
    77#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.inf

    r58464 r58466  
    22#  Provides hash service using TPM2 device
    33#
    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
    55#  mask some hash calculation.
    66#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c

    r58464 r58466  
    11/** @file
    22
    3   This library registers RSA 2048 SHA 256 guided section handler 
     3  This library registers RSA 2048 SHA 256 guided section handler
    44  to parse RSA 2048 SHA 256 encapsulation section and extract raw data.
    55  It uses the BaseCrypyLib based on OpenSSL to authenticate the signature.
    66
    77Copyright (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.             
     8This program and the accompanying materials
     9are licensed and made available under the terms and conditions of the BSD License
     10which accompanies this distribution.  The full text of the license may be found at
     11http://opensource.org/licenses/bsd-license.php
     12
     13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
    1616**/
     
    4949
    5050  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.
    5252  If not, EFI_INVALID_PARAMETER will return.
    5353
     
    5757  @param SectionAttribute   The attribute of the input guided section.
    5858
    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
    6060                                 the attribute of the input section are successull retrieved.
    6161  @retval EFI_INVALID_PARAMETER  The GUID in InputSection does not match this instance guid.
     
    110110  Extraction handler tries to extract raw data from the input guided section.
    111111  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.
    113113  If not, EFI_INVALID_PARAMETER will return.
    114114
     
    141141  VOID                            *HashContext;
    142142  VOID                            *Rsa;
    143  
     143
    144144  HashContext = NULL;
    145145  Rsa         = NULL;
    146  
     146
    147147  if (IS_SECTION2 (InputSection)) {
    148148    //
     
    154154      return EFI_INVALID_PARAMETER;
    155155    }
    156  
     156
    157157    //
    158158    // Get the RSA 2048 SHA 256 information.
     
    182182      return EFI_INVALID_PARAMETER;
    183183    }
    184  
     184
    185185    //
    186186    // Get the RSA 2048 SHA 256 information.
     
    207207  //
    208208  Status = EFI_SUCCESS;
    209  
     209
    210210  //
    211211  // Fail if the HashType is not SHA 256
     
    249249    goto Done;
    250250  }
    251  
     251
    252252  //
    253253  // Fail if the PublicKey is not one of the public keys in PcdRsa2048Sha256PublicKeyBuffer
     
    284284    goto Done;
    285285  }
    286  
    287   // 
     286
     287  //
    288288  // Set RSA Key Components.
    289289  // NOTE: Only N and E are needed to be set as RSA public key for signature verification.
     
    332332  PERF_START (NULL, "RsaVerify", "PEI", 0);
    333333  CryptoStatus = RsaPkcs1Verify (
    334                    Rsa, 
    335                    Digest, 
    336                    SHA256_DIGEST_SIZE, 
    337                    CertBlockRsa2048Sha256->Signature, 
     334                   Rsa,
     335                   Digest,
     336                   SHA256_DIGEST_SIZE,
     337                   CertBlockRsa2048Sha256->Signature,
    338338                   sizeof (CertBlockRsa2048Sha256->Signature)
    339339                   );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.inf

    r58464 r58466  
    11## @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
    33#  ExtractGuidedSectionLib service to register an RSA 2048 SHA 256 guided section handler
    44#  that parses RSA 2048 SHA 256 encapsulation section and extracts raw data.
     
    5050  PerformanceLib
    5151
    52 [PcdEx] 
     52[PcdEx]
    5353  gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer      ## SOMETIMES_CONSUMES
    54  
     54
    5555[Guids]
    5656  gEfiCertTypeRsa2048Sha256Guid  ## PRODUCES     ## UNDEFINED  # Specifies RSA 2048 SHA 256 authentication algorithm.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c

    r48674 r58466  
    11/** @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
    33  user exists but return TRUE directly. This instance can be used to verify security
    44  related features during platform enabling and development. It should be replaced
     
    66
    77Copyright (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 
     8This program and the accompanying materials
     9are licensed and made available under the terms and conditions of the BSD License
     10which accompanies this distribution.  The full text of the license may be found at
    1111http://opensource.org/licenses/bsd-license.php
    1212
    13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1414WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
     
    1919
    2020  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.
    2222
    2323  Programmatic changing of platform security policy (such as disable Secure Boot,
     
    2828  NOTE THAT: This function cannot depend on any EFI Variable Service since they are
    2929  not available when this function is called in AuthenticateVariable driver.
    30  
     30
    3131  @retval  TRUE       The platform is operated by a physically present user.
    3232  @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  
    22#  NULL platform secure library instance that alway returns TRUE for a user physical present
    33#
    4 #  NULL PlatformSecureLib instance does NOT really detect whether a physical present 
     4#  NULL PlatformSecureLib instance does NOT really detect whether a physical present
    55#  user exists but returns TRUE directly. This instance can be used to verify security
    66#  related features during platform enabling and development. It should be replaced
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.c

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2020
    2121  This API should be invoked in BIOS boot phase to process pending request.
    22  
     22
    2323  Caution: This function may receive untrusted input.
    24  
     24
    2525  If OperationRequest < 128, then ASSERT().
    2626
     
    4949
    5050  This API should be invoked in BIOS boot phase to process pending request.
    51  
     51
    5252  Caution: This function may receive untrusted input.
    5353
     
    8383
    8484  Caution: This function may receive untrusted input.
    85  
     85
    8686  If OperationRequest < 128, then ASSERT().
    8787
     
    110110
    111111  Caution: This function may receive untrusted input.
    112  
     112
    113113  If OperationRequest < 128, then ASSERT().
    114114
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.inf

    r58464 r58466  
    3333  MdePkg/MdePkg.dec
    3434  SecurityPkg/SecurityPkg.dec
    35  
     35
    3636[LibraryClasses]
    3737  DebugLib
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c

    r58464 r58466  
    6767/**
    6868  Send NV DefineSpace command to TPM1.2.
    69  
     69
    7070  @param PubInfo           The public parameters of the NV area.
    7171  @param EncAuth           The encrypted AuthData, only valid if the attributes require subsequent authorization.
     
    197197/**
    198198  Send NV WriteValue command to TPM1.2.
    199  
     199
    200200  @param NvIndex           The index of the area to set.
    201201  @param Offset            The offset into the NV Area.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf

    r58464 r58466  
    11## @file
    22#  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
    66#  only uses TPM 1.2 device.
    77#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c

    r58464 r58466  
    11/** @file
    22  TIS (TPM Interface Specification) functions used by TPM1.2.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    153153
    154154///
    155 /// When this bit is 1, TPM is in the Ready state, 
     155/// When this bit is 1, TPM is in the Ready state,
    156156/// indicating it is ready to receive a new command.
    157157///
     
    201201{
    202202  UINT8                             RegRead;
    203  
     203
    204204  RegRead = MmioRead8 ((UINTN)&TisReg->Access);
    205205  return (BOOLEAN)(RegRead != (UINT8)-1);
     
    238238
    239239/**
    240   Get BurstCount by reading the burstCount field of a TIS regiger 
     240  Get BurstCount by reading the burstCount field of a TIS regiger
    241241  in the time of default TIS_TIMEOUT_D.
    242242
     
    282282
    283283/**
    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
    285285  to Status Register in time.
    286286
     
    313313
    314314/**
    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
    316316  to ACCESS Register in the time of default TIS_TIMEOUT_A.
    317317
     
    329329{
    330330  EFI_STATUS                        Status;
    331  
     331
    332332  if (TisReg == NULL) {
    333333    return EFI_INVALID_PARAMETER;
    334334  }
    335  
     335
    336336  if (!Tpm12TisPcPresenceCheck (TisReg)) {
    337337    return EFI_NOT_FOUND;
     
    351351  Send a command to TPM for execution and return response data.
    352352
    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
    359359  @retval EFI_SUCCESS           Operation completed successfully.
    360360  @retval EFI_BUFFER_TOO_SMALL  Response data buffer is too small.
     
    531531  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    532532  @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.
    534534**/
    535535EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.c

    r58464 r58466  
    2222#include <IndustryStandard/Tpm12.h>
    2323
    24 EFI_TCG_PROTOCOL  *mTcgProtocol = NULL; 
     24EFI_TCG_PROTOCOL  *mTcgProtocol = NULL;
    2525
    2626/**
     
    3434  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    3535  @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.
    3737**/
    3838EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf

    r58464 r58466  
    2222  MODULE_TYPE                    = BASE
    2323  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
    2525
    2626#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c

    r58464 r58466  
    4949  This command returns various information regarding the TPM and its current state.
    5050
    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
    5353  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
    5555  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
    5757  a value of NO.
    5858
    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
    6161  many capability categories and only few categories will be used in firmware. It means the caller
    6262  need swap the byte order for the feilds in CapabilityData.
    6363
    6464  @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.
    6666  @param[in]  PropertyCount      Number of properties of the indicated type to return.
    6767  @param[out] MoreData           Flag to indicate if there are more values of this type.
    6868  @param[out] CapabilityData     The capability data.
    69  
     69
    7070  @retval EFI_SUCCESS            Operation completed successfully.
    7171  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    9696  SendBuffer.Property = SwapBytes32 (Property);
    9797  SendBuffer.PropertyCount = SwapBytes32 (PropertyCount);
    98  
     98
    9999  SendBufferSize = (UINT32) sizeof (SendBuffer);
    100100  SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize);
    101    
     101
    102102  //
    103103  // send Tpm command
     
    121121  //
    122122  CopyMem (CapabilityData, &RecvBuffer.CapabilityData, RecvBufferSize - sizeof (TPM2_RESPONSE_HEADER) - sizeof (UINT8));
    123  
     123
    124124  return EFI_SUCCESS;
    125125}
     
    131131
    132132  @param[out] Family             The Family of TPM. (a 4-octet character string)
    133  
     133
    134134  @retval EFI_SUCCESS            Operation completed successfully.
    135135  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    143143  TPMS_CAPABILITY_DATA    TpmCap;
    144144  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,
    152152             &TpmCap
    153153             );
     
    166166
    167167  @param[out] ManufactureId      The manufacture ID of TPM.
    168  
     168
    169169  @retval EFI_SUCCESS            Operation completed successfully.
    170170  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    178178  TPMS_CAPABILITY_DATA    TpmCap;
    179179  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,
    187187             &TpmCap
    188188             );
     
    202202  @param[out] FirmwareVersion1   The FirmwareVersion1.
    203203  @param[out] FirmwareVersion2   The FirmwareVersion2.
    204  
     204
    205205  @retval EFI_SUCCESS            Operation completed successfully.
    206206  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    215215  TPMS_CAPABILITY_DATA    TpmCap;
    216216  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,
    224224             &TpmCap
    225225             );
     
    230230
    231231  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,
    236236             &TpmCap
    237237             );
     
    251251  @param[out] MaxCommandSize     The maximum value for commandSize in a command.
    252252  @param[out] MaxResponseSize    The maximum value for responseSize in a command.
    253  
     253
    254254  @retval EFI_SUCCESS            Operation completed successfully.
    255255  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    267267
    268268  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,
    273273             &TpmCap
    274274             );
     
    280280
    281281  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,
    286286             &TpmCap
    287287             );
     
    291291
    292292  *MaxResponseSize = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);
    293   return EFI_SUCCESS; 
     293  return EFI_SUCCESS;
    294294}
    295295
    296296/**
    297297  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.
    299299
    300300  This function parse the value got from TPM2_GetCapability and return the list.
    301301
    302302  @param[out] AlgList      List of algorithm.
    303  
     303
    304304  @retval EFI_SUCCESS            Operation completed successfully.
    305305  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    315315  UINTN                   Index;
    316316  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
    329329  CopyMem (AlgList, &TpmCap.data.algorithms, sizeof (TPML_ALG_PROPERTY));
    330330
     
    344344
    345345  @param[out] LockoutCounter     The LockoutCounter of TPM.
    346  
     346
    347347  @retval EFI_SUCCESS            Operation completed successfully.
    348348  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    356356  TPMS_CAPABILITY_DATA    TpmCap;
    357357  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,
    365365             &TpmCap
    366366             );
     
    379379
    380380  @param[out] LockoutInterval    The LockoutInterval of TPM.
    381  
     381
    382382  @retval EFI_SUCCESS            Operation completed successfully.
    383383  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    391391  TPMS_CAPABILITY_DATA    TpmCap;
    392392  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,
    400400             &TpmCap
    401401             );
     
    415415  @param[out] InputBufferSize    The InputBufferSize of TPM.
    416416                                 the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER)
    417  
     417
    418418  @retval EFI_SUCCESS            Operation completed successfully.
    419419  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    427427  TPMS_CAPABILITY_DATA    TpmCap;
    428428  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,
    436436             &TpmCap
    437437             );
     
    450450
    451451  @param[out] Pcrs    The Pcr Selection
    452  
     452
    453453  @retval EFI_SUCCESS            Operation completed successfully.
    454454  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    466466
    467467  Status = Tpm2GetCapability (
    468              TPM_CAP_PCRS, 
    469              0, 
    470              1, 
    471              &MoreData, 
     468             TPM_CAP_PCRS,
     469             0,
     470             1,
     471             &MoreData,
    472472             &TpmCap
    473473             );
     
    492492
    493493  @param[out] AlgorithmSet    The AlgorithmSet of TPM.
    494  
     494
    495495  @retval EFI_SUCCESS            Operation completed successfully.
    496496  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    504504  TPMS_CAPABILITY_DATA    TpmCap;
    505505  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,
    513513             &TpmCap
    514514             );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Context.c

    r58464 r58466  
    3737
    3838  @param[in]  FlushHandle        The handle of the item to flush.
    39  
     39
    4040  @retval EFI_SUCCESS            Operation completed successfully.
    4141  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    6060
    6161  SendBuffer.FlushHandle = SwapBytes32 (FlushHandle);
    62  
     62
    6363  SendBufferSize = (UINT32) sizeof (SendBuffer);
    6464  SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize);
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2EnhancedAuthorization.c

    r58464 r58466  
    8888  @param[out] Timeout            Time value used to indicate to the TPM when the ticket expires.
    8989  @param[out] PolicyTicket       A ticket that includes a value indicating when the authorization expires.
    90  
     90
    9191  @retval EFI_SUCCESS            Operation completed successfully.
    9292  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    121121  SendBuffer.AuthHandle = SwapBytes32 (AuthHandle);
    122122  SendBuffer.PolicySession = SwapBytes32 (PolicySession);
    123  
     123
    124124  //
    125125  // Add in Auth session
     
    149149  CopyMem (Buffer, PolicyRef->buffer, PolicyRef->size);
    150150  Buffer += PolicyRef->size;
    151  
     151
    152152  WriteUnaligned32 ((UINT32 *)Buffer, SwapBytes32((UINT32)Expiration));
    153153  Buffer += sizeof(UINT32);
     
    201201  @param[in] PolicySession      Handle for the policy session being extended.
    202202  @param[in] HashList           the list of hashes to check for a match.
    203  
     203
    204204  @retval EFI_SUCCESS            Operation completed successfully.
    205205  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    266266  @param[in]  PolicySession      Handle for the policy session being extended.
    267267  @param[in]  Code               The allowed commandCode.
    268  
     268
    269269  @retval EFI_SUCCESS            Operation completed successfully.
    270270  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    322322  @param[in]  PolicySession      Handle for the policy session.
    323323  @param[out] PolicyHash         the current value of the policyHash of policySession.
    324  
     324
    325325  @retval EFI_SUCCESS            Operation completed successfully.
    326326  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c

    r58464 r58466  
    7474
    7575  Buffer = (UINT8 *)AuthSessionOut;
    76  
     76
    7777  //
    7878  // Add in Auth session
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Hierarchy.c

    r58464 r58466  
    207207  @param[in] AuthHandle        TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP}
    208208  @param[in] AuthSession       Auth Session context
    209  
     209
    210210  @retval EFI_SUCCESS      Operation completed successfully.
    211211  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    432432  //
    433433  Status = Tpm2SubmitCommand (
    434              CmdSize, 
    435              (UINT8 *)&Cmd, 
     434             CmdSize,
     435             (UINT8 *)&Cmd,
    436436             &ResultBufSize,
    437437             ResultBuf
     
    518518  //
    519519  Status = Tpm2SubmitCommand (
    520              CmdSize, 
    521              (UINT8 *)&Cmd, 
     520             CmdSize,
     521             (UINT8 *)&Cmd,
    522522             &ResultBufSize,
    523523             ResultBuf
     
    604604  //
    605605  Status = Tpm2SubmitCommand (
    606              CmdSize, 
    607              (UINT8 *)&Cmd, 
     606             CmdSize,
     607             (UINT8 *)&Cmd,
    608608             &ResultBufSize,
    609609             ResultBuf
     
    700700  //
    701701  Status = Tpm2SubmitCommand (
    702              CmdSize, 
    703              (UINT8 *)&Cmd, 
     702             CmdSize,
     703             (UINT8 *)&Cmd,
    704704             &ResultBufSize,
    705705             ResultBuf
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Integrity.c

    r58464 r58466  
    121121  //
    122122  Buffer = (UINT8 *)&Cmd.AuthSessionPcr;
    123  
     123
    124124  // sessionInfoSize
    125125  SessionInfoSize = CopyAuthSessionCommand (NULL, Buffer);
    126126  Buffer += SessionInfoSize;
    127127  Cmd.AuthorizationSize = SwapBytes32(SessionInfoSize);
    128  
     128
    129129  //Digest Count
    130130  WriteUnaligned32 ((UINT32 *)Buffer, SwapBytes32(Digests->count));
    131131  Buffer += sizeof(UINT32);
    132  
     132
    133133  //Digest
    134134  for (Index = 0; Index < Digests->count; Index++) {
     
    242242  CopyMem (Buffer, EventData->buffer, EventData->size);
    243243  Buffer += EventData->size;
    244  
     244
    245245  CmdSize              = (UINT32)((UINTN)Buffer - (UINTN)&Cmd);
    246246  Cmd.Header.paramSize = SwapBytes32(CmdSize);
     
    307307  @param[out] PcrSelectionOut    The PCR in the returned list.
    308308  @param[out] PcrValues          The contents of the PCR indicated in pcrSelect.
    309  
     309
    310310  @retval EFI_SUCCESS            Operation completed successfully.
    311311  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    334334  SendBuffer.Header.tag = SwapBytes16(TPM_ST_NO_SESSIONS);
    335335  SendBuffer.Header.commandCode = SwapBytes32(TPM_CC_PCR_Read);
    336  
     336
    337337  SendBuffer.PcrSelectionIn.count = SwapBytes32(PcrSelectionIn->count);
    338338  for (Index = 0; Index < PcrSelectionIn->count; Index++) {
     
    419419  @param[out] SizeNeeded         number of octets required to satisfy the request
    420420  @param[out] SizeAvailable      Number of octets available. Computed before the allocation
    421  
     421
    422422  @retval EFI_SUCCESS            Operation completed successfully.
    423423  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    486486  //
    487487  Status = Tpm2SubmitCommand (
    488              CmdSize, 
    489              (UINT8 *)&Cmd, 
     488             CmdSize,
     489             (UINT8 *)&Cmd,
    490490             &ResultBufSize,
    491491             ResultBuf
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2NVStorage.c

    r58464 r58466  
    163163  @param[out] NvPublic           The public area of the index.
    164164  @param[out] NvName             The Name of the nvIndex.
    165  
     165
    166166  @retval EFI_SUCCESS            Operation completed successfully.
    167167  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    193193
    194194  SendBuffer.NvIndex = SwapBytes32 (NvIndex);
    195  
     195
    196196  SendBufferSize = (UINT32) sizeof (SendBuffer);
    197197  SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize);
     
    257257  CopyMem (NvName, (UINT8 *)&RecvBuffer + sizeof(TPM2_RESPONSE_HEADER) + sizeof(UINT16) + NvPublicSize, NvNameSize);
    258258  NvName->size = NvNameSize;
    259  
     259
    260260  return EFI_SUCCESS;
    261261}
     
    270270  @param[in]  Auth               The authorization data.
    271271  @param[in]  NvPublic           The public area of the index.
    272  
     272
    273273  @retval EFI_SUCCESS            Operation completed successfully.
    274274  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    382382    return EFI_DEVICE_ERROR;
    383383  }
    384  
     384
    385385  return EFI_SUCCESS;
    386386}
     
    392392  @param[in]  NvIndex            The NV Index.
    393393  @param[in]  AuthSession        Auth Session context
    394  
     394
    395395  @retval EFI_SUCCESS            Operation completed successfully.
    396396  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    486486  @param[in]     Offset             Byte offset into the area.
    487487  @param[in,out] OutData            The data read.
    488  
     488
    489489  @retval EFI_SUCCESS            Operation completed successfully.
    490490  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    591591  OutData->size = SwapBytes16 (RecvBuffer.Data.size);
    592592  CopyMem (OutData->buffer, &RecvBuffer.Data.buffer, OutData->size);
    593  
     593
    594594  return EFI_SUCCESS;
    595595}
     
    603603  @param[in]  InData             The data to write.
    604604  @param[in]  Offset             The offset into the NV Area.
    605  
     605
    606606  @retval EFI_SUCCESS            Operation completed successfully.
    607607  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c

    r58464 r58466  
    9191                                An Event sequence starts if this is TPM_ALG_NULL.
    9292  @param[out] SequenceHandle    A handle to reference the sequence
    93  
     93
    9494  @retval EFI_SUCCESS      Operation completed successfully.
    9595  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    179179  @param[in] SequenceHandle    Handle for the sequence object
    180180  @param[in] Buffer            Data to be added to hash
    181  
     181
    182182  @retval EFI_SUCCESS      Operation completed successfully.
    183183  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    278278  @param[in]  Buffer            Data to be added to the Event
    279279  @param[out] Results           List of digests computed for the PCR
    280  
     280
    281281  @retval EFI_SUCCESS      Operation completed successfully.
    282282  @retval EFI_DEVICE_ERROR Unexpected device behavior.
     
    404404  @param[in]  Buffer            Data to be added to the hash/HMAC
    405405  @param[out] Result            The returned HMAC or digest in a sized buffer
    406  
     406
    407407  @retval EFI_SUCCESS      Operation completed successfully.
    408408  @retval EFI_DEVICE_ERROR Unexpected device behavior.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Session.c

    r58464 r58466  
    5454  @param[out] SessionHandle      Handle for the newly created session.
    5555  @param[out] NonceTPM           The initial nonce from the TPM, used in the computation of the sessionKey.
    56  
     56
    5757  @retval EFI_SUCCESS            Operation completed successfully.
    5858  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
     
    137137  WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16 (AuthHash));
    138138  Buffer += sizeof(UINT16);
    139  
     139
    140140  SendBufferSize = (UINT32) ((UINTN)Buffer - (UINTN)&SendBuffer);
    141141  SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize);
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.c

    r58464 r58466  
    2929  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    3030  @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.
    3232**/
    3333EFI_STATUS
     
    6363  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    6464  @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.
    6666**/
    6767EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf

    r58464 r58466  
    11## @file
    22#  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
    66#  only uses TPM 2.0 DTPM device.
    77#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.c

    r58464 r58466  
    3232  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    3333  @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.
    3535**/
    3636EFI_STATUS
     
    6464/**
    6565  The function register DTPM2.0 instance.
    66  
     66
    6767  @retval EFI_SUCCESS   DTPM2.0 instance is registered, or system dose not surpport registr DTPM2.0 instance
    6868**/
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf

    r58464 r58466  
    22#  Provides a DTPM instance for TPM 2.0
    33#
    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
    55#  engine, based on platform setting.
    66#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c

    r58464 r58466  
    11/** @file
    22  TIS (TPM Interface Specification) functions used by dTPM2.0 library.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    157157
    158158///
    159 /// When this bit is 1, TPM is in the Ready state, 
     159/// When this bit is 1, TPM is in the Ready state,
    160160/// indicating it is ready to receive a new command.
    161161///
     
    207207{
    208208  UINT8                             RegRead;
    209  
     209
    210210  RegRead = MmioRead8 ((UINTN)&TisReg->Access);
    211211  return (BOOLEAN)(RegRead != (UINT8)-1);
     
    244244
    245245/**
    246   Get BurstCount by reading the burstCount field of a TIS regiger 
     246  Get BurstCount by reading the burstCount field of a TIS regiger
    247247  in the time of default TIS_TIMEOUT_D.
    248248
     
    288288
    289289/**
    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
    291291  to Status Register in time.
    292292
     
    319319
    320320/**
    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
    322322  to ACCESS Register in the time of default TIS_TIMEOUT_A.
    323323
     
    335335{
    336336  EFI_STATUS                        Status;
    337  
     337
    338338  if (TisReg == NULL) {
    339339    return EFI_INVALID_PARAMETER;
    340340  }
    341  
     341
    342342  if (!TisPcPresenceCheck (TisReg)) {
    343343    return EFI_NOT_FOUND;
     
    357357  Send a command to TPM for execution and return response data.
    358358
    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
    365365  @retval EFI_SUCCESS           Operation completed successfully.
    366366  @retval EFI_BUFFER_TOO_SMALL  Response data buffer is too small.
     
    542542  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    543543  @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.
    545545**/
    546546EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.c

    r58464 r58466  
    3333  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    3434  @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.
    3636**/
    3737EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf

    r58464 r58466  
    2323  MODULE_TYPE                    = DXE_DRIVER
    2424  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
    2626
    2727#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterPei.c

    r58464 r58466  
    5555  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    5656  @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.
    5858**/
    5959EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.c

    r58464 r58466  
    2121#include <IndustryStandard/Tpm20.h>
    2222
    23 EFI_TREE_PROTOCOL  *mTreeProtocol = NULL; 
     23EFI_TREE_PROTOCOL  *mTreeProtocol = NULL;
    2424
    2525/**
     
    3333  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.
    3434  @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.
    3636**/
    3737EFI_STATUS
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.inf

    r58464 r58466  
    2222  MODULE_TYPE                    = DXE_DRIVER
    2323  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
    2525
    2626#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/CommonHeader.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TisPc.c

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2929{
    3030  UINT8                             RegRead;
    31  
     31
    3232  RegRead = MmioRead8 ((UINTN)&TisReg->Access);
    3333  return (BOOLEAN)(RegRead != (UINT8)-1);
     
    6767
    6868/**
    69   Get BurstCount by reading the burstCount field of a TIS regiger 
     69  Get BurstCount by reading the burstCount field of a TIS regiger
    7070  in the time of default TIS_TIMEOUT_D.
    7171
     
    112112
    113113/**
    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
    115115  to Status Register in time.
    116116
     
    144144
    145145/**
    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
    147147  to ACCESS Register in the time of default TIS_TIMEOUT_A.
    148148
     
    161161{
    162162  EFI_STATUS                        Status;
    163  
     163
    164164  if (TisReg == NULL) {
    165165    return EFI_INVALID_PARAMETER;
    166166  }
    167  
     167
    168168  if (!TisPcPresenceCheck (TisReg)) {
    169169    return EFI_NOT_FOUND;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TpmComm.c

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2222  @param[in]  DataLen       Size of the raw data.
    2323  @param[out] Digest        Pointer to a buffer that stores the final digest.
    24  
     24
    2525  @retval     EFI_SUCCESS   Always successfully calculate the final digest.
    2626**/
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf

    r58459 r58466  
    22#  Provides some common functions for the TCG feature
    33#
    4 #  This instance provides basic TPM Interface Specification (TIS) functions 
     4#  This instance provides basic TPM Interface Specification (TIS) functions
    55#  and TPM hashall function.
    66#
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TrEEPpVendorLibNull/TrEEPpVendorLibNull.c

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2020
    2121  This API should be invoked in BIOS boot phase to process pending request.
    22  
     22
    2323  Caution: This function may receive untrusted input.
    24  
     24
    2525  If OperationRequest < 128, then ASSERT().
    2626
     
    5151
    5252  This API should be invoked in BIOS boot phase to process pending request.
    53  
     53
    5454  Caution: This function may receive untrusted input.
    5555
     
    8585
    8686  Caution: This function may receive untrusted input.
    87  
     87
    8888  If OperationRequest < 128, then ASSERT().
    8989
     
    112112
    113113  Caution: This function may receive untrusted input.
    114  
     114
    115115  If OperationRequest < 128, then ASSERT().
    116116
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TrEEPpVendorLibNull/TrEEPpVendorLibNull.inf

    r58464 r58466  
    3333  MdePkg/MdePkg.dec
    3434  SecurityPkg/SecurityPkg.dec
    35  
     35
    3636[LibraryClasses]
    3737  DebugLib
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/AesCore.c

    r58464 r58466  
    11/** @file
    22  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.
    55
    66Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
     
    3030//
    3131GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 AesForwardTable[] = {
    32   0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 
     32  0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd,
    3333  0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d,
    34   0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 
     34  0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d,
    3535  0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b,
    36   0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 
     36  0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7,
    3737  0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a,
    38   0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 
     38  0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4,
    3939  0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f,
    40   0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 
     40  0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1,
    4141  0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d,
    42   0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 
     42  0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e,
    4343  0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb,
    44   0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 
     44  0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e,
    4545  0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c,
    46   0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 
     46  0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46,
    4747  0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a,
    48   0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 
     48  0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7,
    4949  0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81,
    50   0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 
     50  0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe,
    5151  0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504,
    52   0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 
     52  0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a,
    5353  0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f,
    54   0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 
     54  0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2,
    5555  0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395,
    56   0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 
     56  0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e,
    5757  0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c,
    58   0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 
     58  0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256,
    5959  0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4,
    60   0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 
     60  0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4,
    6161  0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7,
    62   0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 
     62  0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa,
    6363  0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818,
    64   0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 
     64  0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1,
    6565  0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21,
    66   0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 
     66  0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42,
    6767  0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12,
    68   0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 
     68  0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158,
    6969  0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133,
    70   0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 
     70  0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22,
    7171  0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a,
    72   0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 
     72  0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631,
    7373  0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
    7474  0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a
     
    114114
    115115/**
    116   AES Key Expansion. 
     116  AES Key Expansion.
    117117  This function expands the cipher key into encryption schedule.
    118118
     
    162162    LOAD32H (Ek[Index1], Key + Index2);
    163163  }
    164  
     164
    165165  //
    166166  // Initialize the encryption key scheduler
     
    182182    } else {
    183183      //
    184       // Different routine for key expansion If Cipher Key is 256 bits, 
     184      // Different routine for key expansion If Cipher Key is 256 bits,
    185185      //
    186186      for (Index1 = 1; Index1 < 4 && (Index1 + Index2) < Nw; Index1++) {
     
    194194                                               (AES_FT1((Temp)       & 0xFF) & 0x000000FF);
    195195      }
    196      
     196
    197197      for (Index1 = 5; Index1 < Nk && (Index1 + Index2) < Nw; Index1++) {
    198198        Ek[Index1 + Index2] = Ek[Index1 + Index2 - Nk] ^ Ek[Index1 + Index2 - 1];
     
    260260
    261261  //
    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
    264264  // table lookups to speed up the execution.
    265265  //
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/AsmRdRand.asm

    r58464 r58466  
    2020; Notes:
    2121;
    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
    2323;   architectures are supported assembler not recognizing rdrand instruction so using DB's.
    2424;
     
    2828    .model flat, C
    2929    .code
    30  
     30
    3131;------------------------------------------------------------------------------
    3232;  Generate a 16 bit random number
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/GccRdRand.c

    r58464 r58466  
    3636  __asm__ __volatile__ (
    3737    ".byte 0x66; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"
    38     :"=a"  (*Rand), 
     38    :"=a"  (*Rand),
    3939     "=qm" (Carry)
    40     ); 
     40    );
    4141
    4242  return (BOOLEAN) Carry;
     
    6262  __asm__ __volatile__ (
    6363    ".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"
    64     :"=a"  (*Rand), 
     64    :"=a"  (*Rand),
    6565     "=qm" (Carry)
    6666    );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/RdRandWord.c

    r58464 r58466  
    3434
    3535  //
    36   // Generating a 64-bit rand on a 32-bit system by 
     36  // Generating a 64-bit rand on a 32-bit system by
    3737  // mapping two 32-bit RDRAND instructions.
    3838  //
     
    9797      return Status;
    9898    }
    99    
     99
    100100    RandBuffer++;
    101101  }
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/RdRand.c

    r58464 r58466  
    4343  Status     = EFI_UNSUPPORTED;
    4444  IsIntelCpu = FALSE;
    45  
     45
    4646  //
    4747  // Checks whether the current processor is an Intel product by CPUID.
     
    103103    }
    104104  }
    105  
     105
    106106  return EFI_NOT_READY;
    107107}
     
    141141    }
    142142  }
    143  
     143
    144144  return EFI_NOT_READY;
    145145}
     
    179179    }
    180180  }
    181  
     181
    182182  return EFI_NOT_READY;
    183183}
     
    215215
    216216  //
    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
    218218  // destination buffer, depending on whether we are in 32- or 64-bit mode.
    219219  //
     
    286286  delays to ensure reseeding and performs AES-CBC-MAC over the data to compute the
    287287  seed value.
    288  
     288
    289289  @param[out]  SeedBuffer    Pointer to a 128bit buffer to store the random seed.
    290290
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/RdRand.h

    r58464 r58466  
    3030
    3131//
    32 // The maximun number of retries to obtain one available random number. 
     32// The maximun number of retries to obtain one available random number.
    3333//
    3434#define RETRY_LIMIT    10
     
    142142  IN BOOLEAN       NeedRetry
    143143  );
    144  
     144
    145145/**
    146146  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
    22  RNG Driver to produce the UEFI Random Number Generator protocol.
    33
    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
    55  entropy and random number.
    66
     
    1616
    1717Copyright (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 
     18This program and the accompanying materials
     19are licensed and made available under the terms and conditions of the BSD License
     20which accompanies this distribution.  The full text of the license may be found at
    2121http://opensource.org/licenses/bsd-license.php
    2222
    23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     23THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    2424WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    2525
     
    4040
    4141  @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.
    4343                                      On output with a return code of EFI_SUCCESS, the size
    4444                                      in bytes of the data returned in RNGAlgorithmList. On output
     
    8989  }
    9090  *RNGAlgorithmListSize = RequiredSize;
    91  
     91
    9292  return Status;
    9393}
     
    151151  if (CompareGuid (RNGAlgorithm, &gEfiRngAlgorithmRaw)) {
    152152    //
    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,
    154154    // its security level must be at least 256 bits according to UEFI Spec.
    155155    //
     
    157157      return EFI_INVALID_PARAMETER;
    158158    }
    159    
     159
    160160    Status = RdRandGenerateEntropy (RNGValueLength, RNGValue);
    161161    return Status;
     
    215215                  NULL
    216216                  );
    217  
     217
    218218  return Status;
    219219}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf

    r58464 r58466  
    6060  UefiBootServicesTableLib
    6161  BaseLib
    62   DebugLib     
     62  DebugLib
    6363  UefiDriverEntryPoint
    6464  TimerLib
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/X64/AsmRdRand.asm

    r58464 r58466  
    2020; Notes:
    2121;
    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
    2323;   architectures are supported assembler not recognizing rdrand instruction so using DB's.
    2424;
     
    2626
    2727    .code
    28  
     28
    2929;------------------------------------------------------------------------------
    3030;  Generate a 16 bit random number
     
    7171RdRand64Step  PROC
    7272    ; 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)"
    7474    jb     rn64_ok                 ; jmp if CF=1
    7575    xor    rax, rax                ; reg=0 if CF=0
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/X64/GccRdRand.c

    r58464 r58466  
    3838    :"=a"  (*Rand),
    3939     "=qm" (Carry)
    40     ); 
     40    );
    4141
    4242  return (BOOLEAN) Carry;
     
    6262  __asm__ __volatile__ (
    6363    ".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"
    64     :"=a"  (*Rand), 
     64    :"=a"  (*Rand),
    6565     "=qm" (Carry)
    6666    );
     
    8888  __asm__ __volatile__ (
    8989    ".byte 0x48; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"
    90     :"=a"  (*Rand), 
     90    :"=a"  (*Rand),
    9191     "=qm" (Carry)
    9292    );
    93  
     93
    9494  return (BOOLEAN) Carry;
    9595}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/RandomNumberGenerator/RngDxe/X64/RdRandWord.c

    r58464 r58466  
    6363      return Status;
    6464    }
    65    
     65
    6666    RandBuffer++;
    6767  }
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/SecurityPkg.dec

    • Property svn:eol-style set to native
    r58459 r58466  
    2929[LibraryClasses]
    3030  ##  @libraryclass  Provides hash interfaces from different implementations.
    31   # 
     31  #
    3232  HashLib|Include/Library/HashLib.h
    33  
     33
    3434  ##  @libraryclass  Provides a platform specific interface to detect physically present user.
    3535  #
    3636  PlatformSecureLib|Include/Library/PlatformSecureLib.h
    37  
     37
    3838  ##  @libraryclass  Provides interfaces to handle TPM 1.2 request.
    3939  #
    4040  TcgPhysicalPresenceLib|Include/Library/TcgPhysicalPresenceLib.h
    41  
     41
    4242  ##  @libraryclass  Provides support for TCG PP >= 128 Vendor Specific PPI Operation.
    4343  #
    4444  TcgPpVendorLib|Include/Library/TcgPpVendorLib.h
    45  
     45
    4646  ##  @libraryclass  Provides interfaces for other modules to send TPM 2.0 command.
    4747  #
    4848  Tpm2CommandLib|Include/Library/Tpm2CommandLib.h
    49  
     49
    5050  ##  @libraryclass  Provides interfaces on how to access TPM 2.0 hardware device.
    5151  #
    5252  Tpm2DeviceLib|Include/Library/Tpm2DeviceLib.h
    53  
     53
    5454  ##  @libraryclass  Provides interfaces for other modules to send TPM 1.2 command.
    5555  #
    5656  Tpm12CommandLib|Include/Library/Tpm12CommandLib.h
    57  
     57
    5858  ##  @libraryclass  Provides interfaces on how to access TPM 1.2 hardware device.
    5959  #
    6060  Tpm12DeviceLib|Include/Library/Tpm12DeviceLib.h
    61  
     61
    6262  ##  @libraryclass  Provides TPM Interface Specification (TIS) interfaces for TPM command.
    6363  #
    6464  TpmCommLib|Include/Library/TpmCommLib.h
    65    
     65
    6666  ##  @libraryclass  Provides common interfaces about TPM measurement for other modules.
    6767  #
    6868  TpmMeasurementLib|Include/Library/TpmMeasurementLib.h
    69  
     69
    7070  ##  @libraryclass  Provides interfaces to handle TPM 2.0 request.
    7171  #
    7272  TrEEPhysicalPresenceLib|Include/Library/TrEEPhysicalPresenceLib.h
    73  
     73
    7474  ##  @libraryclass  Provides support for TrEE PP >= 128 Vendor Specific PPI Operation.
    7575  #
     
    100100
    101101  ## 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
    103103  #  mechanism not defined by the UEFI Specification to transition the system to setup mode or to update secure boot keys.
    104104  #  Include/Guid/AuthenticatedVariableFormat.h
     
    108108  #  Include/Guid/AuthenticatedVariableFormat.h
    109109  gEfiCertDbGuid                     = { 0xd9bee56e, 0x75dc, 0x49d9, { 0xb4, 0xd7, 0xb5, 0x34, 0x21, 0xf, 0x63, 0x7a } }
    110  
     110
    111111  ## Hob GUID used to pass a TCG_PCR_EVENT from a TPM PEIM to a TPM DXE Driver.
    112112  #  Include/Guid/TcgEventHob.h
     
    124124  #  Include/Guid/PhysicalPresenceData.h
    125125  gEfiPhysicalPresenceGuid           = { 0xf6499b1, 0xe9ad, 0x493d, { 0xb9, 0xc2, 0x2f, 0x90, 0x81, 0x5c, 0x6c, 0xbc }}
    126  
     126
    127127  ## GUID used for form browser, password credential and provider identifier.
    128128  # Include/Guid/PwdCredentialProviderHii.h
     
    144144  #  Include/Guid/TcgConfigHii.h
    145145  gTcgConfigFormSetGuid              = { 0xb0f901e4, 0xc424, 0x45de, { 0x90, 0x81, 0x95, 0xe2, 0xb, 0xde, 0x6f, 0xb5 }}
    146  
     146
    147147  ## GUID used for FormSet.
    148148  #  Include/Guid/SecureBootConfigHii.h
     
    156156  #  Include/Guid/TpmInstance.h
    157157  gEfiTpmDeviceInstanceNoneGuid      = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
    158  
     158
    159159  ## GUID value used for PcdTpmInstanceGuid to indicate TPM 1.2 device is selected to support.
    160160  #  Include/Guid/TpmInstance.h
    161161  gEfiTpmDeviceInstanceTpm12Guid     = { 0x8b01e5b6, 0x4f19, 0x46e8, { 0xab, 0x93, 0x1c, 0x53, 0x67, 0x1b, 0x90, 0xcc } }
    162  
     162
    163163  ## GUID value used for PcdTpmInstanceGuid to indicate discrete TPM 2.0 device is selected to support.
    164164  #  Include/Guid/TpmInstance.h
    165165  gEfiTpmDeviceInstanceTpm20DtpmGuid = { 0x286bf25a, 0xc2c3, 0x408c, { 0xb3, 0xb4, 0x25, 0xe6, 0x75, 0x8b, 0x73, 0x17 } }
    166  
     166
    167167  ## GUID used to select supported TPM instance from UI.
    168168  #  Include/Guid/TpmInstance.h
     
    232232  #  0x00000005      Query user when there is security violation.<BR>
    233233  # @Prompt Set policy for the image from fixed media.
    234   # @ValidRange 0x80000001 | 0x00000000 - 0x00000005 
     234  # @ValidRange 0x80000001 | 0x00000000 - 0x00000005
    235235  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04|UINT32|0x00000003
    236236
    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
    239239  #  the image will be deferred. The deferred image will be checked after user is identified.<BR><BR>
    240240  #    BIT0       - Image from unknown device. <BR>
     
    244244  #    BIT4       - Image from fixed media device which includes hard disk.<BR>
    245245  # @Prompt Set policy whether trust image before user identification.
    246   # @ValidRange 0x80000002 | 0x00000000 - 0x0000001F 
     246  # @ValidRange 0x80000002 | 0x00000000 - 0x0000001F
    247247  gEfiSecurityPkgTokenSpaceGuid.PcdDeferImageLoadPolicy|0x0000001F|UINT32|0x0000004
    248248
     
    255255  #  Note: This PCD is not been used.
    256256  # @Prompt Max variable size for append operation.
    257   gEfiSecurityPkgTokenSpaceGuid.PcdMaxAppendVariableSize|0x2000|UINT32|0x30000005 
     257  gEfiSecurityPkgTokenSpaceGuid.PcdMaxAppendVariableSize|0x2000|UINT32|0x30000005
    258258
    259259  ## Specifies the type of TCG platform that contains TPM chip.<BR><BR>
     
    261261  #  If 1, TCG platform type is PC server.<BR>
    262262  # @Prompt Select platform type.
    263   # @ValidRange 0x80000001 | 0x00 - 0x1 
     263  # @ValidRange 0x80000001 | 0x00 - 0x1
    264264  gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass|0|UINT8|0x00000006
    265  
     265
    266266  ## Progress Code for TPM device subclass definitions.<BR><BR>
    267267  #  EFI_PERIPHERAL_TPM  = (EFI_PERIPHERAL | 0x000D0000) = 0x010D0000<BR>
     
    272272[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
    273273  ## 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
    275275  #  that required operator physical presence can not run.<BR><BR>
    276276  #   TRUE  - The platform operator is physically present.<BR>
     
    280280
    281281[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.
    283283  #  Once it is locked, it can not be unlocked for TPM life time.<BR><BR>
    284284  #   TRUE  - Lock TPM physical presence asserting method.<BR>
     
    312312  #  If 1, initialization needed.<BR>
    313313  # @Prompt TPM 2.0 device initialization policy.<BR>
    314   # @ValidRange 0x80000001 | 0x00 - 0x1 
     314  # @ValidRange 0x80000001 | 0x00 - 0x1
    315315  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2InitializationPolicy|1|UINT8|0x0001000A
    316316
     
    319319  #  If 1, initialization needed.<BR>
    320320  # @Prompt TPM 1.2 device initialization policy.
    321   # @ValidRange 0x80000001 | 0x00 - 0x1 
     321  # @ValidRange 0x80000001 | 0x00 - 0x1
    322322  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy|1|UINT8|0x0001000B
    323323
     
    326326  #  if 1, SelfTest needed.<BR>
    327327  # @Prompt TPM 2.0 device selftest.
    328   # @ValidRange 0x80000001 | 0x00 - 0x1 
     328  # @ValidRange 0x80000001 | 0x00 - 0x1
    329329  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2SelfTestPolicy|1|UINT8|0x0001000C
    330330
     
    333333  #  if 1, SCRTM measurement done by BIOS.<BR>
    334334  # @Prompt SCRTM policy setting for TPM 2.0 device.
    335   # @ValidRange 0x80000001 | 0x00 - 0x1 
     335  # @ValidRange 0x80000001 | 0x00 - 0x1
    336336  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2ScrtmPolicy|1|UINT8|0x0001000D
    337337
     
    340340  #  if 1, SCRTM measurement done by BIOS.<BR>
    341341  # @Prompt SCRTM policy setting for TPM 1.2 device
    342   # @ValidRange 0x80000001 | 0x00 - 0x1 
     342  # @ValidRange 0x80000001 | 0x00 - 0x1
    343343  gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy|1|UINT8|0x0001000E
    344344
     
    358358  #    BIT3  -  SHA512.<BR>
    359359  # @Prompt Hash mask for TPM 2.0
    360   # @ValidRange 0x80000001 | 0x00000000 - 0x0000000F 
     360  # @ValidRange 0x80000001 | 0x00000000 - 0x0000000F
    361361  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x0000000F|UINT32|0x00010010
    362362
     
    376376  #
    377377  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
    379379[UserExtensions.TianoCore."ExtraFiles"]
    380380  SecurityPkgExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/SecurityPkg.dsc

    r58459 r58466  
    2525[LibraryClasses]
    2626  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
    27   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 
     27  DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
    2828  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
    2929  SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
     
    117117  Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf
    118118  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.inf
    119    
     119
    120120[PcdsDynamicDefault.common.DEFAULT]
    121121  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0xb6, 0xe5, 0x01, 0x8b, 0x19, 0x4f, 0xe8, 0x46, 0xab, 0x93, 0x1c, 0x53, 0x67, 0x1b, 0x90, 0xcc}
     
    173173  SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
    174174  SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.inf
    175  
     175
    176176[Components.IA32, Components.X64, Components.IPF]
    177177#  SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderDxe.inf
     
    233233
    234234[Components.IPF]
    235   SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/EsalVariableDxeSal.inf 
     235  SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/EsalVariableDxeSal.inf
    236236
    237237[BuildOptions]
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.c

    r58459 r58466  
    22  TCG MOR (Memory Overwrite Request) Control Driver.
    33
    4   This driver initilize MemoryOverwriteRequestControl variable. It 
     4  This driver initilize MemoryOverwriteRequestControl variable. It
    55  will clear MOR_CLEAR_MEMORY_BIT bit if it is set.
    66
    77Copyright (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 
     8This program and the accompanying materials
     9are licensed and made available under the terms and conditions of the BSD License
     10which accompanies this distribution.  The full text of the license may be found at
    1111http://opensource.org/licenses/bsd-license.php
    1212
    13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1414WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
     
    3838  EFI_STATUS  Status;
    3939  UINTN       DataSize;
    40  
     40
    4141  if (MOR_CLEAR_MEMORY_VALUE (mMorControl) == 0x0) {
    4242    //
     
    4949  //
    5050  DEBUG ((EFI_D_INFO, "TcgMor: Clear MorClearMemory bit\n"));
    51   mMorControl &= 0xFE; 
     51  mMorControl &= 0xFE;
    5252
    5353  DataSize = sizeof (mMorControl);
    5454  Status   = gRT->SetVariable (
    55                MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 
    56                &gEfiMemoryOverwriteControlDataGuid, 
     55               MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
     56               &gEfiMemoryOverwriteControlDataGuid,
    5757               EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
    58                DataSize, 
     58               DataSize,
    5959               &mMorControl
    6060               );
     
    7171  @param[in] SystemTable  A Pointer to the EFI System Table.
    7272
    73   @retval EFI_SUCEESS     
     73  @retval EFI_SUCEESS
    7474  @return Others          Some error occurs.
    7575**/
     
    9191  DataSize = sizeof (mMorControl);
    9292  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,
    9797                  &mMorControl
    9898                  );
     
    103103    mMorControl = 0;
    104104    Status = gRT->SetVariable (
    105                     MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, 
    106                     &gEfiMemoryOverwriteControlDataGuid, 
     105                    MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
     106                    &gEfiMemoryOverwriteControlDataGuid,
    107107                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
    108                     DataSize, 
     108                    DataSize,
    109109                    &mMorControl
    110110                    );
     
    121121               &Event
    122122               );
    123   }   
    124  
     123  }
     124
    125125  return Status;
    126126}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.h

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/PhysicalPresencePei/PhysicalPresencePei.c

    r48674 r58466  
    11/** @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
    44  specific driver.
    55
    66Copyright (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 
     7This program and the accompanying materials
     8are licensed and made available under the terms and conditions of the BSD License
     9which accompanies this distribution.  The full text of the license may be found at
    1010http://opensource.org/licenses/bsd-license.php
    1111
    12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1313WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1414
     
    7171
    7272  //
    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
    7575  // of the implementation are vendor-specific. Here we read a PCD value to indicate
    7676  // whether operator physical presence.
    77   // 
     77  //
    7878  if (!PcdGetBool (PcdTpmPhysicalPresence)) {
    7979    return TRUE;
     
    8181
    8282  //
    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.
    8585  //
    8686  Status = PeiServicesLocatePpi (
     
    9292  if (!EFI_ERROR (Status)) {
    9393    DataSize = sizeof (EFI_PHYSICAL_PRESENCE);
    94     Status = Variable->GetVariable ( 
    95                          Variable, 
     94    Status = Variable->GetVariable (
     95                         Variable,
    9696                         PHYSICAL_PRESENCE_VARIABLE,
    9797                         &gEfiPhysicalPresenceGuid,
     
    116116  Entry point of this module.
    117117
    118   It installs lock physical presence PPI. 
     118  It installs lock physical presence PPI.
    119119
    120120  @param[in] FileHandle   Handle of the file being invoked.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/PhysicalPresencePei/PhysicalPresencePei.inf

    r58459 r58466  
    33#
    44#  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
    66#  platform specific module.
    77#
     
    5555  gEfiSecurityPkgTokenSpaceGuid.PcdTpmPhysicalPresence  ## SOMETIMES_CONSUMES
    5656
    57 [Depex] 
     57[Depex]
    5858  gEfiPeiMemoryDiscoveredPpiGuid AND
    5959  gEfiPeiReadOnlyVariable2PpiGuid AND
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfig.vfr

    • Property svn:eol-style set to native
    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    6868          endif
    6969          //
    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.
    7171          //
    7272          suppressif ideqval TCG_CONFIGURATION.TpmEnable == 0 OR
     
    7777
    7878          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;
    8080          option text = STRING_TOKEN(STR_TPM_ENABLE_ACTIVATE_CLEAR), value = PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR, flags = RESET_REQUIRED;
    8181          option text = STRING_TOKEN(STR_TPM_ENABLE_ACTIVATE_CLEAR_E_A), value = PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE, flags = RESET_REQUIRED;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDriver.c

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    5454    TcgProtocol = NULL;
    5555  }
    56  
     56
    5757  Status = gBS->OpenProtocol (
    5858                  ImageHandle,
     
    6666    return EFI_ALREADY_STARTED;
    6767  }
    68  
     68
    6969  //
    7070  // Create a private data structure.
     
    7474    return EFI_OUT_OF_RESOURCES;
    7575  }
    76  
     76
    7777  PrivateData->TcgProtocol = TcgProtocol;
    78  
     78
    7979  //
    8080  // Install TCG configuration form
     
    8787  //
    8888  // Install private GUID.
    89   //   
     89  //
    9090  Status = gBS->InstallMultipleProtocolInterfaces (
    9191                  &ImageHandle,
     
    104104  if (PrivateData != NULL) {
    105105    UninstallTcgConfigForm (PrivateData);
    106   } 
    107  
     106  }
     107
    108108  return Status;
    109109}
     
    131131                  &gEfiCallerIdGuid,
    132132                  (VOID **) &PrivateData
    133                   ); 
     133                  );
    134134  if (EFI_ERROR (Status)) {
    135     return Status; 
     135    return Status;
    136136  }
    137  
     137
    138138  ASSERT (PrivateData->Signature == TCG_CONFIG_PRIVATE_DATA_SIGNATURE);
    139139
     
    144144         NULL
    145145         );
    146  
     146
    147147  UninstallTcgConfigForm (PrivateData);
    148148
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf

    r58459 r58466  
    5959  ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
    6060  gEfiPhysicalPresenceGuid
    61  
     61
    6262  gEfiIfrTianoGuid                                    ## SOMETIMES_PRODUCES  ## GUID       # HII opcode
    6363  ## PRODUCES            ## HII
     
    7979  gEfiVariableArchProtocolGuid      AND
    8080  gEfiVariableWriteArchProtocolGuid
    81  
     81
    8282[UserExtensions.TianoCore."ExtraFiles"]
    8383  TcgConfigDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.c

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    4141    END_DEVICE_PATH_TYPE,
    4242    END_ENTIRE_DEVICE_PATH_SUBTYPE,
    43     { 
     43    {
    4444      (UINT8) (END_DEVICE_PATH_LENGTH),
    4545      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
     
    7474
    7575  ASSERT (TcgProtocol != NULL);
    76  
     76
    7777  //
    7878  // Get TPM Permanent flags (TpmEnable, TpmActivate)
     
    8383    *(UINT32*)&CmdBuf[2]  = SwapBytes32 (TpmSendSize);
    8484    *(UINT32*)&CmdBuf[6]  = SwapBytes32 (TPM_ORD_GetCapability);
    85  
     85
    8686    *(UINT32*)&CmdBuf[10] = SwapBytes32 (TPM_CAP_FLAG);
    8787    *(UINT32*)&CmdBuf[14] = SwapBytes32 (sizeof (TPM_CAP_FLAG_PERMANENT));
     
    9494                            sizeof (CmdBuf),
    9595                            CmdBuf
    96                             ); 
     96                            );
    9797    TpmRsp = (TPM_RSP_COMMAND_HDR *) &CmdBuf[0];
    9898    if (EFI_ERROR (Status) || (TpmRsp->tag != SwapBytes16 (TPM_TAG_RSP_COMMAND)) || (TpmRsp->returnCode != 0)) {
    9999      return EFI_DEVICE_ERROR;
    100100    }
    101  
     101
    102102    TpmPermanentFlags = (TPM_PERMANENT_FLAGS *) &CmdBuf[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)];
    103103
     
    110110    }
    111111  }
    112  
    113   return EFI_SUCCESS; 
     112
     113  return EFI_SUCCESS;
    114114}
    115115
     
    179179  //
    180180  // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
    181   // 
     181  //
    182182  ZeroMem (&Configuration, sizeof (TCG_CONFIGURATION));
    183183
     
    337337  if (EFI_ERROR (Status)) {
    338338    return Status;
    339   }               
    340                  
     339  }
     340
    341341  PpData.PPRequest = PpRequest;
    342342  Status = gRT->SetVariable (
     
    397397  SavePpRequest (Value->u8);
    398398  *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
    399  
     399
    400400  return EFI_SUCCESS;
    401401}
     
    455455           ConfigAccess,
    456456           NULL
    457            ); 
     457           );
    458458
    459459    return EFI_OUT_OF_RESOURCES;
    460460  }
    461  
     461
    462462  PrivateData->HiiHandle = HiiHandle;
    463463
    464   return EFI_SUCCESS; 
     464  return EFI_SUCCESS;
    465465}
    466466
     
    498498    PrivateData->DriverHandle = NULL;
    499499  }
    500  
     500
    501501  FreePool (PrivateData);
    502502}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigImpl.h

    r58459 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    6060  EFI_HII_CONFIG_ACCESS_PROTOCOL    ConfigAccess;
    6161  EFI_HII_HANDLE                    HiiHandle;
    62   EFI_HANDLE                        DriverHandle; 
     62  EFI_HANDLE                        DriverHandle;
    6363
    6464  EFI_TCG_PROTOCOL                  *TcgProtocol;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigNvData.h

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgConfigDxe/TcgConfigStrings.uni

    • Property svn:mime-type changed from application/octet-stream to text/plain;encoding=UTF-16LE
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TcgDxe.c

    r58459 r58466  
    1 /** @file 
     1/** @file
    22  This module implements TCG EFI Protocol.
    3  
     3
    44Caution: This module requires additional review when modified.
    55This driver will have external input - TcgDxePassThroughToTpm
     
    1010
    1111Copyright (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 
     12This program and the accompanying materials
     13are licensed and made available under the terms and conditions of the BSD License
     14which accompanies this distribution.  The full text of the license may be found at
    1515http://opensource.org/licenses/bsd-license.php
    1616
    17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     17THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1818WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1919
     
    9191// The following EFI_TCG_SERVER_ACPI_TABLE default setting is just one example,
    9292// 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
    9595//
    9696EFI_TCG_SERVER_ACPI_TABLE           mTcgServerAcpiTemplate = {
     
    214214
    215215/**
    216   This service provides EFI protocol capability information, state information 
     216  This service provides EFI protocol capability information, state information
    217217  about the TPM, and Event Log state information.
    218218
    219219  @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
    222222                                 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,
    227227                                 enable hash algorithm agility.
    228228  @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.
    232232
    233233  @retval EFI_SUCCESS            Operation completed successfully.
    234234  @retval EFI_INVALID_PARAMETER  ProtocolCapability does not match TCG capability.
    235  
     235
    236236**/
    237237EFI_STATUS
     
    278278/**
    279279  This service abstracts the capability to do a hash operation on a data buffer.
    280  
     280
    281281  @param[in]      This             Indicates the calling context
    282282  @param[in]      HashData         Pointer to the data buffer to be hashed
     
    284284  @param[in]      AlgorithmId      Identification of the Algorithm to use for the hashing operation
    285285  @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
    288288  @retval EFI_SUCCESS              Operation completed successfully.
    289289  @retval EFI_INVALID_PARAMETER    HashDataLen is NULL.
     
    292292  @retval EFI_UNSUPPORTED          AlgorithmId not supported.
    293293  @retval EFI_BUFFER_TOO_SMALL     *HashedDataLen < sizeof (TCG_DIGEST).
    294  
     294
    295295**/
    296296EFI_STATUS
     
    327327          if (*HashedDataResult == NULL) {
    328328                *HashedDataResult = AllocatePool ((UINTN) *HashedDataLen);
    329           } 
     329          }
    330330
    331331      return TpmCommHashAll (
     
    343343
    344344  @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
    348348  @retval EFI_SUCCESS           The new event log entry was added.
    349349  @retval EFI_OUT_OF_RESOURCES  No enough memory to log the new event.
     
    383383
    384384  @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
    387387                                 this structure are properly filled by the caller.
    388388  @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
    394394  @retval EFI_SUCCESS            Operation completed successfully.
    395395  @retval EFI_OUT_OF_RESOURCES   Insufficient memory in the event log to complete this action.
    396  
     396
    397397**/
    398398EFI_STATUS
     
    412412
    413413  TcgData = TCG_DXE_DATA_FROM_THIS (This);
    414  
     414
    415415  if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) {
    416416    return EFI_DEVICE_ERROR;
     
    436436  @retval     EFI_UNSUPPORTED             Current Task Priority Level  >= EFI_TPL_CALLBACK.
    437437  @retval     EFI_TIMEOUT                 The TIS timed-out.
    438  
     438
    439439**/
    440440EFI_STATUS
     
    450450  TCG_DXE_DATA                      *TcgData;
    451451
    452   if (TpmInputParameterBlock == NULL || 
    453       TpmOutputParameterBlock == NULL || 
     452  if (TpmInputParameterBlock == NULL ||
     453      TpmOutputParameterBlock == NULL ||
    454454      TpmInputParameterBlockSize == 0 ||
    455455      TpmOutputParameterBlockSize == 0) {
     
    474474
    475475  @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
    477477                                to be hashed, extended, and logged.
    478478  @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.
    481481
    482482  @retval EFI_SUCCESS           Operation completed successfully.
     
    542542
    543543  @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
    545545                                     to be hashed, extended, and logged.
    546546  @param[in]      HashDataLen        The length, in bytes, of the buffer referenced by HashData
    547547  @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
    549549                                     buffer containing the TCG_PCR_EVENT data structure.
    550550  @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
    555555                                     the start of the Event Log.
    556556
     
    559559  @retval EFI_UNSUPPORTED            Current TPL >= EFI_TPL_CALLBACK.
    560560  @retval EFI_DEVICE_ERROR           The command was unsuccessful.
    561  
     561
    562562**/
    563563EFI_STATUS
     
    581581
    582582  TcgData = TCG_DXE_DATA_FROM_THIS (This);
    583  
     583
    584584  if (TcgData->BsCap.TPMDeactivatedFlag || (!TcgData->BsCap.TPMPresentFlag)) {
    585585    return EFI_DEVICE_ERROR;
    586586  }
    587    
     587
    588588  if (AlgorithmId != TPM_ALG_SHA) {
    589589    return EFI_UNSUPPORTED;
    590590  }
    591  
     591
    592592  if (HashData == 0 && HashDataLen > 0) {
    593593    return EFI_INVALID_PARAMETER;
     
    649649  EFI_PEI_HOB_POINTERS  GuidHob;
    650650  EFI_PHYSICAL_ADDRESS  Lasa;
    651  
     651
    652652  if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_CLIENT) {
    653653    Lasa = mTcgClientAcpiTemplate.Lasa;
    654  
     654
    655655    Status = gBS->AllocatePages (
    656656                    AllocateMaxAddress,
     
    664664    mTcgClientAcpiTemplate.Lasa = Lasa;
    665665    //
    666     // To initialize them as 0xFF is recommended 
     666    // To initialize them as 0xFF is recommended
    667667    // because the OS can know the last entry for that.
    668668    //
    669669    SetMem ((VOID *)(UINTN)mTcgClientAcpiTemplate.Lasa, EFI_TCG_LOG_AREA_SIZE, 0xFF);
    670670    mTcgClientAcpiTemplate.Laml = EFI_TCG_LOG_AREA_SIZE;
    671  
     671
    672672  } else {
    673673    Lasa = mTcgServerAcpiTemplate.Lasa;
    674  
     674
    675675    Status = gBS->AllocatePages (
    676676                    AllocateMaxAddress,
     
    684684    mTcgServerAcpiTemplate.Lasa = Lasa;
    685685    //
    686     // To initialize them as 0xFF is recommended 
     686    // To initialize them as 0xFF is recommended
    687687    // because the OS can know the last entry for that.
    688688    //
     
    692692
    693693  GuidHob.Raw = GetHobList ();
    694   while (!EFI_ERROR (Status) && 
     694  while (!EFI_ERROR (Status) &&
    695695         (GuidHob.Raw = GetNextGuidHob (&gTcgEventEntryHobGuid, GuidHob.Raw)) != NULL) {
    696696    TcgEvent    = GET_GUID_HOB_DATA (GuidHob.Guid);
     
    709709  Measure and log an action string, and extend the measurement result into PCR[5].
    710710
    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
    713713  @retval EFI_SUCCESS         Operation completed successfully.
    714714  @retval EFI_DEVICE_ERROR    The operation was unsuccessful.
     
    788788  if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) {
    789789    //
    790     // Tcg Server spec. 
     790    // Tcg Server spec.
    791791    // Measure each processor EFI_CPU_PHYSICAL_LOCATION with EV_TABLE_OF_DEVICES to PCR[1]
    792792    //
     
    820820  Measure and log Separator event, and extend the measurement result into a specific PCR.
    821821
    822   @param[in] PCRIndex         PCR index. 
     822  @param[in] PCRIndex         PCR index.
    823823
    824824  @retval EFI_SUCCESS         Operation completed successfully.
     
    856856  @param[in]  VarName     A Null-terminated string that is the name of the vendor's variable.
    857857  @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.
    859859
    860860  @return A pointer to the buffer to return the contents of the variable.Otherwise NULL.
     
    905905  Measure and log an EFI variable, and extend the measurement result into a specific PCR.
    906906
    907   @param[in]  PCRIndex          PCR Index. 
    908   @param[in]  EventType         Event type. 
     907  @param[in]  PCRIndex          PCR Index.
     908  @param[in]  EventType         Event type.
    909909  @param[in]  VarName           A Null-terminated string that is the name of the vendor's variable.
    910910  @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
    914914  @retval EFI_SUCCESS           Operation completed successfully.
    915915  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    974974  @param[in]   VarName          A Null-terminated string that is the name of the vendor's variable.
    975975  @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
    979979  @retval EFI_SUCCESS           Operation completed successfully.
    980980  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    11581158  Install TCG ACPI Table when ACPI Table Protocol is available.
    11591159
    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.
    11631163
    11641164  @param[in]  Event     Event whose notification function is being invoked
     
    11911191    mTcgClientAcpiTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    11921192    //
    1193     // The ACPI table must be checksumed before calling the InstallAcpiTable() 
     1193    // The ACPI table must be checksumed before calling the InstallAcpiTable()
    11941194    // service of the ACPI table protocol to install it.
    11951195    //
     
    12111211    mTcgServerAcpiTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    12121212    //
    1213     // The ACPI table must be checksumed before calling the InstallAcpiTable() 
     1213    // The ACPI table must be checksumed before calling the InstallAcpiTable()
    12141214    // service of the ACPI table protocol to install it.
    12151215    //
     
    13011301  Get TPM Deactivated state.
    13021302
    1303   @param[out] TPMDeactivatedFlag   Returns TPM Deactivated state. 
     1303  @param[out] TPMDeactivatedFlag   Returns TPM Deactivated state.
    13041304
    13051305  @retval EFI_SUCCESS              Operation completed successfully.
     
    13331333  It publishes EFI TCG Protocol.
    13341334
    1335   @param[in] ImageHandle  The firmware allocated handle for the EFI image. 
     1335  @param[in] ImageHandle  The firmware allocated handle for the EFI image.
    13361336  @param[in] SystemTable  A pointer to the EFI System Table.
    1337  
     1337
    13381338  @retval EFI_SUCCESS     The entry point is executed successfully.
    13391339  @retval other           Some error occurs when executing this entry point.
     
    14121412
    14131413    //
    1414     // Measure Exit Boot Service failed 
     1414    // Measure Exit Boot Service failed
    14151415    //
    14161416    Status = gBS->CreateEventEx (
     
    14281428  //
    14291429  EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, InstallAcpiTable, NULL, &Registration);
    1430  
     1430
    14311431  return Status;
    14321432}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TcgDxe.inf

    r58459 r58466  
    5858  ## SOMETIMES_CONSUMES     ## GUID                  # Handoff Table for measurement.
    5959  gEfiSmbiosTableGuid
    60  
     60
    6161  gEfiGlobalVariableGuid                             ## SOMETIMES_CONSUMES  ## Variable:L"BootXXXX"
    6262  gTcgEventEntryHobGuid                              ## SOMETIMES_CONSUMES  ## HOB
     
    7070  gEfiAcpiTableProtocolGuid                          ## NOTIFY
    7171  gEfiMpServiceProtocolGuid                          ## SOMETIMES_CONSUMES
    72  
     72
    7373[Pcd]
    7474  gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass              ## SOMETIMES_CONSUMES
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TisDxe.c

    r58459 r58466  
    1 /** @file 
     1/** @file
    22  TIS (TPM Interface Specification) functions used by TPM Dxe driver.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2626  Send command to TPM for execution.
    2727
    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
    3232  @retval EFI_SUCCESS   Operation completed successfully.
    3333  @retval EFI_TIMEOUT   The register can't run into the expected status in time.
     
    7676  Receive response data of last command from TPM.
    7777
    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
    8282  @retval EFI_SUCCESS           Operation completed successfully.
    8383  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    165165  Format TPM command data according to the format control character.
    166166
    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
    172172  @retval EFI_SUCCESS           Operation completed successfully.
    173173  @retval EFI_INVALID_PARAMETER Invalid format control character.
     
    252252  Format reponse data according to the format control character.
    253253
    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
    261261  @retval EFI_SUCCESS           Operation completed successfully.
    262262  @retval EFI_INVALID_PARAMETER Invalid format control character.
     
    300300      Size = VA_ARG (*ap, UINTN);
    301301      //
    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
    304304      //
    305305      if ((UINT32) (~0)- *DataIndex >= (UINT32)Size) {
     
    358358  Send formatted command to TPM for execution and return formatted data from response.
    359359
    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.
    362362  @param[in] ...       The variable argument list.
    363  
     363
    364364  @retval EFI_SUCCESS  Operation completed successfully.
    365365  @retval EFI_TIMEOUT  The register can't run into the expected status in time.
     
    421421    goto Error;
    422422  }
    423  
     423
    424424  //
    425425  // Get the formatted data from the TpmCommandBuf.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgDxe/TpmComm.c

    r58459 r58466  
    1 /** @file 
     1/** @file
    22  Utility functions used by TPM Dxe driver.
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2323  Extend a TPM PCR.
    2424
    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.
    2727  @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
    3030  @retval EFI_SUCCESS         Operation completed successfully.
    3131  @retval EFI_DEVICE_ERROR    The command was unsuccessful.
     
    7676  Get TPM capability flags.
    7777
    78   @param[in]  TpmHandle    TPM handle. 
    79   @param[in]  FlagSubcap   Flag subcap. 
     78  @param[in]  TpmHandle    TPM handle.
     79  @param[in]  FlagSubcap   Flag subcap.
    8080  @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
    8383  @retval EFI_SUCCESS      Operation completed successfully.
    8484  @retval EFI_DEVICE_ERROR The command was unsuccessful.
     
    126126  Add a new entry to the Event Log.
    127127
    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.
    130130  @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
    134134  @retval EFI_SUCCESS           The new event log entry was added.
    135135  @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
    22  Definitions and function prototypes used by TPM DXE driver.
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1919  Add a new entry to the Event Log.
    2020
    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.
    2323  @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
    2727  @retval EFI_SUCCESS           The new event log entry was added.
    2828  @retval EFI_OUT_OF_RESOURCES  No enough memory to log the new event.
     
    4141  Extend a TPM PCR.
    4242
    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.
    4545  @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
    4848  @retval EFI_SUCCESS         Operation completed successfully.
    4949  @retval EFI_DEVICE_ERROR    The command was unsuccessful.
     
    6161  Get TPM capability flags.
    6262
    63   @param[in]  TpmHandle    TPM handle. 
    64   @param[in]  FlagSubcap   Flag subcap. 
     63  @param[in]  TpmHandle    TPM handle.
     64  @param[in]  FlagSubcap   Flag subcap.
    6565  @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
    6868  @retval EFI_SUCCESS      Operation completed successfully.
    6969  @retval EFI_DEVICE_ERROR The command was unsuccessful.
     
    8181  Send formatted command to TPM for execution and return formatted data from response.
    8282
    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.
    8585  @param[in] ...       The variable argument list.
    86  
     86
    8787  @retval EFI_SUCCESS  Operation completed successfully.
    8888  @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  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    130130    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
    131131    &gEfiPeiFirmwareVolumeInfoPpiGuid,
    132     FirmwareVolmeInfoPpiNotifyCallback 
     132    FirmwareVolmeInfoPpiNotifyCallback
    133133  },
    134134  {
    135135    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
    136136    &gEfiPeiFirmwareVolumeInfo2PpiGuid,
    137     FirmwareVolmeInfoPpiNotifyCallback 
     137    FirmwareVolmeInfoPpiNotifyCallback
    138138  },
    139139  {
     
    146146/**
    147147  Record all measured Firmware Volum Information into a Guid Hob
    148   Guid Hob payload layout is 
     148  Guid Hob payload layout is
    149149
    150150     UINT32 *************************** FIRMWARE_BLOB number
     
    166166  IN VOID                          *Ppi
    167167  )
    168 { 
     168{
    169169  MEASURED_HOB_DATA *MeasuredHobData;
    170170
     
    172172
    173173  //
    174   // Create a Guid hob to save all measured Fv 
     174  // Create a Guid hob to save all measured Fv
    175175  //
    176176  MeasuredHobData = BuildGuidHob(
     
    205205
    206206  @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
    208208                                to be hashed, extended, and logged.
    209209  @param[in]      HashDataLen   The length, in bytes, of the buffer referenced by HashData.
    210210  @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.
    213213
    214214  @retval EFI_SUCCESS           Operation completed successfully.
     
    229229  EFI_STATUS                        Status;
    230230  VOID                              *HobData;
    231  
     231
    232232  if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
    233233    return EFI_DEVICE_ERROR;
     
    323323
    324324/**
    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.
    327327
    328328  @param[in]  FvBase            Base address of FV image.
    329329  @param[in]  FvLength          Length of FV image.
    330330
    331   @retval EFI_SUCCESS           Fv image is measured successfully 
     331  @retval EFI_SUCCESS           Fv image is measured successfully
    332332                                or it has been already measured.
    333333  @retval EFI_OUT_OF_RESOURCES  No enough memory to log the new event.
     
    371371    }
    372372  }
    373  
     373
    374374  //
    375375  // Measure and record the FV to the TPM
     
    430430  EFI_FV_INFO                       VolumeInfo;
    431431  EFI_PEI_FIRMWARE_VOLUME_PPI       *FvPpi;
    432  
     432
    433433  FvInstances    = 0;
    434434  while (TRUE) {
     
    442442      break;
    443443    }
    444  
     444
    445445    //
    446446    // Measure and record the firmware volume that is dispatched by PeiCore
     
    452452    //
    453453    Status = PeiServicesLocatePpi (
    454                &VolumeInfo.FvFormat, 
    455                0, 
     454               &VolumeInfo.FvFormat,
     455               0,
    456456               NULL,
    457457               (VOID**)&FvPpi
     
    497497  //
    498498  Status = PeiServicesLocatePpi (
    499              &Fv->FvFormat, 
    500              0, 
     499             &Fv->FvFormat,
     500             0,
    501501             NULL,
    502502             (VOID**)&FvPpi
     
    505505    return EFI_SUCCESS;
    506506  }
    507  
     507
    508508  //
    509509  // This is an FV from an FFS file, and the parent FV must have already been measured,
     
    511511  //
    512512  if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) {
    513    
     513
    514514    ASSERT (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
    515515    if (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
     
    572572  if (PcdGetBool (PcdPhysicalPresenceLifetimeLock) && !LifetimeLock) {
    573573    //
    574     // Lock TPM LifetimeLock is required, and LifetimeLock is not locked yet. 
     574    // Lock TPM LifetimeLock is required, and LifetimeLock is not locked yet.
    575575    //
    576576    PhysicalPresenceValue = TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK;
     
    588588    } else {
    589589      PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_HW_DISABLE;
    590     }     
    591      
     590    }
     591
    592592    Status = TpmCommPhysicalPresence (
    593593               PeiServices,
     
    599599    }
    600600  }
    601  
     601
    602602  //
    603603  // 2. Lock physical presence if it is required.
     
    632632  //
    633633  // Lock physical presence
    634   // 
     634  //
    635635  Status = TpmCommPhysicalPresence (
    636636              PeiServices,
     
    665665    return FALSE;
    666666  }
    667   return (BOOLEAN)(!Deactivated); 
     667  return (BOOLEAN)(!Deactivated);
    668668}
    669669
     
    688688
    689689  Status = PeiServicesLocatePpi (
    690                &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, 
    691                0, 
     690               &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid,
     691               0,
    692692               NULL,
    693693               (VOID**)&mMeasurementExcludedFvPpi
     
    712712
    713713    Status = MeasureMainBios (PeiServices, TpmHandle);
    714   } 
     714  }
    715715
    716716  //
     
    718718  // 1). for the FvInfoPpi services to measure and record
    719719  // 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
    721721  // lock the TPM
    722722  //
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TcgPei.inf

    r58459 r58466  
    7575
    7676[Pcd]
    77   gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceLifetimeLock       ## SOMETIMES_CONSUMES 
    78   gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceCmdEnable          ## SOMETIMES_CONSUMES 
     77  gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceLifetimeLock       ## SOMETIMES_CONSUMES
     78  gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceCmdEnable          ## SOMETIMES_CONSUMES
    7979  gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceHwEnable           ## SOMETIMES_CONSUMES
    8080  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString             ## SOMETIMES_CONSUMES
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TisPei.c

    r48674 r58466  
    11/** @file
    22  TIS (TPM Interface Specification) functions used by TPM PEI driver.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2525
    2626  @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
    3333  @retval EFI_SUCCESS           Operation completed successfully.
    3434  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    128128    goto Exit;
    129129  }
    130  
     130
    131131  CopyMem (&Data32, (BufferOut + 2), sizeof (UINT32));
    132132  TpmOutSize  = SwapBytes32 (Data32);
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgPei/TpmComm.c

    r58459 r58466  
    11/** @file
    22  Utility functions used by TPM PEI driver.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1919
    2020  @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
    2727  @retval EFI_SUCCESS           Operation completed successfully.
    2828  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    4545
    4646  @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
    5050  @retval EFI_SUCCESS           Operation completed successfully.
    5151  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    8989
    9090  @param[in] PeiServices        Describes the list of possible PEI Services.
    91   @param[in] TpmHandle          TPM handle. 
    92  
     91  @param[in] TpmHandle          TPM handle.
     92
    9393  @retval EFI_SUCCESS           Operation completed successfully.
    9494  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    115115  TpmSendSize               = sizeof (TPM_CMD_SELF_TEST);
    116116  SendBuffer.Hdr.tag        = SwapBytes16 (TPM_TAG_RQU_COMMAND);
    117   SendBuffer.Hdr.paramSize  = SwapBytes32 (TpmSendSize); 
     117  SendBuffer.Hdr.paramSize  = SwapBytes32 (TpmSendSize);
    118118  SendBuffer.Hdr.ordinal    = SwapBytes32 (TPM_ORD_ContinueSelfTest);
    119119  Status = TisTpmCommand (PeiServices, TpmHandle, (UINT8 *)&SendBuffer, TpmSendSize, RecvBuffer, &TpmRecvSize);
     
    125125
    126126  @param[in]  PeiServices       Describes the list of possible PEI Services.
    127   @param[in]  TpmHandle         TPM handle. 
     127  @param[in]  TpmHandle         TPM handle.
    128128  @param[out] Deactivated       Returns deactivated flag.
    129   @param[out] LifetimeLock      Returns physicalPresenceLifetimeLock permanent flag. 
     129  @param[out] LifetimeLock      Returns physicalPresenceLifetimeLock permanent flag.
    130130  @param[out] CmdEnable         Returns physicalPresenceCMDEnable permanent flag.
    131  
     131
    132132  @retval EFI_SUCCESS           Operation completed successfully.
    133133  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    158158  TpmSendSize                   = sizeof (TPM_CMD_GET_CAPABILITY);
    159159  SendBuffer.Hdr.tag            = SwapBytes16 (TPM_TAG_RQU_COMMAND);
    160   SendBuffer.Hdr.paramSize      = SwapBytes32 (TpmSendSize); 
     160  SendBuffer.Hdr.paramSize      = SwapBytes32 (TpmSendSize);
    161161  SendBuffer.Hdr.ordinal        = SwapBytes32 (TPM_ORD_GetCapability);
    162162  SendBuffer.Capability         = SwapBytes32 (TPM_CAP_FLAG);
     
    186186
    187187  @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.
    190190  @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
    193193  @retval EFI_SUCCESS           Operation completed successfully.
    194194  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    239239
    240240  @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
    244244  @retval EFI_SUCCESS           Operation completed successfully.
    245245  @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  
    11/** @file
    22  The header file for TPM PEI driver.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    5858
    5959  @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
    6363  @retval EFI_SUCCESS           Operation completed successfully.
    6464  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    7878
    7979  @param[in] PeiServices        Describes the list of possible PEI Services.
    80   @param[in] TpmHandle          TPM handle. 
    81  
     80  @param[in] TpmHandle          TPM handle.
     81
    8282  @retval EFI_SUCCESS           Operation completed successfully.
    8383  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    9696
    9797  @param[in]  PeiServices       Describes the list of possible PEI Services.
    98   @param[in]  TpmHandle         TPM handle. 
     98  @param[in]  TpmHandle         TPM handle.
    9999  @param[out] Deactivated       Returns deactivated flag.
    100   @param[out] LifetimeLock      Returns physicalPresenceLifetimeLock permanent flag. 
     100  @param[out] LifetimeLock      Returns physicalPresenceLifetimeLock permanent flag.
    101101  @param[out] CmdEnable         Returns physicalPresenceCMDEnable permanent flag.
    102  
     102
    103103  @retval EFI_SUCCESS           Operation completed successfully.
    104104  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    120120
    121121  @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.
    124124  @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
    127127  @retval EFI_SUCCESS           Operation completed successfully.
    128128  @retval EFI_TIMEOUT           The register can't run into the expected status in time.
     
    145145
    146146  @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
    150150  @retval EFI_SUCCESS           Operation completed successfully.
    151151  @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  
    1010
    1111Copyright (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 
     12This program and the accompanying materials
     13are licensed and made available under the terms and conditions of the BSD License
     14which accompanies this distribution.  The full text of the license may be found at
    1515http://opensource.org/licenses/bsd-license.php
    1616
    17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     17THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1818WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1919
     
    8181    mTcgNvs->PhysicalPresence.LastRequest = PpData.LastPPRequest;
    8282    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)
    8484          || (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) {
    8585    if (EFI_ERROR (Status)) {
     
    108108    }
    109109
    110     if (EFI_ERROR (Status)) { 
     110    if (EFI_ERROR (Status)) {
    111111      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;
    112112      return EFI_SUCCESS;
     
    187187          RequestConfirmed = TRUE;
    188188        }
    189         break; 
     189        break;
    190190
    191191      case PHYSICAL_PRESENCE_SET_NO_PPI_PROVISION_FALSE:
     
    200200        // This command requires UI to prompt user for Auth data
    201201        //
    202         mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; 
     202        mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
    203203        return EFI_SUCCESS;
    204204      default:
     
    210210    } else {
    211211      mTcgNvs->PhysicalPresence.ReturnCode = TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED;
    212     }   
     212    }
    213213    if (mTcgNvs->PhysicalPresence.Request >= TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
    214214      mTcgNvs->PhysicalPresence.ReturnCode = TcgPpVendorLibGetUserConfirmationStatusFunction (mTcgNvs->PhysicalPresence.Request, Flags.PPFlags);
    215215    }
    216   } 
     216  }
    217217
    218218  return EFI_SUCCESS;
     
    282282                           &MorControl
    283283                           );
    284   if (EFI_ERROR (Status)) { 
     284  if (EFI_ERROR (Status)) {
    285285    mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
    286286    DEBUG ((EFI_D_ERROR, "[TPM] Set MOR variable failure! Status = %r\n", Status));
     
    320320       OpRegion <= (AML_OP_REGION_32_8 *) ((UINT8 *) Table + Table->Length);
    321321       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) &&
    323323        (OpRegion->NameString  == Name) &&
    324324        (OpRegion->DWordPrefix == AML_DWORD_PREFIX) &&
     
    404404  The driver's entry point.
    405405
    406   It install callbacks for TPM physical presence and MemoryClear, and locate 
     406  It install callbacks for TPM physical presence and MemoryClear, and locate
    407407  SMM variable to be used in the callback function.
    408408
    409   @param[in] ImageHandle  The firmware allocated handle for the EFI image. 
     409  @param[in] ImageHandle  The firmware allocated handle for the EFI image.
    410410  @param[in] SystemTable  A pointer to the EFI System Table.
    411  
     411
    412412  @retval EFI_SUCCESS     The entry point is executed successfully.
    413413  @retval Others          Some error occurs when executing this entry point.
     
    454454  }
    455455  mTcgNvs->MemoryClear.SoftwareSmi = (UINT8) SwContext.SwSmiInputValue;
    456  
     456
    457457  //
    458458  // Locate SmmVariableProtocol.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.h

    r58459 r58466  
    11/** @file
    22  The header file for TCG SMM driver.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/TcgSmm.inf

    r58459 r58466  
    22#  Implements ACPI metholds for the TCG feature
    33#
    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
    66#  from ACPI method.
    77#
     
    6161  ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl"
    6262  gEfiMemoryOverwriteControlDataGuid
    63  
     63
    6464  gEfiTpmDeviceInstanceTpm12Guid                        ## PRODUCES           ## GUID       # TPM device identifier
    6565
     
    7878  gEfiSmmVariableProtocolGuid AND
    7979  gEfiTcgProtocolGuid
    80  
     80
    8181[UserExtensions.TianoCore."ExtraFiles"]
    8282  TcgSmmExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TcgSmm/Tpm.asl

    • Property svn:eol-style set to native
    r58459 r58466  
    11/** @file
    2   The TPM definition block in ACPI table for physical presence 
     2  The TPM definition block in ACPI table for physical presence
    33  and MemoryClear.
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    5050      OperationRegion (SMIP, SystemIO, 0xB2, 1)
    5151      Field (SMIP, ByteAcc, NoLock, Preserve)
    52       { 
     52      {
    5353          IOB2, 8
    5454      }
     
    8383
    8484      Method (PTS, 1, Serialized)
    85       { 
     85      {
    8686        //
    8787        // Detect Sx state for MOR, only S4, S5 need to handle
    8888        //
    8989        If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))
    90         {   
     90        {
    9191          //
    9292          // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.
     
    9898            //
    9999            Store (0x02, MCIP)
    100              
     100
    101101            //
    102102            // Triggle the SMI interrupt
     
    106106        }
    107107        Return (0)
    108       }   
     108      }
    109109
    110110      Method (_STA, 0)
     
    156156
    157157      Name(TPM2, Package (0x02){
    158         Zero,
    159         Zero
    160       })
    161 
    162       Name(TPM3, Package (0x03){
    163         Zero,
    164158        Zero,
    165159        Zero
    166160      })
    167161
     162      Name(TPM3, Package (0x03){
     163        Zero,
     164        Zero,
     165        Zero
     166      })
     167
    168168      //
    169169      // TCG Physical Presence Interface
    170170      //
    171171      Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
    172       {       
     172      {
    173173        //
    174174        // Switch by function index
     
    195195            // b) Submit TPM Operation Request to Pre-OS Environment
    196196            //
    197                  
     197
    198198            Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
    199199            Store (0x02, PPIP)
    200              
     200
    201201            //
    202202            // Triggle the SMI interrupt
     
    212212            // c) Get Pending TPM Operation Requested By the OS
    213213            //
    214                  
     214
    215215            Store (PPRQ, Index (TPM2, 0x01))
    216216            Return (TPM2)
     
    229229            //
    230230            Store (0x05, PPIP)
    231                  
     231
    232232            //
    233233            // Triggle the SMI interrupt
    234234            //
    235235            Store (PPIN, IOB2)
    236                  
     236
    237237            Store (LPPR, Index (TPM3, 0x01))
    238238            Store (PPRP, Index (TPM3, 0x02))
     
    257257            Store (7, PPIP)
    258258            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)
    264264            Return (FRET)
    265265          }
     
    271271            Store (8, PPIP)
    272272            Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
    273                  
     273
    274274            //
    275275            // Triggle the SMI interrupt
    276276            //
    277277            Store (PPIN, IOB2)
    278                  
     278
    279279            Return (FRET)
    280280          }
     
    305305            //
    306306            Store (DerefOf (Index (Arg2, 0x00)), MORD)
    307                  
     307
    308308            //
    309309            // Triggle the SMI through ACPI _DSM method.
    310310            //
    311311            Store (0x01, MCIP)
    312                  
     312
    313313            //
    314314            // Triggle the SMI interrupt
     
    319319          Default {BreakPoint}
    320320        }
    321         Return (1)       
     321        Return (1)
    322322      }
    323323
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TpmDetection.c

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    4141{
    4242  UINT8                             RegRead;
    43  
     43
    4444  RegRead = MmioRead8 ((UINTN)PcdGet64 (PcdTpmBaseAddress));
    4545  if (RegRead == 0xFF) {
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfig.vfr

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigDriver.c

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    5555    return EFI_ALREADY_STARTED;
    5656  }
    57  
     57
    5858  //
    5959  // Create a private data structure.
     
    6464  //
    6565  // Install private GUID.
    66   //   
     66  //
    6767  Status = gBS->InstallMultipleProtocolInterfaces (
    6868                  &ImageHandle,
     
    156156    ASSERT_EFI_ERROR (Status);
    157157  }
    158  
     158
    159159  //
    160160  // Install TrEE configuration form
     
    170170  if (PrivateData != NULL) {
    171171    UninstallTrEEConfigForm (PrivateData);
    172   } 
    173  
     172  }
     173
    174174  return Status;
    175175}
     
    197197                  &gEfiCallerIdGuid,
    198198                  (VOID **) &PrivateData
    199                   ); 
    200   if (EFI_ERROR (Status)) {
    201     return Status; 
    202   }
    203  
     199                  );
     200  if (EFI_ERROR (Status)) {
     201    return Status;
     202  }
     203
    204204  ASSERT (PrivateData->Signature == TREE_CONFIG_PRIVATE_DATA_SIGNATURE);
    205205
     
    210210         NULL
    211211         );
    212  
     212
    213213  UninstallTrEEConfigForm (PrivateData);
    214214
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigDxe.inf

    r58464 r58466  
    11## @file
    22#  TPM device configuration for TPM 2.0
    3 # 
     3#
    44#  By this module, user may select TPM device, clear TPM state, etc.
    55#  NOTE: This module is only for reference only, each platform should have its own setup page.
     
    6262  ## SOMETIMES_CONSUMES ## Variable:L"TrEEPhysicalPresence"
    6363  gEfiTrEEPhysicalPresenceGuid
    64  
     64
    6565  ## PRODUCES           ## HII
    6666  ## SOMETIMES_PRODUCES ## Variable:L"TREE_CONFIGURATION"
     
    8484  gEfiVariableArchProtocolGuid      AND
    8585  gEfiVariableWriteArchProtocolGuid
    86  
     86
    8787[UserExtensions.TianoCore."ExtraFiles"]
    8888  TrEEConfigDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigImpl.c

    r58464 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    4545    END_DEVICE_PATH_TYPE,
    4646    END_ENTIRE_DEVICE_PATH_SUBTYPE,
    47     { 
     47    {
    4848      (UINT8) (END_DEVICE_PATH_LENGTH),
    4949      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
     
    126126  if (EFI_ERROR (Status)) {
    127127    return Status;
    128   }               
    129                  
     128  }
     129
    130130  PpData.PPRequest = PpRequest;
    131131  Status = gRT->SetVariable (
     
    212212    return EFI_INVALID_PARAMETER;
    213213  }
    214  
     214
    215215  if (Action == EFI_BROWSER_ACTION_CHANGED) {
    216216    if (QuestionId == KEY_TPM_DEVICE) {
     
    279279           ConfigAccess,
    280280           NULL
    281            ); 
     281           );
    282282
    283283    return EFI_OUT_OF_RESOURCES;
    284284  }
    285  
     285
    286286  PrivateData->HiiHandle = HiiHandle;
    287287
     
    304304  }
    305305
    306   return EFI_SUCCESS; 
     306  return EFI_SUCCESS;
    307307}
    308308
     
    340340    PrivateData->DriverHandle = NULL;
    341341  }
    342  
     342
    343343  FreePool (PrivateData);
    344344}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigImpl.h

    r58464 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    6060  EFI_HII_CONFIG_ACCESS_PROTOCOL    ConfigAccess;
    6161  EFI_HII_HANDLE                    HiiHandle;
    62   EFI_HANDLE                        DriverHandle; 
     62  EFI_HANDLE                        DriverHandle;
    6363
    6464  UINT8                             TpmDeviceDetected;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigNvData.h

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigPei.inf

    r58464 r58466  
    6868  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid                 ## PRODUCES
    6969  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy         ## PRODUCES
    70   gEfiSecurityPkgTokenSpaceGuid.PcdTpmAutoDetection                ## CONSUMES 
     70  gEfiSecurityPkgTokenSpaceGuid.PcdTpmAutoDetection                ## CONSUMES
    7171  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress                  ## SOMETIMES_CONSUMES
    7272
     
    7474  gEfiPeiMasterBootModePpiGuid AND
    7575  gEfiPeiReadOnlyVariable2PpiGuid
    76  
     76
    7777[UserExtensions.TianoCore."ExtraFiles"]
    7878  TrEEConfigPeiExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEConfig/TrEEConfigPeim.c

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c

    r58464 r58466  
    11/** @file
    22  This module implements measuring PeCoff image for TrEE Protocol.
    3  
     3
    44  Caution: This file requires additional review when modified.
    55  This driver will have external input - PE/COFF image.
     
    88
    99Copyright (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 
     10This program and the accompanying materials
     11are licensed and made available under the terms and conditions of the BSD License
     12which accompanies this distribution.  The full text of the license may be found at
    1313http://opensource.org/licenses/bsd-license.php
    1414
    15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     15THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1616WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1717
     
    114114  if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
    115115    //
    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
    118118    //       Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
    119119    //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
     
    126126    Magic = Hdr.Pe32->OptionalHeader.Magic;
    127127  }
    128  
     128
    129129  //
    130130  // 3.  Calculate the distance from the base of the image header to the image checksum address.
     
    149149  if (EFI_ERROR (Status)) {
    150150    goto Finish;
    151   } 
     151  }
    152152
    153153  //
     
    178178        goto Finish;
    179179      }
    180     }   
     180    }
    181181  } else {
    182182    //
     
    192192      //
    193193      // Use PE32+ offset
    194       //   
     194      //
    195195      HashBase = (UINT8 *) &Hdr.Pe32Plus->OptionalHeader.CheckSum + sizeof (UINT32);
    196196      HashSize = (UINTN) ((UINT8 *)(&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]) - HashBase);
     
    221221      HashSize = Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - (UINTN) (HashBase - ImageAddress);
    222222    }
    223    
     223
    224224    if (HashSize != 0) {
    225225      Status  = HashUpdate (HashHandle, HashBase, HashSize);
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c

    r58464 r58466  
    11/** @file
    22  This module implements TrEE Protocol.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    109109// The following EFI_TCG_SERVER_ACPI_TABLE default setting is just one example,
    110110// 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
    113113//
    114114EFI_TCG_SERVER_ACPI_TABLE           mTcgServerAcpiTemplate = {
     
    350350  @retval EFI_SUCCESS            Operation completed successfully.
    351351  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
    352                                  The ProtocolCapability variable will not be populated. 
     352                                 The ProtocolCapability variable will not be populated.
    353353  @retval EFI_INVALID_PARAMETER  One or more of the parameters are incorrect.
    354354                                 The ProtocolCapability variable will not be populated.
    355355  @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).
    357357**/
    358358EFI_STATUS
     
    398398
    399399  DEBUG ((EFI_D_INFO, "EventLogFormat: (0x%x)\n", EventLogFormat));
    400  
     400
    401401  switch (EventLogFormat) {
    402402  case TREE_EVENT_LOG_FORMAT_TCG_1_2:
     
    423423/**
    424424  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.
    426426
    427427  @param[in]  This               Indicates the calling context
     
    511511  Add a new entry to the Event Log.
    512512
    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.
    515515  @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.
    517517  @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.
    519519  @param[in]      NewEventSize    New event data size.
    520  
     520
    521521  @retval EFI_SUCCESS           The new event log entry was added.
    522522  @retval EFI_OUT_OF_RESOURCES  No enough memory to log the new event.
     
    569569
    570570  @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.
    572572  @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.
    574574  @param[in] NewEventSize    New event data size.
    575575
     
    614614             NewEventSize
    615615             );
    616  
     616
    617617  if (Status == EFI_DEVICE_ERROR) {
    618618    return EFI_DEVICE_ERROR;
     
    722722
    723723  @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
    725725                                to be hashed, extended, and logged.
    726726  @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.
    729729
    730730  @retval EFI_SUCCESS           Operation completed successfully.
     
    744744  EFI_STATUS                        Status;
    745745  TPML_DIGEST_VALUES                DigestList;
    746  
     746
    747747  if (!mTcgDxeData.BsCap.TrEEPresentFlag) {
    748748    return EFI_DEVICE_ERROR;
     
    776776  The EFI_TREE_PROTOCOL HashLogExtendEvent function call provides callers with
    777777  an opportunity to extend and optionally log events without requiring
    778   knowledge of actual TPM commands. 
     778  knowledge of actual TPM commands.
    779779  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).
    781781
    782782  @param[in]  This               Indicates the calling context
    783783  @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.
    785785  @param[in]  DataToHashLen      The length in bytes of the buffer referenced by DataToHash.
    786786  @param[in]  Event              Pointer to data buffer containing information about the event.
     
    872872  @retval EFI_DEVICE_ERROR       The command was not successfully sent to the device or a response was not successfully received from the device.
    873873  @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.
    875875**/
    876876EFI_STATUS
     
    961961      mTcgDxeData.EventLogAreaStruct[Index].Laml = EFI_TCG_LOG_AREA_SIZE;
    962962      //
    963       // To initialize them as 0xFF is recommended 
     963      // To initialize them as 0xFF is recommended
    964964      // because the OS can know the last entry for that.
    965965      //
     
    985985      GuidHob.Raw = GetHobList ();
    986986      Status = EFI_SUCCESS;
    987       while (!EFI_ERROR (Status) && 
     987      while (!EFI_ERROR (Status) &&
    988988             (GuidHob.Raw = GetNextGuidHob (mTreeEventInfo[Index].EventGuid, GuidHob.Raw)) != NULL) {
    989989        TcgEvent    = GET_GUID_HOB_DATA (GuidHob.Guid);
     
    10091009  Measure and log an action string, and extend the measurement result into PCR[5].
    10101010
    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
    10131013  @retval EFI_SUCCESS         Operation completed successfully.
    10141014  @retval EFI_DEVICE_ERROR    The operation was unsuccessful.
     
    10861086  if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) {
    10871087    //
    1088     // Tcg Server spec. 
     1088    // Tcg Server spec.
    10891089    // Measure each processor EFI_CPU_PHYSICAL_LOCATION with EV_TABLE_OF_DEVICES to PCR[1]
    10901090    //
     
    11181118  Measure and log Separator event, and extend the measurement result into a specific PCR.
    11191119
    1120   @param[in] PCRIndex         PCR index. 
     1120  @param[in] PCRIndex         PCR index.
    11211121
    11221122  @retval EFI_SUCCESS         Operation completed successfully.
     
    11501150  Measure and log an EFI variable, and extend the measurement result into a specific PCR.
    11511151
    1152   @param[in]  PCRIndex          PCR Index. 
    1153   @param[in]  EventType         Event type. 
     1152  @param[in]  PCRIndex          PCR Index.
     1153  @param[in]  EventType         Event type.
    11541154  @param[in]  VarName           A Null-terminated string that is the name of the vendor's variable.
    11551155  @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
    11591159  @retval EFI_SUCCESS           Operation completed successfully.
    11601160  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    12341234  Read then Measure and log an EFI variable, and extend the measurement result into a specific PCR.
    12351235
    1236   @param[in]  PCRIndex          PCR Index. 
    1237   @param[in]  EventType         Event type. 
     1236  @param[in]  PCRIndex          PCR Index.
     1237  @param[in]  EventType         Event type.
    12381238  @param[in]   VarName          A Null-terminated string that is the name of the vendor's variable.
    12391239  @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
    12431243  @retval EFI_SUCCESS           Operation completed successfully.
    12441244  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    12921292  @param[in]   VarName          A Null-terminated string that is the name of the vendor's variable.
    12931293  @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
    12971297  @retval EFI_SUCCESS           Operation completed successfully.
    12981298  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    13231323  @param[in]   VarName          A Null-terminated string that is the name of the vendor's variable.
    13241324  @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
    13281328  @retval EFI_SUCCESS           Operation completed successfully.
    13291329  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    16171617  Install TCG ACPI Table when ACPI Table Protocol is available.
    16181618
    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.
    16221622
    16231623  @param[in]  Event     Event whose notification function is being invoked
     
    16501650    mTcgClientAcpiTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    16511651    //
    1652     // The ACPI table must be checksumed before calling the InstallAcpiTable() 
     1652    // The ACPI table must be checksumed before calling the InstallAcpiTable()
    16531653    // service of the ACPI table protocol to install it.
    16541654    //
     
    16701670    mTcgServerAcpiTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    16711671    //
    1672     // The ACPI table must be checksumed before calling the InstallAcpiTable() 
     1672    // The ACPI table must be checksumed before calling the InstallAcpiTable()
    16731673    // service of the ACPI table protocol to install it.
    16741674    //
     
    17611761/**
    17621762  The function install TrEE protocol.
    1763  
     1763
    17641764  @retval EFI_SUCCESS     TrEE protocol is installed.
    17651765  @retval other           Some error occurs.
     
    17861786  The driver's entry point. It publishes EFI TrEE Protocol.
    17871787
    1788   @param[in] ImageHandle  The firmware allocated handle for the EFI image. 
     1788  @param[in] ImageHandle  The firmware allocated handle for the EFI image.
    17891789  @param[in] SystemTable  A pointer to the EFI System Table.
    1790  
     1790
    17911791  @retval EFI_SUCCESS     The entry point is executed successfully.
    17921792  @retval other           Some error occurs when executing this entry point.
     
    18201820    return EFI_DEVICE_ERROR;
    18211821  }
    1822  
     1822
    18231823  Status = Tpm2RequestUseTpm ();
    18241824  if (EFI_ERROR (Status)) {
     
    18261826    return Status;
    18271827  }
    1828  
     1828
    18291829  //
    18301830  // Fill information
     
    19221922
    19231923    //
    1924     // Measure Exit Boot Service failed 
     1924    // Measure Exit Boot Service failed
    19251925    //
    19261926    Status = gBS->CreateEventEx (
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf

    r58464 r58466  
    6464  ## SOMETIMES_CONSUMES     ## GUID                  # Handoff Table for measurement.
    6565  gEfiSmbiosTableGuid
    66  
     66
    6767  ## SOMETIMES_CONSUMES     ## Variable:L"SecureBoot"
    6868  ## SOMETIMES_CONSUMES     ## Variable:L"PK"
     
    7474  ## SOMETIMES_CONSUMES      ## Variable:L"dbx"
    7575  gEfiImageSecurityDatabaseGuid
    76    
     76
    7777  gTcgEventEntryHobGuid                              ## SOMETIMES_CONSUMES  ## HOB
    7878  gTpmErrorHobGuid                                   ## SOMETIMES_CONSUMES  ## HOB
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEEPei/TrEEPei.c

    r58464 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    117117    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
    118118    &gEfiPeiFirmwareVolumeInfoPpiGuid,
    119     FirmwareVolmeInfoPpiNotifyCallback 
     119    FirmwareVolmeInfoPpiNotifyCallback
    120120  },
    121121  {
    122122    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
    123123    &gEfiPeiFirmwareVolumeInfo2PpiGuid,
    124     FirmwareVolmeInfoPpiNotifyCallback 
     124    FirmwareVolmeInfoPpiNotifyCallback
    125125  },
    126126  {
     
    170170/**
    171171  Record all measured Firmware Volum Information into a Guid Hob
    172   Guid Hob payload layout is 
     172  Guid Hob payload layout is
    173173
    174174     UINT32 *************************** FIRMWARE_BLOB number
     
    190190  IN VOID                          *Ppi
    191191  )
    192 { 
     192{
    193193  MEASURED_HOB_DATA *MeasuredHobData;
    194194
     
    196196
    197197  //
    198   // Create a Guid hob to save all measured Fv 
     198  // Create a Guid hob to save all measured Fv
    199199  //
    200200  MeasuredHobData = BuildGuidHob(
     
    278278
    279279  @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
    281281                                to be hashed, extended, and logged.
    282282  @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.
    285285
    286286  @retval EFI_SUCCESS           Operation completed successfully.
     
    316316    }
    317317  }
    318  
     318
    319319  if (Status == EFI_DEVICE_ERROR) {
    320320    DEBUG ((EFI_D_ERROR, "HashLogExtendEvent - %r. Disable TPM.\n", Status));
     
    363363
    364364/**
    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.
    367367
    368368  @param[in]  FvBase            Base address of FV image.
    369369  @param[in]  FvLength          Length of FV image.
    370370
    371   @retval EFI_SUCCESS           Fv image is measured successfully 
     371  @retval EFI_SUCCESS           Fv image is measured successfully
    372372                                or it has been already measured.
    373373  @retval EFI_OUT_OF_RESOURCES  No enough memory to log the new event.
     
    407407    }
    408408  }
    409  
     409
    410410  //
    411411  // Measure and record the FV to the TPM
     
    473473      break;
    474474    }
    475  
     475
    476476    //
    477477    // Measure and record the firmware volume that is dispatched by PeiCore
     
    483483    //
    484484    Status = PeiServicesLocatePpi (
    485                &VolumeInfo.FvFormat, 
    486                0, 
     485               &VolumeInfo.FvFormat,
     486               0,
    487487               NULL,
    488488               (VOID**)&FvPpi
     
    529529  //
    530530  Status = PeiServicesLocatePpi (
    531              &Fv->FvFormat, 
    532              0, 
     531             &Fv->FvFormat,
     532             0,
    533533             NULL,
    534534             (VOID**)&FvPpi
     
    537537    return EFI_SUCCESS;
    538538  }
    539  
     539
    540540  //
    541541  // This is an FV from an FFS file, and the parent FV must have already been measured,
     
    543543  //
    544544  if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) {
    545    
     545
    546546    ASSERT (mMeasuredChildFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported));
    547547    if (mMeasuredChildFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {
     
    582582
    583583  Status = PeiServicesLocatePpi (
    584                &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, 
    585                0, 
     584               &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid,
     585               0,
    586586               NULL,
    587587               (VOID**)&mMeasurementExcludedFvPpi
     
    593593  mMeasuredChildFvInfo = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
    594594  ASSERT (mMeasuredChildFvInfo != NULL);
    595  
     595
    596596  if (PcdGet8 (PcdTpm2ScrtmPolicy) == 1) {
    597597    Status = MeasureCRTMVersion ();
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/Tpm.asl

    • Property svn:eol-style set to native
    r58464 r58466  
    11/** @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
    33  and MemoryClear.
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    3131      //
    3232      Name (_HID, "MSFT0101")
    33      
     33
    3434      //
    3535      // Readable name of this device, don't know if this way is correct yet
     
    4949      OperationRegion (SMIP, SystemIO, 0xB2, 1)
    5050      Field (SMIP, ByteAcc, NoLock, Preserve)
    51       { 
     51      {
    5252          IOB2, 8
    5353      }
     
    8282
    8383      Method (PTS, 1, Serialized)
    84       { 
     84      {
    8585        //
    8686        // Detect Sx state for MOR, only S4, S5 need to handle
    8787        //
    8888        If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))
    89         {   
     89        {
    9090          //
    9191          // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.
     
    9797            //
    9898            Store (0x02, MCIP)
    99              
     99
    100100            //
    101101            // Triggle the SMI interrupt
     
    105105        }
    106106        Return (0)
    107       }   
     107      }
    108108
    109109      Method (_STA, 0)
     
    155155
    156156      Name(TPM2, Package (0x02){
    157         Zero,
    158         Zero
    159       })
    160 
    161       Name(TPM3, Package (0x03){
    162         Zero,
    163157        Zero,
    164158        Zero
    165159      })
    166160
     161      Name(TPM3, Package (0x03){
     162        Zero,
     163        Zero,
     164        Zero
     165      })
     166
    167167      //
    168168      // TCG Physical Presence Interface
    169169      //
    170170      Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
    171       {       
     171      {
    172172        //
    173173        // Switch by function index
     
    194194            // b) Submit TPM Operation Request to Pre-OS Environment
    195195            //
    196                  
     196
    197197            Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
    198198            Store (0x02, PPIP)
    199              
     199
    200200            //
    201201            // Triggle the SMI interrupt
     
    211211            // c) Get Pending TPM Operation Requested By the OS
    212212            //
    213                  
     213
    214214            Store (PPRQ, Index (TPM2, 0x01))
    215215            Return (TPM2)
     
    228228            //
    229229            Store (0x05, PPIP)
    230                  
     230
    231231            //
    232232            // Triggle the SMI interrupt
    233233            //
    234234            Store (PPIN, IOB2)
    235                  
     235
    236236            Store (LPPR, Index (TPM3, 0x01))
    237237            Store (PPRP, Index (TPM3, 0x02))
     
    256256            Store (7, PPIP)
    257257            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)
    263263            Return (FRET)
    264264          }
     
    270270            Store (8, PPIP)
    271271            Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
    272                  
     272
    273273            //
    274274            // Triggle the SMI interrupt
    275275            //
    276276            Store (PPIN, IOB2)
    277                  
     277
    278278            Return (FRET)
    279279          }
     
    304304            //
    305305            Store (DerefOf (Index (Arg2, 0x00)), MORD)
    306                  
     306
    307307            //
    308308            // Triggle the SMI through ACPI _DSM method.
    309309            //
    310310            Store (0x01, MCIP)
    311                  
     311
    312312            //
    313313            // Triggle the SMI interrupt
     
    318318          Default {BreakPoint}
    319319        }
    320         Return (1)       
     320        Return (1)
    321321      }
    322322
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/TrEESmm.c

    r58464 r58466  
    1111
    1212Copyright (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 
     13This program and the accompanying materials
     14are licensed and made available under the terms and conditions of the BSD License
     15which accompanies this distribution.  The full text of the license may be found at
    1616http://opensource.org/licenses/bsd-license.php
    1717
    18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     18THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1919WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    2020
     
    9898    mTcgNvs->PhysicalPresence.LastRequest = PpData.LastPPRequest;
    9999    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)
    101101          || (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) {
    102102    if (EFI_ERROR (Status)) {
     
    126126    }
    127127
    128     if (EFI_ERROR (Status)) { 
     128    if (EFI_ERROR (Status)) {
    129129      mTcgNvs->PhysicalPresence.ReturnCode = TREE_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;
    130130      DEBUG ((EFI_D_ERROR, "[TPM2] Set PP variable failure! Status = %r\n", Status));
     
    195195        } else {
    196196          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;
    198198            return EFI_SUCCESS;
    199199          }
     
    206206    } else {
    207207      mTcgNvs->PhysicalPresence.ReturnCode = TREE_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED;
    208     }   
     208    }
    209209    if (mTcgNvs->PhysicalPresence.Request >= TREE_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
    210210      mTcgNvs->PhysicalPresence.ReturnCode = TrEEPpVendorLibGetUserConfirmationStatusFunction (mTcgNvs->PhysicalPresence.Request, Flags.PPFlags);
    211211    }
    212   } 
     212  }
    213213
    214214  return EFI_SUCCESS;
     
    278278                           &MorControl
    279279                           );
    280   if (EFI_ERROR (Status)) { 
     280  if (EFI_ERROR (Status)) {
    281281    mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
    282282    DEBUG ((EFI_D_ERROR, "[TPM] Set MOR variable failure! Status = %r\n", Status));
     
    316316       OpRegion <= (AML_OP_REGION_32_8 *) ((UINT8 *) Table + Table->Length);
    317317       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) &&
    319319        (OpRegion->NameString  == Name) &&
    320320        (OpRegion->DWordPrefix == AML_DWORD_PREFIX) &&
     
    453453  The driver's entry point.
    454454
    455   It install callbacks for TPM physical presence and MemoryClear, and locate 
     455  It install callbacks for TPM physical presence and MemoryClear, and locate
    456456  SMM variable to be used in the callback function.
    457457
    458   @param[in] ImageHandle  The firmware allocated handle for the EFI image. 
     458  @param[in] ImageHandle  The firmware allocated handle for the EFI image.
    459459  @param[in] SystemTable  A pointer to the EFI System Table.
    460  
     460
    461461  @retval EFI_SUCCESS     The entry point is executed successfully.
    462462  @retval Others          Some error occurs when executing this entry point.
     
    503503  }
    504504  mTcgNvs->MemoryClear.SoftwareSmi = (UINT8) SwContext.SwSmiInputValue;
    505  
     505
    506506  //
    507507  // Locate SmmVariableProtocol.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/TrEESmm.h

    r58464 r58466  
    11/** @file
    22  The header file for TrEE SMM driver.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Tcg/TrEESmm/TrEESmm.inf

    r58464 r58466  
    22#  Provides ACPI metholds for TPM 2.0 support
    33#
    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
    66#  MemoryClear to handle the requests from ACPI method.
    77#
     
    5959
    6060  ## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl"
    61   ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl" 
     61  ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl"
    6262  gEfiMemoryOverwriteControlDataGuid
    63  
     63
    6464  gEfiTpmDeviceInstanceTpm20DtpmGuid                            ## PRODUCES           ## GUID       # TPM device identifier
    6565
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.c

    r58459 r58466  
    11/** @file
    22  Password Credential Provider driver implementation.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    9898  //
    9999  NewTable = (CREDENTIAL_TABLE *) AllocateZeroPool (
    100                                     sizeof (CREDENTIAL_TABLE) + 
     100                                    sizeof (CREDENTIAL_TABLE) +
    101101                                    (Count - 1) * sizeof (PASSWORD_INFO)
    102102                                    );
    103   ASSERT (NewTable != NULL); 
     103  ASSERT (NewTable != NULL);
    104104
    105105  NewTable->MaxCount    = Count;
     
    110110  //
    111111  CopyMem (
    112     &NewTable->UserInfo, 
    113     &mPwdTable->UserInfo, 
     112    &NewTable->UserInfo,
     113    &mPwdTable->UserInfo,
    114114    mPwdTable->Count * sizeof (PASSWORD_INFO)
    115115    );
     
    123123
    124124  @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,
    127127                        delete the info by Index.
    128128
     
    151151      if (Index != mPwdTable->Count) {
    152152        NewPasswordInfo = &mPwdTable->UserInfo[mPwdTable->Count];
    153       } 
     153      }
    154154    } else {
    155155      //
     
    214214  Var     = NULL;
    215215  Status  = gRT->GetVariable (
    216                    L"PwdCredential", 
    217                    &gPwdCredentialProviderGuid, 
    218                    NULL, 
     216                   L"PwdCredential",
     217                   &gPwdCredentialProviderGuid,
     218                   NULL,
    219219                   &VarSize,
    220220                   Var
     
    226226    }
    227227    Status = gRT->GetVariable (
    228                     L"PwdCredential", 
    229                     &gPwdCredentialProviderGuid, 
    230                     NULL, 
     228                    L"PwdCredential",
     229                    &gPwdCredentialProviderGuid,
     230                    NULL,
    231231                    &VarSize,
    232232                    Var
     
    236236    return Status;
    237237  }
    238  
     238
    239239  //
    240240  // Create the password credential table.
     
    242242  mPwdTable = AllocateZeroPool (
    243243                sizeof (CREDENTIAL_TABLE) - sizeof (PASSWORD_INFO) +
    244                 PASSWORD_TABLE_INC * sizeof (PASSWORD_INFO) + 
     244                PASSWORD_TABLE_INC * sizeof (PASSWORD_INFO) +
    245245                VarSize
    246246                );
     
    270270  @retval      TRUE           Hash the password successfully.
    271271  @retval      FALSE          Failed to hash the password.
    272                  
     272
    273273**/
    274274BOOLEAN
     
    282282  UINTN             HashSize;
    283283  VOID              *Hash;
    284  
     284
    285285  HashSize = Sha1GetContextSize ();
    286286  Hash     = AllocatePool (HashSize);
    287287  ASSERT (Hash != NULL);
    288  
     288
    289289  Status = Sha1Init (Hash);
    290290  if (!Status) {
    291291    goto Done;
    292292  }
    293  
     293
    294294  Status = Sha1Update (Hash, Password, PasswordSize);
    295295  if (!Status) {
    296296    goto Done;
    297297  }
    298  
     298
    299299  Status = Sha1Final (Hash, Credential);
    300  
     300
    301301Done:
    302302  FreePool (Hash);
     
    325325  CHAR16        *QuestionStr;
    326326  CHAR16        *LineStr;
    327  
     327
    328328  PasswordLen = 0;
    329329  while (TRUE) {
     
    346346    FreePool (QuestionStr);
    347347    FreePool (LineStr);
    348    
     348
    349349    //
    350350    // Check key stroke
     
    357357          PasswordLen--;
    358358        }
    359       } else if ((Key.UnicodeChar == CHAR_NULL) || 
    360                  (Key.UnicodeChar == CHAR_TAB) || 
     359      } else if ((Key.UnicodeChar == CHAR_NULL) ||
     360                 (Key.UnicodeChar == CHAR_TAB) ||
    361361                 (Key.UnicodeChar == CHAR_LINEFEED)) {
    362362        continue;
     
    371371    }
    372372  }
    373  
     373
    374374  PasswordLen = PasswordLen * sizeof (CHAR16);
    375375  GenerateCredential (Password, PasswordLen, (UINT8 *)Credential);
     
    392392  UINTN      Index;
    393393  CHAR8      *Pwd;
    394  
     394
    395395  //
    396396  // Check password credential.
     
    412412  Find a user infomation record by the information record type.
    413413
    414   This function searches all user information records of User from beginning 
     414  This function searches all user information records of User from beginning
    415415  until either the information is found, or there are no more user infomation
    416416  records. A match occurs when a Info.InfoType field matches the user information
    417417  record type.
    418418
    419   @param[in]     User      Points to the user profile record to search.                         
     419  @param[in]     User      Points to the user profile record to search.
    420420  @param[in]     InfoType  The infomation type to be searched.
    421421  @param[out]    Info      Points to the user info found, the caller is responsible
    422422                           to free.
    423  
     423
    424424  @retval EFI_SUCCESS      Find the user information successfully.
    425425  @retval Others           Fail to find the user information.
     
    438438  EFI_USER_INFO_HANDLE       UserInfoHandle;
    439439  EFI_USER_MANAGER_PROTOCOL  *UserManager;
    440  
     440
    441441  //
    442442  // Find user information by information type.
     
    501501      *Info = UserInfo;
    502502      return EFI_SUCCESS;
    503     }   
     503    }
    504504  }
    505505
     
    570570      }
    571571      *ActionRequest  = EFI_BROWSER_ACTION_REQUEST_EXIT;
    572     }   
     572    }
    573573    return EFI_SUCCESS;
    574574  }
     
    714714  Enroll a user on a credential provider.
    715715
    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;
    718718  otherwise add the user information on credential provider.
    719  
     719
    720720  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.
    721721  @param[in] User                The user profile to enroll.
    722  
     722
    723723  @retval EFI_SUCCESS            User profile was successfully enrolled.
    724724  @retval EFI_ACCESS_DENIED      Current user profile does not permit enrollment on the
    725725                                 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
    727727                                 other than the current user profile.
    728728  @retval EFI_UNSUPPORTED        This credential provider does not support enrollment in
     
    731731                                 error.
    732732  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.
    733  
     733
    734734**/
    735735EFI_STATUS
     
    767767  }
    768768
    769   CopyMem (PwdInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); 
     769  CopyMem (PwdInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER));
    770770  FreePool (UserInfo);
    771771
    772772  //
    773773  // Get password from user.
    774   // 
     774  //
    775775  while (TRUE) {
    776776    //
     
    789789    if (CompareMem (PwdInfo.Password, Password, CREDENTIAL_LEN) == 0) {
    790790      break;
    791     } 
     791    }
    792792
    793793    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));
    795795    CreatePopUp (
    796796      EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
     
    807807  //
    808808  // Check whether User is ever enrolled in the provider.
    809   // 
     809  //
    810810  for (Index = 0; Index < mPwdTable->Count; Index++) {
    811811    UserId = (UINT8 *) &mPwdTable->UserInfo[Index].UserId;
     
    813813      //
    814814      // User already exists, update the password.
    815       //     
     815      //
    816816      break;
    817817    }
    818818  }
    819    
     819
    820820  //
    821821  // Enroll the User to the provider.
     
    835835  This function returns information about the form used when interacting with the
    836836  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
    838838  the user credential provider does not require a form to identify the user, then this
    839839  function should return EFI_NOT_FOUND.
     
    843843  @param[out] FormSetId  On return, holds the identifier of the form set which contains
    844844                         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
    846846                         identification.
    847                          
     847
    848848  @retval EFI_SUCCESS            Form returned successfully.
    849849  @retval EFI_NOT_FOUND          Form not returned.
    850850  @retval EFI_INVALID_PARAMETER  Hii is NULL or FormSetId is NULL or FormId is NULL.
    851  
     851
    852852**/
    853853EFI_STATUS
     
    860860  )
    861861{
    862   if ((This == NULL) || (Hii == NULL) || 
     862  if ((This == NULL) || (Hii == NULL) ||
    863863      (FormSetId == NULL) || (FormId == NULL)) {
    864864    return EFI_INVALID_PARAMETER;
     
    868868  *FormId    = FORMID_GET_PASSWORD_FORM;
    869869  CopyGuid (FormSetId, &gPwdCredentialProviderGuid);
    870  
     870
    871871  return EFI_SUCCESS;
    872872}
     
    878878  This optional function returns a bitmap that is less than or equal to the number
    879879  of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND
    880   is returned. 
     880  is returned.
    881881
    882882  @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
    885885                          width of the bitmap returned.
    886886  @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
    888888                          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
    892892  @retval EFI_SUCCESS            Image identifier returned successfully.
    893893  @retval EFI_NOT_FOUND          Image identifier not returned.
    894894  @retval EFI_INVALID_PARAMETER  Hii is NULL or Image is NULL.
    895  
     895
    896896**/
    897897EFI_STATUS
     
    904904      OUT    EFI_IMAGE_ID                        *Image
    905905  )
    906 { 
     906{
    907907  if ((This == NULL) || (Hii == NULL) || (Image == NULL)) {
    908908    return EFI_INVALID_PARAMETER;
     
    916916
    917917  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.
    919919
    920920  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    921921  @param[out] Hii        On return, holds the HII database handle.
    922922  @param[out] String     On return, holds the HII string identifier.
    923  
     923
    924924  @retval EFI_SUCCESS            String identifier returned successfully.
    925925  @retval EFI_NOT_FOUND          String identifier not returned.
    926926  @retval EFI_INVALID_PARAMETER  Hii is NULL or String is NULL.
    927  
     927
    928928**/
    929929EFI_STATUS
     
    938938    return EFI_INVALID_PARAMETER;
    939939  }
    940  
     940
    941941  //
    942942  // Set Hii handle and String ID.
     
    953953
    954954  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
    956956  submitted on a form, OR after a call to Default() has returned that this credential is
    957957  ready to log on.
    958958
    959959  @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
    961961                             considered by the user identity manager. If NULL, then no user
    962962                             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
    965965  @retval EFI_SUCCESS            User identifier returned successfully.
    966966  @retval EFI_NOT_READY          No user identifier can be returned.
     
    969969  @retval EFI_NOT_FOUND          User is not NULL, and the specified user handle can't be
    970970                                 found in user profile database
    971  
     971
    972972**/
    973973EFI_STATUS
     
    998998    return EFI_NOT_READY;
    999999  }
    1000  
     1000
    10011001  if (User == NULL) {
    10021002    //
    10031003    // Return the user ID whose password matches the input password.
    1004     // 
     1004    //
    10051005    CopyMem (
    1006       Identifier, 
    1007       &mPwdTable->UserInfo[mPwdTable->ValidIndex - 1].UserId, 
     1006      Identifier,
     1007      &mPwdTable->UserInfo[mPwdTable->ValidIndex - 1].UserId,
    10081008      sizeof (EFI_USER_INFO_IDENTIFIER)
    1009       );   
     1009      );
    10101010    return EFI_SUCCESS;
    10111011  }
    1012  
     1012
    10131013  //
    10141014  // Get the User's ID.
     
    10221022    return EFI_NOT_FOUND;
    10231023  }
    1024  
     1024
    10251025  //
    10261026  // Check whether the input password matches one in PwdTable.
     
    10361036        FreePool (UserInfo);
    10371037        return EFI_SUCCESS;
    1038       } 
    1039     }
    1040   }
    1041 
    1042   FreePool (UserInfo); 
     1038      }
     1039    }
     1040  }
     1041
     1042  FreePool (UserInfo);
    10431043  return EFI_NOT_READY;
    10441044}
     
    10481048  Indicate that user interface interaction has begun for the specified credential.
    10491049
    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
    10511051  AutoLogon returns FALSE, then the user interface will be constructed by the User
    1052   Identity Manager. 
     1052  Identity Manager.
    10531053
    10541054  @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
    10581058  @retval EFI_SUCCESS            Credential provider successfully selected.
    10591059  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
    1060  
     1060
    10611061**/
    10621062EFI_STATUS
     
    10821082
    10831083  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    1084  
     1084
    10851085  @retval EFI_SUCCESS    Credential provider successfully deselected.
    1086  
     1086
    10871087**/
    10881088EFI_STATUS
     
    11021102  Return the default logon behavior for this user credential.
    11031103
    1104   This function reports the default login behavior regarding this credential provider. 
     1104  This function reports the default login behavior regarding this credential provider.
    11051105
    11061106  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    11071107  @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
    11101110  @retval EFI_SUCCESS            Default information successfully returned.
    11111111  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
    1112  
     1112
    11131113**/
    11141114EFI_STATUS
     
    11231123  }
    11241124  *AutoLogon = 0;
    1125  
     1125
    11261126  return EFI_SUCCESS;
    11271127}
     
    11311131  Return information attached to the credential provider.
    11321132
    1133   This function returns user information. 
     1133  This function returns user information.
    11341134
    11351135  @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.
    11371137  @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On
    11381138                                exit, holds the user information. If the buffer is too small
     
    11401140                                and InfoSize is updated to contain the number of bytes actually
    11411141                                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
    11451145  @retval EFI_SUCCESS           Information returned successfully.
    11461146  @retval EFI_BUFFER_TOO_SMALL  The size specified by InfoSize is too small to hold all of the
    11471147                                user information. The size required is returned in *InfoSize.
    11481148  @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
    11511151**/
    11521152EFI_STATUS
     
    11611161  EFI_USER_INFO            *CredentialInfo;
    11621162  UINTN                    Index;
    1163  
     1163
    11641164  if ((This == NULL) || (InfoSize == NULL) || (Info == NULL)) {
    11651165    return EFI_INVALID_PARAMETER;
     
    11691169    return EFI_NOT_FOUND;
    11701170  }
    1171  
     1171
    11721172  //
    11731173  // Find information handle in credential info table.
     
    11831183        return EFI_BUFFER_TOO_SMALL;
    11841184      }
    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
    11901190  return EFI_NOT_FOUND;
    11911191}
     
    11981198  information record handle, point UserInfo at a NULL. Each subsequent call will retrieve
    11991199  another user information record handle until there are no more, at which point UserInfo
    1200   will point to NULL. 
     1200  will point to NULL.
    12011201
    12021202  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    12041204                           to start enumeration. On exit, points to the next user information
    12051205                           handle or NULL if there is no more user information.
    1206  
     1206
    12071207  @retval EFI_SUCCESS            User information returned.
    12081208  @retval EFI_NOT_FOUND          No more user information found.
    12091209  @retval EFI_INVALID_PARAMETER  UserInfo is NULL.
    1210  
     1210
    12111211**/
    12121212EFI_STATUS
     
    12221222  UINTN                    Index;
    12231223  UINTN                    ProvStrLen;
    1224    
     1224
    12251225  if ((This == NULL) || (UserInfo == NULL)) {
    12261226    return EFI_INVALID_PARAMETER;
     
    12441244    Info    = AllocateZeroPool (InfoLen);
    12451245    ASSERT (Info != NULL);
    1246    
     1246
    12471247    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_PROVIDER_RECORD;
    12481248    Info->InfoSize    = (UINT32) InfoLen;
     
    12501250    CopyGuid (&Info->Credential, &gPwdCredentialProviderGuid);
    12511251    CopyGuid ((EFI_GUID *)(Info + 1), &gPwdCredentialProviderGuid);
    1252    
     1252
    12531253    mPwdInfoHandle->Info[0] = Info;
    12541254    mPwdInfoHandle->Count++;
     
    12621262    Info        = AllocateZeroPool (InfoLen);
    12631263    ASSERT (Info != NULL);
    1264    
     1264
    12651265    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD;
    12661266    Info->InfoSize    = (UINT32) InfoLen;
     
    12791279    Info    = AllocateZeroPool (InfoLen);
    12801280    ASSERT (Info != NULL);
    1281      
     1281
    12821282    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_TYPE_RECORD;
    12831283    Info->InfoSize    = (UINT32) InfoLen;
     
    12851285    CopyGuid (&Info->Credential, &gPwdCredentialProviderGuid);
    12861286    CopyGuid ((EFI_GUID *)(Info + 1), &gEfiUserCredentialClassPasswordGuid);
    1287    
     1287
    12881288    mPwdInfoHandle->Info[2] = Info;
    12891289    mPwdInfoHandle->Count++;
    1290  
     1290
    12911291    //
    12921292    // The fourth information, Credential Provider type name info.
     
    12971297    Info        = AllocateZeroPool (InfoLen);
    12981298    ASSERT (Info != NULL);
    1299    
     1299
    13001300    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD;
    13011301    Info->InfoSize    = (UINT32) InfoLen;
     
    13041304    CopyMem ((UINT8*)(Info + 1), ProvNameStr, ProvStrLen);
    13051305    FreePool (ProvNameStr);
    1306    
     1306
    13071307    mPwdInfoHandle->Info[3] = Info;
    13081308    mPwdInfoHandle->Count++;
    13091309  }
    1310  
     1310
    13111311  if (*UserInfo == NULL) {
    13121312    //
     
    13161316    return EFI_SUCCESS;
    13171317  }
    1318  
     1318
    13191319  //
    13201320  // Find information handle in credential info table.
     
    13331333        return EFI_NOT_FOUND;
    13341334      }
    1335    
     1335
    13361336      Index++;
    13371337      *UserInfo = (EFI_USER_INFO_HANDLE)mPwdInfoHandle->Info[Index];
    1338       return EFI_SUCCESS;           
     1338      return EFI_SUCCESS;
    13391339    }
    13401340  }
     
    13471347  Delete a user on this credential provider.
    13481348
    1349   This function deletes a user on this credential provider. 
     1349  This function deletes a user on this credential provider.
    13501350
    13511351  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    13531353
    13541354  @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.
    13581358  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.
    13591359  @retval EFI_DEVICE_ERROR       The new credential could not be deleted because of a device error.
     
    13721372  UINT8                     *NewUserId;
    13731373  UINTN                     Index;
    1374  
     1374
    13751375  if ((This == NULL) || (User == NULL)) {
    13761376    return EFI_INVALID_PARAMETER;
     
    13921392  //
    13931393  // Find the user by user identifier in mPwdTable.
    1394   // 
     1394  //
    13951395  for (Index = 0; Index < mPwdTable->Count; Index++) {
    13961396    UserId    = (UINT8 *) &mPwdTable->UserInfo[Index].UserId;
     
    14401440    return Status;
    14411441  }
    1442  
     1442
    14431443  //
    14441444  // Init Form Browser.
     
    14481448    return Status;
    14491449  }
    1450  
     1450
    14511451  //
    14521452  // Install protocol interfaces for the password credential provider.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.h

    r48674 r58466  
    11/** @file
    22  Password Credential Provider driver header file.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    9393  Enroll a user on a credential provider.
    9494
    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;
    9797  otherwise delete the user information on credential provider.
    98  
     98
    9999  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.
    100100  @param[in] User                The user profile to enroll.
    101  
     101
    102102  @retval EFI_SUCCESS            User profile was successfully enrolled.
    103103  @retval EFI_ACCESS_DENIED      Current user profile does not permit enrollment on the
    104104                                 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
    106106                                 other than the current user profile.
    107107  @retval EFI_UNSUPPORTED        This credential provider does not support enrollment in
     
    110110                                 error.
    111111  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.
    112  
     112
    113113**/
    114114EFI_STATUS
     
    124124  This function returns information about the form used when interacting with the
    125125  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
    127127  the user credential provider does not require a form to identify the user, then this
    128128  function should return EFI_NOT_FOUND.
     
    132132  @param[out] FormSetId  On return, holds the identifier of the form set which contains
    133133                         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
    135135                         identification.
    136                          
     136
    137137  @retval EFI_SUCCESS            Form returned successfully.
    138138  @retval EFI_NOT_FOUND          Form not returned.
    139139  @retval EFI_INVALID_PARAMETER  Hii is NULL or FormSetId is NULL or FormId is NULL.
    140  
     140
    141141**/
    142142EFI_STATUS
     
    154154  This optional function returns a bitmap which is less than or equal to the number
    155155  of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND
    156   is returned. 
     156  is returned.
    157157
    158158  @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
    161161                          width of the bitmap returned.
    162162  @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
    164164                          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
    168168  @retval EFI_SUCCESS            Image identifier returned successfully.
    169169  @retval EFI_NOT_FOUND          Image identifier not returned.
    170170  @retval EFI_INVALID_PARAMETER  Hii is NULL or Image is NULL.
    171  
     171
    172172**/
    173173EFI_STATUS
     
    185185
    186186  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.
    188188
    189189  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    190190  @param[out] Hii        On return, holds the HII database handle.
    191191  @param[out] String     On return, holds the HII string identifier.
    192  
     192
    193193  @retval EFI_SUCCESS            String identifier returned successfully.
    194194  @retval EFI_NOT_FOUND          String identifier not returned.
    195195  @retval EFI_INVALID_PARAMETER  Hii is NULL or String is NULL.
    196  
     196
    197197**/
    198198EFI_STATUS
     
    208208
    209209  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
    211211  submitted on a form OR after a call to Default() has returned that this credential is
    212212  ready to log on.
    213213
    214214  @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
    216216                             considered by the user identity manager. If NULL, then no user
    217217                             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
    220220  @retval EFI_SUCCESS            User identifier returned successfully.
    221221  @retval EFI_NOT_READY          No user identifier can be returned.
     
    224224  @retval EFI_NOT_FOUND          User is not NULL, and the specified user handle can't be
    225225                                 found in user profile database
    226  
     226
    227227**/
    228228EFI_STATUS
     
    237237  Indicate that user interface interaction has begun for the specified credential.
    238238
    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
    240240  AutoLogon returns FALSE, then the user interface will be constructed by the User
    241   Identity Manager. 
     241  Identity Manager.
    242242
    243243  @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
    247247  @retval EFI_SUCCESS            Credential provider successfully selected.
    248248  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
    249  
     249
    250250**/
    251251EFI_STATUS
     
    262262
    263263  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    264  
     264
    265265  @retval EFI_SUCCESS    Credential provider successfully deselected.
    266  
     266
    267267**/
    268268EFI_STATUS
     
    275275  Return the default logon behavior for this user credential.
    276276
    277   This function reports the default login behavior regarding this credential provider. 
     277  This function reports the default login behavior regarding this credential provider.
    278278
    279279  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    280280  @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
    283283  @retval EFI_SUCCESS            Default information successfully returned.
    284284  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
     
    295295  Return information attached to the credential provider.
    296296
    297   This function returns user information. 
     297  This function returns user information.
    298298
    299299  @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.
    301301  @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On
    302302                                exit, holds the user information. If the buffer is too small
     
    304304                                and InfoSize is updated to contain the number of bytes actually
    305305                                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
    309309  @retval EFI_SUCCESS           Information returned successfully.
    310310  @retval EFI_BUFFER_TOO_SMALL  The size specified by InfoSize is too small to hold all of the
    311311                                user information. The size required is returned in *InfoSize.
    312312  @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
    315315**/
    316316EFI_STATUS
     
    330330  information record handle, point UserInfo at a NULL. Each subsequent call will retrieve
    331331  another user information record handle until there are no more, at which point UserInfo
    332   will point to NULL. 
     332  will point to NULL.
    333333
    334334  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    336336                           to start enumeration. On exit, points to the next user information
    337337                           handle or NULL if there is no more user information.
    338  
     338
    339339  @retval EFI_SUCCESS            User information returned.
    340340  @retval EFI_NOT_FOUND          No more user information found.
    341341  @retval EFI_INVALID_PARAMETER  UserInfo is NULL.
    342  
     342
    343343**/
    344344EFI_STATUS
     
    352352  Delete a user on this credential provider.
    353353
    354   This function deletes a user on this credential provider. 
     354  This function deletes a user on this credential provider.
    355355
    356356  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    358358
    359359  @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.
    363363  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.
    364364  @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  
    11/** @file
    22  Data structure used by the Password Credential Provider driver.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2525//
    2626// Key defination
    27 // 
     27//
    2828#define KEY_GET_PASSWORD              0x1000
    2929
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderDxe.inf

    r58459 r58466  
    4545  UefiLib
    4646  BaseCryptLib
    47  
     47
    4848[Guids]
    4949  gEfiUserCredentialClassPasswordGuid           ## SOMETIMES_CONSUMES          ## GUID
    50  
     50
    5151  ## PRODUCES             ## Variable:L"PwdCredential"
    5252  ## CONSUMES             ## Variable:L"PwdCredential"
     
    5454  ## SOMETIMES_CONSUMES   ## GUID               #  The credential provider identifier
    5555  gPwdCredentialProviderGuid
    56  
     56
    5757[Protocols]
    5858  gEfiDevicePathProtocolGuid                    ## PRODUCES
     
    6060  gEfiUserCredential2ProtocolGuid               ## PRODUCES
    6161  gEfiUserManagerProtocolGuid                   ## SOMETIMES_CONSUMES
    62  
     62
    6363[UserExtensions.TianoCore."ExtraFiles"]
    6464  PwdCredentialProviderExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderStrings.uni

    • Property svn:mime-type changed from application/octet-stream to text/plain;encoding=UTF-16LE
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderVfr.Vfr

    • Property svn:eol-style set to native
    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1515#include "PwdCredentialProviderData.h"
    1616
    17 formset 
     17formset
    1818  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),
    2121  classguid = PWD_CREDENTIAL_PROVIDER_GUID,
    22  
    23   form formid = FORMID_GET_PASSWORD_FORM,           
     22
     23  form formid = FORMID_GET_PASSWORD_FORM,
    2424    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),
    2828      text   = STRING_TOKEN(STR_INPUT_PASSWORD),
    2929      flags  = INTERACTIVE,
     
    3131
    3232  endform;
    33  
     33
    3434endformset;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProvider.c

    r58459 r58466  
    11/** @file
    22  Usb Credential Provider driver implemenetation.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    7979               Count * sizeof (USB_INFO)
    8080               );
    81   ASSERT (NewTable != NULL); 
     81  ASSERT (NewTable != NULL);
    8282
    8383  NewTable->MaxCount = Count;
     
    8888  //
    8989  CopyMem (
    90     &NewTable->UserInfo, 
    91     &mUsbTable->UserInfo, 
     90    &NewTable->UserInfo,
     91    &mUsbTable->UserInfo,
    9292    mUsbTable->Count * sizeof (USB_INFO)
    9393    );
     
    101101
    102102  @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,
    105105                        delete the info by Index.
    106106
     
    118118  EFI_STATUS  Status;
    119119  USB_INFO    *NewUsbInfo;
    120  
     120
    121121  NewUsbInfo = NULL;
    122122  if (Index < mUsbTable->Count) {
     
    128128      if (Index != mUsbTable->Count) {
    129129        NewUsbInfo = &mUsbTable->UserInfo[mUsbTable->Count];
    130       } 
     130      }
    131131    } else {
    132132      //
     
    191191  Var     = NULL;
    192192  Status  = gRT->GetVariable (
    193                    L"UsbCredential", 
    194                    &gUsbCredentialProviderGuid, 
    195                    NULL, 
     193                   L"UsbCredential",
     194                   &gUsbCredentialProviderGuid,
     195                   NULL,
    196196                   &VarSize,
    197197                   Var
     
    203203    }
    204204    Status = gRT->GetVariable (
    205                     L"UsbCredential", 
    206                     &gUsbCredentialProviderGuid, 
    207                     NULL, 
     205                    L"UsbCredential",
     206                    &gUsbCredentialProviderGuid,
     207                    NULL,
    208208                    &VarSize,
    209209                    Var
     
    213213    return Status;
    214214  }
    215  
     215
    216216  //
    217217  // Init Usb credential table.
     
    219219  mUsbTable = AllocateZeroPool (
    220220                sizeof (CREDENTIAL_TABLE) - sizeof (USB_INFO) +
    221                 USB_TABLE_INC * sizeof (USB_INFO) + 
     221                USB_TABLE_INC * sizeof (USB_INFO) +
    222222                VarSize
    223223                );
     
    307307        continue;
    308308      }
    309    
     309
    310310      Status = SimpleFileSystem->OpenVolume (
    311311                                   SimpleFileSystem,
     
    315315        continue;
    316316      }
    317                                    
     317
    318318      Status = RootFs->Open (
    319319                         RootFs,
     
    325325      if (!EFI_ERROR (Status)) {
    326326        break;
    327       }     
     327      }
    328328    }
    329329  }
     
    336336    goto Done;
    337337  }
    338  
     338
    339339  //
    340340  // Figure out how big the file is.
     
    353353  }
    354354
    355   FileInfo = AllocateZeroPool (ScratchBufferSize);                                   
     355  FileInfo = AllocateZeroPool (ScratchBufferSize);
    356356  if (FileInfo == NULL) {
    357357    DEBUG ((DEBUG_ERROR, "Can not allocate enough memory for the token file!\n"));
     
    371371    goto Done;
    372372  }
    373  
     373
    374374  //
    375375  // Allocate a buffer for the file.
    376376  //
    377377  *BufferSize = (UINT32) FileInfo->FileSize;
    378   *Buffer     = AllocateZeroPool (*BufferSize); 
     378  *Buffer     = AllocateZeroPool (*BufferSize);
    379379  if (*Buffer == NULL) {
    380380    DEBUG ((DEBUG_ERROR, "Can not allocate a buffer for the file!\n"));
     
    382382    goto Done;
    383383  }
    384  
     384
    385385  //
    386386  // Load file into the allocated memory.
     
    393393    goto Done;
    394394  }
    395  
     395
    396396  //
    397397  // Close file.
     
    417417  Hash the data to get credential.
    418418
    419   @param[in]   Buffer         Points to the data buffer 
     419  @param[in]   Buffer         Points to the data buffer
    420420  @param[in]   BufferSize     The size of data in buffer, in bytes.
    421421  @param[out]  Credential     Points to the hashed result
     
    423423  @retval      TRUE           Hash the data successfully.
    424424  @retval      FALSE          Failed to hash the data.
    425                  
     425
    426426**/
    427427BOOLEAN
     
    435435  UINTN             HashSize;
    436436  VOID              *Hash;
    437  
     437
    438438  HashSize = Sha1GetContextSize ();
    439439  Hash     = AllocatePool (HashSize);
    440440  ASSERT (Hash != NULL);
    441  
     441
    442442  Status = Sha1Init (Hash);
    443443  if (!Status) {
    444444    goto Done;
    445445  }
    446  
     446
    447447  Status = Sha1Update (Hash, Buffer, BufferSize);
    448448  if (!Status) {
    449449    goto Done;
    450450  }
    451  
     451
    452452  Status = Sha1Final (Hash, Credential);
    453  
     453
    454454Done:
    455455  FreePool (Hash);
     
    465465  @retval EFI_SUCCESS           Read a Token successfully.
    466466  @retval Others                Fails to read a Token.
    467  
     467
    468468**/
    469469EFI_STATUS
     
    485485    return Status;
    486486  }
    487  
     487
    488488  if (!GenerateCredential (Buffer, BufSize, Token)) {
    489489    DEBUG ((DEBUG_ERROR, "Generate credential from read data failed!\n"));
     
    491491    return EFI_SECURITY_VIOLATION;
    492492  }
    493  
    494   FreePool (Buffer); 
     493
     494  FreePool (Buffer);
    495495  return EFI_SUCCESS;
    496496}
     
    500500  Find a user infomation record by the information record type.
    501501
    502   This function searches all user information records of User from beginning 
     502  This function searches all user information records of User from beginning
    503503  until either the information is found or there are no more user infomation
    504504  record. A match occurs when a Info.InfoType field matches the user information
    505505  record type.
    506506
    507   @param[in]     User      Points to the user profile record to search.                         
     507  @param[in]     User      Points to the user profile record to search.
    508508  @param[in]     InfoType  The infomation type to be searched.
    509509  @param[out]    Info      Points to the user info found, the caller is responsible
    510510                           to free.
    511  
     511
    512512  @retval EFI_SUCCESS      Find the user information successfully.
    513513  @retval Others           Fail to find the user information.
     
    526526  EFI_USER_INFO_HANDLE       UserInfoHandle;
    527527  EFI_USER_MANAGER_PROTOCOL  *UserManager;
    528  
     528
    529529  //
    530530  // Find user information by information type.
     
    589589      *Info = UserInfo;
    590590      return EFI_SUCCESS;
    591     }   
     591    }
    592592  }
    593593
     
    612612{
    613613  USB_PROVIDER_CALLBACK_INFO  *CallbackInfo;
    614    
     614
    615615  //
    616616  // Initialize driver private data.
     
    620620    return EFI_OUT_OF_RESOURCES;
    621621  }
    622  
     622
    623623  CallbackInfo->DriverHandle  = NULL;
    624624
     
    644644  Enroll a user on a credential provider.
    645645
    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;
    648648  otherwise add the user information on credential provider.
    649  
     649
    650650  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.
    651651  @param[in] User                The user profile to enroll.
    652  
     652
    653653  @retval EFI_SUCCESS            User profile was successfully enrolled.
    654654  @retval EFI_ACCESS_DENIED      Current user profile does not permit enrollment on the
    655655                                 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
    657657                                 other than the current user profile.
    658658  @retval EFI_UNSUPPORTED        This credential provider does not support enrollment in
     
    661661                                 error.
    662662  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.
    663  
     663
    664664**/
    665665EFI_STATUS
     
    682682    return EFI_INVALID_PARAMETER;
    683683  }
    684  
     684
    685685  //
    686686  // Get User Identifier
     
    696696  }
    697697
    698   CopyMem (UsbInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); 
     698  CopyMem (UsbInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER));
    699699  FreePool (UserInfo);
    700  
     700
    701701  //
    702702  // Get Token and User ID to UsbInfo.
     
    705705  if (EFI_ERROR (Status)) {
    706706    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));
    708708    CreatePopUp (
    709709      EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
     
    717717    FreePool (PromptStr);
    718718    return Status;
    719   } 
     719  }
    720720
    721721  //
    722722  // Check whether User is ever enrolled in the provider.
    723   // 
     723  //
    724724  for (Index = 0; Index < mUsbTable->Count; Index++) {
    725725    UserId = (UINT8 *) &mUsbTable->UserInfo[Index].UserId;
     
    727727      //
    728728      // User already exists, update the password.
    729       //     
     729      //
    730730      break;
    731731    }
    732732  }
    733  
     733
    734734  //
    735735  // Enroll the User to the provider.
     
    749749  This function returns information about the form used when interacting with the
    750750  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
    752752  the user credential provider does not require a form to identify the user, then this
    753753  function should return EFI_NOT_FOUND.
     
    757757  @param[out] FormSetId  On return, holds the identifier of the form set which contains
    758758                         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
    760760                         identification.
    761                          
     761
    762762  @retval EFI_SUCCESS            Form returned successfully.
    763763  @retval EFI_NOT_FOUND          Form not returned.
    764764  @retval EFI_INVALID_PARAMETER  Hii is NULL or FormSetId is NULL or FormId is NULL.
    765  
     765
    766766**/
    767767EFI_STATUS
     
    774774  )
    775775{
    776   if ((This == NULL) || (Hii == NULL) || 
     776  if ((This == NULL) || (Hii == NULL) ||
    777777      (FormSetId == NULL) || (FormId == NULL)) {
    778778    return EFI_INVALID_PARAMETER;
     
    787787  This optional function returns a bitmap which is less than or equal to the number
    788788  of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND
    789   is returned. 
     789  is returned.
    790790
    791791  @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
    794794                         width of the bitmap returned.
    795795  @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
    797797                         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
    801801  @retval EFI_SUCCESS            Image identifier returned successfully.
    802802  @retval EFI_NOT_FOUND          Image identifier not returned.
    803803  @retval EFI_INVALID_PARAMETER  Hii is NULL or Image is NULL.
    804  
     804
    805805**/
    806806EFI_STATUS
     
    825825
    826826  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.
    828828
    829829  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    830830  @param[out] Hii        On return, holds the HII database handle.
    831831  @param[out] String     On return, holds the HII string identifier.
    832  
     832
    833833  @retval EFI_SUCCESS            String identifier returned successfully.
    834834  @retval EFI_NOT_FOUND          String identifier not returned.
    835835  @retval EFI_INVALID_PARAMETER  Hii is NULL or String is NULL.
    836  
     836
    837837**/
    838838EFI_STATUS
     
    861861
    862862  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
    864864  submitted on a form OR after a call to Default() has returned that this credential is
    865865  ready to log on.
    866866
    867867  @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
    869869                             considered by the user identity manager. If NULL, then no user
    870870                             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
    873873  @retval EFI_SUCCESS            User identifier returned successfully.
    874874  @retval EFI_NOT_READY          No user identifier can be returned.
     
    877877  @retval EFI_NOT_FOUND          User is not NULL, and the specified user handle can't be
    878878                                 found in user profile database.
    879  
     879
    880880**/
    881881EFI_STATUS
     
    892892  UINT8         *UserId;
    893893  UINT8         *NewUserId;
    894   UINT8         *UserToken; 
     894  UINT8         *UserToken;
    895895  UINT8         ReadToken[HASHED_CREDENTIAL_LEN];
    896896  EFI_INPUT_KEY Key;
    897897  CHAR16        *QuestionStr;
    898898  CHAR16        *PromptStr;
    899  
     899
    900900  if ((This == NULL) || (Identifier == NULL)) {
    901901    return EFI_INVALID_PARAMETER;
    902902  }
    903  
     903
    904904  if (User == NULL) {
    905905    //
     
    909909      return EFI_NOT_READY;
    910910    }
    911    
     911
    912912    //
    913913    // No user selected, get token first and verify the user existed in user database.
     
    917917      return EFI_NOT_READY;
    918918    }
    919    
     919
    920920    for (Index = 0; Index < mUsbTable->Count; Index++) {
    921921      //
     
    930930    }
    931931
    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
    938938  // with read token.
    939   // 
    940  
     939  //
     940
    941941  Status = GetToken (ReadToken);
    942942  if (EFI_ERROR (Status)) {
     
    962962  if (EFI_ERROR (Status)) {
    963963    return EFI_NOT_FOUND;
    964   } 
    965  
     964  }
     965
    966966  //
    967967  // Check the selected user's Token with the read token.
     
    982982        FreePool (UserInfo);
    983983        return EFI_SUCCESS;
    984       } 
    985     }
    986   }
    987 
    988   FreePool (UserInfo); 
    989    
     984      }
     985    }
     986  }
     987
     988  FreePool (UserInfo);
     989
    990990  return EFI_NOT_READY;
    991991}
     
    995995  Indicate that user interface interaction has begun for the specified credential.
    996996
    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
    998998  AutoLogon returns FALSE, then the user interface will be constructed by the User
    999   Identity Manager. 
     999  Identity Manager.
    10001000
    10011001  @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
    10051005  @retval EFI_SUCCESS            Credential provider successfully selected.
    10061006  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
    1007  
     1007
    10081008**/
    10091009EFI_STATUS
     
    10301030
    10311031  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    1032  
     1032
    10331033  @retval EFI_SUCCESS    Credential provider successfully deselected.
    1034  
     1034
    10351035**/
    10361036EFI_STATUS
     
    10501050  Return the default logon behavior for this user credential.
    10511051
    1052   This function reports the default login behavior regarding this credential provider. 
     1052  This function reports the default login behavior regarding this credential provider.
    10531053
    10541054  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    10551055  @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
    10581058  @retval EFI_SUCCESS            Default information successfully returned.
    10591059  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
    1060  
     1060
    10611061**/
    10621062EFI_STATUS
     
    10791079  Return information attached to the credential provider.
    10801080
    1081   This function returns user information. 
     1081  This function returns user information.
    10821082
    10831083  @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.
    10851085  @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On
    10861086                                exit, holds the user information. If the buffer is too small
     
    10881088                                and InfoSize is updated to contain the number of bytes actually
    10891089                                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
    10931093  @retval EFI_SUCCESS           Information returned successfully.
    10941094  @retval EFI_BUFFER_TOO_SMALL  The size specified by InfoSize is too small to hold all of the
    10951095                                user information. The size required is returned in *InfoSize.
    10961096  @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
    10991099**/
    11001100EFI_STATUS
     
    11091109  EFI_USER_INFO            *CredentialInfo;
    11101110  UINTN                    Index;
    1111  
     1111
    11121112  if ((This == NULL) || (InfoSize == NULL) || (Info == NULL)) {
    11131113    return EFI_INVALID_PARAMETER;
     
    11171117    return EFI_NOT_FOUND;
    11181118  }
    1119  
     1119
    11201120  //
    11211121  // Find information handle in credential info table.
     
    11311131        return EFI_BUFFER_TOO_SMALL;
    11321132      }
    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
    11391139  return EFI_NOT_FOUND;
    11401140}
     
    11471147  information record handle, point UserInfo at a NULL. Each subsequent call will retrieve
    11481148  another user information record handle until there are no more, at which point UserInfo
    1149   will point to NULL. 
     1149  will point to NULL.
    11501150
    11511151  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    11531153                           to start enumeration. On exit, points to the next user information
    11541154                           handle or NULL if there is no more user information.
    1155  
     1155
    11561156  @retval EFI_SUCCESS            User information returned.
    11571157  @retval EFI_NOT_FOUND          No more user information found.
    11581158  @retval EFI_INVALID_PARAMETER  UserInfo is NULL.
    1159  
     1159
    11601160**/
    11611161EFI_STATUS
     
    11711171  UINTN                    Index;
    11721172  UINTN                    ProvStrLen;
    1173    
     1173
    11741174  if ((This == NULL) || (UserInfo == NULL)) {
    11751175    return EFI_INVALID_PARAMETER;
     
    11931193    Info    = AllocateZeroPool (InfoLen);
    11941194    ASSERT (Info != NULL);
    1195    
     1195
    11961196    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_PROVIDER_RECORD;
    11971197    Info->InfoSize    = (UINT32) InfoLen;
     
    11991199    CopyGuid (&Info->Credential, &gUsbCredentialProviderGuid);
    12001200    CopyGuid ((EFI_GUID *)(Info + 1), &gUsbCredentialProviderGuid);
    1201    
     1201
    12021202    mUsbInfoHandle->Info[0] = Info;
    12031203    mUsbInfoHandle->Count++;
     
    12111211    Info        = AllocateZeroPool (InfoLen);
    12121212    ASSERT (Info != NULL);
    1213    
     1213
    12141214    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD;
    12151215    Info->InfoSize    = (UINT32) InfoLen;
     
    12181218    CopyMem ((UINT8*)(Info + 1), ProvNameStr, ProvStrLen);
    12191219    FreePool (ProvNameStr);
    1220    
     1220
    12211221    mUsbInfoHandle->Info[1] = Info;
    12221222    mUsbInfoHandle->Count++;
     
    12281228    Info    = AllocateZeroPool (InfoLen);
    12291229    ASSERT (Info != NULL);
    1230      
     1230
    12311231    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_TYPE_RECORD;
    12321232    Info->InfoSize    = (UINT32) InfoLen;
     
    12341234    CopyGuid (&Info->Credential, &gUsbCredentialProviderGuid);
    12351235    CopyGuid ((EFI_GUID *)(Info + 1), &gEfiUserCredentialClassSecureCardGuid);
    1236    
     1236
    12371237    mUsbInfoHandle->Info[2] = Info;
    12381238    mUsbInfoHandle->Count++;
    1239  
     1239
    12401240    //
    12411241    // The fourth information, Credential Provider type name info.
     
    12461246    Info        = AllocateZeroPool (InfoLen);
    12471247    ASSERT (Info != NULL);
    1248    
     1248
    12491249    Info->InfoType    = EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD;
    12501250    Info->InfoSize    = (UINT32) InfoLen;
     
    12531253    CopyMem ((UINT8*)(Info + 1), ProvNameStr, ProvStrLen);
    12541254    FreePool (ProvNameStr);
    1255    
     1255
    12561256    mUsbInfoHandle->Info[3] = Info;
    12571257    mUsbInfoHandle->Count++;
    12581258  }
    1259  
     1259
    12601260  if (*UserInfo == NULL) {
    12611261    //
     
    12651265    return EFI_SUCCESS;
    12661266  }
    1267  
     1267
    12681268  //
    12691269  // Find information handle in credential info table.
     
    12841284      Index++;
    12851285      *UserInfo = (EFI_USER_INFO_HANDLE)mUsbInfoHandle->Info[Index];
    1286       return EFI_SUCCESS; 
     1286      return EFI_SUCCESS;
    12871287    }
    12881288  }
     
    12961296  Delete a user on this credential provider.
    12971297
    1298   This function deletes a user on this credential provider. 
     1298  This function deletes a user on this credential provider.
    12991299
    13001300  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    13021302
    13031303  @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.
    13071307  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.
    13081308  @retval EFI_DEVICE_ERROR       The new credential could not be deleted because of a device error.
     
    13211321  UINT8                     *NewUserId;
    13221322  UINTN                     Index;
    1323  
     1323
    13241324  if ((This == NULL) || (User == NULL)) {
    13251325    return EFI_INVALID_PARAMETER;
     
    13411341  //
    13421342  // Find the user by user identifier in mPwdTable.
    1343   // 
     1343  //
    13441344  for (Index = 0; Index < mUsbTable->Count; Index++) {
    13451345    UserId    = (UINT8 *) &mUsbTable->UserInfo[Index].UserId;
     
    13891389    return Status;
    13901390  }
    1391  
     1391
    13921392  //
    13931393  // Init Form Browser
     
    13971397    return Status;
    13981398  }
    1399  
     1399
    14001400  //
    14011401  // Install protocol interfaces for the Usb Credential Provider.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProvider.h

    r48674 r58466  
    11/** @file
    22  Usb Credential Provider driver header file.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    8181  Enroll a user on a credential provider.
    8282
    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
    8787  provider.
    8888
    8989  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.
    9090  @param[in] User                The user profile to enroll.
    91  
     91
    9292  @retval EFI_SUCCESS            User profile was successfully enrolled.
    9393  @retval EFI_ACCESS_DENIED      Current user profile does not permit enrollment on the
    9494                                 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
    9696                                 other than the current user profile.
    9797  @retval EFI_UNSUPPORTED        This credential provider does not support enrollment in
     
    100100                                 error.
    101101  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.
    102  
     102
    103103**/
    104104EFI_STATUS
     
    112112  Returns the user interface information used during user identification.
    113113
    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;
    116116  otherwise delete the user information on credential provider.
    117117
     
    120120  @param[out] FormSetId  On return, holds the identifier of the form set which contains
    121121                         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
    123123                         identification.
    124                          
     124
    125125  @retval EFI_SUCCESS            Form returned successfully.
    126126  @retval EFI_NOT_FOUND          Form not returned.
    127127  @retval EFI_INVALID_PARAMETER  Hii is NULL or FormSetId is NULL or FormId is NULL.
    128  
     128
    129129**/
    130130EFI_STATUS
     
    142142  This optional function returns a bitmap which is less than or equal to the number
    143143  of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND
    144   is returned. 
     144  is returned.
    145145
    146146  @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
    149149                         width of the bitmap returned.
    150150  @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
    152152                         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
    156156  @retval EFI_SUCCESS            Image identifier returned successfully.
    157157  @retval EFI_NOT_FOUND          Image identifier not returned.
    158158  @retval EFI_INVALID_PARAMETER  Hii is NULL or Image is NULL.
    159  
     159
    160160**/
    161161EFI_STATUS
     
    173173
    174174  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.
    176176
    177177  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    178178  @param[out] Hii        On return, holds the HII database handle.
    179179  @param[out] String     On return, holds the HII string identifier.
    180  
     180
    181181  @retval EFI_SUCCESS            String identifier returned successfully.
    182182  @retval EFI_NOT_FOUND          String identifier not returned.
    183183  @retval EFI_INVALID_PARAMETER  Hii is NULL or String is NULL.
    184  
     184
    185185**/
    186186EFI_STATUS
     
    196196
    197197  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
    199199  submitted on a form OR after a call to Default() has returned that this credential is
    200200  ready to log on.
    201201
    202202  @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
    204204                             considered by the user identity manager. If NULL, then no user
    205205                             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
    208208  @retval EFI_SUCCESS        User identifier returned successfully.
    209209  @retval EFI_NOT_READY      No user identifier can be returned.
     
    212212  @retval EFI_NOT_FOUND          User is not NULL, and the specified user handle can't be
    213213                                 found in user profile database.
    214  
     214
    215215**/
    216216EFI_STATUS
     
    225225  Indicate that user interface interaction has begun for the specified credential.
    226226
    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
    228228  AutoLogon returns FALSE, then the user interface will be constructed by the User
    229   Identity Manager. 
     229  Identity Manager.
    230230
    231231  @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
    235235  @retval EFI_SUCCESS            Credential provider successfully selected.
    236236  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
    237  
     237
    238238**/
    239239EFI_STATUS
     
    250250
    251251  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    252  
     252
    253253  @retval EFI_SUCCESS    Credential provider successfully deselected.
    254  
     254
    255255**/
    256256EFI_STATUS
     
    263263  Return the default logon behavior for this user credential.
    264264
    265   This function reports the default login behavior regarding this credential provider. 
     265  This function reports the default login behavior regarding this credential provider.
    266266
    267267  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
    268268  @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
    271271  @retval EFI_SUCCESS            Default information successfully returned.
    272272  @retval EFI_INVALID_PARAMETER  AutoLogon is NULL.
     
    283283  Return information attached to the credential provider.
    284284
    285   This function returns user information. 
     285  This function returns user information.
    286286
    287287  @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.
    289289  @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On
    290290                                exit, holds the user information. If the buffer is too small
     
    292292                                and InfoSize is updated to contain the number of bytes actually
    293293                                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
    297297  @retval EFI_SUCCESS           Information returned successfully.
    298298  @retval EFI_BUFFER_TOO_SMALL  The size specified by InfoSize is too small to hold all of the
    299299                                user information. The size required is returned in *InfoSize.
    300300  @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
    303303**/
    304304EFI_STATUS
     
    317317  information record handle, point UserInfo at a NULL. Each subsequent call will retrieve
    318318  another user information record handle until there are no more, at which point UserInfo
    319   will point to NULL. 
     319  will point to NULL.
    320320
    321321  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    323323                           to start enumeration. On exit, points to the next user information
    324324                           handle or NULL if there is no more user information.
    325  
     325
    326326  @retval EFI_SUCCESS            User information returned.
    327327  @retval EFI_NOT_FOUND          No more user information found.
    328328  @retval EFI_INVALID_PARAMETER  UserInfo is NULL.
    329  
     329
    330330**/
    331331EFI_STATUS
     
    339339  Delete a user on this credential provider.
    340340
    341   This function deletes a user on this credential provider. 
     341  This function deletes a user on this credential provider.
    342342
    343343  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.
     
    345345
    346346  @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.
    350350  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.
    351351  @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  
    22#  Provides a USB credential provider implementation
    33#
    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
    55#  folder of a USB stick. The token file name can be specified by the PCD
    66#  PcdFixedUsbCredentialProviderTokenFileName.
     
    4646  UefiLib
    4747  BaseCryptLib
    48  
     48
    4949[Guids]
    5050  ## PRODUCES             ## Variable:L"UsbCredential"
     
    5353  ## SOMETIMES_CONSUMES   ## GUID               # The credential provider identifier
    5454  gUsbCredentialProviderGuid
    55  
     55
    5656  gEfiFileInfoGuid                              ## SOMETIMES_CONSUMES         ## GUID
    5757  gEfiUserCredentialClassSecureCardGuid         ## SOMETIMES_CONSUMES         ## GUID
    5858
    5959[Pcd]
    60   gEfiSecurityPkgTokenSpaceGuid.PcdFixedUsbCredentialProviderTokenFileName    ## SOMETIMES_CONSUMES 
     60  gEfiSecurityPkgTokenSpaceGuid.PcdFixedUsbCredentialProviderTokenFileName    ## SOMETIMES_CONSUMES
    6161
    6262[Protocols]
     
    6565  gEfiBlockIoProtocolGuid                       ## SOMETIMES_CONSUMES
    6666  gEfiSimpleFileSystemProtocolGuid              ## SOMETIMES_CONSUMES
    67  
     67
    6868[UserExtensions.TianoCore."ExtraFiles"]
    6969  UsbCredentialProviderExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProviderStrings.uni

    • Property svn:mime-type changed from application/octet-stream to text/plain;encoding=UTF-16LE
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/LoadDeferredImage.c

    r48674 r58466  
    11/** @file
    22  Load the deferred images after user is identified.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    4040  EFI_DEVICE_PATH_PROTOCOL           *ImageDevicePath;
    4141  VOID                               *DriverImage;
    42   UINTN                              ImageSize; 
     42  UINTN                              ImageSize;
    4343  BOOLEAN                            BootOption;
    4444  EFI_HANDLE                         ImageHandle;
     
    7878      //
    7979      Status = DeferredImage->GetImageInfo(
    80                                 DeferredImage, 
    81                                 DriverIndex, 
    82                                 &ImageDevicePath, 
     80                                DeferredImage,
     81                                DriverIndex,
     82                                &ImageDevicePath,
    8383                                (VOID **) &DriverImage,
    84                                 &ImageSize, 
     84                                &ImageSize,
    8585                                &BootOption
    8686                                );
    8787      if (EFI_ERROR (Status)) {
    8888        break;
    89       } 
     89      }
    9090
    9191      //
     
    107107        gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
    108108        Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData);
    109    
     109
    110110        //
    111111        // Clear the Watchdog Timer after the image returns.
     
    116116    } while (TRUE);
    117117  }
    118   FreePool (HandleBuf); 
     118  FreePool (HandleBuf);
    119119}
    120120
     
    135135
    136136  mDeferredImageHandle = ImageHandle;
    137  
     137
    138138  Status = gBS->CreateEventEx (
    139139                  EVT_NOTIFY_SIGNAL,
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.c

    r58459 r58466  
    11/** @file
    22  This driver manages user information and produces user manager protocol.
    3  
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    8181  Find the specified user in the user database.
    8282
    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.
    8787                               On return, points to the user profile entry or NULL if not found.
    8888  @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
    9292                               user specifyed by User.
    9393
    9494  @retval EFI_NOT_FOUND        User was NULL, or User was not found, or the next user was not found.
    9595  @retval EFI_SUCCESS          User or the next user are found in user profile database
    96  
     96
    9797**/
    9898EFI_STATUS
     
    111111    return EFI_NOT_FOUND;
    112112  }
    113  
     113
    114114  //
    115115  // Check whether the user profile is in the user profile database.
     
    152152  Find the specified user information record in the specified User profile.
    153153
    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.
    158158  @param[in, out] Info     On entry, points to the user information record or NULL to start
    159159                           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.
    161161  @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.
    164164  @param[out]     Offset   A pointer to the offset of the information record in the user profile.
    165165
     
    167167  @retval EFI_NOT_FOUND         Info was not found, or the next Info was not found.
    168168  @retval EFI_SUCCESS           Info or the next info are found in user profile.
    169  
     169
    170170**/
    171171EFI_STATUS
     
    184184    return EFI_INVALID_PARAMETER;
    185185  }
    186  
     186
    187187  //
    188188  // Check user profile entry
     
    207207    InfoLen += ALIGN_VARIABLE (UserInfo->InfoSize);
    208208  }
    209  
     209
    210210  //
    211211  // Check whether to find the next user information.
     
    245245  Find a user infomation record by the information record type.
    246246
    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
    249249  or there are no more user infomation record.
    250250  A match occurs when a Info.InfoType field matches the user information record type.
    251251
    252   @param[in]      User     Points to the user profile record to search.                         
     252  @param[in]      User     Points to the user profile record to search.
    253253  @param[in, out] Info     On entry, points to the user information record or NULL to start
    254254                           searching with the first user information record.
     
    257257
    258258  @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.
    260260  @retval EFI_INVALID_PARAMETER User is NULL or Info is NULL.
    261  
     261
    262262**/
    263263EFI_STATUS
     
    275275    return EFI_INVALID_PARAMETER;
    276276  }
    277  
     277
    278278  //
    279279  // Check whether the user has the specified user information.
     
    289289    return EFI_NOT_FOUND;
    290290  }
    291  
     291
    292292  while (InfoLen < User->UserProfileSize) {
    293293    UserInfo = (EFI_USER_INFO *) (User->ProfileInfo + InfoLen);
     
    309309  Find a user using a user information record.
    310310
    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
    313313  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
    315315  user information record data matches the portion of Info passed the EFI_USER_INFO header.
    316316
    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.
    319319                           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.
    322322                           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
    324324                           to the user information record.
    325325  @param[in]      InfoSize The size of Info, in bytes. Same as Info->InfoSize.
    326326
    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,
    328328                                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.
    330330  @retval EFI_INVALID_PARAMETER User is NULL; Info is NULL; or, InfoSize is too small.
    331  
     331
    332332**/
    333333EFI_STATUS
     
    362362    *User = mUserProfileDb->UserProfile[0];
    363363  }
    364  
     364
    365365  //
    366366  // Check user profile handle.
     
    377377        break;
    378378      }
    379      
     379
    380380      if (InfoSize == Info->InfoSize) {
    381381        if (CompareMem ((UINT8 *) (InfoEntry + 1), (UINT8 *) (Info + 1), InfoSize - sizeof (EFI_USER_INFO)) == 0) {
     
    388388          return EFI_SUCCESS;
    389389        }
    390       }     
    391     }
    392    
     390      }
     391    }
     392
    393393    //
    394394    // Get next user profile.
     
    410410  @retval TRUE     The policy is a valid access policy.
    411411  @retval FALSE    The access policy is not a valid access policy.
    412  
     412
    413413**/
    414414BOOLEAN
     
    430430    // Check access policy according to type.
    431431    //
    432     CopyMem (&Access, PolicyInfo + TotalLen, sizeof (Access));   
     432    CopyMem (&Access, PolicyInfo + TotalLen, sizeof (Access));
    433433    ValueLen = Access.Size - sizeof (EFI_USER_INFO_ACCESS_CONTROL);
    434434    switch (Access.Type) {
     
    492492  @retval TRUE     The policy is a valid identity policy.
    493493  @retval FALSE    The access policy is not a valid identity policy.
    494  
     494
    495495**/
    496496BOOLEAN
     
    602602  @retval TRUE     The info is a valid user information record.
    603603  @retval FALSE    The info is not a valid user information record.
    604  
     604
    605605**/
    606606BOOLEAN
     
    697697  @retval TRUE     It is a valid user profile.
    698698  @retval FALSE    It is not a valid user profile.
    699  
     699
    700700**/
    701701BOOLEAN
     
    711711    return FALSE;
    712712  }
    713  
     713
    714714  //
    715715  // Check user profile information length.
     
    742742                             EFI_USER_INFO_ACCESS_ENROLL_OTHERS or
    743743                             EFI_USER_INFO_ACCESS_ENROLL_SELF.
    744  
     744
    745745  @retval TRUE     Find the specified RightType in current user profile.
    746746  @retval FALSE    Can't find the right in the profile.
    747  
     747
    748748**/
    749749BOOLEAN
     
    882882  @retval TRUE     Success to expand user profile database.
    883883  @retval FALSE    Fail to expand user profile database.
    884  
     884
    885885**/
    886886BOOLEAN
     
    935935
    936936  @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.
    938938
    939939  @retval TRUE     Success to expand user profile size.
    940940  @retval FALSE    Fail to expand user profile size.
    941  
     941
    942942**/
    943943BOOLEAN
     
    959959    return FALSE;
    960960  }
    961  
     961
    962962  //
    963963  // Copy exist information.
     
    981981  @retval EFI_SUCCESS      Save or delete user profile successfully.
    982982  @retval Others           Fail to change the profile.
    983  
     983
    984984**/
    985985EFI_STATUS
     
    998998    return Status;
    999999  }
    1000  
     1000
    10011001  //
    10021002  // Save the user profile to non-volatile memory.
     
    10401040    return EFI_INVALID_PARAMETER;
    10411041  }
    1042  
     1042
    10431043  //
    10441044  // Check user profile handle.
     
    10481048    return Status;
    10491049  }
    1050  
     1050
    10511051  //
    10521052  // Check user information memory size.
     
    10571057    }
    10581058  }
    1059  
     1059
    10601060  //
    10611061  // Add new user information.
     
    10831083  @param[in]      User            Point to the user profile.
    10841084  @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.
    10861086                                  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.
    10881088                                  On return, points to the size of the user information.
    10891089  @param[in]      ChkRight        If TRUE, check the user info attribute.
     
    10931093  @retval EFI_ACCESS_DENIED       The information cannot be accessed by the current user.
    10941094  @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
    10961096                                  returned data. The actual size required is returned in *InfoSize.
    10971097  @retval EFI_SUCCESS             Information returned successfully.
     
    11161116    return EFI_INVALID_PARAMETER;
    11171117  }
    1118  
     1118
    11191119  //
    11201120  // Find the user information to get.
     
    11241124    return Status;
    11251125  }
    1126  
     1126
    11271127  //
    11281128  // Check information attributes.
     
    11451145    }
    11461146  }
    1147  
     1147
    11481148  //
    11491149  // Get user information.
     
    11971197    return EFI_ACCESS_DENIED;
    11981198  }
    1199  
     1199
    12001200  //
    12011201  // Delete the specified user information.
     
    12201220  @param[in]      User           Point to the user profile.
    12211221  @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.
    12231223                                 On return, points to the modified user information.
    12241224  @param[in]      Info           Points to the new user information.
     
    12491249    return EFI_INVALID_PARAMETER;
    12501250  }
    1251  
     1251
    12521252  //
    12531253  // Check user information.
     
    12561256    return EFI_ACCESS_DENIED;
    12571257  }
    1258  
     1258
    12591259  if (!CheckUserInfo (Info)) {
    12601260    return EFI_INVALID_PARAMETER;
     
    12741274      ASSERT (OldInfo != NULL);
    12751275
    1276       if (((OldInfo->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) || 
     1276      if (((OldInfo->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) ||
    12771277           ((Info->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0)) {
    12781278        //
     
    12921292        continue;
    12931293      }
    1294  
     1294
    12951295      PayloadLen = Info->InfoSize - sizeof (EFI_USER_INFO);
    12961296      if (PayloadLen == 0) {
     
    13111311    return Status;
    13121312  }
    1313  
     1313
    13141314  //
    13151315  // Modify existing user information.
     
    13191319    return EFI_INVALID_PARAMETER;
    13201320  }
    1321  
    1322   if (((Info->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) && 
     1321
     1322  if (((Info->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) != 0) &&
    13231323       (OldInfo->InfoAttribs & EFI_USER_INFO_EXCLUSIVE) == 0) {
    13241324    //
    1325     // Try to add exclusive attrib in new info. 
     1325    // Try to add exclusive attrib in new info.
    13261326    // Check whether there is another information with the same type in profile.
    13271327    //
     
    13391339        return EFI_ACCESS_DENIED;
    13401340      }
    1341     } while (TRUE);   
     1341    } while (TRUE);
    13421342  }
    13431343
     
    13581358  @retval EFI_SUCCESS      Delete user from the user profile successfully.
    13591359  @retval Others           Fail to delete user from user profile
    1360  
     1360
    13611361**/
    13621362EFI_STATUS
     
    13751375    return EFI_INVALID_PARAMETER;
    13761376  }
    1377  
     1377
    13781378  //
    13791379  // Check whether it is the current user.
     
    13821382    return EFI_ACCESS_DENIED;
    13831383  }
    1384  
     1384
    13851385  //
    13861386  // Delete user profile from the non-volatile memory.
     
    14491449    return EFI_SECURITY_VIOLATION;
    14501450  }
    1451  
     1451
    14521452  //
    14531453  // Create user profile entry.
     
    14681468
    14691469  UnicodeSPrint (
    1470     User->UserVarName, 
     1470    User->UserVarName,
    14711471    sizeof (User->UserVarName),
    1472     L"User%04x", 
     1472    L"User%04x",
    14731473    mUserProfileDb->UserProfileNum
    14741474    );
     
    15321532  UserInfo->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | EFI_USER_INFO_PUBLIC | EFI_USER_INFO_EXCLUSIVE;
    15331533  GenerateUserId ((UINT8 *) (UserInfo + 1));
    1534  
     1534
    15351535  //
    15361536  // Add user profile to the user profile database.
     
    15471547  @retval EFI_SUCCESS             A default user profile is added successfully.
    15481548  @retval Others                  Fail to add a default user profile
    1549  
     1549
    15501550**/
    15511551EFI_STATUS
     
    15621562  EFI_USER_INFO_ACCESS_CONTROL  *Access;
    15631563  EFI_USER_INFO_IDENTITY_POLICY *Policy;
    1564  
     1564
    15651565  //
    15661566  // Create a user profile.
     
    15701570    return Status;
    15711571  }
    1572  
     1572
    15731573  //
    15741574  // Allocate a buffer to add all default user information.
     
    15911591    goto Done;
    15921592  }
    1593  
     1593
    15941594  //
    15951595  // Add user profile create date record.
     
    16091609    goto Done;
    16101610  }
    1611  
     1611
    16121612  //
    16131613  // Add user profile usage count record.
     
    16231623    goto Done;
    16241624  }
    1625  
     1625
    16261626  //
    16271627  // Add user access right.
     
    16381638    goto Done;
    16391639  }
    1640  
     1640
    16411641  //
    16421642  // Add user identity policy.
     
    16461646  Policy            = (EFI_USER_INFO_IDENTITY_POLICY *) (Info + 1);
    16471647  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);
    16491649  Info->InfoSize    = sizeof (EFI_USER_INFO) + Policy->Length;
    16501650  NewInfo = NULL;
     
    16601660  Publish current user information into EFI System Configuration Table.
    16611661
    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
    16631663  into the EFI System Configuration Table. Currently, only the user identifier and user
    16641664  name are published.
     
    16851685  if (!EFI_ERROR (Status)) {
    16861686    //
    1687     // The table existed! 
     1687    // The table existed!
    16881688    //
    16891689    return EFI_SUCCESS;
     
    17071707    return Status;
    17081708  }
    1709  
     1709
    17101710  //
    17111711  // Allocate a buffer for user information table.
    17121712  //
    17131713  UserInfoTable = (EFI_USER_INFO_TABLE *) AllocateRuntimePool (
    1714                                             sizeof (EFI_USER_INFO_TABLE) + 
    1715                                             IdInfo->InfoSize + 
     1714                                            sizeof (EFI_USER_INFO_TABLE) +
     1715                                            IdInfo->InfoSize +
    17161716                                            NameInfo->InfoSize
    17171717                                            );
     
    17211721  }
    17221722
    1723   UserInfoTable->Size = sizeof (EFI_USER_INFO_TABLE); 
    1724  
     1723  UserInfoTable->Size = sizeof (EFI_USER_INFO_TABLE);
     1724
    17251725  //
    17261726  // Append the user information to the user info table
     
    17401740  Get the user's identity type.
    17411741
    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
    17431743  provider handles are connected by the operator 'AND' or 'OR'.
    17441744
     
    17711771  }
    17721772  ASSERT (IdentifyInfo != NULL);
    1773  
     1773
    17741774  //
    17751775  // Search the user identify policy according to type.
     
    18231823    return EFI_INVALID_PARAMETER;
    18241824  }
    1825  
     1825
    18261826  //
    18271827  // Check the user ID identified by the specified credential provider.
     
    18431843        //
    18441844        Status = UserCredential->Form (
    1845                                    UserCredential, 
    1846                                    &HiiHandle, 
    1847                                    &FormSetId, 
     1845                                   UserCredential,
     1846                                   &HiiHandle,
     1847                                   &FormSetId,
    18481848                                   &FormId
    18491849                                   );
    1850         if (!EFI_ERROR (Status)) {       
     1850        if (!EFI_ERROR (Status)) {
    18511851          //
    18521852          // Send form to get user input.
     
    18631863          if (EFI_ERROR (Status)) {
    18641864            return Status;
    1865           }                                           
    1866         }       
     1865          }
     1866        }
    18671867      }
    18681868
     
    18761876        return Status;
    18771877      }
    1878      
     1878
    18791879      return EFI_SUCCESS;
    18801880    }
     
    19141914    return EFI_OUT_OF_RESOURCES;
    19151915  }
    1916  
     1916
    19171917  //
    19181918  // Check create date record.
     
    19381938    }
    19391939  }
    1940  
     1940
    19411941  //
    19421942  // Update usage date record.
     
    19611961    }
    19621962  }
    1963  
     1963
    19641964  //
    19651965  // Update usage count record.
     
    20432043
    20442044  @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.
    20462046  @param[in]  OpCodeHandle     Points to container for dynamic created opcodes.
    20472047
     
    20662066    return Status;
    20672067  }
    2068  
     2068
    20692069  //
    20702070  // Add user name selection.
     
    20902090/**
    20912091  Identify the user whose identity policy does not contain the operator 'OR'.
    2092  
     2092
    20932093  @param[in]  User             Points to the user profile.
    20942094
    20952095  @retval EFI_SUCCESS          The specified user is identified successfully.
    20962096  @retval Others               Fail to identify the user.
    2097  
     2097
    20982098**/
    20992099EFI_STATUS
     
    21182118  }
    21192119  ASSERT (IdentifyInfo != NULL);
    2120  
     2120
    21212121  //
    21222122  // Check each part of identification policy expression.
     
    22132213/**
    22142214  Identify the user whose identity policy does not contain the operator 'AND'.
    2215  
     2215
    22162216  @param[in]  User             Points to the user profile.
    22172217
    22182218  @retval EFI_SUCCESS          The specified user is identified successfully.
    22192219  @retval Others               Fail to identify the user.
    2220  
     2220
    22212221**/
    22222222EFI_STATUS
     
    22442244  }
    22452245  ASSERT (IdentifyInfo != NULL);
    2246  
     2246
    22472247  //
    22482248  // Initialize the container for dynamic opcodes.
     
    23542354        return EFI_SUCCESS;
    23552355      }
    2356  
     2356
    23572357      //
    23582358      // Initialize the container for dynamic opcodes.
     
    23602360      StartOpCodeHandle = HiiAllocateOpCodeHandle ();
    23612361      ASSERT (StartOpCodeHandle != NULL);
    2362  
     2362
    23632363      EndOpCodeHandle = HiiAllocateOpCodeHandle ();
    23642364      ASSERT (EndOpCodeHandle != NULL);
    2365  
     2365
    23662366      //
    23672367      // Create Hii Extend Label OpCode.
     
    23752375      StartLabel->ExtendOpCode  = EFI_IFR_EXTEND_OP_LABEL;
    23762376      StartLabel->Number        = LABEL_USER_NAME;
    2377  
     2377
    23782378      EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
    23792379                                          EndOpCodeHandle,
     
    23842384      EndLabel->ExtendOpCode  = EFI_IFR_EXTEND_OP_LABEL;
    23852385      EndLabel->Number        = LABEL_END;
    2386  
     2386
    23872387      //
    23882388      // Add all the user profile in the user profile database.
     
    23922392        AddUserSelection ((UINT16)(LABEL_USER_NAME + Index), User, StartOpCodeHandle);
    23932393      }
    2394  
     2394
    23952395      HiiUpdateForm (
    23962396        mCallbackInfo->HiiHandle, // HII handle
     
    24002400        EndOpCodeHandle           // Replace data
    24012401        );
    2402  
     2402
    24032403      HiiFreeOpCodeHandle (StartOpCodeHandle);
    24042404      HiiFreeOpCodeHandle (EndOpCodeHandle);
    2405  
     2405
    24062406      return EFI_SUCCESS;
    24072407    }
     
    24152415    if (QuestionId >= LABEL_PROVIDER_NAME) {
    24162416      //
    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
    24182418      // policy is OR type). Identify the user by the selected provider.
    24192419      //
     
    24262426    }
    24272427    break;
    2428    
     2428
    24292429  case EFI_BROWSER_ACTION_CHANGING:
    24302430    //
     
    24832483/**
    24842484  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
    24862486  profile database.
    24872487
    24882488  @retval EFI_SUCCESS            Init user profile database successfully.
    24892489  @retval Others                 Fail to init user profile database.
    2490  
     2490
    24912491**/
    24922492EFI_STATUS
     
    25222522    return EFI_OUT_OF_RESOURCES;
    25232523  }
    2524  
     2524
    25252525  //
    25262526  // Get all user proifle entries.
     
    25322532    //
    25332533    UnicodeSPrint (
    2534       VarName, 
     2534      VarName,
    25352535      sizeof (VarName),
    2536       L"User%04x", 
     2536      L"User%04x",
    25372537      Index
    25382538      );
     
    25622562      break;
    25632563    }
    2564    
     2564
    25652565    //
    25662566    // Check variable attributes.
     
    25702570      continue;
    25712571    }
    2572    
     2572
    25732573    //
    25742574    // Add user profile to the user profile database.
     
    26022602    return Status;
    26032603  }
    2604  
     2604
    26052605  //
    26062606  // Check whether the user profile database is empty.
     
    26292629  UINTN       HandleCount;
    26302630  EFI_HANDLE  *HandleBuf;
    2631   UINTN       Index; 
     2631  UINTN       Index;
    26322632
    26332633  if (mProviderDb != NULL) {
     
    26582658  //
    26592659  mProviderDb = AllocateZeroPool (
    2660                   sizeof (CREDENTIAL_PROVIDER_INFO) - 
    2661                   sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) + 
     2660                  sizeof (CREDENTIAL_PROVIDER_INFO) -
     2661                  sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) +
    26622662                  HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *)
    26632663                  );
     
    28162816  CallbackInfo->FormBrowser2  = FormBrowser2;
    28172817  CallbackInfo->DriverHandle  = NULL;
    2818  
     2818
    28192819  //
    28202820  // Install Device Path Protocol and Config Access protocol to driver handle.
     
    28902890    return Status;
    28912891  }
    2892  
     2892
    28932893  //
    28942894  // Find user with the specified user ID.
     
    29092909    return EFI_NOT_READY;
    29102910  }
    2911  
     2911
    29122912  return Status;
    29132913}
     
    29182918
    29192919  @param[in]   ProtocolGuid   Points to the protocol guid of sonsole .
    2920  
     2920
    29212921  @retval TRUE     The given console is ready.
    29222922  @retval FALSE    The given console is not ready.
    2923  
     2923
    29242924**/
    29252925BOOLEAN
    29262926CheckConsole (
    2927   EFI_GUID                     *ProtocolGuid 
     2927  EFI_GUID                     *ProtocolGuid
    29282928  )
    29292929{
     
    29312931  UINTN                        HandleCount;
    29322932  EFI_HANDLE                   *HandleBuf;
    2933   UINTN                        Index; 
     2933  UINTN                        Index;
    29342934  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;
    2935  
     2935
    29362936  //
    29372937  // Try to find all the handle driver.
     
    29572957    }
    29582958  }
    2959   FreePool (HandleBuf); 
     2959  FreePool (HandleBuf);
    29602960  return FALSE;
    29612961}
     
    29672967  @retval TRUE     The console is ready.
    29682968  @retval FALSE    The console is not ready.
    2969  
     2969
    29702970**/
    29712971BOOLEAN
     
    29832983    }
    29842984  }
    2985  
     2985
    29862986  return TRUE;
    29872987}
     
    30393039    }
    30403040  }
    3041  
     3041
    30423042  //
    30433043  // Find and login the default & AutoLogon user.
     
    30603060    }
    30613061  }
    3062  
     3062
    30633063  if (!IsConsoleReady ()) {
    30643064    //
     
    30803080                                 NULL
    30813081                                 );
    3082  
     3082
    30833083  if (mIdentified) {
    30843084    *User = (USER_PROFILE_ENTRY *) mCurrentUser;
     
    30863086    return EFI_SUCCESS;
    30873087  }
    3088  
     3088
    30893089  return EFI_ACCESS_DENIED;
    30903090}
     
    30933093/**
    30943094  An empty function to pass error checking of CreateEventEx ().
    3095  
     3095
    30963096  @param  Event         Event whose notification function is being invoked.
    30973097  @param  Context       Pointer to the notification function's context,
     
    31383138  Create a new user profile.
    31393139
    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
    31413141  its handle. The user profile is non-volatile, but the handle User can change across reboots.
    31423142
    31433143  @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.
    31453145                                 The user profile handle is unique only during this boot.
    3146  
     3146
    31473147  @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
    31493149                                 user profile.
    31503150  @retval EFI_UNSUPPORTED        Creation of new user profiles is not supported.
    31513151  @retval EFI_INVALID_PARAMETER  The User parameter is NULL.
    3152  
     3152
    31533153**/
    31543154EFI_STATUS
     
    31733173    }
    31743174  }
    3175  
     3175
    31763176  //
    31773177  // Create new user profile
     
    31893189
    31903190  @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.
    31923192
    31933193  @retval EFI_SUCCESS            User profile was successfully deleted.
     
    31963196  @retval EFI_UNSUPPORTED        Deletion of new user profiles is not supported.
    31973197  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile.
    3198  
     3198
    31993199**/
    32003200EFI_STATUS
     
    32103210    return EFI_INVALID_PARAMETER;
    32113211  }
    3212  
     3212
    32133213  //
    32143214  // Check the right of the current user.
     
    32173217    return EFI_ACCESS_DENIED;
    32183218  }
    3219  
     3219
    32203220  //
    32213221  // Delete user profile.
     
    32363236  Enumerate all of the enrolled users on the platform.
    32373237
    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.
    32413241
    32423242  @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
    32443244                                 start enumeration. On exit, points to the next user profile handle
    32453245                                 or NULL if there are no more user profiles.
    32463246
    3247   @retval EFI_SUCCESS            Next enrolled user profile successfully returned. 
     3247  @retval EFI_SUCCESS            Next enrolled user profile successfully returned.
    32483248  @retval EFI_ACCESS_DENIED      Next enrolled user profile was not successfully returned.
    32493249  @retval EFI_INVALID_PARAMETER  The User parameter is NULL.
     
    32613261    return EFI_INVALID_PARAMETER;
    32623262  }
    3263  
     3263
    32643264  Status = FindUserProfile ((USER_PROFILE_ENTRY **) User, TRUE, NULL);
    32653265  if (EFI_ERROR (Status)) {
     
    32763276  @param[out] CurrentUser        On return, points to the current user profile handle.
    32773277
    3278   @retval EFI_SUCCESS            Current user profile handle returned successfully. 
     3278  @retval EFI_SUCCESS            Current user profile handle returned successfully.
    32793279  @retval EFI_INVALID_PARAMETER  The CurrentUser parameter is NULL.
    3280  
     3280
    32813281**/
    32823282EFI_STATUS
     
    32863286  OUT       EFI_USER_PROFILE_HANDLE             *CurrentUser
    32873287  )
    3288 { 
     3288{
    32893289  //
    32903290  // Get current user profile.
     
    33043304  Identify the user and, if authenticated, returns the user handle and changes the current
    33053305  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
    33083308  EFI_EVENT_GROUP_USER_PROFILE_CHANGED is signaled.
    33093309
     
    33153315  @retval EFI_ACCESS_DENIED      User was not successfully identified.
    33163316  @retval EFI_INVALID_PARAMETER  The User parameter is NULL.
    3317  
     3317
    33183318**/
    33193319EFI_STATUS
     
    33343334    return EFI_SUCCESS;
    33353335  }
    3336  
     3336
    33373337  //
    33383338  // Identify user
     
    33423342    return EFI_ACCESS_DENIED;
    33433343  }
    3344  
     3344
    33453345  //
    33463346  // Publish the user info into the EFI system configuration table.
     
    33593359
    33603360  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
    33623362  continues until either the information is found or there are no more user profiles.
    33633363  A match occurs when the Info.InfoType field matches the user information record
     
    33653365
    33663366  @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
    33683368                                 handle, or NULL to start searching with the first user profile.
    33693369                                 On return, points to the user profile handle, or NULL if not
    33703370                                 found.
    33713371  @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,
    33733373                                 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
    33803380                                 must be empty.
    33813381
    3382   @param[in]      InfoSize       The size of Info, in bytes. 
     3382  @param[in]      InfoSize       The size of Info, in bytes.
    33833383
    33843384  @retval EFI_SUCCESS            User information was found. User points to the user profile
    33853385                                 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
    33873387                                 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
    33903390**/
    33913391EFI_STATUS
     
    34183418    }
    34193419  }
    3420   Size = Info->InfoSize; 
    3421  
     3420  Size = Info->InfoSize;
     3421
    34223422  //
    34233423  // Find user profile accdoring to user information.
     
    34363436    return EFI_NOT_FOUND;
    34373437  }
    3438  
     3438
    34393439  return EFI_SUCCESS;
    34403440}
     
    34443444  Return information attached to the user.
    34453445
    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
    34503450  with a credential provider for which the user has not been authenticated.
    34513451
    34523452  @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.
    34613461
    34623462  @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
    34643464                                 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
    34663466                                 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
    34683468                                 to a valid user info handle.
    34693469  @retval EFI_INVALID_PARAMETER  Info is NULL or InfoSize is NULL.
    3470  
     3470
    34713471**/
    34723472EFI_STATUS
     
    34893489    return EFI_INVALID_PARAMETER;
    34903490  }
    3491  
     3491
    34923492  if ((User == NULL) || (UserInfo == NULL)) {
    34933493    return EFI_NOT_FOUND;
    34943494  }
    3495  
     3495
    34963496  Status = GetUserInfo (User, UserInfo, Info, InfoSize, TRUE);
    34973497  if (EFI_ERROR (Status)) {
     
    35083508  Add or update user information.
    35093509
    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
    35123512  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
    35143514  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
    35163516  type already exists in the user profile, then EFI_ACCESS_DENIED will be returned and UserInfo
    35173517  will point to the handle of the existing record.
    35183518
    35193519  @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.
    35283528
    35293529  @retval EFI_SUCCESS             Information returned successfully.
    35303530  @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
    35323532                                  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
    35343534                                  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.
    35363536**/
    35373537EFI_STATUS
     
    35503550    return EFI_INVALID_PARAMETER;
    35513551  }
    3552  
     3552
    35533553  //
    35543554  // Check the right of the current user.
     
    35623562        return EFI_SECURITY_VIOLATION;
    35633563      }
    3564      
     3564
    35653565      if (!CheckCurrentUserAccessRight (EFI_USER_INFO_ACCESS_ENROLL_OTHERS)) {
    35663566        //
     
    35823582    }
    35833583  }
    3584  
     3584
    35853585  //
    35863586  // Modify user information.
     
    35893589  if (EFI_ERROR (Status)) {
    35903590    if (Status == EFI_ACCESS_DENIED) {
    3591       return EFI_ACCESS_DENIED;     
     3591      return EFI_ACCESS_DENIED;
    35923592    }
    35933593    return EFI_SECURITY_VIOLATION;
     
    36003600  Called by credential provider to notify of information change.
    36013601
    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
    36033603  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
    36073607  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
    36093609  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
    36113611  current user, then logout current user and signal the EFI_EVENT_GROUP_USER_PROFILE_CHANGED event.
    36123612
    36133613  @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
    36153615                           where the user has changed.
    36163616
     
    36183618  @retval EFI_NOT_READY    The function was called while the specified credential provider was not selected.
    36193619  @retval EFI_UNSUPPORTED  The User Identity Manager doesn't support asynchronous notifications.
    3620  
     3620
    36213621**/
    36223622EFI_STATUS
     
    36263626  IN        EFI_HANDLE                          Changed
    36273627  )
    3628 {   
     3628{
    36293629  return EFI_UNSUPPORTED;
    36303630}
     
    36423642  @retval EFI_SUCCESS        User information deleted successfully.
    36433643  @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
    36463646**/
    36473647EFI_STATUS
     
    36583658    return EFI_INVALID_PARAMETER;
    36593659  }
    3660  
     3660
    36613661  //
    36623662  // Check the right of the current user.
     
    36673667    }
    36683668  }
    3669  
     3669
    36703670  //
    36713671  // Delete user information.
     
    36773677    }
    36783678    return EFI_ACCESS_DENIED;
    3679   } 
     3679  }
    36803680  return EFI_SUCCESS;
    36813681}
     
    36853685  Enumerate user information of all the enrolled users on the platform.
    36863686
    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.
    36913691
    36923692  @param[in]      This           Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
     
    36973697  @retval EFI_NOT_FOUND          No more user information found.
    36983698  @retval EFI_INVALID_PARAMETER  UserInfo is NULL.
    3699  
     3699
    37003700**/
    37013701EFI_STATUS
     
    37553755                  &gUserIdentifyManager
    37563756                  );
    3757   ASSERT_EFI_ERROR (Status); 
     3757  ASSERT_EFI_ERROR (Status);
    37583758
    37593759  LoadDeferredImageInit (ImageHandle);
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.h

    r48674 r58466  
    11/** @file
    22  The header file for User identify Manager driver.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    240240
    241241  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
    243243  continues until either the information is found or there are no more user profiles.
    244244  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
    246246  EFI_USER_INFO header.
    247247
    248248  @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
    250250                           handle, or NULL to start searching with the first user profile.
    251251                           On return, points to the user profile handle, or NULL if not
    252252                           found.
    253253  @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,
    255255                           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,
    261261                           then the user information record must be empty.
    262262
    263   @param[in]      InfoSize The size of Info, in bytes. 
     263  @param[in]      InfoSize The size of Info, in bytes.
    264264
    265265  @retval EFI_SUCCESS      User information was found. User points to the user profile handle,
    266266                           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
    268268                           points to NULL.
    269  
     269
    270270**/
    271271EFI_STATUS
     
    410410  IN OUT    EFI_USER_INFO_HANDLE                *UserInfo
    411411  );
    412  
     412
    413413#endif
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerData.h

    r48674 r58466  
    11/** @file
    22  Data structure used by the user identify manager driver.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerDxe.inf

    r58459 r58466  
    33#
    44#  This module manages user information and produces user manager protocol.
    5 # 
     5#
    66# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
    77# This program and the accompanying materials
     
    4949  gEfiIfrTianoGuid                              ## SOMETIMES_CONSUMES  ## GUID
    5050  gEfiEventUserProfileChangedGuid               ## SOMETIMES_PRODUCES  ## Event
    51  
     51
    5252  ## SOMETIMES_PRODUCES                         ## Variable:L"Userxxxx"
    5353  ## SOMETIMES_CONSUMES                         ## Variable:L"Userxxxx"
     
    6565  gEfiHiiConfigAccessProtocolGuid               ## PRODUCES
    6666  gEfiDevicePathProtocolGuid                    ## PRODUCES
    67  
     67
    6868  ## PRODUCES
    6969  ## SOMETIMES_PRODUCES                         ## SystemTable
    70   gEfiUserManagerProtocolGuid                   
     70  gEfiUserManagerProtocolGuid
    7171
    7272[Depex]
    73   gEfiHiiDatabaseProtocolGuid   AND 
    74   gEfiHiiStringProtocolGuid     AND 
    75   gEfiFormBrowser2ProtocolGuid 
     73  gEfiHiiDatabaseProtocolGuid   AND
     74  gEfiHiiStringProtocolGuid     AND
     75  gEfiFormBrowser2ProtocolGuid
    7676
    7777[UserExtensions.TianoCore."ExtraFiles"]
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerStrings.uni

    • Property svn:mime-type changed from application/octet-stream to text/plain;encoding=UTF-16LE
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerVfr.Vfr

    • Property svn:eol-style set to native
    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1515#include "UserIdentifyManagerData.h"
    1616
    17 formset 
     17formset
    1818  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),
    2121  classguid = USER_IDENTIFY_MANAGER_GUID,
    22  
     22
    2323  form formid = FORMID_USER_FORM,
    24     title = STRING_TOKEN(STR_USER_SELECT);     
     24    title = STRING_TOKEN(STR_USER_SELECT);
    2525
    2626    suppressif TRUE;
     
    3333
    3434    label LABEL_USER_NAME;
    35     label LABEL_END; 
     35    label LABEL_END;
    3636  endform;
    37  
     37
    3838  form formid = FORMID_PROVIDER_FORM,
    3939    title = STRING_TOKEN(STR_PROVIDER_SELECT);
    4040    label LABEL_PROVIDER_NAME;
    4141    label LABEL_END;
    42   endform; 
     42  endform;
    4343endformset;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c

    r58459 r58466  
    11/** @file
    22  The functions for access policy modification.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1616
    1717/**
    18   Collect all the access policy data to mUserInfo.AccessPolicy, 
     18  Collect all the access policy data to mUserInfo.AccessPolicy,
    1919  and save it to user profile.
    2020
     
    3939  mUserInfo.AccessPolicyModified  = TRUE;
    4040  OffSet                          = 0;
    41  
     41
    4242  //
    4343  // Save access right.
     
    5252  CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control));
    5353  OffSet += sizeof (Control);
    54  
     54
    5555  //
    5656  // Save access setup.
     
    6262
    6363  Control.Type = EFI_USER_INFO_ACCESS_SETUP;
    64   Control.Size = (UINT32) Size; 
     64  Control.Size = (UINT32) Size;
    6565  CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control));
    6666  OffSet += sizeof (Control);
    67  
     67
    6868  if (mAccessInfo.AccessSetup == ACCESS_SETUP_NORMAL) {
    6969    CopyGuid ((EFI_GUID *) (mUserInfo.AccessPolicy + OffSet), &gEfiUserInfoAccessSetupNormalGuid);
     
    7474  }
    7575  OffSet += sizeof (EFI_GUID);
    76  
     76
    7777  //
    7878  // Save access of boot order.
     
    8484
    8585  Control.Type = EFI_USER_INFO_ACCESS_BOOT_ORDER;
    86   Control.Size = (UINT32) Size; 
     86  Control.Size = (UINT32) Size;
    8787  CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control));
    8888  OffSet += sizeof (Control);
     
    9090  CopyMem ((UINT8 *) (mUserInfo.AccessPolicy + OffSet), &mAccessInfo.AccessBootOrder, sizeof (UINT32));
    9191  OffSet += sizeof (UINT32);
    92  
     92
    9393  //
    9494  // Save permit load.
     
    101101
    102102    Control.Type = EFI_USER_INFO_ACCESS_PERMIT_LOAD;
    103     Control.Size = (UINT32) Size; 
     103    Control.Size = (UINT32) Size;
    104104    CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control));
    105105    OffSet += sizeof (Control);
    106  
     106
    107107    CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.LoadPermit, mAccessInfo.LoadPermitLen);
    108108    OffSet += mAccessInfo.LoadPermitLen;
    109109  }
    110  
     110
    111111  //
    112112  // Save forbid load.
     
    119119
    120120    Control.Type = EFI_USER_INFO_ACCESS_FORBID_LOAD;
    121     Control.Size = (UINT32) Size; 
     121    Control.Size = (UINT32) Size;
    122122    CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control));
    123123    OffSet += sizeof (Control);
    124    
     124
    125125    CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.LoadForbid, mAccessInfo.LoadForbidLen);
    126126    OffSet += mAccessInfo.LoadForbidLen;
    127127  }
    128  
     128
    129129  //
    130130  // Save permit connect.
     
    137137
    138138    Control.Type = EFI_USER_INFO_ACCESS_PERMIT_CONNECT;
    139     Control.Size = (UINT32) Size; 
     139    Control.Size = (UINT32) Size;
    140140    CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control));
    141141    OffSet += sizeof (Control);
    142    
     142
    143143    CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.ConnectPermit, mAccessInfo.ConnectPermitLen);
    144144    OffSet += mAccessInfo.ConnectPermitLen;
    145145  }
    146  
     146
    147147  //
    148148  // Save forbid connect.
     
    155155
    156156    Control.Type = EFI_USER_INFO_ACCESS_FORBID_CONNECT;
    157     Control.Size = (UINT32) Size; 
     157    Control.Size = (UINT32) Size;
    158158    CopyMem (mUserInfo.AccessPolicy + OffSet, &Control, sizeof (Control));
    159159    OffSet += sizeof (Control);
    160    
     160
    161161    CopyMem (mUserInfo.AccessPolicy + OffSet, mAccessInfo.ConnectForbid, mAccessInfo.ConnectForbidLen);
    162162    OffSet += mAccessInfo.ConnectForbidLen;
     
    265265
    266266/**
    267   Check whether the DevicePath is in the device path forbid list 
     267  Check whether the DevicePath is in the device path forbid list
    268268  (mAccessInfo.LoadForbid).
    269269
    270270  @param[in]  DevicePath           Points to device path.
    271  
     271
    272272  @retval TRUE     The DevicePath is in the device path forbid list.
    273273  @retval FALSE    The DevicePath is not in the device path forbid list.
     
    331331  OrderSize = 0;
    332332  Status    = gRT->GetVariable (
    333                      L"DriverOrder", 
    334                      &gEfiGlobalVariableGuid, 
    335                      NULL, 
    336                      &OrderSize, 
     333                     L"DriverOrder",
     334                     &gEfiGlobalVariableGuid,
     335                     NULL,
     336                     &OrderSize,
    337337                     NULL
    338338                     );
     
    347347
    348348  Status = gRT->GetVariable (
    349                   L"DriverOrder", 
    350                   &gEfiGlobalVariableGuid, 
    351                   NULL, 
    352                   &OrderSize, 
     349                  L"DriverOrder",
     350                  &gEfiGlobalVariableGuid,
     351                  NULL,
     352                  &OrderSize,
    353353                  Order
    354354                  );
     
    356356    return ;
    357357  }
    358  
     358
    359359  //
    360360  // Initialize the container for dynamic opcodes.
     
    401401      continue;
    402402    }
    403    
     403
    404404    //
    405405    // Check whether the driver is already forbidden.
    406406    //
    407    
     407
    408408    VarPtr = Var;
    409409    //
     
    546546{
    547547  //
    548   // Note: 
     548  // Note:
    549549  // As no architect protocol/interface to be called in ConnectController()
    550550  // to verify the device path, just add a place holder for permitted connect
     
    564564{
    565565  //
    566   // Note: 
     566  // Note:
    567567  // As no architect protocol/interface to be called in ConnectController()
    568568  // to verify the device path, just add a place holder for forbidden connect
     
    573573
    574574/**
    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
    576576  list (mAccessInfo.LoadForbid).
    577577
    578578  @param[in]  DriverIndex   The index of driver in forbidden device path list.
    579  
     579
    580580**/
    581581VOID
     
    599599    DriverIndex--;
    600600  }
    601  
     601
    602602  //
    603603  // Specified device path found.
     
    609609    if (OffLen > 0) {
    610610      CopyMem (
    611         mAccessInfo.LoadForbid + OffSet, 
    612         mAccessInfo.LoadForbid + OffSet + DPSize, 
     611        mAccessInfo.LoadForbid + OffSet,
     612        mAccessInfo.LoadForbid + OffSet + DPSize,
    613613        OffLen
    614614        );
     
    620620
    621621/**
    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
    623623  list (mAccessInfo.LoadForbid).
    624624
    625625  @param[in]  DriverIndex   The index of driver saved in driver options.
    626  
     626
    627627**/
    628628VOID
     
    646646    return;
    647647  }
    648  
     648
    649649  //
    650650  // Save forbid load driver.
    651651  //
    652  
     652
    653653  VarPtr = Var;
    654654  //
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c

    r48674 r58466  
    11/** @file
    22  The functions for identification policy modification.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2121
    2222  @param[in] NewGuid       Points to the credential provider guid.
    23  
     23
    2424  @retval TRUE     The NewGuid was found in the identity policy.
    2525  @retval FALSE    The NewGuid was not found.
     
    5353    Offset += Identity->Length;
    5454  }
    55  
     55
    5656  return FALSE;
    5757}
     
    7171EnrollUserOnProvider (
    7272  IN  EFI_USER_INFO_IDENTITY_POLICY              *Identity,
    73   IN  EFI_USER_PROFILE_HANDLE                    User 
     73  IN  EFI_USER_PROFILE_HANDLE                    User
    7474  )
    7575{
    7676  UINTN                          Index;
    7777  EFI_USER_CREDENTIAL2_PROTOCOL  *UserCredential;
    78  
     78
    7979  //
    8080  // Find the specified credential provider.
     
    8787  }
    8888
    89   return EFI_NOT_FOUND; 
     89  return EFI_NOT_FOUND;
    9090}
    9191
     
    104104DeleteUserOnProvider (
    105105  IN  EFI_USER_INFO_IDENTITY_POLICY              *Identity,
    106   IN  EFI_USER_PROFILE_HANDLE                    User 
     106  IN  EFI_USER_PROFILE_HANDLE                    User
    107107  )
    108108{
    109109  UINTN                          Index;
    110110  EFI_USER_CREDENTIAL2_PROTOCOL  *UserCredential;
    111  
     111
    112112  //
    113113  // Find the specified credential provider.
     
    120120  }
    121121
    122   return EFI_NOT_FOUND; 
     122  return EFI_NOT_FOUND;
    123123}
    124124
     
    126126/**
    127127  Delete User's credental from all the providers that exist in User's identity policy.
    128  
     128
    129129  @param[in]  IdentityPolicy     Point to User's identity policy.
    130130  @param[in]  IdentityPolicyLen  The length of the identity policy.
     
    136136  IN     UINT8                                *IdentityPolicy,
    137137  IN     UINTN                                 IdentityPolicyLen,
    138   IN     EFI_USER_PROFILE_HANDLE               User 
     138  IN     EFI_USER_PROFILE_HANDLE               User
    139139  )
    140140{
     
    159159/**
    160160  Remove the provider specified by Offset from the new user identification record.
    161  
     161
    162162  @param[in]  IdentityPolicy    Point to user identity item in new identification policy.
    163163  @param[in]  Offset            The item offset in the new identification policy.
     
    188188    //
    189189    // This provider is not the last item in the identification policy, delete it and the connector.
    190     //   
     190    //
    191191    RemainingLen = mUserInfo.NewIdentityPolicyLen - Offset - DeleteLen;
    192192    CopyMem ((UINT8 *) IdentityPolicy, (UINT8 *) IdentityPolicy + DeleteLen, RemainingLen);
    193193  }
    194   mUserInfo.NewIdentityPolicyLen -= DeleteLen; 
     194  mUserInfo.NewIdentityPolicyLen -= DeleteLen;
    195195}
    196196
     
    202202
    203203  @param[in] NewGuid       Points to the credential provider guid.
    204  
     204
    205205**/
    206206VOID
     
    249249    FreePool (mUserInfo.NewIdentityPolicy);
    250250  }
    251  
     251
    252252  //
    253253  // Save credential provider.
     
    326326  @retval TRUE     The policy is a valid identity policy.
    327327  @retval FALSE    The policy is not a valid identity policy.
    328  
     328
    329329**/
    330330BOOLEAN
     
    338338  UINTN                         Offset;
    339339  UINT32                        OpCode;
    340  
     340
    341341  //
    342342  // Check policy expression.
     
    350350    Identity = (EFI_USER_INFO_IDENTITY_POLICY *) (PolicyInfo + Offset);
    351351    switch (Identity->Type) {
    352      
     352
    353353    case EFI_USER_INFO_IDENTITY_TRUE:
    354354      break;
     
    409409/**
    410410  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,
    413413  the identity policy can be:  T, P & P & P & ..., P | P | P | ...
    414414  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.
    416416
    417417**/
     
    440440    return ;
    441441  }
    442  
     442
    443443  //
    444444  // Update the informantion on credential provider.
     
    448448    return ;
    449449  }
    450  
     450
    451451  //
    452452  // Save new identification policy.
     
    462462  Status = mUserManager->SetInfo (mUserManager, mModifyUser, &UserInfo, Info, Info->InfoSize);
    463463  FreePool (Info);
    464    
     464
    465465  //
    466466  // Update the mUserInfo.IdentityPolicy by mUserInfo.NewIdentityPolicy
     
    474474  mUserInfo.NewIdentityPolicy         = NULL;
    475475  mUserInfo.NewIdentityPolicyLen      = 0;
    476   mUserInfo.NewIdentityPolicyModified = FALSE;   
     476  mUserInfo.NewIdentityPolicyModified = FALSE;
    477477
    478478  //
     
    495495    return ;
    496496  }
    497  
     497
    498498  //
    499499  // Check the identity policy.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileAdd.c

    r48674 r58466  
    11/** @file
    22  The functions to add a user profile.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1818/**
    1919  Get user name from the popup windows.
    20  
     20
    2121  @param[in, out]  UserNameLen  On entry, point to UserName buffer lengh, in bytes.
    2222                                On exit, point to input user name length, in bytes.
    2323  @param[out]      UserName     The buffer to hold the input user name.
    24  
     24
    2525  @retval EFI_ABORTED           It is given up by pressing 'ESC' key.
    2626  @retval EFI_NOT_READY         Not a valid input at all.
     
    101101  *UserNameLen = NameLen * sizeof (CHAR16);
    102102  CopyMem (UserName, Name, *UserNameLen);
    103  
     103
    104104  return EFI_SUCCESS;
    105105}
     
    113113
    114114  @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
    116116                             username in mAddUserName.
    117117
     
    128128  EFI_USER_PROFILE_HANDLE TempUser;
    129129  EFI_USER_INFO           *NewUserInfo;
    130    
     130
    131131  NewUserInfo = AllocateZeroPool (sizeof (EFI_USER_INFO) + UserNameLen);
    132132  ASSERT (NewUserInfo != NULL);
    133133
    134134  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 |
    137137                             EFI_USER_INFO_EXCLUSIVE;
    138138  NewUserInfo->InfoSize    = (UINT32) (sizeof (EFI_USER_INFO) + UserNameLen);
     
    182182  EFI_USER_INFO_CREATE_DATE Date;
    183183  EFI_USER_INFO             *NewUserInfo;
    184  
     184
    185185  NewUserInfo = AllocateZeroPool (
    186186                  sizeof (EFI_USER_INFO) +
     
    190190
    191191  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 |
    194194                             EFI_USER_INFO_EXCLUSIVE;
    195195  NewUserInfo->InfoSize    = sizeof (EFI_USER_INFO) + sizeof (EFI_USER_INFO_CREATE_DATE);
     
    216216  Set the default identity policy of the specified user.
    217217
    218   @param[in]  User               Handle of a user profile. 
     218  @param[in]  User               Handle of a user profile.
    219219
    220220**/
     
    227227  EFI_USER_INFO_HANDLE          UserInfo;
    228228  EFI_USER_INFO                 *NewUserInfo;
    229  
     229
    230230  NewUserInfo = AllocateZeroPool (
    231                   sizeof (EFI_USER_INFO) + 
     231                  sizeof (EFI_USER_INFO) +
    232232                  sizeof (EFI_USER_INFO_IDENTITY_POLICY)
    233233                  );
    234234  ASSERT (NewUserInfo != NULL);
    235  
     235
    236236  Policy                   = (EFI_USER_INFO_IDENTITY_POLICY *) (NewUserInfo + 1);
    237237  Policy->Type             = EFI_USER_INFO_IDENTITY_TRUE;
     
    239239
    240240  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 |
    243243                             EFI_USER_INFO_EXCLUSIVE;
    244244  NewUserInfo->InfoSize    = sizeof (EFI_USER_INFO) + Policy->Length;
     
    258258  Set the default access policy of the specified user.
    259259
    260   @param[in]  User               Handle of a user profile. 
     260  @param[in]  User               Handle of a user profile.
    261261
    262262**/
     
    269269  EFI_USER_INFO_HANDLE          UserInfo;
    270270  EFI_USER_INFO                 *NewUserInfo;
    271  
     271
    272272  NewUserInfo = AllocateZeroPool (
    273                   sizeof (EFI_USER_INFO) + 
     273                  sizeof (EFI_USER_INFO) +
    274274                  sizeof (EFI_USER_INFO_ACCESS_CONTROL)
    275275                  );
    276276  ASSERT (NewUserInfo != NULL);
    277  
     277
    278278  Control                  = (EFI_USER_INFO_ACCESS_CONTROL *) (NewUserInfo + 1);
    279279  Control->Type            = EFI_USER_INFO_ACCESS_ENROLL_SELF;
     
    281281
    282282  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 |
    285285                             EFI_USER_INFO_EXCLUSIVE;
    286286  NewUserInfo->InfoSize    = sizeof (EFI_USER_INFO) + Control->Size;
     
    316316  QuestionStr = NULL;
    317317  PromptStr   = NULL;
    318  
     318
    319319  //
    320320  // Get user name to add.
     
    325325    if (Status != EFI_ABORTED) {
    326326      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));
    328328      goto Done;
    329329    }
     
    338338  if (EFI_ERROR (Status)) {
    339339    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));
    341341  } else {
    342342    //
     
    346346    if (EFI_ERROR (Status)) {
    347347      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));
    349349      goto Done;
    350350    }
     
    355355
    356356    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));
    358358  }
    359359
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileDelete.c

    r48674 r58466  
    11/** @file
    22  The functions to delete a user profile.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1818  Get the username from the specified user.
    1919
    20   @param[in]   User              Handle of a user profile. 
     20  @param[in]   User              Handle of a user profile.
    2121
    2222  @retval EFI_STRING_ID          The String Id of the user's username.
    2323
    2424**/
    25 EFI_STRING_ID 
     25EFI_STRING_ID
    2626GetUserName (
    2727  IN  EFI_USER_PROFILE_HANDLE                   User
     
    3636  CHAR16                UserName[USER_NAME_LENGTH];
    3737  EFI_STRING_ID         UserId;
    38  
     38
    3939  //
    4040  // Allocate user information memory.
     
    4343  Info    = AllocateZeroPool (MemSize);
    4444  ASSERT (Info != NULL);
    45  
     45
    4646  //
    4747  // Get user name information.
     
    117117  Add a username item in form.
    118118
    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.
    120120  @param[in]  Index         The index of the user in the user name list
    121121  @param[in]  OpCodeHandle  Points to container for dynamic created opcodes.
     
    138138    return ;
    139139  }
    140  
     140
    141141  //
    142142  // Create user name option.
     
    174174  Delete the user specified by UserIndex in user profile database.
    175175
    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
    177177                              to be deleted.
    178178
     
    198198    goto Done;
    199199  }
    200  
     200
    201201  while (UserIndex > 1) {
    202202    Status = mUserManager->GetNext (mUserManager, &User);
     
    233233    DeleteCredentialFromProviders ((UINT8 *)(Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO), User);
    234234    FreePool (Info);
    235    
     235
    236236    Status = mUserManager->Delete (mUserManager, User);
    237237    if (EFI_ERROR (Status)) {
     
    246246      NULL
    247247      );
    248     return ; 
     248    return ;
    249249  }
    250250
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c

    r48674 r58466  
    11/** @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
    55  policy, etc.
    66
    77Copyright (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 
     8This program and the accompanying materials
     9are licensed and made available under the terms and conditions of the BSD License
     10which accompanies this distribution.  The full text of the license may be found at
    1111http://opensource.org/licenses/bsd-license.php
    1212
    13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1414WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
     
    7171
    7272/**
    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
    7474  to mProviderInfo.
    7575
    7676  @retval EFI_SUCESS     Init credential provider database successfully.
    7777  @retval Others         Fail to init credential provider database.
    78  
     78
    7979**/
    8080EFI_STATUS
     
    8686  UINTN       HandleCount;
    8787  EFI_HANDLE  *HandleBuf;
    88   UINTN       Index; 
    89  
     88  UINTN       Index;
     89
    9090  //
    9191  // Try to find all the user credential provider driver.
     
    103103    return Status;
    104104  }
    105  
     105
    106106  //
    107107  // Get provider infomation.
     
    111111  }
    112112  mProviderInfo = AllocateZeroPool (
    113                     sizeof (CREDENTIAL_PROVIDER_INFO) - 
     113                    sizeof (CREDENTIAL_PROVIDER_INFO) -
    114114                    sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) +
    115115                    HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *)
     
    192192        return EFI_SUCCESS;
    193193      }
    194  
     194
    195195      //
    196196      // Get current user
     
    202202        return EFI_NOT_READY;
    203203      }
    204      
     204
    205205      //
    206206      // Get current user's right information.
     
    210210        CurrentAccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF;
    211211      }
    212  
     212
    213213      //
    214214      // Init credential provider information.
     
    218218        return Status;
    219219      }
    220      
     220
    221221      //
    222222      // Initialize the container for dynamic opcodes.
     
    224224      StartOpCodeHandle = HiiAllocateOpCodeHandle ();
    225225      ASSERT (StartOpCodeHandle != NULL);
    226  
     226
    227227      EndOpCodeHandle = HiiAllocateOpCodeHandle ();
    228228      ASSERT (EndOpCodeHandle != NULL);
    229  
     229
    230230      //
    231231      // Create Hii Extend Label OpCode.
     
    239239      StartLabel->ExtendOpCode  = EFI_IFR_EXTEND_OP_LABEL;
    240240      StartLabel->Number        = LABEL_USER_MANAGE_FUNC;
    241  
     241
    242242      EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
    243243                                          EndOpCodeHandle,
     
    248248      EndLabel->ExtendOpCode  = EFI_IFR_EXTEND_OP_LABEL;
    249249      EndLabel->Number        = LABEL_END;
    250  
     250
    251251      //
    252252      // Add user profile option.
     
    264264          );
    265265      }
    266      
     266
    267267      //
    268268      // Add modify user profile option.
     
    276276        KEY_MODIFY_USER                       // Question ID
    277277        );
    278  
     278
    279279      //
    280280      // Add delete user profile option
     
    290290          );
    291291      }
    292  
     292
    293293      HiiUpdateForm (
    294294        mCallbackInfo->HiiHandle,               // HII handle
     
    298298        EndOpCodeHandle                         // Replace data
    299299        );
    300  
     300
    301301      HiiFreeOpCodeHandle (StartOpCodeHandle);
    302302      HiiFreeOpCodeHandle (EndOpCodeHandle);
    303  
     303
    304304      return EFI_SUCCESS;
    305305    }
     
    311311
    312312  case EFI_BROWSER_ACTION_CHANGED:
    313   { 
     313  {
    314314    //
    315315    // Handle the request from form.
     
    318318      return EFI_INVALID_PARAMETER;
    319319    }
    320    
     320
    321321    //
    322322    // Judge first 2 bits.
     
    392392          // Change credential provider option.
    393393          //
    394           case KEY_MODIFY_PROV:         
     394          case KEY_MODIFY_PROV:
    395395            mProviderChoice = Value->u8;
    396396            break;
     
    556556
    557557  case EFI_BROWSER_ACTION_CHANGING:
    558   { 
     558  {
    559559    //
    560560    // Handle the request from form.
     
    563563      return EFI_INVALID_PARAMETER;
    564564    }
    565    
     565
    566566    //
    567567    // Judge first 2 bits.
     
    666666              DisplayLoadPermit ();
    667667              break;
    668          
     668
    669669            //
    670670            // Forbid load device path.
     
    673673              DisplayLoadForbid ();
    674674              break;
    675          
     675
    676676            default:
    677677              break;
    678678            }
    679679            break;
    680            
     680
    681681          //
    682682          // Connect device path form.
     
    693693              DisplayConnectPermit ();
    694694              break;
    695          
     695
    696696            //
    697697            // Forbid connect device path.
     
    700700              DisplayConnectForbid ();
    701701              break;
    702          
     702
    703703            default:
    704704              break;
     
    837837    return EFI_SUCCESS;
    838838  }
    839  
     839
    840840  //
    841841  // Initialize driver private data.
     
    845845
    846846  CallbackInfo = AllocateZeroPool (sizeof (USER_PROFILE_MANAGER_CALLBACK_INFO));
    847   ASSERT (CallbackInfo != NULL); 
     847  ASSERT (CallbackInfo != NULL);
    848848
    849849  CallbackInfo->Signature                   = USER_PROFILE_MANAGER_SIGNATURE;
     
    852852  CallbackInfo->ConfigAccess.Callback       = UserProfileManagerCallback;
    853853  CallbackInfo->DriverHandle                = NULL;
    854  
     854
    855855  //
    856856  // Install Device Path Protocol and Config Access protocol to driver handle.
     
    876876                              NULL
    877877                              );
    878   ASSERT (CallbackInfo->HiiHandle != NULL);                             
     878  ASSERT (CallbackInfo->HiiHandle != NULL);
    879879  mCallbackInfo = CallbackInfo;
    880880
     
    882882}
    883883
    884  
     884
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h

    r58459 r58466  
    11/** @file
    22  The header file for user profile manager driver.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    5656  UINTN     AccessPolicyLen;
    5757  UINTN     IdentityPolicyLen;
    58   UINTN     NewIdentityPolicyLen;   
     58  UINTN     NewIdentityPolicyLen;
    5959  UINT8     *AccessPolicy;
    6060  UINT8     *IdentityPolicy;
     
    198198  Add a username item in form.
    199199
    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.
    201201  @param[in]  Index            The index of the user in the user name list.
    202202  @param[in]  OpCodeHandle     Points to container for dynamic created opcodes.
     
    217217
    218218  @param[in] UserIndex       The index of the user in display list to modify.
    219  
     219
    220220**/
    221221VOID
     
    225225
    226226/**
    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
    228228  database with it.
    229229
     
    254254/**
    255255  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,
    258258  the identity policy can be:  T, P & P & P & ..., P | P | P | ...
    259259  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.
    261261
    262262**/
     
    271271  In this form, access right, access setu,p and access boot order are dynamically
    272272  added. Load devicepath and connect devicepath are displayed too.
    273  
     273
    274274**/
    275275VOID
     
    279279
    280280/**
    281   Collect all the access policy data to mUserInfo.AccessPolicy, 
     281  Collect all the access policy data to mUserInfo.AccessPolicy,
    282282  and save it to user profile.
    283283
     
    339339
    340340/**
    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
    342342  list (mAccessInfo.LoadForbid).
    343343
    344344  @param[in]  DriverIndex   The index of driver in a forbidden device path list.
    345  
     345
    346346**/
    347347VOID
     
    349349  IN  UINT16                                    DriverIndex
    350350  );
    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
    354354  list (mAccessInfo.LoadForbid).
    355355
    356356  @param[in]  DriverIndex   The index of driver saved in driver options.
    357  
     357
    358358**/
    359359VOID
     
    364364/**
    365365  Get user name from the popup windows.
    366  
     366
    367367  @param[in, out]  UserNameLen   On entry, point to the buffer lengh of UserName.
    368368                                 On exit, point to the input user name length.
    369369  @param[out]      UserName      The buffer to hold the input user name.
    370  
     370
    371371  @retval EFI_ABORTED            It is given up by pressing 'ESC' key.
    372372  @retval EFI_NOT_READY          Not a valid input at all.
     
    386386  @param[in]  InfoType     The user information type to find.
    387387  @param[out] UserInfo     Points to user information handle found.
    388  
     388
    389389  @retval EFI_SUCCESS      Find the user information successfully.
    390390  @retval Others           Fail to find the user information.
     
    419419  @param[in] ValidLen       The valid access policy length.
    420420  @param[in] ExpandLen      The length that is needed to expand.
    421    
     421
    422422**/
    423423VOID
     
    429429/**
    430430  Delete User's credental from all the providers that exist in User's identity policy.
    431  
     431
    432432  @param[in]  IdentityPolicy     Point to User's identity policy.
    433433  @param[in]  IdentityPolicyLen  The length of the identity policy.
     
    439439  IN     UINT8                                *IdentityPolicy,
    440440  IN     UINTN                                 IdentityPolicyLen,
    441   IN     EFI_USER_PROFILE_HANDLE               User 
    442   );
    443  
     441  IN     EFI_USER_PROFILE_HANDLE               User
     442  );
     443
    444444#endif
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerData.h

    r48674 r58466  
    11/** @file
    22  The form data for user profile manager driver.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    4848
    4949//
    50 // First form key (Add/modify/del user profile). 
     50// First form key (Add/modify/del user profile).
    5151// First 2 bits (bit 16~15).
    5252//
     
    7878// Specified key, used in VFR (KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_NAME).
    7979//
    80 #define  KEY_MODIFY_USER_NAME       0x5200 
     80#define  KEY_MODIFY_USER_NAME       0x5200
    8181
    8282//
     
    135135// Device path modify key.
    136136// 2 bits (bit 12~11).
    137 // 
     137//
    138138#define KEY_LOAD_PERMIT_MODIFY      0x0000
    139139#define KEY_LOAD_FORBID_MODIFY      0x0400
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerDxe.inf

    r58459 r58466  
    5151  UefiLib
    5252  DevicePathLib
    53  
     53
    5454[Guids]
    5555  gEfiIfrTianoGuid                              ## SOMETIMES_CONSUMES  ## GUID
     
    6767[Depex]
    6868  gEfiUserManagerProtocolGuid
    69  
     69
    7070[UserExtensions.TianoCore."ExtraFiles"]
    7171  UserProfileManagerExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerStrings.uni

    • Property svn:mime-type changed from application/octet-stream to text/plain;encoding=UTF-16LE
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerVfr.Vfr

    • Property svn:eol-style set to native
    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    1818#define USER_MANAGER_SUBCLASS    0x04
    1919
    20 formset 
     20formset
    2121  guid     = USER_PROFILE_MANAGER_GUID,
    22   title    = STRING_TOKEN(STR_FORMSET_TITLE), 
     22  title    = STRING_TOKEN(STR_FORMSET_TITLE),
    2323  help     = STRING_TOKEN(STR_TITLE_HELP),
    2424  class    = USER_MANAGER_CLASS,
    2525  subclass = USER_MANAGER_SUBCLASS,
    26    
     26
    2727  // User manager form
    2828  form formid = FORMID_USER_MANAGE,
     
    3939        key    = QUESTIONID_USER_MANAGE;
    4040    endif;
    41      
    42   endform;
    43  
     41
     42  endform;
     43
    4444  // Modify user profile form
    4545  form formid = FORMID_MODIFY_USER,
     
    5050
    5151  endform;
    52  
     52
    5353  // Delete user profile form
    5454  form formid = FORMID_DEL_USER,
    5555    title     = STRING_TOKEN(STR_DELETE_USER_TITLE);
    56  
     56
    5757    label LABEL_USER_DEL_FUNC;
    5858    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
    6464  //
    6565  // User profile information form
     
    6868    title     = STRING_TOKEN(STR_USER_INFO);
    6969
    70     text 
    71       help   = STRING_TOKEN(STR_USER_NAME_VAL), 
     70    text
     71      help   = STRING_TOKEN(STR_USER_NAME_VAL),
    7272      text   = STRING_TOKEN(STR_USER_NAME),
    7373      flags  = INTERACTIVE,
    7474      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),
    7878      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),
    8282      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),
    8686      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
    9393  //
    9494  // Identify policy modify form
     
    9797    title     = STRING_TOKEN(STR_IDENTIFY_POLICY);
    9898
    99     text 
     99    text
    100100      help   = STRING_TOKEN(STR_IDENTIFY_POLICY_HELP),
    101101      text   = STRING_TOKEN(STR_IDENTIFY_POLICY),
    102102        text   = STRING_TOKEN(STR_IDENTIFY_POLICY_VALUE);
    103      
     103
    104104    label LABEL_IP_MOD_FUNC;
    105105    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),
    109109      text   = STRING_TOKEN(STR_ADD_OPTION),
    110110      flags  = INTERACTIVE,
    111111      key    = KEY_ADD_LOGICAL_OP;
    112      
    113     subtitle 
     112
     113    subtitle
    114114      text   = STRING_TOKEN(STR_NULL_STRING);
    115115
     
    121121
    122122  endform;
    123  
     123
    124124  //
    125125  // Access policy modify form
     
    143143      key     = KEY_CONN_DP;
    144144
    145     subtitle 
    146       text   = STRING_TOKEN(STR_NULL_STRING);
    147    
     145    subtitle
     146      text   = STRING_TOKEN(STR_NULL_STRING);
     147
    148148    text
    149149      help   = STRING_TOKEN(STR_ACCESS_SAVE_HELP),
     
    165165      flags   = INTERACTIVE,
    166166      key     = KEY_LOAD_PERMIT;
    167    
     167
    168168    goto FORMID_FORBID_LOAD_DP,
    169169      prompt  = STRING_TOKEN(STR_LOAD_FORBID),
     
    171171      flags   = INTERACTIVE,
    172172      key     = KEY_LOAD_FORBID;
    173  
    174   endform;
    175  
     173
     174  endform;
     175
    176176  //
    177177  // Permit load device path form
     
    179179  form formid = FORMID_PERMIT_LOAD_DP,
    180180    title     = STRING_TOKEN(STR_LOAD_PERMIT);
    181  
     181
    182182    label LABEL_PERMIT_LOAD_FUNC;
    183183    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
    190190  //
    191191  // Forbid load device path form
     
    193193  form formid = FORMID_FORBID_LOAD_DP,
    194194    title     = STRING_TOKEN(STR_LOAD_FORBID);
    195  
     195
    196196    label LABLE_FORBID_LOAD_FUNC;
    197197    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
    204204  //
    205205  // Connect device path form
     
    213213      flags   = INTERACTIVE,
    214214      key     = KEY_CONNECT_PERMIT;
    215      
     215
    216216    goto FORMID_FORBID_CONNECT_DP,
    217217      prompt  = STRING_TOKEN(STR_CONNECT_FORBID),
     
    219219      flags   = INTERACTIVE,
    220220      key     = KEY_CONNECT_FORBID;
    221      
    222   endform;
    223  
     221
     222  endform;
     223
    224224  //
    225225  // Permit connect device path form
     
    227227  form formid = FORMID_PERMIT_CONNECT_DP,
    228228    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
    235235  //
    236236  // Forbid connect device path form
     
    238238  form formid = FORMID_FORBID_CONNECT_DP,
    239239    title     = STRING_TOKEN(STR_CONNECT_FORBID);
    240      
    241    subtitle 
     240
     241   subtitle
    242242     text   = STRING_TOKEN(STR_NULL_STRING);
    243243
    244244  endform;
    245  
     245
    246246endformset;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c

    r48674 r58466  
    11/** @file
    22  The functions to modify a user profile.
    3    
     3
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    128128  mUserInfo.UsageDateExist          = FALSE;
    129129  mUserInfo.UsageCount              = 0;
    130  
     130
    131131  mUserInfo.AccessPolicyLen         = 0;
    132132  mUserInfo.AccessPolicyModified    = FALSE;
     
    141141    mUserInfo.IdentityPolicy = NULL;
    142142  }
    143  
     143
    144144  //
    145145  // Allocate user information memory.
     
    150150    return ;
    151151  }
    152  
     152
    153153  //
    154154  // Get each user information.
     
    165165    InfoSize  = MemSize;
    166166    Status    = mUserManager->GetInfo (
    167                                 mUserManager, 
    168                                 mModifyUser, 
    169                                 UserInfo, 
    170                                 Info, 
     167                                mUserManager,
     168                                mModifyUser,
     169                                UserInfo,
     170                                Info,
    171171                                &InfoSize
    172172                                );
     
    282282    Str + StrLen (Str),
    283283    DateBufLen,
    284     L"%2d:%2d:%2d", 
     284    L"%2d:%2d:%2d",
    285285    Date->Hour,
    286286    Date->Minute,
    287287    Date->Second
    288288    );
    289  
     289
    290290  HiiSetString (mCallbackInfo->HiiHandle, DateId, Str, NULL);
    291291  FreePool (Str);
     
    309309  CHAR16  Count[10];
    310310
    311   UnicodeSPrint (Count, 20, L"%d", CountVal); 
     311  UnicodeSPrint (Count, 20, L"%d", CountVal);
    312312  HiiSetString (mCallbackInfo->HiiHandle, CountId, Count, NULL);
    313313}
     
    319319
    320320  @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
    322322  @param[in]       Source2      Pointer to a Null-terminated Unicode string.
    323323
     
    381381  EFI_HII_HANDLE                HiiHandle;
    382382  EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;
    383  
     383
    384384  TmpStr = NULL;
    385  
     385
    386386  //
    387387  // Resolve each policy.
     
    414414      for (Index = 0; Index < mProviderInfo->Count; Index++) {
    415415        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)) {
    436417          UserCredential->Title (
    437418                            UserCredential,
     
    448429      }
    449430      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;
    450450    }
    451451
     
    467467
    468468  @param[in] UserIndex       The index of the user in display list to modify.
    469  
     469
    470470**/
    471471VOID
     
    528528    UserIndex--;
    529529  }
    530  
     530
    531531  //
    532532  // Get user profile information.
     
    542542    NULL
    543543    );
    544  
     544
    545545  //
    546546  // Update create date.
     
    556556      );
    557557  }
    558  
     558
    559559  //
    560560  // Add usage date.
     
    570570      );
    571571  }
    572  
     572
    573573  //
    574574  // Add usage count.
    575575  //
    576576  ResolveCount ((UINT32) mUserInfo.UsageCount, STRING_TOKEN (STR_USAGE_COUNT_VAL));
    577  
     577
    578578  //
    579579  // Add identity policy.
     
    595595      );
    596596  }
    597  
     597
    598598  //
    599599  // Add access policy.
     
    644644
    645645  //
    646   // Set default value 
     646  // Set default value
    647647  //
    648648  mAccessInfo.AccessRight       = EFI_USER_INFO_ACCESS_ENROLL_SELF;
     
    654654  mAccessInfo.ConnectPermitLen  = 0;
    655655  mAccessInfo.ConnectForbidLen  = 0;
    656  
     656
    657657  //
    658658  // Get each user access policy.
     
    660660  OffSet = 0;
    661661  while (OffSet < mUserInfo.AccessPolicyLen) {
    662     CopyMem (&Control, mUserInfo.AccessPolicy + OffSet, sizeof (Control));   
     662    CopyMem (&Control, mUserInfo.AccessPolicy + OffSet, sizeof (Control));
    663663    ValLen = Control.Size - sizeof (Control);
    664664    switch (Control.Type) {
     
    755755  @param[in]  InfoType     The user information type to find.
    756756  @param[out] UserInfo     Points to user information handle found.
    757  
     757
    758758  @retval EFI_SUCCESS      Find the user information successfully.
    759759  @retval Others           Fail to find the user information.
     
    785785    return EFI_OUT_OF_RESOURCES;
    786786  }
    787  
     787
    788788  //
    789789  // Get each user information.
     
    837837  In this form, access right, access setup and access boot order are dynamically
    838838  added. Load devicepath and connect devicepath are displayed too.
    839  
     839
    840840**/
    841841VOID
     
    850850  EFI_IFR_GUID_LABEL  *EndLabel;
    851851  VOID                *DefaultOpCodeHandle;
    852  
     852
    853853  //
    854854  // Initialize the container for dynamic opcodes.
     
    894894  DefaultOpCodeHandle = HiiAllocateOpCodeHandle ();
    895895  ASSERT (DefaultOpCodeHandle != NULL);
    896  
     896
    897897  HiiCreateOneOfOptionOpCode (
    898898    OptionsOpCodeHandle,
     
    920920
    921921  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,
    925925    mAccessInfo.AccessRight
    926926    );
    927  
     927
    928928  HiiCreateOneOfOpCode (
    929929    StartOpCodeHandle,                    // Container for dynamic created opcodes
     
    949949  DefaultOpCodeHandle = HiiAllocateOpCodeHandle ();
    950950  ASSERT (DefaultOpCodeHandle != NULL);
    951  
     951
    952952  HiiCreateOneOfOptionOpCode (
    953953    OptionsOpCodeHandle,
     
    957957    ACCESS_SETUP_RESTRICTED
    958958    );
    959    
     959
    960960  HiiCreateOneOfOptionOpCode (
    961961    OptionsOpCodeHandle,
     
    975975
    976976  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,
    980980    mAccessInfo.AccessSetup
    981     );   
     981    );
    982982
    983983  HiiCreateOneOfOpCode (
     
    995995  HiiFreeOpCodeHandle (DefaultOpCodeHandle);
    996996  HiiFreeOpCodeHandle (OptionsOpCodeHandle);
    997  
     997
    998998  //
    999999  // Add boot order one-of-code.
     
    10031003  DefaultOpCodeHandle = HiiAllocateOpCodeHandle ();
    10041004  ASSERT (DefaultOpCodeHandle != NULL);
    1005  
     1005
    10061006  HiiCreateOneOfOptionOpCode (
    10071007    OptionsOpCodeHandle,
     
    10271027    EFI_USER_INFO_ACCESS_BOOT_ORDER_REPLACE
    10281028    );
    1029    
     1029
    10301030  HiiCreateOneOfOptionOpCode (
    10311031    OptionsOpCodeHandle,
     
    10371037
    10381038  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,
    10421042    mAccessInfo.AccessBootOrder
    10431043    );
    1044    
     1044
    10451045  HiiCreateOneOfOpCode (
    10461046    StartOpCodeHandle,                  // Container for dynamic created opcodes
     
    10551055    DefaultOpCodeHandle                 // Default Opcode
    10561056    );
    1057   HiiFreeOpCodeHandle (DefaultOpCodeHandle);   
     1057  HiiFreeOpCodeHandle (DefaultOpCodeHandle);
    10581058  HiiFreeOpCodeHandle (OptionsOpCodeHandle);
    10591059
     
    10791079  @param[in] ValidLen       The valid access policy length.
    10801080  @param[in] ExpandLen      The length that is needed to expand.
    1081    
     1081
    10821082**/
    10831083VOID
     
    11081108
    11091109/**
    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
    11111111  database with it.
    11121112
     
    11431143    return ;
    11441144  }
    1145  
     1145
    11461146  //
    11471147  // Check whether the username had been used or not.
     
    11791179    return ;
    11801180  }
    1181  
     1181
    11821182  //
    11831183  // Update username display in the form.
     
    11851185  CopyMem (mUserInfo.UserName, UserName, Len);
    11861186  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,
    11901190    NULL
    11911191    );
     
    13041304    HiiFreeOpCodeHandle (OptionsOpCodeHandle);
    13051305  }
    1306  
     1306
    13071307  //
    13081308  // Add logical connector Option OpCode.
     
    13461346  //
    13471347  ResolveIdentityPolicy (
    1348     mUserInfo.IdentityPolicy, 
    1349     mUserInfo.IdentityPolicyLen, 
     1348    mUserInfo.IdentityPolicy,
     1349    mUserInfo.IdentityPolicyLen,
    13501350    STRING_TOKEN (STR_IDENTIFY_POLICY_VALUE)
    13511351    );
     
    14051405    return EFI_OUT_OF_RESOURCES;
    14061406  }
    1407  
     1407
    14081408  //
    14091409  // Get user access information.
     
    14461446      break;
    14471447    }
    1448    
     1448
    14491449    //
    14501450    // Check user information.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/AuthService.c

    r58459 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    6262  ASSERT (mVariableModuleGlobal->HashContext[Physical] != NULL);
    6363  //
    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.
    6666  //
    6767  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,
    7171             &mVariableModuleGlobal->VariableGlobal[Physical],
    7272             mVariableModuleGlobal->FvbInstance
     
    9797    //
    9898    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,
    103103              &VariableHeader
    104104              );
     
    118118  }
    119119  //
    120   // Check "SetupMode" variable's existence. 
     120  // Check "SetupMode" variable's existence.
    121121  // 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.
    123123  //
    124124  Status = FindVariable (
    125              mVariableModuleGlobal->VariableName[Physical][VAR_SETUP_MODE], 
    126              &gEfiGlobalVariableGuid, 
    127              &Variable, 
     125             mVariableModuleGlobal->VariableName[Physical][VAR_SETUP_MODE],
     126             &gEfiGlobalVariableGuid,
     127             &Variable,
    128128             &mVariableModuleGlobal->VariableGlobal[Physical],
    129129             mVariableModuleGlobal->FvbInstance
     
    132132  if (Variable.CurrPtr == 0x0) {
    133133    Status = FindVariable (
    134                mVariableModuleGlobal->VariableName[Physical][VAR_PLATFORM_KEY], 
    135                &gEfiGlobalVariableGuid, 
    136                &Variable, 
     134               mVariableModuleGlobal->VariableName[Physical][VAR_PLATFORM_KEY],
     135               &gEfiGlobalVariableGuid,
     136               &Variable,
    137137               &mVariableModuleGlobal->VariableGlobal[Physical],
    138138               mVariableModuleGlobal->FvbInstance
     
    170170  }
    171171  //
    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.
    174174  //
    175175  Status = FindVariable (
    176              EFI_SIGNATURE_SUPPORT_NAME, 
    177              &gEfiGlobalVariableGuid, 
    178              &Variable, 
     176             EFI_SIGNATURE_SUPPORT_NAME,
     177             &gEfiGlobalVariableGuid,
     178             &Variable,
    179179             &mVariableModuleGlobal->VariableGlobal[Physical],
    180180             mVariableModuleGlobal->FvbInstance
     
    365365  Rsa = RsaNew ();
    366366  ASSERT (Rsa != NULL);
    367   // 
     367  //
    368368  // Set RSA Key Components.
    369369  // NOTE: Only N and E are needed to be set as RSA public key for signature verification.
     
    381381  //
    382382  Status = RsaPkcs1Verify (
    383              Rsa, 
    384              Digest, 
    385              SHA256_DIGEST_SIZE, 
    386              CertBlock->Signature, 
     383             Rsa,
     384             Digest,
     385             SHA256_DIGEST_SIZE,
     386             CertBlock->Signature,
    387387             EFI_CERT_TYPE_RSA2048_SHA256_SIZE
    388388             );
     
    420420
    421421  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,
    425425             &Global->VariableGlobal[VirtualMode],
    426426             Global->FvbInstance
     
    460460
    461461  @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.
    464464  @retval EFI_SUCCESS                     The variable passed validation successfully.
    465465
     
    508508    if (Variable->CurrPtr != 0x0) {
    509509      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,
    514514                &VariableHeader
    515515                );
     
    527527    //
    528528    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,
    532532               &Global->VariableGlobal[VirtualMode],
    533533               Global->FvbInstance
     
    549549    if (!EFI_ERROR (Status)) {
    550550      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,
    559559                 Global,
    560560                 Variable
     
    597597
    598598  @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.
    601601  @retval EFI_SUCCESS                     The variable passed validation successfully.
    602602
     
    641641    if (Variable->CurrPtr != 0x0) {
    642642      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,
    647647                &VariableHeader
    648648                );
     
    660660    //
    661661    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,
    665665               &Global->VariableGlobal[VirtualMode],
    666666               Global->FvbInstance
     
    699699    if (!EFI_ERROR (Status)) {
    700700      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,
    708708                 VirtualMode,
    709709                 Global,
     
    716716    //
    717717    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,
    725725               VirtualMode,
    726726               Global,
     
    749749                                          EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
    750750  @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.
    753753  @retval EFI_SUCCESS                     The variable is not write-protected, or passed validation successfully.
    754754
     
    790790  if (Variable->CurrPtr != 0x0) {
    791791    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,
    796796              &VariableHeader
    797797              );
     
    821821      IsFirstTime = FALSE;
    822822    }
    823   } else if (Valid && (VariableHeader.Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) { 
     823  } else if (Valid && (VariableHeader.Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
    824824      //
    825825      // If the variable is already write-protected, it always needs authentication before update.
     
    865865      return EFI_SECURITY_VIOLATION;
    866866    }
    867   } 
     867  }
    868868  //
    869869  // Verify the certificate in Data payload.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/AuthService.h

    r48674 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    4747                                          EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
    4848  @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.
    5151  @retval EFI_SUCCESS                     The variable is not write-protected, or passed validation successfully.
    5252
     
    100100
    101101  @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.
    104104  @retval EFI_SUCCESS                     The variable passed validation successfully.
    105105
     
    132132
    133133  @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.
    136136  @retval EFI_SUCCESS                     The variable passed validation successfully.
    137137
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/EsalVariableDxeSal.inf

    r58459 r58466  
    3030#  VALID_ARCHITECTURES           = IPF
    3131#
    32 #  VIRTUAL_ADDRESS_MAP_CALLBACK  =  VariableClassAddressChangeEvent             
     32#  VIRTUAL_ADDRESS_MAP_CALLBACK  =  VariableClassAddressChangeEvent
    3333#
    3434
     
    7474  ## PRODUCES             ## Variable:L"SignatureSupport"
    7575  gEfiGlobalVariableGuid
    76  
     76
    7777  ## PRODUCES             ## GUID # Variable store header
    7878  ## CONSUMES             ## GUID # Variable store header
     
    8080  ## SOMETIMES_PRODUCES   ## SystemTable
    8181  gEfiAuthenticatedVariableGuid
    82  
     82
    8383  gEfiEventVirtualAddressChangeGuid             ## CONSUMES               ## Event
    8484  gEfiCertRsa2048Sha256Guid                     ## CONSUMES               ## GUID        # Unique ID for the format of the CertType.
     
    9595  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize                     ## CONSUMES
    9696  gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize                      ## CONSUMES
    97  
     97
    9898[FeaturePcd.common]
    9999  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics             ## CONSUMES    # statistic the information of variable.
    100100
    101101[Depex]
    102   gEfiExtendedSalFvBlockServicesProtocolGuid AND gEfiFaultTolerantWriteProtocolGuid 
     102  gEfiExtendedSalFvBlockServicesProtocolGuid AND gEfiFaultTolerantWriteProtocolGuid
    103103
    104104[UserExtensions.TianoCore."ExtraFiles"]
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/InitVariable.c

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    5656{
    5757  SAL_RETURN_REGS ReturnVal;
    58  
     58
    5959  ReturnVal.r9  = 0;
    6060  ReturnVal.r10 = 0;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Reclaim.c

    r48674 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.c

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    163163      return EFI_INVALID_PARAMETER;
    164164    }
    165    
     165
    166166    //
    167167    // For volatile variable, a simple memory copy is enough.
     
    182182                          EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
    183183                          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,
    191191                          0
    192192                          ).Status;
     
    200200    return EFI_INVALID_PARAMETER;
    201201  }
    202  
     202
    203203  LinearOffset  = (UINTN) FwVolHeader;
    204204  CurrWritePtr  = StartAddress;
     
    228228                                    EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
    229229                                    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,
    237237                                    0
    238238                                    ).Status;
     
    241241                                    EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
    242242                                    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,
    250250                                    0
    251251                                    ).Status;
     
    261261                                    EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
    262262                                    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,
    270270                                    0
    271271                                    ).Status;
     
    274274                                    EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
    275275                                    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,
    283283                                    0
    284284                                    ).Status;
     
    333333             VarStoreAddress,
    334334             sizeof (VARIABLE_STORE_HEADER),
    335              VarStoreHeader   
     335             VarStoreHeader
    336336             );
    337337  ASSERT_EFI_ERROR (Status);
     
    373373             VariableAddress,
    374374             sizeof (VARIABLE_HEADER),
    375              &LocalVariableHeader   
     375             &LocalVariableHeader
    376376             );
    377377
     
    521521             Address,
    522522             VariableHeader.NameSize,
    523              VariableName   
     523             VariableName
    524524             );
    525525  ASSERT_EFI_ERROR (Status);
     
    572572             Address,
    573573             VariableHeader.DataSize,
    574              VariableData   
     574             VariableData
    575575             );
    576576  ASSERT_EFI_ERROR (Status);
     
    627627  Gets the pointer to the first variable header in given variable store area.
    628628
    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
    630630  store area. The variable store area is given by its start address.
    631631
     
    676676             VarStoreHeaderAddress,
    677677             sizeof (VARIABLE_STORE_HEADER),
    678              &VariableStoreHeader   
     678             &VariableStoreHeader
    679679             );
    680680
     
    686686  Updates variable info entry in EFI system table for statistical information.
    687687
    688   Routine used to track statistical information about variable usage. 
     688  Routine used to track statistical information about variable usage.
    689689  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
    691691  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
    694694  the transaction. Data is allocated by this routine, but never
    695695  freed.
     
    743743    }
    744744
    745    
     745
    746746    for (Entry = gVariableInfo; Entry != NULL; Entry = Entry->Next) {
    747747      if (CompareGuid (VendorGuid, &Entry->VendorGuid)) {
     
    827827  for (Index = 0, Entry = mVariableCache; Index < sizeof (mVariableCache)/sizeof (VARIABLE_CACHE_ENTRY); Index++, Entry++) {
    828828    if (CompareGuid (VendorGuid, Entry->Guid)) {
    829       if (StrCmp (VariableName, Entry->Name) == 0) { 
     829      if (StrCmp (VariableName, Entry->Name) == 0) {
    830830        Entry->Attributes = Attributes;
    831831        if (DataSize == 0) {
     
    929929    }
    930930  }
    931  
     931
    932932  return EFI_NOT_FOUND;
    933933}
     
    10041004    }
    10051005    while (IsValidVariableHeader (Variable[Index], Volatile, Global, Instance, &VariableHeader)) {
    1006       if (VariableHeader.State == VAR_ADDED || 
     1006      if (VariableHeader.State == VAR_ADDED ||
    10071007          VariableHeader.State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)
    10081008         ) {
     
    11631163    // Collect VAR_ADDED variables, and variables in delete transition status.
    11641164    //
    1165     if (VariableHeader.State == VAR_ADDED || 
     1165    if (VariableHeader.State == VAR_ADDED ||
    11661166        VariableHeader.State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)
    11671167       ) {
     
    11741174
    11751175  //
    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  //
    11791179  MaximumBufferSize += 1;
    11801180  ValidBuffer = AllocatePool (MaximumBufferSize);
     
    11931193  //
    11941194  // Reinstall all ADDED variables
    1195   // 
     1195  //
    11961196  Variable = GetStartPointer (VariableBase);
    11971197  while (IsValidVariableHeader (Variable, IsVolatile, VariableGlobal, Instance, &VariableHeader)) {
     
    12111211  //
    12121212  // Reinstall in delete transition variables
    1213   // 
     1213  //
    12141214  Variable = GetStartPointer (VariableBase);
    12151215  while (IsValidVariableHeader (Variable, IsVolatile, VariableGlobal, Instance, &VariableHeader)) {
     
    12181218
    12191219      //
    1220       // Buffer has cached all ADDED variable. 
     1220      // Buffer has cached all ADDED variable.
    12211221      // 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      //
    12241224      FoundAdded = FALSE;
    12251225      AddedVariable = GetStartPointer ((EFI_PHYSICAL_ADDRESS) ValidBuffer);
     
    13281328  IN  CHAR8            *Lang,
    13291329  IN  BOOLEAN          Iso639Language
    1330   ) 
     1330  )
    13311331{
    13321332  UINTN    Index;
     
    13631363      //
    13641364      for (CompareLength = 0; SupportedLang[CompareLength] != '\0' && SupportedLang[CompareLength] != ';'; CompareLength++);
    1365      
    1366       if ((CompareLength == LanguageLength) && 
     1365
     1366      if ((CompareLength == LanguageLength) &&
    13671367          (AsciiStrnCmp (Lang, SupportedLang, CompareLength) == 0)) {
    13681368        //
     
    14661466
    14671467/**
    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
    14721472  code types may not be mixed in a single call to this function. This function
    14731473  supports a variable argument list that allows the caller to pass in a prioritized
     
    14771477
    14781478  @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
    14801480                                  specified by Iso639Language.
    14811481  @param[in]  Iso639Language      If TRUE, then all language codes are assumed to be
     
    14831483                                  codes are assumed to be in RFC 4646 language format.
    14841484  @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
    14861486                                  Null-terminated ASCII strings that contain one or more
    14871487                                  language codes in the format specified by Iso639Language.
    14881488                                  The first language code from each of these language
    14891489                                  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
    14911491                                  SupportedLanguages.  Close matches only apply to RFC 4646
    14921492                                  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
    14941494                                  an exact or close match is found, then the matching
    14951495                                  language code from SupportedLanguages is returned.  If
    14961496                                  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
    14981498                                  is terminated by a NULL.
    14991499
    15001500  @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
    15021502                 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
    15041504                 language in SupportedLanguages.
    15051505
     
    15071507CHAR8 *
    15081508VariableGetBestLanguage (
    1509   IN CONST CHAR8  *SupportedLanguages, 
     1509  IN CONST CHAR8  *SupportedLanguages,
    15101510  IN BOOLEAN      Iso639Language,
    15111511  IN BOOLEAN      VirtualMode,
     
    15831583      } else {
    15841584        //
    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
    15861586        //
    15871587        for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);
     
    15921592
    15931593  //
    1594   // No matches were found 
     1594  // No matches were found
    15951595  //
    15961596  return NULL;
     
    16651665
    16661666    //
    1667     // PlatformLang holds a single language from PlatformLangCodes, 
     1667    // PlatformLang holds a single language from PlatformLangCodes,
    16681668    // so the size of PlatformLangCodes is enough for the PlatformLang.
    16691669    //
     
    16951695  }
    16961696
    1697   if (SetLanguageCodes 
     1697  if (SetLanguageCodes
    16981698      && (Global->PlatformLangCodes[VirtualMode] != NULL)
    16991699      && (Global->LangCodes[VirtualMode] != NULL)) {
     
    17331733               sizeof (DataSize),
    17341734               &DataSize
    1735                ); 
     1735               );
    17361736    ASSERT_EFI_ERROR (Status);
    17371737  }
     
    18121812
    18131813        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,
    18191819                   0,
    18201820                   0,
    1821                    VirtualMode, 
    1822                    Global, 
     1821                   VirtualMode,
     1822                   Global,
    18231823                   &Variable
    18241824                   );
     
    18321832
    18331833/**
    1834   Update the variable region with Variable information. These are the same 
     1834  Update the variable region with Variable information. These are the same
    18351835  arguments as the EFI Variable services.
    18361836
     
    18411841  @param[in] Attributes         Attributes of the variable.
    18421842  @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.
    18441844  @param[in] VirtualMode        Current calling mode for this function.
    18451845  @param[in] Global             Context of this Extended SAL Variable Services Class call.
     
    18571857  IN      VOID                    *Data,
    18581858  IN      UINTN                   DataSize,
    1859   IN      UINT32                  Attributes OPTIONAL, 
     1859  IN      UINT32                  Attributes OPTIONAL,
    18601860  IN      UINT32                  KeyIndex  OPTIONAL,
    18611861  IN      UINT64                  MonotonicCount  OPTIONAL,
     
    18991899    //
    19001900    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
    19061906      // return EFI_WRITE_PROTECTED.
    19071907      //
     
    19151915      if ((VariableHeader.Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
    19161916        Status = EFI_INVALID_PARAMETER;
    1917         goto Done;     
     1917        goto Done;
    19181918      }
    19191919    }
     
    19221922    // specified causes it to be deleted.
    19231923    //
    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) {
    19251925      State = VariableHeader.State;
    19261926      State &= VAR_DELETED;
     
    19341934                 sizeof (UINT8),
    19351935                 &State
    1936                  ); 
     1936                 );
    19371937      if (!EFI_ERROR (Status)) {
    19381938        UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, FALSE, TRUE, FALSE);
    19391939        UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
    19401940      }
    1941       goto Done;     
     1941      goto Done;
    19421942    }
    19431943    //
     
    19721972                 sizeof (UINT8),
    19731973                 &State
    1974                  );     
     1974                 );
    19751975      if (EFI_ERROR (Status)) {
    1976         goto Done; 
    1977       }
    1978     }   
     1976        goto Done;
     1977      }
     1978    }
    19791979  } else {
    19801980    //
    19811981    // Create a new variable
    1982     // 
    1983    
     1982    //
     1983
    19841984    //
    19851985    // 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.
    19871987    //
    19881988    if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {
     
    19901990      goto Done;
    19911991    }
    1992    
     1992
    19931993    //
    19941994    // Only variable have NV|RT attribute can be created in Runtime
     
    19981998      Status = EFI_INVALID_PARAMETER;
    19991999      goto Done;
    2000     }         
     2000    }
    20012001  }
    20022002
     
    20512051    //
    20522052    Volatile = FALSE;
    2053    
     2053
    20542054    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)
    20562056             && ((HEADER_ALIGN (VarSize) + Global->HwErrVariableTotalSize) > PcdGet32(PcdHwErrStorageSize)))
    2057              || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0) 
     2057             || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
    20582058             && ((HEADER_ALIGN (VarSize) + Global->CommonVariableTotalSize) > VariableStoreHeader.Size - sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize)))) {
    20592059      if (EfiAtRuntime ()) {
     
    20732073      // If still no enough space, return out of resources
    20742074      //
    2075       if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) 
     2075      if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0)
    20762076               && ((HEADER_ALIGN (VarSize) + Global->HwErrVariableTotalSize) > PcdGet32(PcdHwErrStorageSize)))
    2077                || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0) 
     2077               || (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
    20782078               && ((HEADER_ALIGN (VarSize) + Global->CommonVariableTotalSize) > VariableStoreHeader.Size - sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize)))) {
    20792079        Status = EFI_OUT_OF_RESOURCES;
     
    20842084    // Four steps
    20852085    // 1. Write variable header
    2086     // 2. Set variable state to header valid 
     2086    // 2. Set variable state to header valid
    20872087    // 3. Write variable data
    20882088    // 4. Set variable state to valid
     
    21662166    //
    21672167    // Create a volatile variable
    2168     //     
     2168    //
    21692169    Volatile = TRUE;
    21702170
     
    22412241  This function implements EsalGetVariable function of Extended SAL Variable Services Class.
    22422242  It is equivalent in functionality to the EFI Runtime Service GetVariable().
    2243  
     2243
    22442244  @param[in]      VariableName    A Null-terminated Unicode string that is the name of
    22452245                                  the vendor's variable.
    22462246  @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
    22482248                                  attributes bitmask for the variable.
    22492249  @param[in, out] DataSize        Size of Data found. If size is less than the
    22502250                                  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.
    22522252                                  On output, the size of data returned in Data.
    22532253  @param[in]      VirtualMode     Current calling mode for this function.
    22542254  @param[in]      Global          Context of this Extended SAL Variable Services Class call.
    22552255
    2256   @retval EFI_SUCCESS            The function completed successfully. 
     2256  @retval EFI_SUCCESS            The function completed successfully.
    22572257  @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
    22592259                                 been updated with the size needed to complete the request.
    22602260  @retval EFI_INVALID_PARAMETER  VariableName is NULL.
     
    23502350    UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, TRUE, FALSE, FALSE, FALSE);
    23512351    UpdateVariableCache (VariableName, VendorGuid, VariableHeader.Attributes, VarDataSize, Data);
    2352  
     2352
    23532353    Status = EFI_SUCCESS;
    23542354    goto Done;
     
    23722372  This function implements EsalGetNextVariableName function of Extended SAL Variable Services Class.
    23732373  It is equivalent in functionality to the EFI Runtime Service GetNextVariableName().
    2374  
     2374
    23752375  @param[in, out] VariableNameSize Size of the variable
    23762376  @param[in, out] VariableName     On input, supplies the last VariableName that was returned by GetNextVariableName().
    23772377                                   On output, returns the Null-terminated Unicode string of the current variable.
    23782378  @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.
    23802380  @param[in]      VirtualMode      Current calling mode for this function.
    23812381  @param[in]      Global           Context of this Extended SAL Variable Services Class call.
    23822382
    2383   @retval EFI_SUCCESS             The function completed successfully. 
     2383  @retval EFI_SUCCESS             The function completed successfully.
    23842384  @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.
    23862386                                  VariableNameSize has been updated with the size needed to complete the request.
    23872387  @retval EFI_INVALID_PARAMETER   VariableNameSize is NULL.
     
    25132513  This function implements EsalSetVariable function of Extended SAL Variable Services Class.
    25142514  It is equivalent in functionality to the EFI Runtime Service SetVariable().
    2515  
     2515
    25162516  @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
    25202520                                 string, then EFI_INVALID_PARAMETER is returned.
    25212521  @param[in]  VendorGuid         A unique identifier for the vendor.
     
    25272527  @param[in]  Global             Context of this Extended SAL Variable Services Class call.
    25282528
    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
    25302530                                 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
    25322532                                 DataSize exceeds the maximum allowed.
    25332533  @retval EFI_INVALID_PARAMETER  VariableName is an empty Unicode string.
     
    25672567  if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) {
    25682568    return EFI_INVALID_PARAMETER;
    2569   } 
     2569  }
    25702570
    25712571  if (DataSize != 0 && Data == NULL) {
     
    25862586      //
    25872587      return EFI_SECURITY_VIOLATION;
    2588     } 
    2589     PayloadSize = DataSize - AUTHINFO_SIZE; 
     2588    }
     2589    PayloadSize = DataSize - AUTHINFO_SIZE;
    25902590  } else {
    2591     PayloadSize = DataSize; 
    2592   }
    2593 
    2594  
     2591    PayloadSize = DataSize;
     2592  }
     2593
     2594
    25952595  if ((UINTN)(~0) - PayloadSize < StrSize(VariableName)){
    25962596    //
    2597     // Prevent whole variable size overflow 
    2598     // 
     2597    // Prevent whole variable size overflow
     2598    //
    25992599    return EFI_INVALID_PARAMETER;
    26002600  }
     
    26262626    if (StrSize (VariableName) + PayloadSize > PcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER)) {
    26272627      return EFI_INVALID_PARAMETER;
    2628     } 
    2629   } 
     2628    }
     2629  }
    26302630
    26312631  AcquireLockOnlyAtBootTime(&VariableGlobal->VariableServicesLock);
     
    26772677        //
    26782678        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,
    26882688                   &Variable
    26892689                   );
    26902690      } else {
    26912691        //
    2692         // Update variable as usual 
     2692        // Update variable as usual
    26932693        //
    26942694        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,
    27042704                   &Variable
    27052705                   );
     
    27212721  @param[in]  Attributes                   Attributes bitmask to specify the type of variables
    27222722                                           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
    27262726                                           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
    27282728                                           associated with the attributes specified.
    27292729  @param[in]  VirtualMode                  Current calling mode for this function
     
    27322732  @retval EFI_SUCCESS                      Valid answer returned.
    27332733  @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,
    27362736                                           MaximumVariableSize are undefined.
    27372737**/
     
    27652765    return EFI_INVALID_PARAMETER;
    27662766  }
    2767  
     2767
    27682768  if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) == 0) {
    27692769    //
    27702770    // Make sure the Attributes combination is supported by the platform.
    27712771    //
    2772     return EFI_UNSUPPORTED; 
     2772    return EFI_UNSUPPORTED;
    27732773  } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
    27742774    //
     
    29182918
    29192919  VarSize = ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase))->Size;
    2920   Status  = EFI_SUCCESS; 
     2920  Status  = EFI_SUCCESS;
    29212921  //
    29222922  //Allowable max size of common variable storage space
     
    29252925
    29262926  RemainingCommonVariableSpace = CommonVariableSpace - mVariableModuleGlobal->CommonVariableTotalSize;
    2927  
     2927
    29282928  RemainingHwErrVariableSpace = PcdGet32 (PcdHwErrStorageSize) - mVariableModuleGlobal->HwErrVariableTotalSize;
    29292929  //
     
    29312931  //
    29322932  if ((RemainingCommonVariableSpace < PcdGet32 (PcdMaxVariableSize))
    2933     || ((PcdGet32 (PcdHwErrStorageSize) != 0) && 
     2933    || ((PcdGet32 (PcdHwErrStorageSize) != 0) &&
    29342934       (RemainingHwErrVariableSpace < PcdGet32 (PcdMaxHardwareErrorVariableSize)))){
    29352935    Status = Reclaim (
     
    30573057  // Note that in EdkII variable driver implementation, Hardware Error Record type variable
    30583058  // 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
    30603060  // PcdFlashNvStorageVariableSize.
    30613061  //
     
    31343134                               EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
    31353135                               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,
    31433143                               0
    31443144                               ).Status;
     
    32383238    //
    32393239    Status = EfiCreateEventReadyToBootEx (
    3240                TPL_NOTIFY, 
    3241                ReclaimForOS, 
    3242                NULL, 
     3240               TPL_NOTIFY,
     3241               ReclaimForOS,
     3242               NULL,
    32433243               &ReadyToBootEvent
    32443244               );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.h

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    6464
    6565///
    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
    6767/// varible size, and excluding the variable header and name size.
    6868///
     
    192192  This function implements EsalGetVariable function of Extended SAL Variable Services Class.
    193193  It is equivalent in functionality to the EFI Runtime Service GetVariable().
    194  
     194
    195195  @param[in]      VariableName    A Null-terminated Unicode string that is the name of
    196196                                  the vendor's variable.
    197197  @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
    199199                                  attributes bitmask for the variable.
    200200  @param[in, out] DataSize        Size of Data found. If size is less than the
    201201                                  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.
    203203                                  On output, the size of data returned in Data.
    204204  @param[in]      VirtualMode     Current calling mode for this function.
    205205  @param[in]      Global          Context of this Extended SAL Variable Services Class call.
    206206
    207   @retval EFI_SUCCESS            The function completed successfully. 
     207  @retval EFI_SUCCESS            The function completed successfully.
    208208  @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
    210210                                 been updated with the size needed to complete the request.
    211211  @retval EFI_INVALID_PARAMETER  VariableName is NULL.
     
    234234  This function implements EsalGetNextVariableName function of Extended SAL Variable Services Class.
    235235  It is equivalent in functionality to the EFI Runtime Service GetNextVariableName().
    236  
     236
    237237  @param[in, out] VariableNameSize Size of the variable
    238238  @param[in, out] VariableName     On input, supplies the last VariableName that was returned by GetNextVariableName().
    239239                                   On output, returns the Null-terminated Unicode string of the current variable.
    240240  @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.
    242242  @param[in]      VirtualMode      Current calling mode for this function.
    243243  @param[in]      Global           Context of this Extended SAL Variable Services Class call.
    244244
    245   @retval EFI_SUCCESS             The function completed successfully. 
     245  @retval EFI_SUCCESS             The function completed successfully.
    246246  @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.
    248248                                  VariableNameSize has been updated with the size needed to complete the request.
    249249  @retval EFI_INVALID_PARAMETER   VariableNameSize is NULL.
     
    268268  This function implements EsalSetVariable function of Extended SAL Variable Services Class.
    269269  It is equivalent in functionality to the EFI Runtime Service SetVariable().
    270  
     270
    271271  @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
    275275                                 string, then EFI_INVALID_PARAMETER is returned.
    276276  @param[in]  VendorGuid         A unique identifier for the vendor.
     
    282282  @param[in]  Global             Context of this Extended SAL Variable Services Class call.
    283283
    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
    285285                                 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
    287287                                 DataSize exceeds the maximum allowed.
    288288  @retval EFI_INVALID_PARAMETER  VariableName is an empty Unicode string.
     
    315315  @param[in]  Attributes                   Attributes bitmask to specify the type of variables
    316316                                           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
    320320                                           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
    322322                                           associated with the attributes specified.
    323323  @param[in]  VirtualMode                  Current calling mode for this function
     
    326326  @retval EFI_SUCCESS                      Valid answer returned.
    327327  @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,
    330330                                           MaximumVariableSize are undefined.
    331331**/
     
    437437
    438438/**
    439   Update the variable region with Variable information. These are the same 
     439  Update the variable region with Variable information. These are the same
    440440  arguments as the EFI Variable services.
    441441
     
    446446  @param[in] Attributes         Attributes of the variable.
    447447  @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.
    449449  @param[in] VirtualMode        Current calling mode for this function.
    450450  @param[in] Global             Context of this Extended SAL Variable Services Class call.
     
    462462  IN      VOID                    *Data,
    463463  IN      UINTN                   DataSize,
    464   IN      UINT32                  Attributes OPTIONAL, 
     464  IN      UINT32                  Attributes OPTIONAL,
    465465  IN      UINT32                  KeyIndex  OPTIONAL,
    466466  IN      UINT64                  MonotonicCount  OPTIONAL,
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/Pei/Variable.c

    r58459 r58466  
    11/** @file
    22  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
    44  storage space.
    55
    66Copyright (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 
     7This program and the accompanying materials
     8are licensed and made available under the terms and conditions of the BSD License
     9which accompanies this distribution.  The full text of the license may be found at
    1010http://opensource.org/licenses/bsd-license.php
    1111
    12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1313WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1414
     
    3434/**
    3535  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.
    3838                       Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().
    3939  @param  PeiServices  General purpose services available to every PEIM.
     
    193193{
    194194  UINTN Value;
    195  
     195
    196196  //
    197197  // Be careful about pad size for alignment
     
    451451
    452452        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) :
    455455                                                PcdGet32 (PcdFlashNvStorageVariableBase)
    456456                                               );
     
    493493          break;
    494494        }
    495        
     495
    496496        VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINT8 *) FvHeader + FvHeader->HeaderLength);
    497497
     
    503503          // If it's the first time to access variable region in flash, create a guid hob to record
    504504          // 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
    506506          // VAR_ADDED type variables to reduce access time.
    507507          //
     
    619619  EFI_PHYSICAL_ADDRESS  SpareAddress;
    620620  UINTN                 PartialSize;
    621  
     621
    622622  if (StoreInfo->FtwLastWriteData != NULL) {
    623623    TargetAddress = StoreInfo->FtwLastWriteData->TargetAddress;
     
    826826               StoreInfo,
    827827               VariableName,
    828                VendorGuid, 
     828               VendorGuid,
    829829               PtrTrack
    830830               );
     
    840840  This service retrieves a variable's value using its name and GUID.
    841841
    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
    843843  buffer is too small to hold the contents of the variable, the error
    844844  EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer
     
    856856  @retval EFI_SUCCESS           The variable was read successfully.
    857857  @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
    860860                                the specified variable.
    861861  @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.
     
    921921  Return the next variable name and GUID.
    922922
    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,
    928928  EFI_NOT_FOUND is returned.
    929929
     
    934934  @param  VariableName      On entry, a pointer to a null-terminated string that is the variable's name.
    935935                            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.
    937937                            On return, a pointer to the next variable's GUID.
    938938
     
    10131013      }
    10141014      //
    1015       // Capture the case that 
     1015      // Capture the case that
    10161016      // 1. current storage is the last one, or
    10171017      // 2. no further storage
     
    10541054                   &StoreInfoForHob,
    10551055                   GetVariableNamePtr (Variable.CurrPtr),
    1056                    &VariableHeader->VendorGuid, 
     1056                   &VariableHeader->VendorGuid,
    10571057                   &VariableInHob
    10581058                   );
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/Pei/Variable.h

    r58459 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    5555/**
    5656  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.
    5959                      Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().
    6060  @param  PeiServices  General purpose services available to every PEIM.
     
    7474  This service retrieves a variable's value using its name and GUID.
    7575
    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
    7777  buffer is too small to hold the contents of the variable, the error
    7878  EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer
     
    9090  @retval EFI_SUCCESS           The variable was read successfully.
    9191  @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
    9494                                the specified variable.
    9595  @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.
     
    111111  Return the next variable name and GUID.
    112112
    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,
    118118  EFI_NOT_FOUND is returned.
    119119
     
    124124                            On return, points to the next variable's null-terminated name string.
    125125
    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.
    127127                            On return, a pointer to the next variable's GUID.
    128128
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c

    r58459 r58466  
    1010     The whole SMM authentication variable design relies on the integrity of flash part and SMM.
    1111  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,
    1313  the authentication service provided in this driver will be broken, and the behavior is undefined.
    1414
     
    8989  @retval TRUE      This variable is protected, only a physical present user could set this variable.
    9090  @retval FALSE     This variable is not protected.
    91  
     91
    9292**/
    9393BOOLEAN
     
    101101    return TRUE;
    102102  }
    103  
     103
    104104  return FALSE;
    105105}
     
    123123    return TRUE;
    124124  }
    125  
     125
    126126  return FALSE;
    127127}
     
    257257    ASSERT ((DataSize != 0) && (Data != NULL));
    258258    //
    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)
    260260    //  Therefore, there is no memory overflow in underlying CopyMem.
    261261    //
     
    270270    DEBUG ((EFI_D_INFO, "Variable %s exists.\n", EFI_PLATFORM_KEY_NAME));
    271271  }
    272  
     272
    273273  //
    274274  // Create "SetupMode" variable with BS+RT attribute set.
     
    294294    return Status;
    295295  }
    296  
     296
    297297  //
    298298  // Create "SignatureSupport" variable with BS+RT attribute set.
     
    391391    return Status;
    392392  }
    393  
     393
    394394  DEBUG ((EFI_D_INFO, "Variable %s is %x\n", EFI_CUSTOM_MODE_NAME, CustomMode));
    395395
    396396  //
    397397  // 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
    399399  // EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.
    400400  //
     
    424424      return Status;
    425425    }
    426   } 
     426  }
    427427
    428428  //
     
    481481
    482482  @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
    484484
    485485  @return                             Index of new added item
     
    544544        return 0;
    545545      }
    546      
     546
    547547      Status = Reclaim (
    548548                 mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase,
     
    574574      ASSERT ((DataSize != 0) && (Data != NULL));
    575575      //
    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)
    577577      //  Therefore, there is no memory overflow in underlying CopyMem.
    578578      //
     
    582582      if (mPubKeyNumber == mMaxKeyNumber) {
    583583        return 0;
    584       }     
     584      }
    585585    }
    586586
     
    657657  VOID                            *Rsa;
    658658  UINTN                           PayloadSize;
    659  
     659
    660660  PayloadSize = DataSize - AUTHINFO_SIZE;
    661661  Rsa         = NULL;
     
    895895  @return EFI_INVALID_PARAMETER           Invalid signature list format.
    896896  @return EFI_SUCCESS                     Passed signature list format check successfully.
    897  
     897
    898898**/
    899899EFI_STATUS
     
    923923    IsPk = TRUE;
    924924  } else if ((CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && StrCmp (VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0) ||
    925              (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 
     925             (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) &&
    926926              (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0 || StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))){
    927927    IsPk = FALSE;
     
    943943      if (CompareGuid (&SigList->SignatureType, &mSupportSigItem[Index].SigType)) {
    944944        //
    945         // The value of SignatureSize should always be 16 (size of SignatureOwner 
     945        // The value of SignatureSize should always be 16 (size of SignatureOwner
    946946        // component) add the data length according to signature type.
    947947        //
    948         if (mSupportSigItem[Index].SigDataSize != ((UINT32) ~0) && 
     948        if (mSupportSigItem[Index].SigDataSize != ((UINT32) ~0) &&
    949949          (SigList->SignatureSize - sizeof (EFI_GUID)) != mSupportSigItem[Index].SigDataSize) {
    950950          return EFI_INVALID_PARAMETER;
     
    987987    }
    988988    SigCount += (SigList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - SigList->SignatureHeaderSize) / SigList->SignatureSize;
    989    
     989
    990990    SigDataSize -= SigList->SignatureListSize;
    991991    SigList = (EFI_SIGNATURE_LIST *) ((UINT8 *) SigList + SigList->SignatureListSize);
     
    10081008  @return EFI_SUCCESS           Variable is updated successfully.
    10091009  @return Others                Failed to update variable.
    1010  
     1010
    10111011**/
    10121012EFI_STATUS
     
    10221022  }
    10231023  mVendorKeyState = VENDOR_KEYS_MODIFIED;
    1024  
     1024
    10251025  FindVariable (EFI_VENDOR_KEYS_NV_VARIABLE_NAME, &gEfiVendorKeysNvGuid, &Variable, &mVariableModuleGlobal->VariableGlobal, FALSE);
    10261026  Status = UpdateVariable (
     
    10941094  UINTN                       PayloadSize;
    10951095
    1096   if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0 || 
     1096  if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0 ||
    10971097      (Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) {
    10981098    //
     
    12541254      return Status;
    12551255    }
    1256    
     1256
    12571257    Status = UpdateVariable (
    12581258               VariableName,
     
    13391339    return EFI_SECURITY_VIOLATION;
    13401340  }
    1341  
     1341
    13421342  //
    13431343  // A time-based authenticated variable and a count-based authenticated variable
    13441344  // can't be updated by each other.
    1345   // 
    1346   if (Variable->CurrPtr != NULL) {   
     1345  //
     1346  if (Variable->CurrPtr != NULL) {
    13471347    if (((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) &&
    13481348        ((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) &&
    13531353        ((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
    13581358  //
    13591359  // Process Time-based Authenticated variable.
     
    13931393      IsFirstTime = FALSE;
    13941394    }
    1395   } else if ((Variable->CurrPtr != NULL) && 
     1395  } else if ((Variable->CurrPtr != NULL) &&
    13961396             ((Variable->CurrPtr->Attributes & (EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) != 0)
    13971397            ) {
     
    14241424    //
    14251425    // 2 cases need to check here
    1426     //   1. Internal PubKey variable. PubKeyIndex is always 0 
     1426    //   1. Internal PubKey variable. PubKeyIndex is always 0
    14271427    //   2. Other counter-based AuthVariable. Check input PubKey.
    14281428    //
     
    14791479  @param[in, out]  Data              Pointer to original EFI_SIGNATURE_LIST.
    14801480  @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
    14821482  @param[in]       NewData           Pointer to new EFI_SIGNATURE_LIST to be appended.
    14831483  @param[in]       NewDataSize       Size of NewData buffer.
     
    17151715      // Check whether VariableName matches.
    17161716      //
    1717       if ((NameSize == StrLen (VariableName)) && 
     1717      if ((NameSize == StrLen (VariableName)) &&
    17181718          (CompareMem (Data + Offset, VariableName, NameSize * sizeof (CHAR16)) == 0)) {
    17191719        Offset = Offset + NameSize * sizeof (CHAR16);
     
    17241724
    17251725        if (CertDataSize != NULL) {
    1726           *CertDataSize = CertSize;       
     1726          *CertDataSize = CertSize;
    17271727        }
    17281728
     
    17451745  }
    17461746
    1747   return EFI_NOT_FOUND; 
     1747  return EFI_NOT_FOUND;
    17481748}
    17491749
     
    17791779    return EFI_INVALID_PARAMETER;
    17801780  }
    1781  
     1781
    17821782  //
    17831783  // Get variable "certdb".
     
    17891789             &mVariableModuleGlobal->VariableGlobal,
    17901790             FALSE
    1791              );     
     1791             );
    17921792  if (EFI_ERROR (Status)) {
    17931793    return Status;
     
    18521852    return EFI_INVALID_PARAMETER;
    18531853  }
    1854  
     1854
    18551855  //
    18561856  // Get variable "certdb".
     
    18621862             &mVariableModuleGlobal->VariableGlobal,
    18631863             FALSE
    1864              );     
     1864             );
    18651865  if (EFI_ERROR (Status)) {
    18661866    return Status;
     
    19301930  //
    19311931  // 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;
    19341934  Status   = UpdateVariable (
    19351935               EFI_CERT_DB_NAME,
     
    19851985    return EFI_INVALID_PARAMETER;
    19861986  }
    1987  
     1987
    19881988  //
    19891989  // Get variable "certdb".
     
    19951995             &mVariableModuleGlobal->VariableGlobal,
    19961996             FALSE
    1997              );     
     1997             );
    19981998  if (EFI_ERROR (Status)) {
    19991999    return Status;
     
    20312031  //
    20322032  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);
    20342034  NewCertDbSize = (UINT32) DataSize + CertNodeSize;
    20352035  if (NewCertDbSize > mMaxCertDbSize) {
     
    20542054  CopyMem (&Ptr->NameSize, &NameSize, sizeof (UINT32));
    20552055  CopyMem (&Ptr->CertDataSize, &CertDataSize, sizeof (UINT32));
    2056  
     2056
    20572057  CopyMem (
    20582058    (UINT8 *) Ptr + sizeof (AUTH_CERT_DB_DATA),
     
    20662066    CertDataSize
    20672067    );
    2068  
     2068
    20692069  //
    20702070  // 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;
    20732073  Status   = UpdateVariable (
    20742074               EFI_CERT_DB_NAME,
     
    23772377        goto Exit;
    23782378      }
    2379    
     2379
    23802380      if ((CertStackSize != CertsSizeinDb) ||
    23812381          (CompareMem (SignerCerts, CertsInCertDb, CertsSizeinDb) != 0)) {
     
    24202420    RootCert      = Cert->SignatureData;
    24212421    RootCertSize  = CertList->SignatureSize - (sizeof (EFI_SIGNATURE_DATA) - 1);
    2422    
     2422
    24232423    // Verify Pkcs7 SignedData via Pkcs7Verify library.
    24242424    //
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.h

    r58459 r58466  
    1010     The whole SMM authentication variable design relies on the integrity of flash part and SMM.
    1111  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,
    1313  the authentication service provided in this driver will be broken, and the behavior is undefined.
    1414
     
    5151/// "certdb" variable stores the signer's certificates for non PK/KEK/DB/DBX
    5252/// variables with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.
    53 /// 
     53///
    5454///
    5555#define EFI_CERT_DB_NAME        L"certdb"
     
    168168  @return EFI_INVALID_PARAMETER           Invalid signature list format.
    169169  @return EFI_SUCCESS                     Passed signature list format check successfully.
    170  
     170
    171171**/
    172172EFI_STATUS
     
    255255  @param[in, out]  Data             Pointer to original EFI_SIGNATURE_LIST.
    256256  @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
    258258  @param[in]       NewData          Pointer to new EFI_SIGNATURE_LIST to be appended.
    259259  @param[in]       NewDataSize      Size of NewData buffer.
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Measurement.c

    r58464 r58466  
    5757
    5858  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) &&
    6060        (CompareGuid (VendorGuid, mVariableType[Index].VendorGuid))) {
    6161      return TRUE;
     
    7070  @param[in]  VarName           A Null-terminated string that is the name of the vendor's variable.
    7171  @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
    7575  @retval EFI_SUCCESS           Operation completed successfully.
    7676  @retval EFI_OUT_OF_RESOURCES  Out of memory.
     
    135135
    136136/**
    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
    139139  returned buffer is allocated using AllocatePool().  The caller is responsible
    140140  for freeing this buffer with FreePool().
     
    171171    *Size  = 0;
    172172  }
    173  
     173
    174174  Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
    175175  if (Status != EFI_BUFFER_TOO_SMALL) {
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c

    r58459 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c

    r58459 r58466  
    593593  Check the PubKeyIndex is a valid key or not.
    594594
    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
    596596  by any valid count-based auth variabe.
    597  
     597
    598598  @param[in]  PubKeyIndex     Index of the public key in public key store.
    599599
    600600  @retval     TRUE            The PubKeyIndex is still in use.
    601601  @retval     FALSE           The PubKeyIndex is not referenced by any count-based auth variabe.
    602  
     602
    603603**/
    604604BOOLEAN
     
    618618
    619619  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)) &&
    621621        Variable->PubKeyIndex == PubKeyIndex) {
    622622      return TRUE;
     
    624624    Variable = GetNextVariablePtr (Variable);
    625625  }
    626  
     626
    627627  return FALSE;
    628628}
     
    631631
    632632  Get the number of valid public key in PubKeyStore.
    633  
     633
    634634  @param[in]  PubKeyNumber     Number of the public key in public key store.
    635635
     
    646646
    647647  Counter = 0;
    648  
     648
    649649  for (PubKeyIndex = 1; PubKeyIndex <= PubKeyNumber; PubKeyIndex++) {
    650650    if (IsValidPubKeyIndex (PubKeyIndex)) {
     
    652652    }
    653653  }
    654  
     654
    655655  return Counter;
    656656}
     
    660660  Filter the useless key in public key store.
    661661
    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
    663663  buffer NewPubKeyStore, and give the new PubKeyIndex. The caller is responsible for freeing buffer
    664664  NewPubKeyIndex and NewPubKeyStore with FreePool().
     
    669669  @param[out]  NewPubKeyStore       Saved all valid public keys in PubKeyStore.
    670670  @param[out]  NewPubKeySize        Buffer size of the NewPubKeyStore.
    671  
     671
    672672  @retval  EFI_SUCCESS              Trim operation is complete successfully.
    673673  @retval  EFI_OUT_OF_RESOURCES     No enough memory resources, or no useless key in PubKeyStore.
    674  
     674
    675675**/
    676676EFI_STATUS
     
    686686  UINT32        CopiedKey;
    687687  UINT32        NewPubKeyNumber;
    688  
     688
    689689  NewPubKeyNumber = GetValidPubKeyNumber (PubKeyNumber);
    690690  if (NewPubKeyNumber == PubKeyNumber) {
     
    740740  @param[in]      NewVariableSize         New variable size.
    741741  @param[in]      ReclaimPubKeyStore      Reclaim for public key database or not.
    742  
     742
    743743  @return EFI_SUCCESS                  Reclaim operation has finished successfully.
    744744  @return EFI_OUT_OF_RESOURCES         No enough memory resources or variable space.
     
    874874      NextVariable = GetNextVariablePtr (Variable);
    875875      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) &&
    877877            (CompareGuid (&Variable->VendorGuid, &gEfiAuthenticatedVariableGuid))) {
    878878          //
     
    883883          continue;
    884884        }
    885        
     885
    886886        VariableSize = (UINTN) NextVariable - (UINTN) Variable;
    887887        CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize);
     
    910910    StrCpy (GetVariableNamePtr (Variable), GetVariableNamePtr (PubKeyHeader));
    911911    CopyMem (GetVariableDataPtr (Variable), NewPubKeyStore, NewPubKeySize);
    912     CurrPtr = (UINT8*) GetNextVariablePtr (Variable); 
     912    CurrPtr = (UINT8*) GetNextVariablePtr (Variable);
    913913    CommonVariableTotalSize += (UINTN) CurrPtr - (UINTN) Variable;
    914914  } else {
     
    15251525  @param[in] Attributes         Variable attributes for Variable entries.
    15261526  @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
    15281528                                VARIABLE_ENTRY_CONSISTENCY is the variable data size as input.
    15291529                                It will be changed to variable total size as output.
     
    18041804        VariableEntry[0].Guid = &gEfiGlobalVariableGuid;
    18051805        VariableEntry[0].Name = EFI_LANG_VARIABLE_NAME;
    1806        
     1806
    18071807        VariableEntry[1].VariableSize = AsciiStrSize (BestPlatformLang);
    18081808        VariableEntry[1].Guid = &gEfiGlobalVariableGuid;
     
    20102010        goto Done;
    20112011      }
    2012      
     2012
    20132013      //
    20142014      // Only variable that have RT attributes can be updated/deleted in Runtime.
     
    21042104
    21052105        //
    2106         // Set Max Common Variable Data Size as default MaxDataSize 
     2106        // Set Max Common Variable Data Size as default MaxDataSize
    21072107        //
    21082108        MaxDataSize = PcdGet32 (PcdMaxVariableSize) - DataOffset;
     
    21172117          Status = AppendSignatureList (
    21182118                     BufferForMerge,
    2119                      Variable->CurrPtr->DataSize, 
     2119                     Variable->CurrPtr->DataSize,
    21202120                     MaxDataSize - Variable->CurrPtr->DataSize,
    21212121                     Data,
     
    25312531  Check if a Unicode character is a hexadecimal character.
    25322532
    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
    25352535  L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
    25362536
     
    27022702  @retval TRUE      This variable is read-only variable.
    27032703  @retval FALSE     This variable is NOT read-only variable.
    2704  
     2704
    27052705**/
    27062706BOOLEAN
     
    27232723    }
    27242724  }
    2725  
     2725
    27262726  return FALSE;
    27272727}
     
    30783078  if ((UINTN)(~0) - PayloadSize < StrSize(VariableName)){
    30793079    //
    3080     // Prevent whole variable size overflow 
    3081     // 
     3080    // Prevent whole variable size overflow
     3081    //
    30823082    return EFI_INVALID_PARAMETER;
    30833083  }
     
    31853185  } else if (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp (VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0)) {
    31863186    Status = ProcessVarWithPk (VariableName, VendorGuid, Data, DataSize, &Variable, Attributes, FALSE);
    3187   } else if (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 
     3187  } else if (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) &&
    31883188          ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))) {
    31893189    Status = ProcessVarWithPk (VariableName, VendorGuid, Data, DataSize, &Variable, Attributes, FALSE);
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h

    r58459 r58466  
    44
    55Copyright (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 
     6This program and the accompanying materials
     7are licensed and made available under the terms and conditions of the BSD License
     8which accompanies this distribution.  The full text of the license may be found at
    99http://opensource.org/licenses/bsd-license.php
    1010
    11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1313
     
    229229  @param[in] Attributes         Variable attributes for Variable entries.
    230230  @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
    232232                                VARIABLE_ENTRY_CONSISTENCY is the variable data size as input.
    233233                                It will be changed to variable total size as output.
     
    243243  ...
    244244  );
    245  
     245
    246246/**
    247247  Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set,
     
    273273  IN      UINT64          MonotonicCount  OPTIONAL,
    274274  IN OUT  VARIABLE_POINTER_TRACK *Variable,
    275   IN      EFI_TIME        *TimeStamp  OPTIONAL 
     275  IN      EFI_TIME        *TimeStamp  OPTIONAL
    276276  );
    277277
     
    279279/**
    280280  Return TRUE if ExitBootServices () has been called.
    281  
     281
    282282  @retval TRUE If ExitBootServices () has been called.
    283283**/
     
    290290  Initializes a basic mutual exclusion lock.
    291291
    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
    294294  priority level.  Since there is no preemption or multiprocessor support in EFI,
    295295  acquiring the lock only consists of raising to the locks TPL.
     
    309309  );
    310310
    311  
     311
    312312/**
    313313  Acquires lock only at boot time. Simply returns at runtime.
     
    343343ReleaseLockOnlyAtBootTime (
    344344  IN EFI_LOCK  *Lock
    345   ); 
     345  );
    346346
    347347/**
     
    355355  @retval EFI_UNSUPPORTED       The device does not support the FVB protocol.
    356356  @retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.
    357  
     357
    358358**/
    359359EFI_STATUS
     
    381381/**
    382382  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.
    384384
    385385  @param[out]  NumberHandles    The number of handles returned in Buffer.
     
    392392  @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the matching results.
    393393  @retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.
    394  
     394
    395395**/
    396396EFI_STATUS
     
    428428  @param[in]      NewVariableSize         New variable size.
    429429  @param[in]      ReclaimPubKeyStore      Reclaim for public key database or not.
    430  
     430
    431431  @return EFI_SUCCESS                  Reclaim operation has finished successfully.
    432432  @return EFI_OUT_OF_RESOURCES         No enough memory resources or variable space.
     
    448448/**
    449449  This function reclaims variable storage if free size is below the threshold.
    450  
     450
    451451**/
    452452VOID
    453453ReclaimForOS(
    454454  VOID
    455   ); 
     455  );
    456456
    457457
     
    467467  VOID
    468468  );
    469  
     469
    470470/**
    471471  Retrive the SMM Fault Tolerent Write protocol interface.
     
    512512                                    data, this value contains the required size.
    513513  @param Data                       Data pointer.
    514                      
     514
    515515  @return EFI_INVALID_PARAMETER     Invalid parameter.
    516516  @return EFI_SUCCESS               Find the specified variable.
     
    645645  OUT UINT64                 *RemainingVariableStorageSize,
    646646  OUT UINT64                 *MaximumVariableSize
    647   ); 
     647  );
    648648
    649649/**
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf

    r58459 r58466  
    22#  Provides authenticated variable service
    33#
    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
    55#  variable services: SetVariable, GetVariable, GetNextVariableName and QueryVariableInfo.
    66#
    77#  Caution: This module requires additional review when modified.
    88#  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
    1010#  buffer overflow or integer overflow.
    1111#
     
    8585  ## SOMETIMES_PRODUCES   ## SystemTable
    8686  gEfiAuthenticatedVariableGuid
    87  
     87
    8888  ## SOMETIMES_CONSUMES   ## Variable:L"PlatformLang"
    8989  ## SOMETIMES_PRODUCES   ## Variable:L"PlatformLang"
     
    9898  ## PRODUCES             ## Variable:L"SecureBoot"
    9999  ## CONSUMES             ## Variable:L"SignatureSupport"
    100   ## PRODUCES             ## Variable:L"SignatureSupport" 
     100  ## PRODUCES             ## Variable:L"SignatureSupport"
    101101  ## PRODUCES             ## Variable:L"VendorKeys"
    102102  gEfiGlobalVariableGuid
    103  
     103
    104104  ## SOMETIMES_CONSUMES   ## Variable:L"DB"
    105105  ## SOMETIMES_CONSUMES   ## Variable:L"DBX"
    106106  gEfiImageSecurityDatabaseGuid
    107  
     107
    108108  ## CONSUMES             ## Variable:L"SecureBootEnable"
    109109  ## PRODUCES             ## Variable:L"SecureBootEnable"
    110110  gEfiSecureBootEnableDisableGuid
    111  
     111
    112112  ## CONSUMES             ## Variable:L"CustomMode"
    113113  ## PRODUCES             ## Variable:L"CustomMode"
    114114  gEfiCustomModeEnableGuid
    115  
     115
    116116  ## CONSUMES             ## Variable:L"certdb"
    117117  ## PRODUCES             ## Variable:L"certdb"
    118118  gEfiCertDbGuid
    119  
     119
    120120  ## CONSUMES             ## Variable:L"VendorKeysNv"
    121121  ## PRODUCES             ## Variable:L"VendorKeysNv"
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c

    r58459 r58466  
    11/** @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
    44  to provide variable services.
    55
     
    1111  SmmVariableHandler() will receive untrusted input and do basic validation.
    1212
    13   Each sub function VariableServiceGetVariable(), VariableServiceGetNextVariableName(), 
    14   VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(), 
     13  Each sub function VariableServiceGetVariable(), VariableServiceGetNextVariableName(),
     14  VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(),
    1515  SmmVariableGetStatistics() should also do validation based on its own knowledge.
    1616
    1717Copyright (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 
     18This program and the accompanying materials
     19are licensed and made available under the terms and conditions of the BSD License
     20which accompanies this distribution.  The full text of the license may be found at
    2121http://opensource.org/licenses/bsd-license.php
    2222
    23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     23THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    2424WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    2525
     
    119119/**
    120120  Return TRUE if ExitBootServices () has been called.
    121  
     121
    122122  @retval TRUE If ExitBootServices () has been called.
    123123**/
     
    133133  Initializes a basic mutual exclusion lock.
    134134
    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
    137137  priority level.  Since there is no preemption or multiprocessor support in EFI,
    138138  acquiring the lock only consists of raising to the locks TPL.
     
    217217  //
    218218  Status = gSmst->SmmLocateProtocol (
    219                     &gEfiSmmFaultTolerantWriteProtocolGuid, 
    220                     NULL, 
     219                    &gEfiSmmFaultTolerantWriteProtocolGuid,
     220                    NULL,
    221221                    FtwProtocol
    222222                    );
     
    256256/**
    257257  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.
    259259
    260260  @param[out]  NumberHandles    The number of handles returned in Buffer.
     
    327327
    328328  @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
    330330                                InfoEntry->VendorGuid is zero, return the first information.
    331331                                On output, point to the next variable information.
     
    334334
    335335  @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
    337337                                PcdVariableCollectStatistics should be set TRUE to support it.
    338338  @retval EFI_BUFFER_TOO_SMALL  The buffer is too small to hold the next variable information.
     
    351351  CHAR16                                               *InfoName;
    352352  EFI_GUID                                             VendorGuid;
    353  
     353
    354354  if (InfoEntry == NULL) {
    355355    return EFI_INVALID_PARAMETER;
    356356  }
    357  
    358   VariableInfo = gVariableInfo; 
     357
     358  VariableInfo = gVariableInfo;
    359359  if (VariableInfo == NULL) {
    360360    return EFI_UNSUPPORTED;
     
    398398    VariableInfo = VariableInfo->Next;
    399399  };
    400    
     400
    401401  if (VariableInfo == NULL) {
    402402    *InfoSize = 0;
     
    416416  CopyMem (InfoName, VariableInfo->Name, StrSize (VariableInfo->Name));
    417417  *InfoSize = StatisticsInfoSize;
    418  
     418
    419419  return EFI_SUCCESS;
    420420}
     
    428428  Caution: This function may receive untrusted input.
    429429  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(),
    432432  SmmVariableGetStatistics() should also do validation based on its own knowledge.
    433433
     
    439439  @param[in, out] CommBufferSize The size of the CommBuffer.
    440440
    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
    442442                                              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
    444444                                              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
    446446                                              be called.
    447447  @retval EFI_INTERRUPT_PENDING               The interrupt could not be quiesced.
     
    492492    return EFI_SUCCESS;
    493493  }
    494  
     494
    495495  SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *)CommBuffer;
    496    
     496
    497497  switch (SmmVariableFunctionHeader->Function) {
    498498    case SMM_VARIABLE_FUNCTION_GET_VARIABLE:
     
    514514        goto EXIT;
    515515      }
    516       InfoSize = OFFSET_OF(SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE, Name) 
     516      InfoSize = OFFSET_OF(SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE, Name)
    517517                 + SmmVariableHeader->DataSize + SmmVariableHeader->NameSize;
    518518
     
    543543      CopyMem (SmmVariableFunctionHeader->Data, mVariableBufferPayload, CommBufferPayloadSize);
    544544      break;
    545      
     545
    546546    case SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME:
    547547      if (CommBufferPayloadSize < OFFSET_OF(SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME, Name)) {
     
    588588      CopyMem (SmmVariableFunctionHeader->Data, mVariableBufferPayload, CommBufferPayloadSize);
    589589      break;
    590      
     590
    591591    case SMM_VARIABLE_FUNCTION_SET_VARIABLE:
    592592      if (CommBufferPayloadSize < OFFSET_OF(SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE, Name)) {
     
    636636                 );
    637637      break;
    638      
     638
    639639    case SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO:
    640640      if (CommBufferPayloadSize < sizeof (SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO)) {
     
    643643      }
    644644      QueryVariableInfo = (SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO *) SmmVariableFunctionHeader->Data;
    645  
     645
    646646      Status = VariableServiceQueryVariableInfo (
    647647                 QueryVariableInfo->Attributes,
     
    661661      Status = EFI_SUCCESS;
    662662      break;
    663  
     663
    664664    case SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE:
    665665      mAtRuntime = TRUE;
     
    672672
    673673      //
    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
    678678      if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)CommBufferSize, sizeof(UINTN))) {
    679679        DEBUG ((EFI_D_ERROR, "GetStatistics: SMM communication buffer in SMRAM!\n"));
    680680        Status = EFI_ACCESS_DENIED;
    681681        goto EXIT;
    682       } 
     682      }
    683683
    684684      Status = SmmVariableGetStatistics (VariableInfo, &InfoSize);
     
    738738  SMM Fault Tolerant Write protocol notification event handler.
    739739
    740   Non-Volatile variable write may needs FTW protocol to reclaim when 
     740  Non-Volatile variable write may needs FTW protocol to reclaim when
    741741  writting variable.
    742  
     742
    743743  @param  Protocol   Points to the protocol's unique identifier
    744744  @param  Interface  Points to the interface instance
     
    747747  @retval EFI_SUCCESS   SmmEventCallback runs successfully
    748748  @retval EFI_NOT_FOUND The Fvb protocol for variable is not found.
    749  
     749
    750750 **/
    751751EFI_STATUS
     
    762762  EFI_PHYSICAL_ADDRESS                    NvStorageVariableBase;
    763763  UINTN                                   FtwMaxBlockSize;
    764  
     764
    765765  if (mVariableModuleGlobal->FvbInstance != NULL) {
    766766    return EFI_SUCCESS;
     
    793793
    794794  mVariableModuleGlobal->FvbInstance = FvbProtocol;
    795  
     795
    796796  Status = VariableWriteServiceInitialize ();
    797797  if (EFI_ERROR (Status)) {
    798798    DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status));
    799799  }
    800  
     800
    801801  //
    802802  // Notify the variable wrapper driver the variable write service is ready
     
    809809                  );
    810810  ASSERT_EFI_ERROR (Status);
    811  
     811
    812812  return EFI_SUCCESS;
    813813}
     
    816816/**
    817817  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
    819819  for variable read and write services being available. It also registers
    820820  a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
    821821
    822   @param[in] ImageHandle    The firmware allocated handle for the EFI image. 
     822  @param[in] ImageHandle    The firmware allocated handle for the EFI image.
    823823  @param[in] SystemTable    A pointer to the EFI System Table.
    824  
     824
    825825  @retval EFI_SUCCESS       Variable service successfully initialized.
    826826
     
    872872  Status = gSmst->SmiHandlerRegister (SmmVariableHandler, &gEfiSmmVariableProtocolGuid, &VariableHandle);
    873873  ASSERT_EFI_ERROR (Status);
    874  
     874
    875875  //
    876876  // Notify the variable wrapper driver the variable service is ready
     
    883883                                        );
    884884  ASSERT_EFI_ERROR (Status);
    885  
     885
    886886  //
    887887  // Register EFI_SMM_END_OF_DXE_PROTOCOL_GUID notify function.
     
    896896  //
    897897  // Register FtwNotificationEvent () notify function.
    898   // 
     898  //
    899899  Status = gSmst->SmmRegisterProtocolNotify (
    900900                    &gEfiSmmFaultTolerantWriteProtocolGuid,
     
    905905
    906906  SmmFtwNotificationEvent (NULL, NULL, NULL);
    907  
     907
    908908  return EFI_SUCCESS;
    909909}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.inf

    r58459 r58466  
    1212#  Caution: This module requires additional review when modified.
    1313#  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
    1515#  buffer overflow or integer overflow.
    1616#    The whole SMM authentication variable design relies on the integrity of flash part and SMM.
    1717#  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,
    1919#  the authentication service provided in this driver will be broken, and the behavior is undefined.
    2020#
     
    7777[Protocols]
    7878  gEfiSmmFirmwareVolumeBlockProtocolGuid        ## CONSUMES
    79  
     79
    8080  ## PRODUCES
    8181  ## UNDEFINED     # SmiHandlerRegister
    8282  gEfiSmmVariableProtocolGuid
    83  
     83
    8484  ## CONSUMES
    85   ## NOTIFY 
     85  ## NOTIFY
    8686  gEfiSmmFaultTolerantWriteProtocolGuid
    8787  gEfiSmmEndOfDxeProtocolGuid              ## NOTIFY
     
    9292  ## SOMETIMES_CONSUMES   ## HOB
    9393  gEfiAuthenticatedVariableGuid
    94  
     94
    9595  ## SOMETIMES_CONSUMES   ## Variable:L"PlatformLang"
    9696  ## SOMETIMES_PRODUCES   ## Variable:L"PlatformLang"
     
    108108  ## PRODUCES             ## Variable:L"VendorKeys"
    109109  gEfiGlobalVariableGuid
    110  
     110
    111111  ## SOMETIMES_CONSUMES   ## Variable:L"DB"
    112112  ## SOMETIMES_CONSUMES   ## Variable:L"DBX"
    113113  gEfiImageSecurityDatabaseGuid
    114  
     114
    115115  ## CONSUMES             ## Variable:L"SecureBootEnable"
    116116  ## PRODUCES             ## Variable:L"SecureBootEnable"
    117117  gEfiSecureBootEnableDisableGuid
    118  
     118
    119119  ## CONSUMES             ## Variable:L"CustomMode"
    120120  ## PRODUCES             ## Variable:L"CustomMode"
    121121  gEfiCustomModeEnableGuid
    122  
     122
    123123  ## CONSUMES             ## Variable:L"certdb"
    124124  ## PRODUCES             ## Variable:L"certdb"
     
    128128  ## PRODUCES             ## Variable:L"VendorKeysNv"
    129129  gEfiVendorKeysNvGuid
    130    
     130
    131131  gSmmVariableWriteGuid                    ## PRODUCES               ## GUID        # Install protocol
    132132  gEfiCertTypeRsa2048Sha256Guid            ## SOMETIMES_CONSUMES     ## GUID        # Unique ID for the format of the CertData.
     
    136136  gEfiHardwareErrorVariableGuid            ## SOMETIMES_CONSUMES     ## Variable:L"HwErrRec####"
    137137  gEdkiiFaultTolerantWriteGuid             ## SOMETIMES_CONSUMES     ## HOB
    138  
     138
    139139[Pcd]
    140140  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize       ## CONSUMES
     
    153153[Depex]
    154154  TRUE
    155  
     155
    156156[UserExtensions.TianoCore."ExtraFiles"]
    157157  VariableSmmExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmmRuntimeDxe.c

    r58459 r58466  
    1515
    1616Copyright (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 
     17This program and the accompanying materials
     18are licensed and made available under the terms and conditions of the BSD License
     19which accompanies this distribution.  The full text of the license may be found at
    2020http://opensource.org/licenses/bsd-license.php
    2121
    22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     22THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    2323WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    2424
     
    4747#include <Guid/SmmVariableCommon.h>
    4848
    49 EFI_HANDLE                       mHandle                    = NULL; 
     49EFI_HANDLE                       mHandle                    = NULL;
    5050EFI_SMM_VARIABLE_PROTOCOL       *mSmmVariable               = NULL;
    5151EFI_EVENT                        mVirtualAddressChangeEvent = NULL;
     
    128128  @param[in]       DataSize         The data size to send to SMM.
    129129  @param[in]       Function         The function number to initialize the communicate header.
    130                      
     130
    131131  @retval EFI_INVALID_PARAMETER     The data size is too big.
    132132  @retval EFI_SUCCESS               Find the specified variable.
     
    140140  )
    141141{
    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
    146146  if (DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE > mVariableBufferSize) {
    147147    return EFI_INVALID_PARAMETER;
     
    151151  CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGuid);
    152152  SmmCommunicateHeader->MessageLength = DataSize + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE;
    153    
     153
    154154  SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
    155155  SmmVariableFunctionHeader->Function = Function;
     
    168168
    169169  @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
    172172**/
    173173EFI_STATUS
     
    178178  EFI_STATUS                                Status;
    179179  UINTN                                     CommSize;
    180   EFI_SMM_COMMUNICATE_HEADER                *SmmCommunicateHeader; 
     180  EFI_SMM_COMMUNICATE_HEADER                *SmmCommunicateHeader;
    181181  SMM_VARIABLE_COMMUNICATE_HEADER           *SmmVariableFunctionHeader;
    182  
     182
    183183  CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE;
    184184  Status = mSmmCommunication->Communicate (mSmmCommunication, mVariableBufferPhysical, &CommSize);
     
    271271                                     data, this value contains the required size.
    272272  @param[out]     Data               Data pointer.
    273                      
     273
    274274  @retval EFI_INVALID_PARAMETER      Invalid parameter.
    275275  @retval EFI_SUCCESS                Find the specified variable.
     
    471471    goto Done;
    472472  }
    473  
     473
    474474  CopyGuid (VendorGuid, &SmmGetNextVariableName->Guid);
    475   CopyMem (VariableName, SmmGetNextVariableName->Name, SmmGetNextVariableName->NameSize); 
     475  CopyMem (VariableName, SmmGetNextVariableName->Name, SmmGetNextVariableName->NameSize);
    476476
    477477Done:
     
    511511{
    512512  EFI_STATUS                                Status;
    513   UINTN                                     PayloadSize; 
     513  UINTN                                     PayloadSize;
    514514  SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE  *SmmVariableHeader;
    515515  UINTN                                     VariableNameSize;
    516    
     516
    517517  //
    518518  // Check input parameters.
     
    520520  if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) {
    521521    return EFI_INVALID_PARAMETER;
    522   } 
     522  }
    523523
    524524  if (DataSize != 0 && Data == NULL) {
     
    641641  *MaximumVariableSize          = SmmQueryVariableInfo->MaximumVariableSize;
    642642  *MaximumVariableStorageSize   = SmmQueryVariableInfo->MaximumVariableStorageSize;
    643   *RemainingVariableStorageSize = SmmQueryVariableInfo->RemainingVariableStorageSize; 
     643  *RemainingVariableStorageSize = SmmQueryVariableInfo->RemainingVariableStorageSize;
    644644
    645645Done:
     
    669669  // SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE.
    670670  //
    671   InitCommunicateBuffer (NULL, 0, SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE); 
     671  InitCommunicateBuffer (NULL, 0, SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE);
    672672
    673673  //
     
    699699  //
    700700  InitCommunicateBuffer (NULL, 0, SMM_VARIABLE_FUNCTION_READY_TO_BOOT);
    701  
     701
    702702  //
    703703  // Send data to SMM.
     
    734734  @param[in] Event    Event whose notification function is being invoked.
    735735  @param[in] Context  Pointer to the notification function's context.
    736  
     736
    737737**/
    738738VOID
     
    749749    return;
    750750  }
    751  
     751
    752752  Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
    753753  ASSERT_EFI_ERROR (Status);
    754  
     754
    755755  //
    756756  // Allocate memory for variable communicate buffer.
     
    771771  gRT->SetVariable         = RuntimeServiceSetVariable;
    772772  gRT->QueryVariableInfo   = RuntimeServiceQueryVariableInfo;
    773  
     773
    774774  //
    775775  // Install the Variable Architectural Protocol on a new handle.
     
    777777  Status = gBS->InstallProtocolInterface (
    778778                  &mHandle,
    779                   &gEfiVariableArchProtocolGuid, 
     779                  &gEfiVariableArchProtocolGuid,
    780780                  EFI_NATIVE_INTERFACE,
    781781                  NULL
     
    790790  @param[in] Event    Event whose notification function is being invoked.
    791791  @param[in] Context  Pointer to the notification function's context.
    792  
     792
    793793**/
    794794VOID
     
    809809    return;
    810810  }
    811  
     811
    812812  Status = gBS->InstallProtocolInterface (
    813813                  &mHandle,
    814                   &gEfiVariableWriteArchProtocolGuid, 
     814                  &gEfiVariableWriteArchProtocolGuid,
    815815                  EFI_NATIVE_INTERFACE,
    816816                  NULL
    817817                  );
    818   ASSERT_EFI_ERROR (Status); 
     818  ASSERT_EFI_ERROR (Status);
    819819}
    820820
     
    822822/**
    823823  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
    825825  for variable read and write services being available. It also registers
    826826  a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
    827827
    828   @param[in] ImageHandle    The firmware allocated handle for the EFI image. 
     828  @param[in] ImageHandle    The firmware allocated handle for the EFI image.
    829829  @param[in] SystemTable    A pointer to the EFI System Table.
    830  
     830
    831831  @retval EFI_SUCCESS       Variable service successfully initialized.
    832832
     
    860860  //
    861861  EfiCreateProtocolNotifyEvent (
    862     &gEfiSmmVariableProtocolGuid, 
    863     TPL_CALLBACK, 
    864     SmmVariableReady, 
    865     NULL, 
     862    &gEfiSmmVariableProtocolGuid,
     863    TPL_CALLBACK,
     864    SmmVariableReady,
     865    NULL,
    866866    &SmmVariableRegistration
    867867    );
     
    871871  //
    872872  EfiCreateProtocolNotifyEvent (
    873     &gSmmVariableWriteGuid, 
    874     TPL_CALLBACK, 
    875     SmmVariableWriteReady, 
    876     NULL, 
     873    &gSmmVariableWriteGuid,
     874    TPL_CALLBACK,
     875    SmmVariableWriteReady,
     876    NULL,
    877877    &SmmVariableWriteRegistration
    878878    );
     
    882882  //
    883883  EfiCreateEventReadyToBootEx (
    884     TPL_NOTIFY, 
    885     OnReadyToBoot, 
    886     NULL, 
     884    TPL_NOTIFY,
     885    OnReadyToBoot,
     886    NULL,
    887887    &OnReadyToBootEvent
    888     );             
     888    );
    889889
    890890  //
     
    898898         &gEfiEventExitBootServicesGuid,
    899899         &ExitBootServiceEvent
    900          ); 
     900         );
    901901
    902902  //
     
    911911         &mVirtualAddressChangeEvent
    912912         );
    913  
     913
    914914  return EFI_SUCCESS;
    915915}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmmRuntimeDxe.inf

    r58459 r58466  
    22#  Runtime DXE part corresponding to SMM authenticated variable module
    33#
    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.
    66#
    77#  Caution: This module requires additional review when modified.
    88#  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
    1010#  buffer overflow or integer overflow.
    1111#    The whole SMM authentication variable design relies on the integrity of flash part and SMM.
    1212#  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,
    1414#  the authentication service provided in this driver will be broken, and the behavior is undefined.
    1515#
     
    5252[LibraryClasses]
    5353  MemoryAllocationLib
    54   BaseLib 
     54  BaseLib
    5555  UefiBootServicesTableLib
    5656  DebugLib
     
    5858  DxeServicesTableLib
    5959  UefiDriverEntryPoint
    60   PcdLib 
     60  PcdLib
    6161  TpmMeasurementLib
    6262
     
    7575  gEfiEventVirtualAddressChangeGuid                                 ## CONSUMES       ## Event
    7676  gEfiEventExitBootServicesGuid                                     ## CONSUMES       ## Event
    77    
     77
    7878  ## CONSUMES ## UNDEFINED # Locate protocol
    7979  ## CONSUMES ## UNDEFINED # Protocol notify
    8080  gSmmVariableWriteGuid
    81  
     81
    8282
    8383  ## SOMETIMES_CONSUMES   ## Variable:L"PK"
     
    8585  ## SOMETIMES_CONSUMES   ## Variable:L"SecureBoot"
    8686  gEfiGlobalVariableGuid
    87  
     87
    8888  ## SOMETIMES_CONSUMES   ## Variable:L"DB"
    8989  ## 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  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    2525    name  = SECUREBOOT_CONFIGURATION,
    2626    guid  = SECUREBOOT_CONFIG_FORM_SET_GUID;
    27  
     27
    2828  //
    2929  // ##1 Form "Secure Boot Configuration"
     
    3838      text   = STRING_TOKEN(STR_SECURE_BOOT_STATE_PROMPT),
    3939        text   = STRING_TOKEN(STR_SECURE_BOOT_STATE_CONTENT);
    40        
     40
    4141    //
    4242    // Define of Check Box: Attempt Secure Boot
     
    4949              flags    = INTERACTIVE,
    5050      endcheckbox;
    51     endif; 
    52    
     51    endif;
     52
    5353    //
    5454    // Display of Check Box: Attempt Secure Boot
     
    6262    endcheckbox;
    6363    endif;
    64    
     64
    6565    //
    6666    // Display of Oneof: 'Secure Boot Mode'
     
    7676    endif;
    7777      oneof name = SecureBootMode,
    78             questionid = KEY_SECURE_BOOT_MODE,     
     78            questionid = KEY_SECURE_BOOT_MODE,
    7979            prompt = STRING_TOKEN(STR_SECURE_BOOT_MODE_PROMPT),
    8080            help   = STRING_TOKEN(STR_SECURE_BOOT_MODE_HELP),
     
    8383            option text = STRING_TOKEN(STR_CUSTOM_MODE),      value = SECURE_BOOT_MODE_CUSTOM,   flags = 0;
    8484      endoneof;
    85    
     85
    8686    //
    8787    //
     
    9898    endif;
    9999  endform;
    100  
     100
    101101  //
    102102  // ##2 Form: 'Custom Secure Boot Options'
     
    104104  form formid = FORMID_SECURE_BOOT_OPTION_FORM,
    105105    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
    109109    goto FORMID_SECURE_BOOT_PK_OPTION_FORM,
    110110         prompt = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION),
     
    112112         flags  = INTERACTIVE,
    113113         key    = KEY_SECURE_BOOT_PK_OPTION;
    114        
    115     subtitle text = STRING_TOKEN(STR_NULL);
    116    
     114
     115    subtitle text = STRING_TOKEN(STR_NULL);
     116
    117117    goto FORMID_SECURE_BOOT_KEK_OPTION_FORM,
    118118         prompt = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION),
     
    120120         flags  = INTERACTIVE,
    121121         key    = KEY_SECURE_BOOT_KEK_OPTION;
    122        
    123     subtitle text = STRING_TOKEN(STR_NULL);
    124    
     122
     123    subtitle text = STRING_TOKEN(STR_NULL);
     124
    125125    goto FORMID_SECURE_BOOT_DB_OPTION_FORM,
    126126         prompt = STRING_TOKEN(STR_SECURE_BOOT_DB_OPTION),
     
    128128         flags  = INTERACTIVE,
    129129         key    = KEY_SECURE_BOOT_DB_OPTION;
    130    
    131     subtitle text = STRING_TOKEN(STR_NULL);
    132    
     130
     131    subtitle text = STRING_TOKEN(STR_NULL);
     132
    133133    goto FORMID_SECURE_BOOT_DBX_OPTION_FORM,
    134134         prompt = STRING_TOKEN(STR_SECURE_BOOT_DBX_OPTION),
     
    138138
    139139  endform;
    140  
     140
    141141  //
    142142  // ##3 Form: 'PK Options'
     
    144144  form formid = FORMID_SECURE_BOOT_PK_OPTION_FORM,
    145145    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
    149149    //
    150150    // Define of Check Box: 'Delete PK'
     
    156156      endcheckbox;
    157157    endif;
    158    
     158
    159159    grayoutif ideqval SECUREBOOT_CONFIGURATION.HasPk == 1;
    160160    goto FORMID_ENROLL_PK_FORM,
     
    164164         key    = KEY_ENROLL_PK;
    165165    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'
    171171    //
    172172    grayoutif ideqval SECUREBOOT_CONFIGURATION.HideSecureBoot == 1;
    173173    checkbox varid = SECUREBOOT_CONFIGURATION.DeletePk,
    174174          questionid = KEY_SECURE_BOOT_DELETE_PK,
    175           prompt = STRING_TOKEN(STR_DELETE_PK),         
     175          prompt = STRING_TOKEN(STR_DELETE_PK),
    176176          help   = STRING_TOKEN(STR_DELETE_PK_HELP),
    177177          flags  = INTERACTIVE | RESET_REQUIRED,
     
    179179    endif;
    180180  endform;
    181  
     181
    182182  //
    183183  // ##4 Form: 'Enroll PK'
     
    185185  form formid = FORMID_ENROLL_PK_FORM,
    186186    title  = STRING_TOKEN(STR_ENROLL_PK);
    187    
     187
    188188    subtitle text = STRING_TOKEN(STR_NULL);
    189189
     
    194194         key = SECUREBOOT_ADD_PK_FILE_FORM_ID;
    195195  endform;
    196  
     196
    197197  //
    198198  // ##5 Form: 'KEK Options'
     
    202202
    203203    //
    204     // Display of 'Enroll KEK' 
     204    // Display of 'Enroll KEK'
    205205    //
    206206    goto FORMID_ENROLL_KEK_FORM,
     
    208208         help   = STRING_TOKEN(STR_ENROLL_KEK_HELP),
    209209         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'
    215215    //
    216216    goto FORMID_DELETE_KEK_FORM,
     
    219219         flags  = INTERACTIVE,
    220220         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'
    227227  //
    228228  form formid = FORMID_ENROLL_KEK_FORM,
     
    259259      flags  = INTERACTIVE,
    260260      key    = KEY_VALUE_SAVE_AND_EXIT_KEK;
    261  
     261
    262262    goto FORMID_SECURE_BOOT_OPTION_FORM,
    263263      prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
     
    270270  //
    271271  // ##7 Form: 'Delete KEK'
    272   // 
     272  //
    273273  form formid = FORMID_DELETE_KEK_FORM,
    274274    title  = STRING_TOKEN(STR_DELETE_KEK_TITLE);
     
    276276    label LABEL_KEK_DELETE;
    277277    label LABEL_END;
    278          
    279     subtitle text = STRING_TOKEN(STR_NULL);
    280    
     278
     279    subtitle text = STRING_TOKEN(STR_NULL);
     280
    281281  endform;
    282282
     
    301301    flags  = INTERACTIVE,
    302302    key    = SECUREBOOT_DELETE_SIGNATURE_FROM_DB;
    303    
     303
    304304  endform;
    305305
     
    336336    label LABEL_END;
    337337    subtitle text = STRING_TOKEN(STR_NULL);
    338    
     338
    339339  endform;
    340340
     
    348348    label LABEL_END;
    349349    subtitle text = STRING_TOKEN(STR_NULL);
    350    
     350
    351351  endform;
    352352
     
    387387         flags  = INTERACTIVE,
    388388         key    = KEY_VALUE_SAVE_AND_EXIT_DB;
    389  
     389
    390390    goto FORMID_SECURE_BOOT_OPTION_FORM,
    391391         prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
     
    432432         flags  = INTERACTIVE,
    433433         key    = KEY_VALUE_SAVE_AND_EXIT_DBX;
    434  
     434
    435435    goto FORMID_SECURE_BOOT_OPTION_FORM,
    436436         prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
     
    450450       label LABEL_END;
    451451  endform;
    452  
     452
    453453  //
    454454  // File Explorer for KEK
     
    490490    label SECUREBOOT_ADD_PK_FILE_FORM_ID;
    491491    label LABEL_END;
    492    
     492
    493493    subtitle text = STRING_TOKEN(STR_NULL);
    494494
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDriver.c

    r48674 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    3636  EFI_STATUS                       Status;
    3737  SECUREBOOT_CONFIG_PRIVATE_DATA   *PrivateData;
    38  
     38
    3939  //
    4040  // If already started, return.
     
    5151    return EFI_ALREADY_STARTED;
    5252  }
    53  
     53
    5454  //
    5555  // Create a private data structure.
     
    5959    return EFI_OUT_OF_RESOURCES;
    6060  }
    61    
     61
    6262  //
    6363  // Install SecureBoot configuration form
     
    7070  //
    7171  // Install private GUID.
    72   //   
     72  //
    7373  Status = gBS->InstallMultipleProtocolInterfaces (
    7474                  &ImageHandle,
     
    8787  if (PrivateData != NULL) {
    8888    UninstallSecureBootConfigForm (PrivateData);
    89   } 
    90  
     89  }
     90
    9191  return Status;
    9292}
     
    114114                  &gEfiCallerIdGuid,
    115115                  (VOID **) &PrivateData
    116                   ); 
     116                  );
    117117  if (EFI_ERROR (Status)) {
    118     return Status; 
     118    return Status;
    119119  }
    120  
     120
    121121  ASSERT (PrivateData->Signature == SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE);
    122122
     
    127127         NULL
    128128         );
    129  
     129
    130130  UninstallSecureBootConfigForm (PrivateData);
    131131
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf

    r58459 r58466  
    6363  ## SOMETIMES_PRODUCES      ## Variable:L"CustomMode"
    6464  gEfiCustomModeEnableGuid
    65    
     65
    6666  ## SOMETIMES_CONSUMES      ## Variable:L"SecureBootEnable"
    6767  ## SOMETIMES_PRODUCES      ## Variable:L"SecureBootEnable"
    6868  gEfiSecureBootEnableDisableGuid
    69  
     69
    7070  ## SOMETIMES_CONSUMES      ## GUID            # Unique ID for the type of the signature.
    7171  ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of the signature.
    7272  gEfiCertRsa2048Guid
    73  
     73
    7474  ## 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.
    7676  gEfiCertX509Guid
    77  
     77
    7878  ## 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.
    8080  gEfiCertSha1Guid
    81  
     81
    8282  ## 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.
    8484  gEfiCertSha256Guid
    85  
     85
    8686  ## SOMETIMES_CONSUMES      ## Variable:L"db"
    8787  ## SOMETIMES_PRODUCES      ## Variable:L"db"
     
    8989  ## SOMETIMES_PRODUCES      ## Variable:L"dbx"
    9090  gEfiImageSecurityDatabaseGuid
    91    
     91
    9292  ## SOMETIMES_CONSUMES      ## Variable:L"SetupMode"
    9393  ## SOMETIMES_PRODUCES      ## Variable:L"PK"
     
    9696  ## SOMETIMES_CONSUMES      ## Variable:L"SecureBoot"
    9797  gEfiGlobalVariableGuid
    98  
     98
    9999  gEfiIfrTianoGuid                              ## PRODUCES            ## GUID       # HII opcode
    100100  ## PRODUCES                ## HII
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c

    r58459 r58466  
    6666
    6767/**
    68   Helper function called as part of the code needed to allocate 
     68  Helper function called as part of the code needed to allocate
    6969  the proper sized buffer for various EFI interfaces.
    7070
     
    123123
    124124/**
    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
    126126  to hold the appended result.
    127127
     
    150150  ASSERT (Str != NULL);
    151151
    152   TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16)); 
     152  TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));
    153153  ASSERT (TmpStr != NULL);
    154154
     
    171171
    172172      //
    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
    174174      // that overlap.
    175175      //
     
    183183
    184184      //
    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
    186186      // that overlap.
    187187      //
     
    197197
    198198  FreePool (TmpStr);
    199  
     199
    200200  return Str;
    201201}
     
    355355
    356356  @param[in, out]  MenuOption        Menu to be freed
    357  
     357
    358358**/
    359359VOID
     
    460460  Attributes is valid only for EFI_FILE_MODE_CREATE.
    461461
    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.
    463463                                   On output, the remaining device path.
    464464  @param[out]      FileHandle      Pointer to the file handle.
     
    496496  EFI_FILE_PROTOCOL               *Handle1;
    497497  EFI_FILE_PROTOCOL               *Handle2;
    498   EFI_HANDLE                      DeviceHandle; 
     498  EFI_HANDLE                      DeviceHandle;
    499499
    500500  if ((FilePath == NULL || FileHandle == NULL)) {
     
    817817    FreePool (SimpleFsHandle);
    818818  }
    819  
     819
    820820  //
    821821  // Remember how many file system options are here
     
    827827
    828828/**
    829   Find files under the current directory. All files and sub-directories 
     829  Find files under the current directory. All files and sub-directories
    830830  in current directory will be stored in DirectoryMenu for future use.
    831831
     
    893893    return EFI_OUT_OF_RESOURCES;
    894894  }
    895  
     895
    896896  //
    897897  // Get all files in current directory
     
    935935                                    );
    936936      NewMenuEntry->HelpString = NULL;
    937      
     937
    938938      NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);
    939939      if (NewFileContext->IsDir) {
     
    978978  //
    979979  // Free current updated date
    980   // 
     980  //
    981981  if (mStartOpCodeHandle != NULL) {
    982982    HiiFreeOpCodeHandle (mStartOpCodeHandle);
     
    11191119    FreeMenu (&FsOptionMenu);
    11201120    FindFileSystem ();
    1121    
     1121
    11221122    CreateMenuStringToken (PrivateData->HiiHandle, &FsOptionMenu);
    11231123    UpdateFileExplorePage (PrivateData->HiiHandle, &FsOptionMenu, PrivateData->FeCurrentState);
     
    11631163      PrivateData->MenuEntry = NewMenuEntry;
    11641164      PrivateData->FileContext->FileName = NewFileContext->FileName;
    1165      
     1165
    11661166      TmpDevicePath = NewFileContext->DevicePath;
    11671167      OpenFileByDevicePath (
     
    12011201
    12021202/**
    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.
    12041204
    12051205  @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  
    1818
    1919SECUREBOOT_CONFIG_PRIVATE_DATA         mSecureBootConfigPrivateDateTemplate = {
    20   SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE, 
     20  SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE,
    2121  {
    2222    SecureBootExtractConfig,
     
    7272
    7373//
    74 // Variable Definitions 
    75 //                                         
     74// Variable Definitions
     75//
    7676UINT32            mPeCoffHeaderOffset = 0;
    7777WIN_CERTIFICATE   *mCertificate = NULL;
     
    110110)
    111111{
    112   UINTN     Index; 
     112  UINTN     Index;
    113113  for (Index = 0; mDerEncodedSuffix[Index] != NULL; Index++) {
    114114    if (StrCmp (FileSuffix, mDerEncodedSuffix[Index]) == 0) {
     
    148148  Create a time based data payload by concatenating the EFI_VARIABLE_AUTHENTICATION_2
    149149  descriptor with the input data. NO authentication is required in this function.
    150  
     150
    151151  @param[in, out]   DataSize       On input, the size of Data buffer in bytes.
    152152                                   On output, the size of data returned in Data
    153153                                   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
    155155                                   pointer to NULL to wrap an empty payload.
    156156                                   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.
    158158
    159159  @retval EFI_SUCCESS              Create time based payload successfully.
     
    176176  UINTN                            DescriptorSize;
    177177  EFI_TIME                         Time;
    178  
     178
    179179  if (Data == NULL || DataSize == NULL) {
    180180    return EFI_INVALID_PARAMETER;
    181181  }
    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
    185185  // parameters to the SetVariable() call still need to be prepared as authenticated
    186186  // variable. So we create EFI_VARIABLE_AUTHENTICATED_2 descriptor without certificate
     
    189189  Payload     = *Data;
    190190  PayloadSize = *DataSize;
    191  
     191
    192192  DescriptorSize    = OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo) + OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData);
    193193  NewData = (UINT8*) AllocateZeroPool (DescriptorSize + PayloadSize);
     
    214214  Time.Pad2       = 0;
    215215  CopyMem (&DescriptorData->TimeStamp, &Time, sizeof (EFI_TIME));
    216  
     216
    217217  DescriptorData->AuthInfo.Hdr.dwLength         = OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData);
    218218  DescriptorData->AuthInfo.Hdr.wRevision        = 0x0200;
    219219  DescriptorData->AuthInfo.Hdr.wCertificateType = WIN_CERT_TYPE_EFI_GUID;
    220220  CopyGuid (&DescriptorData->AuthInfo.CertType, &gEfiCertPkcs7Guid);
    221  
     221
    222222  if (Payload != NULL) {
    223223    FreePool(Payload);
    224224  }
    225  
     225
    226226  *DataSize = DescriptorSize + PayloadSize;
    227227  *Data     = NewData;
     
    288288  @param[in]   SecureBootMode        New secure boot mode: STANDARD_SECURE_BOOT_MODE or
    289289                                     CUSTOM_SECURE_BOOT_MODE.
    290  
     290
    291291  @return EFI_SUCCESS                The platform has switched to the special mode successfully.
    292292  @return other                      Fail to operate the secure boot mode.
    293  
     293
    294294**/
    295295EFI_STATUS
     
    298298  )
    299299{
    300   return gRT->SetVariable (                         
     300  return gRT->SetVariable (
    301301                EFI_CUSTOM_MODE_NAME,
    302302                &gEfiCustomModeEnableGuid,
     
    312312  @param[in]   X509File              FileHandle of X509 Certificate storing file.
    313313  @param[out]  PkCert                Point to the data buffer to store the signature list.
    314  
     314
    315315  @return EFI_UNSUPPORTED            Unsupported Key Length.
    316316  @return EFI_OUT_OF_RESOURCES       There are not enough memory resourses to form the signature list.
    317  
     317
    318318**/
    319319EFI_STATUS
    320320CreatePkX509SignatureList (
    321   IN    EFI_FILE_HANDLE             X509File, 
    322   OUT   EFI_SIGNATURE_LIST          **PkCert 
     321  IN    EFI_FILE_HANDLE             X509File,
     322  OUT   EFI_SIGNATURE_LIST          **PkCert
    323323  )
    324324{
    325   EFI_STATUS              Status; 
     325  EFI_STATUS              Status;
    326326  UINT8                   *X509Data;
    327327  UINTN                   X509DataSize;
     
    330330  X509Data = NULL;
    331331  PkCertData = NULL;
    332   X509DataSize = 0; 
    333  
     332  X509DataSize = 0;
     333
    334334  Status = ReadFileContent (X509File, (VOID**) &X509Data, &X509DataSize, 0);
    335335  if (EFI_ERROR (Status)) {
     
    351351  }
    352352
    353   (*PkCert)->SignatureListSize   = (UINT32) (sizeof(EFI_SIGNATURE_LIST) 
     353  (*PkCert)->SignatureListSize   = (UINT32) (sizeof(EFI_SIGNATURE_LIST)
    354354                                    + sizeof(EFI_SIGNATURE_DATA) - 1
    355355                                    + X509DataSize);
     
    357357  (*PkCert)->SignatureHeaderSize = 0;
    358358  CopyGuid (&(*PkCert)->SignatureType, &gEfiCertX509Guid);
    359   PkCertData                     = (EFI_SIGNATURE_DATA*) ((UINTN)(*PkCert) 
     359  PkCertData                     = (EFI_SIGNATURE_DATA*) ((UINTN)(*PkCert)
    360360                                                          + sizeof(EFI_SIGNATURE_LIST)
    361361                                                          + (*PkCert)->SignatureHeaderSize);
    362   CopyGuid (&PkCertData->SignatureOwner, &gEfiGlobalVariableGuid);   
     362  CopyGuid (&PkCertData->SignatureOwner, &gEfiGlobalVariableGuid);
    363363  //
    364364  // Fill the PK database with PKpub data from X509 certificate file.
    365   // 
     365  //
    366366  CopyMem (&(PkCertData->SignatureData[0]), X509Data, X509DataSize);
    367  
     367
    368368ON_EXIT:
    369  
     369
    370370  if (X509Data != NULL) {
    371371    FreePool (X509Data);
    372372  }
    373  
     373
    374374  if (EFI_ERROR(Status) && *PkCert != NULL) {
    375375    FreePool (*PkCert);
    376376    *PkCert = NULL;
    377377  }
    378  
     378
    379379  return Status;
    380380}
     
    390390  @retval   EFI_INVALID_PARAMETER  The parameter is invalid.
    391391  @retval   EFI_OUT_OF_RESOURCES   Could not allocate needed resources.
    392  
     392
    393393**/
    394394EFI_STATUS
    395395EnrollPlatformKey (
    396396   IN  SECUREBOOT_CONFIG_PRIVATE_DATA*   Private
    397   )                       
     397  )
    398398{
    399399  EFI_STATUS                      Status;
     
    403403  UINT16*                         FilePostFix;
    404404  UINTN                           NameLength;
    405  
     405
    406406  if (Private->FileContext->FileName == NULL) {
    407407    return EFI_INVALID_PARAMETER;
     
    434434  //
    435435  Status = CreatePkX509SignatureList (
    436             Private->FileContext->FHandle, 
    437             &PkCert 
     436            Private->FileContext->FHandle,
     437            &PkCert
    438438            );
    439439  if (EFI_ERROR (Status)) {
     
    441441  }
    442442  ASSERT (PkCert != NULL);
    443                          
     443
    444444  //
    445445  // 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
    448448          | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
    449449  DataSize = PkCert->SignatureListSize;
     
    453453    goto ON_EXIT;
    454454  }
    455  
     455
    456456  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,
    461461                  PkCert
    462462                  );
     
    467467    goto ON_EXIT;
    468468  }
    469  
     469
    470470ON_EXIT:
    471471
     
    473473    FreePool(PkCert);
    474474  }
    475  
     475
    476476  if (Private->FileContext->FHandle != NULL) {
    477477    CloseFile (Private->FileContext->FHandle);
     
    487487  @retval EFI_SUCCESS    Delete PK successfully.
    488488  @retval Others         Could not allow to delete PK.
    489  
     489
    490490**/
    491491EFI_STATUS
     
    533533  EFI_SIGNATURE_DATA              *KEKSigData;
    534534  UINTN                           KekSigListSize;
    535   UINT8                           *KeyBuffer; 
     535  UINT8                           *KeyBuffer;
    536536  UINTN                           KeyLenInBytes;
    537537
     
    545545  KekSigList  = NULL;
    546546  KekSigListSize = 0;
    547  
     547
    548548  //
    549549  // Form the KeKpub certificate list into EFI_SIGNATURE_LIST type.
    550550  // First, We have to parse out public key data from the pbk key file.
    551   //               
     551  //
    552552  Status = ReadFileContent (
    553553             Private->FileContext->FHandle,
     
    566566    goto ON_EXIT;
    567567  }
    568  
     568
    569569  //
    570570  // Convert the Public key to fix octet string format represented in RSA PKCS#1.
    571   // 
     571  //
    572572  KeyLenInBytes = KeyInfo->KeyLengthInBits / 8;
    573573  KeyBuffer = AllocateZeroPool (KeyLenInBytes);
     
    577577  }
    578578  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,
    582582    KeyLenInBytes
    583583    );
    584584  CopyMem(KeyBlob + sizeof(CPL_KEY_INFO), KeyBuffer, KeyLenInBytes);
    585  
     585
    586586  //
    587587  // Form an new EFI_SIGNATURE_LIST.
     
    603603  KekSigList->SignatureSize = sizeof(EFI_SIGNATURE_DATA) - 1 + WIN_CERT_UEFI_RSA2048_SIZE;
    604604  CopyGuid (&KekSigList->SignatureType, &gEfiCertRsa2048Guid);
    605  
     605
    606606  KEKSigData = (EFI_SIGNATURE_DATA*)((UINT8*)KekSigList + sizeof(EFI_SIGNATURE_LIST));
    607607  CopyGuid (&KEKSigData->SignatureOwner, Private->SignatureGUID);
     
    611611    WIN_CERT_UEFI_RSA2048_SIZE
    612612    );
    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
    617617  // 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
    620620         | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
    621621  Status = CreateTimeBasedPayload (&KekSigListSize, (UINT8**) &KekSigList);
     
    626626
    627627  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,
    632632                  NULL
    633633                  );
     
    637637    goto ON_EXIT;
    638638  }
    639  
     639
    640640  //
    641641  // Done. Now we have formed the correct KEKpub database item, just set it into variable storage,
    642   //             
     642  //
    643643  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,
    648648                  KekSigList
    649649                  );
     
    651651    goto ON_EXIT;
    652652  }
    653  
     653
    654654ON_EXIT:
    655655
     
    672672    FreePool (KekSigList);
    673673  }
    674  
     674
    675675  return Status;
    676676}
     
    690690EnrollX509ToKek (
    691691  IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private
    692   ) 
     692  )
    693693{
    694694  EFI_STATUS                        Status;
     
    728728  //
    729729  // Fill Certificate Database parameters.
    730   // 
     730  //
    731731  KekSigList->SignatureListSize   = (UINT32) KekSigListSize;
    732732  KekSigList->SignatureHeaderSize = 0;
     
    739739
    740740  //
    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
    743743  // 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
    746746          | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
    747747  Status = CreateTimeBasedPayload (&KekSigListSize, (UINT8**) &KekSigList);
     
    750750    goto ON_EXIT;
    751751  }
    752  
     752
    753753  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,
    758758                  NULL
    759759                  );
     
    762762  } else if (Status != EFI_NOT_FOUND) {
    763763    goto ON_EXIT;
    764   } 
     764  }
    765765
    766766  Status = gRT->SetVariable(
    767                   EFI_KEY_EXCHANGE_KEY_NAME, 
    768                   &gEfiGlobalVariableGuid, 
    769                   Attr, 
     767                  EFI_KEY_EXCHANGE_KEY_NAME,
     768                  &gEfiGlobalVariableGuid,
     769                  Attr,
    770770                  KekSigListSize,
    771771                  KekSigList
     
    796796  Enroll new KEK into the System without PK's authentication.
    797797  The SignatureOwner GUID will be Private->SignatureGUID.
    798  
     798
    799799  @param[in] PrivateData     The module's private data.
    800  
     800
    801801  @retval   EFI_SUCCESS            New KEK enrolled successful.
    802802  @retval   EFI_INVALID_PARAMETER  The parameter is invalid.
    803803  @retval   others                 Fail to enroll KEK data.
    804  
     804
    805805**/
    806806EFI_STATUS
    807807EnrollKeyExchangeKey (
    808808  IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private
    809   ) 
     809  )
    810810{
    811811  UINT16*     FilePostFix;
    812812  EFI_STATUS  Status;
    813813  UINTN       NameLength;
    814  
     814
    815815  if ((Private->FileContext->FileName == NULL) || (Private->SignatureGUID == NULL)) {
    816816    return EFI_INVALID_PARAMETER;
     
    823823
    824824  //
    825   // Parse the file's postfix. Supports DER-encoded X509 certificate, 
     825  // Parse the file's postfix. Supports DER-encoded X509 certificate,
    826826  // and .pbk as RSA public key file.
    827827  //
     
    845845
    846846  @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
    848848                             EFI_IMAGE_SECURITY_DATABASE or EFI_IMAGE_SECURITY_DATABASE1.
    849  
     849
    850850  @retval   EFI_SUCCESS            New X509 is enrolled successfully.
    851851  @retval   EFI_OUT_OF_RESOURCES   Could not allocate needed resources.
     
    856856  IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private,
    857857  IN CHAR16                         *VariableName
    858   ) 
     858  )
    859859{
    860860  EFI_STATUS                        Status;
     
    897897  //
    898898  // Fill Certificate Database parameters.
    899   // 
     899  //
    900900  SigDBCert = (EFI_SIGNATURE_LIST*) Data;
    901901  SigDBCert->SignatureListSize   = (UINT32) SigDBSize;
     
    909909
    910910  //
    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
    913913  // 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
    916916          | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
    917917  Status = CreateTimeBasedPayload (&SigDBSize, (UINT8**) &Data);
     
    922922
    923923  Status = gRT->GetVariable(
    924                   VariableName, 
    925                   &gEfiImageSecurityDatabaseGuid, 
    926                   NULL, 
    927                   &DataSize, 
     924                  VariableName,
     925                  &gEfiImageSecurityDatabaseGuid,
     926                  NULL,
     927                  &DataSize,
    928928                  NULL
    929929                  );
     
    932932  } else if (Status != EFI_NOT_FOUND) {
    933933    goto ON_EXIT;
    934   } 
     934  }
    935935
    936936  Status = gRT->SetVariable(
    937                   VariableName, 
    938                   &gEfiImageSecurityDatabaseGuid, 
    939                   Attr, 
     937                  VariableName,
     938                  &gEfiImageSecurityDatabaseGuid,
     939                  Attr,
    940940                  SigDBSize,
    941941                  Data
     
    977977EFI_STATUS
    978978LoadPeImage (
    979   VOID 
    980   )   
     979  VOID
     980  )
    981981{
    982982  EFI_IMAGE_DOS_HEADER                  *DosHdr;
     
    993993  {
    994994    //
    995     // DOS image header is present, 
     995    // DOS image header is present,
    996996    // So read the PE header after the DOS image header
    997997    //
     
    10181018  // Note the size of FileHeader field is constant for both IA32 and X64 arch
    10191019  //
    1020   if ((NtHeader32->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32) 
     1020  if ((NtHeader32->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32)
    10211021      || (NtHeader32->FileHeader.Machine == EFI_IMAGE_MACHINE_EBC)) {
    10221022    //
     
    10461046
    10471047  @param[in]    HashAlg   Hash algorithm type.
    1048  
     1048
    10491049  @retval TRUE            Successfully hash image.
    10501050  @retval FALSE           Fail in hash image.
    10511051
    10521052**/
    1053 BOOLEAN 
     1053BOOLEAN
    10541054HashPeImage (
    10551055  IN  UINT32                HashAlg
     
    10751075    return FALSE;
    10761076  }
    1077  
     1077
    10781078  //
    10791079  // Initialize context of hash.
     
    10831083  if (HashAlg == HASHALG_SHA1) {
    10841084    mImageDigestSize  = SHA1_DIGEST_SIZE;
    1085     mCertType         = gEfiCertSha1Guid;   
     1085    mCertType         = gEfiCertSha1Guid;
    10861086  } else if (HashAlg == HASHALG_SHA256) {
    10871087    mImageDigestSize  = SHA256_DIGEST_SIZE;
     
    10901090
    10911091  CtxSize   = mHash[HashAlg].GetContextSize();
    1092  
     1092
    10931093  HashCtx = AllocatePool (CtxSize);
    10941094  ASSERT (HashCtx != NULL);
     
    11071107  if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
    11081108    //
    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
    11111111    //       Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
    11121112    //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
     
    11191119    Magic = mNtHeader.Pe32->OptionalHeader.Magic;
    11201120  }
    1121  
     1121
    11221122  //
    11231123  // 3.  Calculate the distance from the base of the image header to the image checksum address.
     
    11551155    //
    11561156    // Use PE32+ offset.
    1157     //   
     1157    //
    11581158    HashBase = (UINT8 *) &mNtHeader.Pe32Plus->OptionalHeader.CheckSum + sizeof (UINT32);
    11591159    HashSize = (UINTN) ((UINT8 *) (&mNtHeader.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]) - HashBase);
     
    12781278                 mImageSize -
    12791279                 mNtHeader.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size -
    1280                  SumOfBytesHashed);     
     1280                 SumOfBytesHashed);
    12811281    }
    12821282
     
    13001300
    13011301/**
    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
    13041304  8.0 Appendix A
    13051305
     
    13081308
    13091309**/
    1310 EFI_STATUS 
     1310EFI_STATUS
    13111311HashPeImageByType (
    13121312  VOID
     
    13181318  PkcsCertData = (WIN_CERTIFICATE_EFI_PKCS *) (mImageBase + mSecDataDir->Offset);
    13191319
    1320   for (Index = 0; Index < HASHALG_MAX; Index++) { 
     1320  for (Index = 0; Index < HASHALG_MAX; Index++) {
    13211321    //
    13221322    // Check the Hash algorithm in PE/COFF Authenticode.
    1323     //    According to PKCS#7 Definition: 
     1323    //    According to PKCS#7 Definition:
    13241324    //        SignedData ::= SEQUENCE {
    13251325    //            version Version,
     
    13381338    }
    13391339
    1340     //   
     1340    //
    13411341    if (CompareMem (PkcsCertData->CertData + 32, mHash[Index].OidValue, mHash[Index].OidLength) == 0) {
    13421342      break;
     
    13591359
    13601360/**
    1361   Enroll a new executable's signature into Signature Database. 
     1361  Enroll a new executable's signature into Signature Database.
    13621362
    13631363  @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
    13651365                             EFI_IMAGE_SECURITY_DATABASE or EFI_IMAGE_SECURITY_DATABASE1.
    13661366
     
    14031403  Status = ReadFileContent(
    14041404             Private->FileContext->FHandle,
    1405              (VOID **) &mImageBase, 
    1406              &mImageSize, 
     1405             (VOID **) &mImageBase,
     1406             &mImageSize,
    14071407             0
    14081408             );
    14091409  if (EFI_ERROR (Status)) {
    14101410    goto ON_EXIT;
    1411   } 
     1411  }
    14121412  ASSERT (mImageBase != NULL);
    14131413
     
    14231423    }
    14241424  } else {
    1425  
     1425
    14261426    //
    14271427    // Read the certificate data
     
    14401440        goto ON_EXIT;;
    14411441      }
    1442    
     1442
    14431443    } else if (mCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
    14441444
     
    14561456  // Create a new SigDB entry.
    14571457  //
    1458   SigDBSize = sizeof(EFI_SIGNATURE_LIST) 
     1458  SigDBSize = sizeof(EFI_SIGNATURE_LIST)
    14591459              + sizeof(EFI_SIGNATURE_DATA) - 1
    14601460              + (UINT32) mImageDigestSize;
     
    14651465    goto ON_EXIT;
    14661466  }
    1467  
     1467
    14681468  //
    14691469  // Adjust the Certificate Database parameters.
    1470   // 
     1470  //
    14711471  SigDBCert = (EFI_SIGNATURE_LIST*) Data;
    14721472  SigDBCert->SignatureListSize   = (UINT32) SigDBSize;
     
    14791479  CopyMem (SigDBCertData->SignatureData, mImageDigest, mImageDigestSize);
    14801480
    1481   Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS 
     1481  Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS
    14821482          | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
    14831483  Status = CreateTimeBasedPayload (&SigDBSize, (UINT8**) &Data);
     
    14861486    goto ON_EXIT;
    14871487  }
    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
    14921492  // new signature data to original variable
    1493   //   
     1493  //
    14941494  DataSize = 0;
    14951495  Status = gRT->GetVariable(
    1496                   VariableName, 
    1497                   &gEfiImageSecurityDatabaseGuid, 
    1498                   NULL, 
    1499                   &DataSize, 
     1496                  VariableName,
     1497                  &gEfiImageSecurityDatabaseGuid,
     1498                  NULL,
     1499                  &DataSize,
    15001500                  NULL
    15011501                  );
     
    15041504  } else if (Status != EFI_NOT_FOUND) {
    15051505    goto ON_EXIT;
    1506   } 
     1506  }
    15071507
    15081508  //
     
    15101510  //
    15111511  Status = gRT->SetVariable(
    1512                   VariableName, 
    1513                   &gEfiImageSecurityDatabaseGuid, 
    1514                   Attr, 
    1515                   SigDBSize, 
     1512                  VariableName,
     1513                  &gEfiImageSecurityDatabaseGuid,
     1514                  Attr,
     1515                  SigDBSize,
    15161516                  Data
    15171517                  );
     
    15461546  Enroll signature into DB/DBX without KEK's authentication.
    15471547  The SignatureOwner GUID will be Private->SignatureGUID.
    1548  
     1548
    15491549  @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
    15511551                             EFI_IMAGE_SECURITY_DATABASE or EFI_IMAGE_SECURITY_DATABASE1.
    1552  
     1552
    15531553  @retval   EFI_SUCCESS            New signature enrolled successfully.
    15541554  @retval   EFI_INVALID_PARAMETER  The parameter is invalid.
    15551555  @retval   others                 Fail to enroll signature data.
    1556  
     1556
    15571557**/
    15581558EFI_STATUS
     
    15601560  IN SECUREBOOT_CONFIG_PRIVATE_DATA     *Private,
    15611561  IN CHAR16                             *VariableName
    1562   ) 
     1562  )
    15631563{
    15641564  UINT16*      FilePostFix;
     
    15741574    return Status;
    15751575  }
    1576  
    1577   //
    1578   // Parse the file's postfix. 
     1576
     1577  //
     1578  // Parse the file's postfix.
    15791579  //
    15801580  NameLength = StrLen (Private->FileContext->FileName);
     
    16061606  @retval   EFI_SUCCESS             Success to update the signature list page
    16071607  @retval   EFI_OUT_OF_RESOURCES    Unable to allocate required resources.
    1608  
     1608
    16091609**/
    16101610EFI_STATUS
     
    16251625  VOID                        *EndOpCodeHandle;
    16261626  EFI_IFR_GUID_LABEL          *StartLabel;
    1627   EFI_IFR_GUID_LABEL          *EndLabel; 
     1627  EFI_IFR_GUID_LABEL          *EndLabel;
    16281628  UINTN                       DataSize;
    16291629  UINT8                       *Data;
     
    16411641  StartOpCodeHandle = NULL;
    16421642  EndOpCodeHandle   = NULL;
    1643  
     1643
    16441644  //
    16451645  // Initialize the container for dynamic opcodes.
     
    16481648  if (StartOpCodeHandle == NULL) {
    16491649    Status = EFI_OUT_OF_RESOURCES;
    1650     goto ON_EXIT; 
     1650    goto ON_EXIT;
    16511651  }
    16521652
     
    16541654  if (EndOpCodeHandle == NULL) {
    16551655    Status = EFI_OUT_OF_RESOURCES;
    1656     goto ON_EXIT; 
     1656    goto ON_EXIT;
    16571657  }
    16581658
     
    16821682  //
    16831683  DataSize = 0;
    1684   Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, Data); 
     1684  Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, Data);
    16851685  if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
    16861686    goto ON_EXIT;
     
    17321732    CertCount  = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
    17331733    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
    17371737                                              + Index * CertList->SignatureSize);
    17381738      //
    1739       // Display GUID and help 
     1739      // Display GUID and help
    17401740      //
    17411741      GuidToString (&Cert->SignatureOwner, GuidStr, 100);
     
    17441744        StartOpCodeHandle,
    17451745        (EFI_QUESTION_ID) (QuestionIdBase + GuidIndex++),
    1746         0, 
    1747         0, 
    1748         GuidID, 
     1746        0,
     1747        0,
     1748        GuidID,
    17491749        Help,
    17501750        EFI_IFR_FLAG_CALLBACK,
    17511751        0,
    17521752        NULL
    1753         );       
     1753        );
    17541754    }
    17551755
     
    17741774    HiiFreeOpCodeHandle (EndOpCodeHandle);
    17751775  }
    1776  
     1776
    17771777  if (Data != NULL) {
    17781778    FreePool (Data);
     
    17871787
    17881788/**
    1789   Delete a KEK entry from KEK database. 
     1789  Delete a KEK entry from KEK database.
    17901790
    17911791  @param[in]    PrivateData         Module's private data.
     
    17941794  @retval   EFI_SUCCESS            Delete kek item successfully.
    17951795  @retval   EFI_OUT_OF_RESOURCES   Could not allocate needed resources.
    1796  
     1796
    17971797**/
    17981798EFI_STATUS
     
    18221822  CertList        = NULL;
    18231823  Cert            = NULL;
    1824   Attr            = 0;   
     1824  Attr            = 0;
    18251825  DeleteKekIndex  = QuestionId - OPTION_DEL_KEK_QUESTION_ID;
    18261826
     
    18291829    return Status;
    18301830  }
    1831  
     1831
    18321832  //
    18331833  // Get original KEK variable.
    1834   //                           
    1835   DataSize = 0; 
     1834  //
     1835  DataSize = 0;
    18361836  Status = gRT->GetVariable (EFI_KEY_EXCHANGE_KEY_NAME, &gEfiGlobalVariableGuid, NULL, &DataSize, NULL);
    18371837  if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
     
    18411841  OldData = (UINT8*)AllocateZeroPool(DataSize);
    18421842  if (OldData == NULL) {
    1843     Status = EFI_OUT_OF_RESOURCES; 
     1843    Status = EFI_OUT_OF_RESOURCES;
    18441844    goto ON_EXIT;
    18451845  }
     
    18511851
    18521852  //
    1853   // Allocate space for new variable. 
     1853  // Allocate space for new variable.
    18541854  //
    18551855  Data = (UINT8*) AllocateZeroPool (DataSize);
     
    18811881          //
    18821882          NewCertList->SignatureListSize -= CertList->SignatureSize;
    1883           IsKEKItemFound = TRUE;         
     1883          IsKEKItemFound = TRUE;
    18841884        } else {
    18851885          //
     
    18991899      Offset += CertList->SignatureListSize;
    19001900    }
    1901      
     1901
    19021902    KekDataSize -= CertList->SignatureListSize;
    19031903    CertList = (EFI_SIGNATURE_LIST*) ((UINT8*) CertList + CertList->SignatureListSize);
     
    19251925      CopyMem (OldData + Offset, CertList, CertList->SignatureListSize);
    19261926      Offset += CertList->SignatureListSize;
    1927     }   
     1927    }
    19281928    KekDataSize -= CertList->SignatureListSize;
    19291929    CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize);
     
    19401940
    19411941  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,
    19461946                  OldData
    19471947                  );
     
    19501950    goto ON_EXIT;
    19511951  }
    1952  
     1952
    19531953ON_EXIT:
    19541954  if (Data != NULL) {
     
    19611961
    19621962  return UpdateDeletePage (
    1963            PrivateData, 
     1963           PrivateData,
    19641964           EFI_KEY_EXCHANGE_KEY_NAME,
    19651965           &gEfiGlobalVariableGuid,
     
    19801980  @param[in]    QuestionIdBase      Base question id of the signature list.
    19811981  @param[in]    DeleteIndex         Signature index to delete.
    1982  
     1982
    19831983  @retval   EFI_SUCCESS             Delete siganture successfully.
    19841984  @retval   EFI_NOT_FOUND           Can't find the signature item,
     
    20152015  CertList        = NULL;
    20162016  Cert            = NULL;
    2017   Attr            = 0; 
     2017  Attr            = 0;
    20182018
    20192019  Status = SetSecureBootMode(CUSTOM_SECURE_BOOT_MODE);
     
    20242024  //
    20252025  // Get original signature list data.
    2026   //                           
     2026  //
    20272027  DataSize = 0;
    20282028  Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, NULL);
     
    20332033  OldData = (UINT8 *) AllocateZeroPool (DataSize);
    20342034  if (OldData == NULL) {
    2035     Status = EFI_OUT_OF_RESOURCES; 
     2035    Status = EFI_OUT_OF_RESOURCES;
    20362036    goto ON_EXIT;
    20372037  }
     
    20402040  if (EFI_ERROR(Status)) {
    20412041    goto ON_EXIT;
    2042   } 
    2043 
    2044   //
    2045   // Allocate space for new variable. 
     2042  }
     2043
     2044  //
     2045  // Allocate space for new variable.
    20462046  //
    20472047  Data = (UINT8*) AllocateZeroPool (DataSize);
     
    20792079          //
    20802080          NewCertList->SignatureListSize -= CertList->SignatureSize;
    2081           IsItemFound = TRUE;         
     2081          IsItemFound = TRUE;
    20822082        } else {
    20832083          //
     
    20972097      Offset += CertList->SignatureListSize;
    20982098    }
    2099      
     2099
    21002100    ItemDataSize -= CertList->SignatureListSize;
    21012101    CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize);
     
    21232123      CopyMem (OldData + Offset, (UINT8*)(CertList), CertList->SignatureListSize);
    21242124      Offset += CertList->SignatureListSize;
    2125     }   
     2125    }
    21262126    ItemDataSize -= CertList->SignatureListSize;
    21272127    CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize);
     
    21382138
    21392139  Status = gRT->SetVariable(
    2140                   VariableName, 
    2141                   VendorGuid, 
    2142                   Attr, 
    2143                   DataSize, 
     2140                  VariableName,
     2141                  VendorGuid,
     2142                  Attr,
     2143                  DataSize,
    21442144                  OldData
    21452145                  );
     
    21482148    goto ON_EXIT;
    21492149  }
    2150  
     2150
    21512151ON_EXIT:
    21522152  if (Data != NULL) {
     
    21592159
    21602160  return UpdateDeletePage (
    2161            PrivateData, 
     2161           PrivateData,
    21622162           VariableName,
    21632163           VendorGuid,
     
    21702170/**
    21712171  This function extracts configuration from variable.
    2172  
     2172
    21732173  @param[in, out]  ConfigData   Point to SecureBoot configuration private data.
    21742174
     
    21772177SecureBootExtractConfigFromVariable (
    21782178  IN OUT SECUREBOOT_CONFIGURATION    *ConfigData
    2179   ) 
     2179  )
    21802180{
    21812181  UINT8   *SecureBootEnable;
     
    21862186  SetupMode        = NULL;
    21872187  SecureBootMode   = NULL;
    2188  
     2188
    21892189  //
    21902190  // If the SecureBootEnable Variable doesn't exist, hide the SecureBoot Enable/Disable
     
    22012201    }
    22022202  }
    2203  
     2203
    22042204  //
    22052205  // If it is Physical Presence User, set the PhysicalPresent to true.
     
    22102210    ConfigData->PhysicalPresent = FALSE;
    22112211  }
    2212  
     2212
    22132213  //
    22142214  // If there is no PK then the Delete Pk button will be gray.
     
    22902290    return EFI_INVALID_PARAMETER;
    22912291  }
    2292  
     2292
    22932293  AllocatedRequest = FALSE;
    22942294  ConfigRequestHdr = NULL;
     
    22962296  Size             = 0;
    22972297  SecureBoot       = NULL;
    2298  
     2298
    22992299  ZeroMem (&Configuration, sizeof (Configuration));
    23002300  PrivateData      = SECUREBOOT_CONFIG_PRIVATE_FROM_THIS (This);
    23012301  *Progress        = Request;
    2302  
     2302
    23032303  if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gSecureBootConfigFormSetGuid, mSecureBootStorageName)) {
    23042304    return EFI_NOT_FOUND;
     
    23222322    FreePool (SecureBoot);
    23232323  }
    2324  
     2324
    23252325  BufferSize = sizeof (SECUREBOOT_CONFIGURATION);
    23262326  ConfigRequest = Request;
     
    24002400  UINTN                      BufferSize;
    24012401  EFI_STATUS                 Status;
    2402  
     2402
    24032403  if (Configuration == NULL || Progress == NULL) {
    24042404    return EFI_INVALID_PARAMETER;
     
    24812481{
    24822482  EFI_INPUT_KEY                   Key;
    2483   EFI_STATUS                      Status; 
     2483  EFI_STATUS                      Status;
    24842484  SECUREBOOT_CONFIG_PRIVATE_DATA  *Private;
    24852485  UINTN                           BufferSize;
     
    25062506    return EFI_SUCCESS;
    25072507  }
    2508  
     2508
    25092509  if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
    25102510    Status = EFI_UNSUPPORTED;
     
    25172517    return Status;
    25182518  }
    2519  
     2519
    25202520  if ((Action != EFI_BROWSER_ACTION_CHANGED) &&
    25212521      (Action != EFI_BROWSER_ACTION_CHANGING) &&
     
    25242524    return EFI_UNSUPPORTED;
    25252525  }
    2526  
     2526
    25272527  Private = SECUREBOOT_CONFIG_PRIVATE_FROM_THIS (This);
    25282528
     
    25392539
    25402540  HiiGetBrowserData (&gSecureBootConfigFormSetGuid, mSecureBootStorageName, BufferSize, (UINT8 *) IfrNvData);
    2541  
     2541
    25422542  if (Action == EFI_BROWSER_ACTION_CHANGING) {
    25432543
     
    25962596      // Refresh selected file.
    25972597      //
    2598       CleanUpPage (LabelId, Private);   
     2598      CleanUpPage (LabelId, Private);
    25992599      break;
    2600  
     2600
    26012601    case SECUREBOOT_ADD_PK_FILE_FORM_ID:
    26022602    case FORMID_ENROLL_KEK_FORM:
     
    26182618      break;
    26192619
    2620     case KEY_SECURE_BOOT_DELETE_PK: 
     2620    case KEY_SECURE_BOOT_DELETE_PK:
    26212621      if (Value->u8) {
    26222622        CreatePopUp (
     
    26432643    case KEY_DELETE_KEK:
    26442644      UpdateDeletePage (
    2645         Private, 
     2645        Private,
    26462646        EFI_KEY_EXCHANGE_KEY_NAME,
    26472647        &gEfiGlobalVariableGuid,
    26482648        LABEL_KEK_DELETE,
    26492649        FORMID_DELETE_KEK_FORM,
    2650         OPTION_DEL_KEK_QUESTION_ID         
     2650        OPTION_DEL_KEK_QUESTION_ID
    26512651        );
    26522652      break;
    26532653
    2654     case SECUREBOOT_DELETE_SIGNATURE_FROM_DB:       
     2654    case SECUREBOOT_DELETE_SIGNATURE_FROM_DB:
    26552655      UpdateDeletePage (
    26562656        Private,
     
    27262726          EFI_IMAGE_SECURITY_DATABASE,
    27272727          &gEfiImageSecurityDatabaseGuid,
    2728           LABEL_DB_DELETE,   
     2728          LABEL_DB_DELETE,
    27292729          SECUREBOOT_DELETE_SIGNATURE_FROM_DB,
    27302730          OPTION_DEL_DB_QUESTION_ID,
     
    27372737          EFI_IMAGE_SECURITY_DATABASE1,
    27382738          &gEfiImageSecurityDatabaseGuid,
    2739           LABEL_DBX_DELETE,   
     2739          LABEL_DBX_DELETE,
    27402740          SECUREBOOT_DELETE_SIGNATURE_FROM_DBX,
    27412741          OPTION_DEL_DBX_QUESTION_ID,
     
    27492749    case KEY_SECURE_BOOT_ENABLE:
    27502750      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
    2751       break; 
     2751      break;
    27522752    case KEY_VALUE_SAVE_AND_EXIT_PK:
    27532753      Status = EnrollPlatformKey (Private);
     
    27672767          );
    27682768      } else {
    2769         *ActionRequest = EFI_BROWSER_ACTION_REQUEST_RESET; 
    2770       }       
     2769        *ActionRequest = EFI_BROWSER_ACTION_REQUEST_RESET;
     2770      }
    27712771      break;
    27722772
     
    27802780        Private->FileContext->FileName = NULL;
    27812781      }
    2782    
     2782
    27832783      if (Private->SignatureGUID != NULL) {
    27842784        FreePool (Private->SignatureGUID);
     
    27872787      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
    27882788      break;
    2789      
     2789
    27902790    case KEY_SECURE_BOOT_MODE:
    27912791      mIsEnterSecureBootForm = FALSE;
     
    28552855    }
    28562856  }
    2857  
     2857
    28582858  if (!EFI_ERROR (Status)) {
    28592859    BufferSize = sizeof (SECUREBOOT_CONFIGURATION);
     
    28612861  }
    28622862  FreePool (IfrNvData);
    2863  
     2863
    28642864  return EFI_SUCCESS;
    28652865}
     
    29272927  PrivateData->FileContext = AllocateZeroPool (sizeof (SECUREBOOT_FILE_CONTEXT));
    29282928  PrivateData->MenuEntry   = AllocateZeroPool (sizeof (SECUREBOOT_MENU_ENTRY));
    2929  
     2929
    29302930  if (PrivateData->FileContext == NULL || PrivateData->MenuEntry == NULL) {
    29312931    UninstallSecureBootConfigForm (PrivateData);
    29322932    return EFI_OUT_OF_RESOURCES;
    29332933  }
    2934  
     2934
    29352935  PrivateData->FeCurrentState = FileExplorerStateInActive;
    29362936  PrivateData->FeDisplayContext = FileExplorerDisplayUnknown;
    2937  
     2937
    29382938  InitializeListHead (&FsOptionMenu.Head);
    29392939  InitializeListHead (&DirectoryMenu.Head);
     
    29762976  mEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
    29772977  mEndLabel->Number       = LABEL_END;
    2978  
     2978
    29792979  return EFI_SUCCESS;
    29802980}
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h

    r58459 r58466  
    317317  CHAR16                   *Name;           ///< Name for Hash Algorithm
    318318  UINTN                    DigestLength;    ///< Digest Length
    319   UINT8                    *OidValue;       ///< Hash Algorithm OID ASN.1 Value 
     319  UINT8                    *OidValue;       ///< Hash Algorithm OID ASN.1 Value
    320320  UINTN                    OidLength;       ///< Length of Hash OID Value
    321321  HASH_GET_CONTEXT_SIZE    GetContextSize;  ///< Pointer to Hash GetContentSize function
     
    472472
    473473/**
    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.
    475475
    476476  @param[in] LabelId         It is both the Form ID and Label ID for opcode deletion.
     
    506506
    507507  @param[in, out]  MenuOption        Menu to be freed
    508  
     508
    509509**/
    510510VOID
     
    515515
    516516/**
    517   Read file content into BufferPtr, the size of the allocate buffer 
     517  Read file content into BufferPtr, the size of the allocate buffer
    518518  is *FileSize plus AddtionAllocateSize.
    519519
     
    521521  @param[in, out]  BufferPtr             Pointers to the pointer of allocated buffer.
    522522  @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.
    524524                                         In case the buffer need to contain others besides the file content.
    525  
     525
    526526  @retval   EFI_SUCCESS                  The file was read into the buffer.
    527527  @retval   EFI_INVALID_PARAMETER        A parameter was invalid.
     
    543543
    544544  @param[in] FileHandle           The file handle to close.
    545  
     545
    546546**/
    547547VOID
     
    556556  @param[in]   Integer          Pointer to the nonnegative integer to be converted
    557557  @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
    559559  @param[in]   OSSizeInBytes    Intended length of resulting octet string in bytes
    560560
     
    588588EFI_STATUS
    589589StringToGuid (
    590   IN   CHAR16           *Str, 
    591   IN   UINTN            StrLen, 
     590  IN   CHAR16           *Str,
     591  IN   UINTN            StrLen,
    592592  OUT  EFI_GUID         *Guid
    593593  );
     
    600600  @param[in]     Buffer        Buffer to print Guid into.
    601601  @param[in]     BufferSize    Size of Buffer.
    602  
     602
    603603  @retval    Number of characters printed.
    604604
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigMisc.c

    r48674 r58466  
    1616
    1717/**
    18   Read file content into BufferPtr, the size of the allocate buffer 
     18  Read file content into BufferPtr, the size of the allocate buffer
    1919  is *FileSize plus AddtionAllocateSize.
    2020
     
    2222  @param[in, out]  BufferPtr             Pointers to the pointer of allocated buffer.
    2323  @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.
    2525                                         In case the buffer need to contain others besides the file content.
    26  
     26
    2727  @retval   EFI_SUCCESS                  The file was read into the buffer.
    2828  @retval   EFI_INVALID_PARAMETER        A parameter was invalid.
     
    6363    goto ON_EXIT;
    6464  }
    65  
     65
    6666  Status = FileHandle->SetPosition (FileHandle, 0);
    6767  if (EFI_ERROR (Status)) {
     
    8787
    8888ON_EXIT:
    89  
     89
    9090  *BufferPtr = Buffer;
    9191  return Status;
     
    9696
    9797  @param[in] FileHandle           The file handle to close.
    98  
     98
    9999**/
    100100VOID
     
    104104{
    105105  if (FileHandle != NULL) {
    106     FileHandle->Close (FileHandle); 
     106    FileHandle->Close (FileHandle);
    107107  }
    108108}
     
    113113  @param[in]   Integer          Pointer to the nonnegative integer to be converted
    114114  @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
    116116  @param[in]   OSSizeInBytes    Intended length of resulting octet string in bytes
    117117
     
    139139    *Ptr2 = *Ptr1;
    140140  }
    141        
     141
    142142  for (; Ptr1 < (CONST UINT8 *)(Integer + IntSizeInWords) && *Ptr1 == 0; Ptr1++);
    143  
     143
    144144  if (Ptr1 < (CONST UINT8 *)(Integer + IntSizeInWords)) {
    145145    return EFI_BUFFER_TOO_SMALL;
    146146  }
    147  
     147
    148148  if (Ptr2 >= OctetString) {
    149149    ZeroMem (OctetString, Ptr2 - OctetString + 1);
    150150  }
    151  
     151
    152152  return EFI_SUCCESS;
    153153}
     
    168168EFI_STATUS
    169169StringToGuid (
    170   IN   CHAR16           *Str, 
    171   IN   UINTN            StrLen, 
     170  IN   CHAR16           *Str,
     171  IN   UINTN            StrLen,
    172172  OUT  EFI_GUID         *Guid
    173173  )
     
    191191  //
    192192  PtrBuffer       = Buffer;
    193   PtrPosition     = PtrBuffer; 
     193  PtrPosition     = PtrBuffer;
    194194  while (*PtrBuffer != L'\0') {
    195195    if (*PtrBuffer == L'-') {
     
    288288
    289289  FreePool (Buffer);
    290  
     290
    291291  return EFI_SUCCESS;
    292292}
     
    298298  @param[in]     Buffer        Buffer to print Guid into.
    299299  @param[in]     BufferSize    Size of Buffer.
    300  
     300
    301301  @retval    Number of characters printed.
    302302
     
    313313  Size = UnicodeSPrint (
    314314            Buffer,
    315             BufferSize, 
     315            BufferSize,
    316316            L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
    317             (UINTN)Guid->Data1,                   
     317            (UINTN)Guid->Data1,
    318318            (UINTN)Guid->Data2,
    319319            (UINTN)Guid->Data3,
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h

    r58459 r58466  
    33
    44Copyright (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 
     5This program and the accompanying materials
     6are licensed and made available under the terms and conditions of the BSD License
     7which accompanies this distribution.  The full text of the license may be found at
    88http://opensource.org/licenses/bsd-license.php
    99
    10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
     10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
     
    9494// Question ID 0x4000 ~ 0x4FFF is for DBX
    9595//
    96 #define OPTION_DEL_DBX_QUESTION_ID            0x4000 
     96#define OPTION_DEL_DBX_QUESTION_ID            0x4000
    9797
    9898#define FILE_OPTION_GOTO_OFFSET               0xC000
     
    113113  BOOLEAN PhysicalPresent; //If a Physical Present User;
    114114  UINT8   SecureBootMode;  //Secure Boot Mode: Standard Or Custom
    115   BOOLEAN DeletePk; 
     115  BOOLEAN DeletePk;
    116116  BOOLEAN HasPk;           //If Pk is existed it is true;
    117117} SECUREBOOT_CONFIGURATION;
  • trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni

    • Property svn:mime-type changed from application/octet-stream to text/plain;encoding=UTF-16LE
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette