VirtualBox

Ignore:
Timestamp:
Oct 29, 2015 4:30:44 AM (9 years ago)
Author:
vboxsync
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:
66 edited

Legend:

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

  • 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
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