Changeset 58466 in vbox for trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library
- Timestamp:
- Oct 29, 2015 4:30:44 AM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 66 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
- Property svn:mergeinfo changed
/vendor/edk2/current merged: 103769-103776
- Property svn:mergeinfo changed
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c
r58459 r58466 3 3 4 4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 34 34 35 35 @param[in] File This is a pointer to the device path of the file 36 that is being dispatched. 37 38 @return UINT32 Image Type 36 that is being dispatched. 37 38 @return UINT32 Image Type 39 39 40 40 **/ … … 45 45 { 46 46 EFI_STATUS Status; 47 EFI_HANDLE DeviceHandle; 47 EFI_HANDLE DeviceHandle; 48 48 EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; 49 49 EFI_BLOCK_IO_PROTOCOL *BlockIo; … … 111 111 112 112 // 113 // File is not in a Firmware Volume or on a Block I/O device, so check to see if 113 // File is not in a Firmware Volume or on a Block I/O device, so check to see if 114 114 // the device path supports the Simple File System Protocol. 115 115 // … … 130 130 // 131 131 // File is not from an FV, Block I/O or Simple File System, so the only options 132 // left are a PCI Option ROM and a Load File Protocol such as a PXE Boot from a NIC. 132 // left are a PCI Option ROM and a Load File Protocol such as a PXE Boot from a NIC. 133 133 // 134 134 TempDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)File; 135 135 while (!IsDevicePathEndType (TempDevicePath)) { 136 136 switch (DevicePathType (TempDevicePath)) { 137 137 138 138 case MEDIA_DEVICE_PATH: 139 139 if (DevicePathSubType (TempDevicePath) == MEDIA_RELATIVE_OFFSET_RANGE_DP) { … … 145 145 if (DevicePathSubType(TempDevicePath) == MSG_MAC_ADDR_DP) { 146 146 return IMAGE_FROM_REMOVABLE_MEDIA; 147 } 147 } 148 148 break; 149 149 … … 153 153 TempDevicePath = NextDevicePathNode (TempDevicePath); 154 154 } 155 return IMAGE_UNKNOWN; 155 return IMAGE_UNKNOWN; 156 156 } 157 157 … … 192 192 return EFI_NOT_FOUND; 193 193 } 194 194 195 195 // 196 196 // Get current user access information. … … 235 235 break; 236 236 } 237 237 238 238 ASSERT (Info != NULL); 239 239 if (Info->InfoType != EFI_USER_INFO_ACCESS_POLICY_RECORD) { 240 240 continue; 241 241 } 242 242 243 243 // 244 244 // Get specified access information. … … 257 257 } 258 258 } 259 259 260 260 if (Info != NULL) { 261 261 FreePool (Info); … … 267 267 Get file name from device path. 268 268 269 The file name may contain one or more device path node. Save the file name in a 270 buffer if file name is found. The caller is responsible to free the buffer. 271 269 The file name may contain one or more device path node. Save the file name in a 270 buffer if file name is found. The caller is responsible to free the buffer. 271 272 272 @param[in] DevicePath A pointer to a device path. 273 273 @param[out] FileName The callee allocated buffer to save the file name if file name is found. 274 274 @param[out] FileNameOffset The offset of file name in device path if file name is found. 275 275 276 276 @retval UINTN The file name length. 0 means file name is not found. 277 277 278 278 **/ 279 UINTN 279 UINTN 280 280 GetFileName ( 281 281 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, … … 343 343 NodeStr = (CHAR8 *)TmpDevicePath + sizeof (EFI_DEVICE_PATH_PROTOCOL); 344 344 NodeStrLength = DevicePathNodeLength (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof(CHAR16); 345 345 346 346 if ((FirstNodeChar == '\\') && (LastNodeChar == '\\')) { 347 347 // … … 349 349 // 350 350 NodeStr += sizeof (CHAR16); 351 NodeStrLength -= sizeof (CHAR16); 351 NodeStrLength -= sizeof (CHAR16); 352 352 } else if ((FirstNodeChar != '\\') && (LastNodeChar != '\\')) { 353 353 // … … 356 356 WriteUnaligned16 ((UINT16 *)(*FileName + Length), '\\'); 357 357 Length += sizeof (CHAR16); 358 } 358 } 359 359 CopyMem (*FileName + Length, NodeStr, NodeStrLength); 360 360 Length += NodeStrLength; 361 361 362 362 LastNodeChar = (CHAR16) ReadUnaligned16 ((UINT16 *) (NodeStr + NodeStrLength - sizeof(CHAR16))); 363 363 TmpDevicePath = NextDevicePathNode (TmpDevicePath); 364 } 364 } 365 365 366 366 return Length; … … 374 374 If DevicePath2 is identical with DevicePath1, or with DevicePath1's child device 375 375 path, then TRUE returned. Otherwise, FALSE is returned. 376 376 377 377 If DevicePath1 is NULL, then ASSERT(). 378 378 If DevicePath2 is NULL, then ASSERT(). … … 381 381 @param[in] DevicePath2 A pointer to a device path. 382 382 383 @retval TRUE Two device paths are identical , or DevicePath2 is 383 @retval TRUE Two device paths are identical , or DevicePath2 is 384 384 DevicePath1's child device path. 385 @retval FALSE Two device paths are not identical, and DevicePath2 385 @retval FALSE Two device paths are not identical, and DevicePath2 386 386 is not DevicePath1's child device path. 387 387 … … 411 411 return FALSE; 412 412 } 413 414 // 415 // The file name may contain one or more device path node. 413 414 // 415 // The file name may contain one or more device path node. 416 416 // To compare the file name, copy file name to a buffer and compare the buffer. 417 417 // … … 423 423 goto Done; 424 424 } 425 if (CompareMem (DevicePath1, DevicePath2, FileNameOffset1) != 0) { 425 if (CompareMem (DevicePath1, DevicePath2, FileNameOffset1) != 0) { 426 426 DevicePathEqual = FALSE; 427 427 goto Done; … … 431 431 goto Done; 432 432 } 433 if (CompareMem (FileName1, FileName2, FileNameSize1) != 0) { 433 if (CompareMem (FileName1, FileName2, FileNameSize1) != 0) { 434 434 DevicePathEqual = FALSE; 435 435 goto Done; … … 450 450 if (CompareMem (DevicePath1, DevicePath2, DevicePathSize) != 0) { 451 451 DevicePathEqual = FALSE; 452 } 453 454 Done: 452 } 453 454 Done: 455 455 if (FileName1 != NULL) { 456 456 FreePool (FileName1); … … 464 464 465 465 /** 466 Check whether the image pointed to by DevicePath is in the device path list 467 specified by AccessType. 466 Check whether the image pointed to by DevicePath is in the device path list 467 specified by AccessType. 468 468 469 469 @param[in] DevicePath Points to device path. 470 470 @param[in] AccessType The type of user access control. 471 471 472 472 @retval TURE The DevicePath is in the specified List. 473 473 @retval FALSE The DevicePath is not in the specified List. … … 483 483 EFI_USER_INFO_ACCESS_CONTROL *Access; 484 484 EFI_DEVICE_PATH_PROTOCOL *Path; 485 UINTN OffSet; 485 UINTN OffSet; 486 486 487 487 Status = GetAccessControl (&Access, AccessType); 488 488 if (EFI_ERROR (Status)) { 489 489 return FALSE; 490 } 490 } 491 491 492 492 OffSet = 0; 493 493 while (OffSet < Access->Size - sizeof (EFI_USER_INFO_ACCESS_CONTROL)) { 494 Path = (EFI_DEVICE_PATH_PROTOCOL*)((UINT8*)(Access + 1) + OffSet); 494 Path = (EFI_DEVICE_PATH_PROTOCOL*)((UINT8*)(Access + 1) + OffSet); 495 495 if (CheckDevicePath (Path, DevicePath)) { 496 496 // … … 499 499 FreePool (Access); 500 500 return TRUE; 501 } 501 } 502 502 OffSet += GetDevicePathSize (Path); 503 503 } 504 504 505 505 FreePool (Access); 506 return FALSE; 507 } 508 509 510 /** 511 Check whether the image pointed to by DevicePath is permitted to load. 506 return FALSE; 507 } 508 509 510 /** 511 Check whether the image pointed to by DevicePath is permitted to load. 512 512 513 513 @param[in] DevicePath Points to device path 514 514 515 515 @retval TURE The image pointed by DevicePath is permitted to load. 516 516 @retval FALSE The image pointed by DevicePath is forbidden to load. … … 524 524 if (IsDevicePathInList (DevicePath, EFI_USER_INFO_ACCESS_PERMIT_LOAD)) { 525 525 // 526 // This access control overrides any restrictions put in place by the 526 // This access control overrides any restrictions put in place by the 527 527 // EFI_USER_INFO_ACCESS_FORBID_LOAD record. 528 528 // 529 529 return TRUE; 530 530 } 531 531 532 532 if (IsDevicePathInList (DevicePath, EFI_USER_INFO_ACCESS_FORBID_LOAD)) { 533 533 // … … 536 536 return FALSE; 537 537 } 538 539 return TRUE; 540 } 541 542 543 /** 544 Check the image pointed by DevicePath is a boot option or not. 538 539 return TRUE; 540 } 541 542 543 /** 544 Check the image pointed by DevicePath is a boot option or not. 545 545 546 546 @param[in] DevicePath Points to device path. 547 547 548 548 @retval TURE The image pointed by DevicePath is a boot option. 549 549 @retval FALSE The image pointed by DevicePath is not a boot option. … … 563 563 UINT8 *OptionPtr; 564 564 EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath; 565 565 566 566 // 567 567 // Get BootOrder 568 568 // 569 569 BootOrderListSize = 0; 570 BootOrderList = NULL; 570 BootOrderList = NULL; 571 571 Status = gRT->GetVariable ( 572 L"BootOrder", 573 &gEfiGlobalVariableGuid, 574 NULL, 575 &BootOrderListSize, 572 L"BootOrder", 573 &gEfiGlobalVariableGuid, 574 NULL, 575 &BootOrderListSize, 576 576 NULL 577 577 ); … … 580 580 ASSERT (BootOrderList != NULL); 581 581 Status = gRT->GetVariable ( 582 L"BootOrder", 583 &gEfiGlobalVariableGuid, 584 NULL, 585 &BootOrderListSize, 582 L"BootOrder", 583 &gEfiGlobalVariableGuid, 584 NULL, 585 &BootOrderListSize, 586 586 BootOrderList 587 587 ); 588 588 } 589 589 590 590 if (EFI_ERROR (Status)) { 591 591 // … … 609 609 // Check whether the image is forbidden. 610 610 // 611 611 612 612 OptionPtr = OptionBuffer; 613 613 // … … 625 625 // 626 626 OptionPtr += StrSize ((UINT16 *) OptionPtr); 627 627 628 628 // 629 629 // Now OptionPtr points to Device Path. … … 651 651 Add the image info to a deferred image list. 652 652 653 @param[in] ImageDevicePath A pointer to the device path of a image. 654 @param[in] Image Points to the first byte of the image, or NULL if the 653 @param[in] ImageDevicePath A pointer to the device path of a image. 654 @param[in] Image Points to the first byte of the image, or NULL if the 655 655 image is not available. 656 656 @param[in] ImageSize The size of the image, or 0 if the image is not available. 657 657 658 658 **/ 659 659 VOID … … 676 676 CurImageInfo = AllocatePool ((mDeferredImage.Count + 1) * sizeof (DEFERRED_IMAGE_INFO)); 677 677 ASSERT (CurImageInfo != NULL); 678 678 679 679 CopyMem ( 680 CurImageInfo, 680 CurImageInfo, 681 681 mDeferredImage.ImageInfo, 682 682 mDeferredImage.Count * sizeof (DEFERRED_IMAGE_INFO) … … 686 686 } 687 687 mDeferredImage.Count++; 688 688 689 689 // 690 690 // Save the deferred image information. … … 705 705 Returns information about a deferred image. 706 706 707 This function returns information about a single deferred image. The deferred images are 708 numbered consecutively, starting with 0. If there is no image which corresponds to 709 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 707 This function returns information about a single deferred image. The deferred images are 708 numbered consecutively, starting with 0. If there is no image which corresponds to 709 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 710 710 iteratively calling this function until EFI_NOT_FOUND is returned. 711 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 712 because of the location of the executable image, rather than its actual contents. 711 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 712 because of the location of the executable image, rather than its actual contents. 713 713 714 714 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 715 715 @param[in] ImageIndex Zero-based index of the deferred index. 716 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 717 The device path should not be freed by the caller. 718 @param[out] Image On return, points to the first byte of the image or NULL if the 716 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 717 The device path should not be freed by the caller. 718 @param[out] Image On return, points to the first byte of the image or NULL if the 719 719 image is not available. The image should not be freed by the caller 720 unless LoadImage() has been successfully called. 720 unless LoadImage() has been successfully called. 721 721 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available. 722 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 723 or FALSE if it was not intended as a boot option. 724 722 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 723 or FALSE if it was not intended as a boot option. 724 725 725 @retval EFI_SUCCESS Image information returned successfully. 726 726 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image. 727 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 727 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 728 728 BootOption is NULL. 729 729 730 730 **/ 731 731 EFI_STATUS … … 749 749 return EFI_INVALID_PARAMETER; 750 750 } 751 751 752 752 if ((ImageDevicePath == NULL) || (BootOption == NULL)) { 753 753 return EFI_INVALID_PARAMETER; … … 757 757 return EFI_NOT_FOUND; 758 758 } 759 759 760 760 // 761 761 // Get the request deferred image. 762 // 762 // 763 763 ReqImageInfo = &mDeferredImage.ImageInfo[ImageIndex]; 764 764 765 765 *ImageDevicePath = ReqImageInfo->ImageDevicePath; 766 766 *Image = ReqImageInfo->Image; 767 767 *ImageSize = ReqImageInfo->ImageSize; 768 768 *BootOption = ReqImageInfo->BootOption; 769 769 770 770 return EFI_SUCCESS; 771 771 } … … 776 776 and installs Deferred Image Load Protocol. 777 777 778 @param[in] AuthenticationStatus This is the authentication status returned from the 778 @param[in] AuthenticationStatus This is the authentication status returned from the 779 779 security measurement services for the input file. 780 780 @param[in] File This is a pointer to the device path of the file that … … 825 825 // 826 826 // Check whether user has a logon. 827 // 827 // 828 828 CurrentUser = NULL; 829 829 if (mUserManager != NULL) { … … 840 840 } 841 841 } 842 842 843 843 // 844 844 // Still no user logon. … … 853 853 return EFI_SUCCESS; 854 854 } 855 855 856 856 DEBUG ((EFI_D_INFO, "[Security] No user identified, the image is deferred to load!\n")); 857 857 PutDefferedImageInfo (File, FileBuffer, FileSize); … … 875 875 876 876 /** 877 Locate user manager protocol when user manager is installed. 877 Locate user manager protocol when user manager is installed. 878 878 879 879 @param[in] Event The Event that is being processed, not used. 880 @param[in] Context Event Context, not used. 880 @param[in] Context Event Context, not used. 881 881 882 882 **/ … … 893 893 (VOID **) &mUserManager 894 894 ); 895 895 896 896 } 897 897 … … 913 913 { 914 914 VOID *Registration; 915 915 916 916 // 917 917 // Register user manager notification function. 918 918 // 919 919 EfiCreateProtocolNotifyEvent ( 920 &gEfiUserManagerProtocolGuid, 920 &gEfiUserManagerProtocolGuid, 921 921 TPL_CALLBACK, 922 922 FindUserManagerProtocol, … … 924 924 &Registration 925 925 ); 926 926 927 927 return RegisterSecurity2Handler ( 928 928 DxeDeferImageLoadHandler, 929 EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 930 ); 931 } 932 933 929 EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 930 ); 931 } 932 933 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.h
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 68 68 Returns information about a deferred image. 69 69 70 This function returns information about a single deferred image. The deferred images are 71 numbered consecutively, starting with 0. If there is no image which corresponds to 72 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 70 This function returns information about a single deferred image. The deferred images are 71 numbered consecutively, starting with 0. If there is no image which corresponds to 72 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 73 73 iteratively calling this function until EFI_NOT_FOUND is returned. 74 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 75 because of the location of the executable image, rather than its actual contents. 74 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 75 because of the location of the executable image, rather than its actual contents. 76 76 77 77 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 78 78 @param[in] ImageIndex Zero-based index of the deferred index. 79 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 80 The device path should not be freed by the caller. 81 @param[out] Image On return, points to the first byte of the image or NULL if the 79 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 80 The device path should not be freed by the caller. 81 @param[out] Image On return, points to the first byte of the image or NULL if the 82 82 image is not available. The image should not be freed by the caller 83 unless LoadImage() has been called successfully. 83 unless LoadImage() has been called successfully. 84 84 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available. 85 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 86 or FALSE if it was not intended as a boot option. 87 85 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 86 or FALSE if it was not intended as a boot option. 87 88 88 @retval EFI_SUCCESS Image information returned successfully. 89 89 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image. 90 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 90 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 91 91 BootOption is NULL. 92 92 93 93 **/ 94 94 EFI_STATUS … … 102 102 OUT BOOLEAN *BootOption 103 103 ); 104 104 105 105 #endif -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.inf
r58459 r58466 2 2 # Provides security service of deferred image load 3 3 # 4 # The platform may need to defer the execution of an image because of security 5 # considerations. These deferred images will be recorded and then reported by 4 # The platform may need to defer the execution of an image because of security 5 # considerations. These deferred images will be recorded and then reported by 6 6 # installing an instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 7 7 # … … 49 49 BaseMemoryLib 50 50 PrintLib 51 DebugLib 51 DebugLib 52 52 UefiLib 53 PcdLib 53 PcdLib 54 54 55 55 [Protocols] … … 61 61 ## NOTIFY 62 62 gEfiUserManagerProtocolGuid 63 63 64 64 [Guids] 65 65 gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES ## Variable:L"BootOrder" 66 66 67 67 [Pcd] 68 68 gEfiSecurityPkgTokenSpaceGuid.PcdDeferImageLoadPolicy ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageAuthenticationStatusLib/DxeImageAuthenticationStatusLib.c
r58464 r58466 19 19 /** 20 20 Check image authentication status returned from Section Extraction Protocol 21 22 @param[in] AuthenticationStatus This is the authentication status returned from 21 22 @param[in] AuthenticationStatus This is the authentication status returned from 23 23 the Section Extraction Protocol when reading the input file. 24 24 @param[in] File This is a pointer to the device path of the file that is -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageAuthenticationStatusLib/DxeImageAuthenticationStatusLib.inf
r58464 r58466 21 21 MODULE_TYPE = DXE_DRIVER 22 22 VERSION_STRING = 1.0 23 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 23 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 24 CONSTRUCTOR = DxeImageAuthenticationStatusLibConstructor 25 25 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
r58459 r58466 100 100 @param FileHandle Pointer to the file handle to read the PE/COFF image. 101 101 @param FileOffset Offset into the PE/COFF image to begin the read operation. 102 @param ReadSize On input, the size in bytes of the requested read operation. 102 @param ReadSize On input, the size in bytes of the requested read operation. 103 103 On output, the number of bytes actually read. 104 104 @param Buffer Output buffer that contains the data read from the PE/COFF image. 105 106 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 105 106 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 107 107 **/ 108 108 EFI_STATUS … … 118 118 119 119 if (FileHandle == NULL || ReadSize == NULL || Buffer == NULL) { 120 return EFI_INVALID_PARAMETER; 120 return EFI_INVALID_PARAMETER; 121 121 } 122 122 … … 348 348 if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 349 349 // 350 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 351 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 350 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 351 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 352 352 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 353 353 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 360 360 Magic = mNtHeader.Pe32->OptionalHeader.Magic; 361 361 } 362 362 363 363 // 364 364 // 3. Calculate the distance from the base of the image header to the image checksum address. … … 467 467 goto Done; 468 468 } 469 } 469 } 470 470 } 471 471 … … 605 605 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed image. 606 606 @param[in] AuthDataSize Size of the Authenticode Signature in bytes. 607 607 608 608 @retval EFI_UNSUPPORTED Hash algorithm is not supported. 609 609 @retval EFI_SUCCESS Hash successfully. … … 1110 1110 1111 1111 // 1112 // The policy QUERY_USER_ON_SECURITY_VIOLATION and ALLOW_EXECUTE_ON_SECURITY_VIOLATION 1112 // The policy QUERY_USER_ON_SECURITY_VIOLATION and ALLOW_EXECUTE_ON_SECURITY_VIOLATION 1113 1113 // violates the UEFI spec and has been removed. 1114 1114 // … … 1185 1185 if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 1186 1186 // 1187 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 1188 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 1187 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 1188 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 1189 1189 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 1190 1190 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 1197 1197 Magic = mNtHeader.Pe32->OptionalHeader.Magic; 1198 1198 } 1199 1199 1200 1200 if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 1201 1201 // … … 1205 1205 if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_SECURITY) { 1206 1206 SecDataDir = (EFI_IMAGE_DATA_DIRECTORY *) &mNtHeader.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]; 1207 } 1207 } 1208 1208 } else { 1209 1209 // … … 1221 1221 if (SecDataDir == NULL || SecDataDir->Size == 0) { 1222 1222 // 1223 // This image is not signed. The SHA256 hash value of the image must match a record in the security database "db", 1223 // This image is not signed. The SHA256 hash value of the image must match a record in the security database "db", 1224 1224 // and not be reflected in the security data base "dbx". 1225 1225 // … … 1249 1249 1250 1250 // 1251 // Verify the signature of the image, multiple signatures are allowed as per PE/COFF Section 4.7 1251 // Verify the signature of the image, multiple signatures are allowed as per PE/COFF Section 4.7 1252 1252 // "Attribute Certificate Table". 1253 1253 // The first certificate starts at offset (SecDataDir->VirtualAddress) from the start of the file. … … 1261 1261 break; 1262 1262 } 1263 1263 1264 1264 // 1265 1265 // Verify the image's Authenticode signature, only DER-encoded PKCS#7 signed data is supported. … … 1267 1267 if (WinCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) { 1268 1268 // 1269 // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is described in the 1269 // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is described in the 1270 1270 // Authenticode specification. 1271 1271 // … … 1300 1300 continue; 1301 1301 } 1302 1302 1303 1303 // 1304 1304 // Check the digital signature against the revoked certificate in forbidden database (dbx). … … 1339 1339 VerifyStatus = EFI_ACCESS_DENIED; 1340 1340 } 1341 1341 1342 1342 if (!EFI_ERROR (VerifyStatus)) { 1343 1343 return EFI_SUCCESS; … … 1414 1414 } 1415 1415 1416 ImageExeInfoTable->NumberOfImages = 0; 1416 ImageExeInfoTable->NumberOfImages = 0; 1417 1417 gBS->InstallConfigurationTable (&gEfiImageSecurityDatabaseGuid, (VOID *) ImageExeInfoTable); 1418 1418 … … 1441 1441 EfiCreateEventReadyToBootEx ( 1442 1442 TPL_CALLBACK, 1443 OnReadyToBoot, 1444 NULL, 1443 OnReadyToBoot, 1444 NULL, 1445 1445 &Event 1446 ); 1446 ); 1447 1447 1448 1448 return RegisterSecurity2Handler ( -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
r58459 r58466 4 4 5 5 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 9 http://opensource.org/licenses/bsd-license.php 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 … … 79 79 // Set max digest size as SHA256 Output (32 bytes) by far 80 80 // 81 #define MAX_DIGEST_SIZE SHA256_DIGEST_SIZE 81 #define MAX_DIGEST_SIZE SHA256_DIGEST_SIZE 82 82 // 83 83 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
r58459 r58466 26 26 MODULE_TYPE = DXE_DRIVER 27 27 VERSION_STRING = 1.0 28 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 28 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 29 CONSTRUCTOR = DxeImageVerificationLibConstructor 30 30 … … 75 75 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. 76 76 gEfiCertSha1Guid 77 77 78 78 ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 79 79 ## SOMETIMES_PRODUCES ## GUID # Unique ID for the type of the signature. … … 82 82 gEfiCertX509Guid ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the signature. 83 83 gEfiCertPkcs7Guid ## SOMETIMES_CONSUMES ## GUID # Unique ID for the type of the certificate. 84 84 85 85 [Pcd] 86 86 gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeImageVerificationLib/Measurement.c
r58464 r58466 99 99 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 100 100 @param[in] VendorGuid A unique identifier for the vendor. 101 @param[in] VarData The content of the variable data. 102 @param[in] VarSize The size of the variable data. 103 101 @param[in] VarData The content of the variable data. 102 @param[in] VarSize The size of the variable data. 103 104 104 @retval EFI_SUCCESS Operation completed successfully. 105 105 @retval EFI_OUT_OF_RESOURCES Out of memory. … … 153 153 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 154 154 @param[in] VendorGuid A unique identifier for the vendor. 155 @param[in] VarData The content of the variable data. 156 @param[in] VarSize The size of the variable data. 155 @param[in] VarData The content of the variable data. 156 @param[in] VarSize The size of the variable data. 157 157 158 158 @retval TRUE The data is already measured. … … 199 199 200 200 for (Index = 0; Index < sizeof(mVariableType)/sizeof(mVariableType[0]); Index++) { 201 if ((StrCmp (VariableName, mVariableType[Index].VariableName) == 0) && 201 if ((StrCmp (VariableName, mVariableType[Index].VariableName) == 0) && 202 202 (CompareGuid (VendorGuid, mVariableType[Index].VendorGuid))) { 203 203 return TRUE; … … 212 212 @param[in] VarName A Null-terminated string that is the name of the vendor's variable. 213 213 @param[in] VendorGuid A unique identifier for the vendor. 214 @param[in] VarData The content of the variable data. 215 @param[in] VarSize The size of the variable data. 216 214 @param[in] VarData The content of the variable data. 215 @param[in] VarSize The size of the variable data. 216 217 217 @retval EFI_SUCCESS Operation completed successfully. 218 218 @retval EFI_OUT_OF_RESOURCES Out of memory. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
r58464 r58466 1 1 /** @file 2 2 3 This library registers RSA 2048 SHA 256 guided section handler 3 This library registers RSA 2048 SHA 256 guided section handler 4 4 to parse RSA 2048 SHA 256 encapsulation section and extract raw data. 5 5 It uses the BaseCrypyLib based on OpenSSL to authenticate the signature. 6 6 7 7 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 16 16 **/ … … 51 51 52 52 GetInfo gets raw data size and attribute of the input guided section. 53 It first checks whether the input guid section is supported. 53 It first checks whether the input guid section is supported. 54 54 If not, EFI_INVALID_PARAMETER will return. 55 55 … … 59 59 @param SectionAttribute The attribute of the input guided section. 60 60 61 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 61 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 62 62 the attribute of the input section are successull retrieved. 63 63 @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid. … … 112 112 Extraction handler tries to extract raw data from the input guided section. 113 113 It also does authentication check for RSA 2048 SHA 256 signature in the input guided section. 114 It first checks whether the input guid section is supported. 114 It first checks whether the input guid section is supported. 115 115 If not, EFI_INVALID_PARAMETER will return. 116 116 … … 144 144 VOID *HashContext; 145 145 VOID *Rsa; 146 146 147 147 HashContext = NULL; 148 148 Rsa = NULL; 149 149 150 150 if (IS_SECTION2 (InputSection)) { 151 151 // … … 157 157 return EFI_INVALID_PARAMETER; 158 158 } 159 159 160 160 // 161 161 // Get the RSA 2048 SHA 256 information. … … 185 185 return EFI_INVALID_PARAMETER; 186 186 } 187 187 188 188 // 189 189 // Get the RSA 2048 SHA 256 information. … … 215 215 // 216 216 *AuthenticationStatus |= EFI_AUTH_STATUS_PLATFORM_OVERRIDE; 217 217 218 218 return EFI_SUCCESS; 219 219 } … … 223 223 // 224 224 Status = EFI_SUCCESS; 225 225 226 226 // 227 227 // Fail if the HashType is not SHA 256 … … 265 265 goto Done; 266 266 } 267 267 268 268 // 269 269 // Fail if the PublicKey is not one of the public keys in PcdRsa2048Sha256PublicKeyBuffer … … 300 300 goto Done; 301 301 } 302 303 // 302 303 // 304 304 // Set RSA Key Components. 305 305 // NOTE: Only N and E are needed to be set as RSA public key for signature verification. … … 348 348 PERF_START (NULL, "RsaVerify", "DXE", 0); 349 349 CryptoStatus = RsaPkcs1Verify ( 350 Rsa, 351 Digest, 352 SHA256_DIGEST_SIZE, 353 CertBlockRsa2048Sha256->Signature, 350 Rsa, 351 Digest, 352 SHA256_DIGEST_SIZE, 353 CertBlockRsa2048Sha256->Signature, 354 354 sizeof (CertBlockRsa2048Sha256->Signature) 355 355 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
r58464 r58466 1 1 ## @file 2 # This library doesn't produce any library class. The constructor function uses 2 # This library doesn't produce any library class. The constructor function uses 3 3 # ExtractGuidedSectionLib service to register an RSA 2048 SHA 256 guided section handler 4 4 # that parses RSA 2048 SHA 256 encapsulation section and extracts raw data. … … 40 40 CryptoPkg/CryptoPkg.dec 41 41 SecurityPkg/SecurityPkg.dec 42 42 43 43 [LibraryClasses] 44 44 ExtractGuidedSectionLib … … 51 51 PerformanceLib 52 52 53 [PcdEx] 53 [PcdEx] 54 54 gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer ## SOMETIMES_CONSUMES 55 55 56 56 [Protocols] 57 57 gEfiSecurityPolicyProtocolGuid ## SOMETIMES_CONSUMES (Set platform override AUTH status if exist) 58 58 59 59 [Guids] 60 60 gEfiCertTypeRsa2048Sha256Guid ## PRODUCES ## UNDEFINED # Specifies RSA 2048 SHA 256 authentication algorithm. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
r58459 r58466 10 10 11 11 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 15 15 http://opensource.org/licenses/bsd-license.php 16 16 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 18 18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 19 19 … … 61 61 Get TPM physical presence permanent flags. 62 62 63 @param[in] TcgProtocol EFI TCG Protocol instance. 64 @param[out] LifetimeLock physicalPresenceLifetimeLock permanent flag. 63 @param[in] TcgProtocol EFI TCG Protocol instance. 64 @param[out] LifetimeLock physicalPresenceLifetimeLock permanent flag. 65 65 @param[out] CmdEnable physicalPresenceCMDEnable permanent flag. 66 66 67 67 @retval EFI_SUCCESS Flags were returns successfully. 68 68 @retval other Failed to locate EFI TCG Protocol. … … 83 83 TPM_PERMANENT_FLAGS *TpmPermanentFlags; 84 84 UINT8 RecvBuffer[40]; 85 85 86 86 // 87 87 // Fill request header … … 89 89 TpmRsp = (TPM_RSP_COMMAND_HDR*)RecvBuffer; 90 90 TpmRqu = (TPM_RQU_COMMAND_HDR*)SendBuffer; 91 91 92 92 TpmRqu->tag = SwapBytes16 (TPM_TAG_RQU_COMMAND); 93 93 TpmRqu->paramSize = SwapBytes32 (sizeof (SendBuffer)); … … 100 100 WriteUnaligned32 (SendBufPtr++, SwapBytes32 (TPM_CAP_FLAG)); 101 101 WriteUnaligned32 (SendBufPtr++, SwapBytes32 (sizeof (TPM_CAP_FLAG_PERMANENT))); 102 WriteUnaligned32 (SendBufPtr, SwapBytes32 (TPM_CAP_FLAG_PERMANENT)); 103 102 WriteUnaligned32 (SendBufPtr, SwapBytes32 (TPM_CAP_FLAG_PERMANENT)); 103 104 104 Status = TcgProtocol->PassThroughToTpm ( 105 105 TcgProtocol, … … 112 112 ASSERT (TpmRsp->tag == SwapBytes16 (TPM_TAG_RSP_COMMAND)); 113 113 ASSERT (TpmRsp->returnCode == 0); 114 114 115 115 TpmPermanentFlags = (TPM_PERMANENT_FLAGS *)&RecvBuffer[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)]; 116 116 117 117 if (LifetimeLock != NULL) { 118 118 *LifetimeLock = TpmPermanentFlags->physicalPresenceLifetimeLock; … … 129 129 Issue TSC_PhysicalPresence command to TPM. 130 130 131 @param[in] TcgProtocol EFI TCG Protocol instance. 132 @param[in] PhysicalPresence The state to set the TPM's Physical Presence flags. 133 131 @param[in] TcgProtocol EFI TCG Protocol instance. 132 @param[in] PhysicalPresence The state to set the TPM's Physical Presence flags. 133 134 134 @retval EFI_SUCCESS TPM executed the command successfully. 135 135 @retval EFI_SECURITY_VIOLATION TPM returned error when executing the command. … … 155 155 TpmRqu->paramSize = SwapBytes32 (sizeof (Buffer)); 156 156 TpmRqu->ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence); 157 WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence)); 157 WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence)); 158 158 159 159 Status = TcgProtocol->PassThroughToTpm ( … … 172 172 return EFI_SECURITY_VIOLATION; 173 173 } 174 174 175 175 return Status; 176 176 } … … 179 179 Issue a TPM command for which no additional output data will be returned. 180 180 181 @param[in] TcgProtocol EFI TCG Protocol instance. 182 @param[in] Ordinal TPM command code. 183 @param[in] AdditionalParameterSize Additional parameter size. 184 @param[in] AdditionalParameters Pointer to the Additional paramaters. 185 186 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 181 @param[in] TcgProtocol EFI TCG Protocol instance. 182 @param[in] Ordinal TPM command code. 183 @param[in] AdditionalParameterSize Additional parameter size. 184 @param[in] AdditionalParameters Pointer to the Additional paramaters. 185 186 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 187 187 receiving response from TPM. 188 188 @retval Others Return code from the TPM device after command execution. … … 233 233 @param[in] CommandCode Physical presence operation value. 234 234 @param[in, out] PpiFlags The physical presence interface flags. 235 235 236 236 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Unknown physical presence operation. 237 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 237 @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 238 238 receiving response from TPM. 239 239 @retval Others Return code from the TPM device after command execution. … … 398 398 PpiFlags->PPFlags |= TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_MAINTENANCE; 399 399 return 0; 400 400 401 401 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR: 402 402 // … … 424 424 TpmResponse = ExecutePhysicalPresence (TcgProtocol, PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE, PpiFlags); 425 425 PpiFlags->PPFlags &= ~TCG_VENDOR_LIB_FLAG_RESET_TRACK; 426 } 426 } 427 427 return TpmResponse; 428 428 … … 454 454 UINTN Index; 455 455 456 InputKey = 0; 456 InputKey = 0; 457 457 do { 458 458 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); … … 480 480 return TRUE; 481 481 } 482 482 483 483 return FALSE; 484 484 } … … 486 486 /** 487 487 The constructor function register UNI strings into imageHandle. 488 489 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 488 489 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 490 490 491 491 @param ImageHandle The firmware allocated handle for the EFI image. 492 492 @param SystemTable A pointer to the EFI System Table. 493 493 494 494 @retval EFI_SUCCESS The constructor successfully added string package. 495 495 @retval Other value The constructor can't add string package. … … 524 524 CHAR16 *ConfirmText; 525 525 CHAR16 *TmpStr1; 526 CHAR16 *TmpStr2; 526 CHAR16 *TmpStr2; 527 527 UINTN BufSize; 528 528 BOOLEAN CautionKey; 529 529 UINT16 Index; 530 530 CHAR16 DstStr[81]; 531 531 532 532 TmpStr2 = NULL; 533 533 CautionKey = FALSE; … … 539 539 case PHYSICAL_PRESENCE_ENABLE: 540 540 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ENABLE)); 541 541 542 542 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 543 543 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); … … 551 551 case PHYSICAL_PRESENCE_DISABLE: 552 552 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DISABLE)); 553 553 554 554 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 555 555 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); … … 564 564 FreePool (TmpStr1); 565 565 break; 566 566 567 567 case PHYSICAL_PRESENCE_ACTIVATE: 568 568 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACTIVATE)); 569 569 570 570 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 571 571 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); … … 590 590 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACCEPT_KEY)); 591 591 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 592 FreePool (TmpStr1); 592 FreePool (TmpStr1); 593 593 break; 594 594 … … 604 604 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 605 605 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 606 FreePool (TmpStr1); 606 FreePool (TmpStr1); 607 607 608 608 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 629 629 case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE: 630 630 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DEACTIVATE_DISABLE)); 631 632 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 631 632 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 633 633 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 634 634 FreePool (TmpStr1); … … 637 637 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 638 638 FreePool (TmpStr1); 639 639 640 640 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING)); 641 641 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); … … 649 649 case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_TRUE: 650 650 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ALLOW_TAKE_OWNERSHIP)); 651 652 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 651 652 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 653 653 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 654 654 FreePool (TmpStr1); … … 661 661 case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_FALSE: 662 662 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DISALLOW_TAKE_OWNERSHIP)); 663 664 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 663 664 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 665 665 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 666 666 FreePool (TmpStr1); … … 689 689 case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE_OWNER_FALSE: 690 690 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_TURN_OFF)); 691 692 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 691 692 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR)); 693 693 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 694 694 FreePool (TmpStr1); … … 697 697 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 698 698 FreePool (TmpStr1); 699 699 700 700 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING)); 701 701 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); … … 710 710 CautionKey = TRUE; 711 711 TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UNOWNED_FIELD_UPGRADE)); 712 713 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UPGRADE_HEAD_STR)); 714 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 715 FreePool (TmpStr1); 716 712 713 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UPGRADE_HEAD_STR)); 714 UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2); 715 FreePool (TmpStr1); 716 717 717 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_MAINTAIN)); 718 718 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); … … 788 788 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 789 789 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 790 FreePool (TmpStr1); 790 FreePool (TmpStr1); 791 791 792 792 TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 878 878 DstStr[80] = L'\0'; 879 879 for (Index = 0; Index < StrLen (ConfirmText); Index += 80) { 880 StrnCpy(DstStr, ConfirmText + Index, 80); 881 Print (DstStr); 882 } 883 880 StrnCpy(DstStr, ConfirmText + Index, 80); 881 Print (DstStr); 882 } 883 884 884 FreePool (TmpStr1); 885 885 FreePool (TmpStr2); … … 890 890 } 891 891 892 return FALSE; 892 return FALSE; 893 893 } 894 894 895 895 /** 896 Check if there is a valid physical presence command request. Also updates parameter value 896 Check if there is a valid physical presence command request. Also updates parameter value 897 897 to whether the requested physical presence command already confirmed by user 898 898 899 899 @param[in] TcgPpData EFI TCG Physical Presence request data. 900 @param[in] Flags The physical presence interface flags. 900 @param[in] Flags The physical presence interface flags. 901 901 @param[out] RequestConfirmed If the physical presence operation command required user confirm from UI. 902 True, it indicates the command doesn't require user confirm, or already confirmed 902 True, it indicates the command doesn't require user confirm, or already confirmed 903 903 in last boot cycle by user. 904 904 False, it indicates the command need user confirm from UI. … … 1007 1007 its data structure to be valid value. 1008 1008 1009 @param[in] TcgProtocol EFI TCG Protocol instance. 1009 @param[in] TcgProtocol EFI TCG Protocol instance. 1010 1010 @param[in] TcgPpData Point to the physical presence NV variable. 1011 1011 @param[in] Flags The physical presence interface flags. … … 1053 1053 if (!RequestConfirmed) { 1054 1054 // 1055 // Print confirm text and wait for approval. 1055 // Print confirm text and wait for approval. 1056 1056 // 1057 1057 RequestConfirmed = UserConfirm (TcgPpData->PPRequest); … … 1078 1078 sizeof (EFI_PHYSICAL_PRESENCE_FLAGS), 1079 1079 &NewFlags 1080 ); 1080 ); 1081 1081 if (EFI_ERROR (Status)) { 1082 1082 return; 1083 1083 } 1084 1084 } 1085 1085 1086 1086 // 1087 1087 // Clear request … … 1089 1089 if ((NewFlags.PPFlags & TCG_VENDOR_LIB_FLAG_RESET_TRACK) == 0) { 1090 1090 TcgPpData->LastPPRequest = TcgPpData->PPRequest; 1091 TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION; 1091 TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION; 1092 1092 } 1093 1093 … … 1125 1125 case PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE: 1126 1126 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR: 1127 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE: 1127 case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE: 1128 1128 break; 1129 1129 default: … … 1143 1143 Print (L"Rebooting system to make TPM settings in effect\n"); 1144 1144 gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); 1145 ASSERT (FALSE); 1145 ASSERT (FALSE); 1146 1146 } 1147 1147 … … 1149 1149 Check and execute the pending TPM request and Lock TPM. 1150 1150 1151 The TPM request may come from OS or BIOS. This API will display request information and wait 1151 The TPM request may come from OS or BIOS. This API will display request information and wait 1152 1152 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after 1153 the TPM request is confirmed, and one or more reset may be required to make TPM request to 1153 the TPM request is confirmed, and one or more reset may be required to make TPM request to 1154 1154 take effect. At last, it will lock TPM to prevent TPM state change by malware. 1155 1155 1156 1156 This API should be invoked after console in and console out are all ready as they are required 1157 to display request information and get user input to confirm the request. This API should also 1157 to display request information and get user input to confirm the request. This API should also 1158 1158 be invoked as early as possible as TPM is locked in this function. 1159 1159 1160 1160 **/ 1161 1161 VOID … … 1173 1173 EDKII_VARIABLE_LOCK_PROTOCOL *VariableLockProtocol; 1174 1174 EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags; 1175 1175 1176 1176 Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol); 1177 1177 if (EFI_ERROR (Status)) { … … 1207 1207 1208 1208 // 1209 // This flags variable controls whether physical presence is required for TPM command. 1209 // This flags variable controls whether physical presence is required for TPM command. 1210 1210 // It should be protected from malicious software. We set it as read-only variable here. 1211 1211 // … … 1222 1222 } 1223 1223 } 1224 1224 1225 1225 // 1226 1226 // Initialize physical presence variable. … … 1263 1263 return ; 1264 1264 } 1265 1265 1266 1266 if (!CmdEnable) { 1267 1267 if (LifetimeLock) { … … 1276 1276 } 1277 1277 } 1278 1278 1279 1279 // 1280 1280 // Set operator physical presence flags … … 1284 1284 // 1285 1285 // Execute pending TPM request. 1286 // 1286 // 1287 1287 ExecutePendingTpmRequest (TcgProtocol, &TcgPpData, PpiFlags); 1288 1288 DEBUG ((EFI_D_INFO, "[TPM] PPResponse = %x\n", TcgPpData.PPResponse)); … … 1299 1299 The TPM request may come from OS. This API will check if TPM request exists and need user 1300 1300 input to confirmation. 1301 1301 1302 1302 @retval TRUE TPM needs input to confirm user physical presence. 1303 1303 @retval FALSE TPM doesn't need input to confirm user physical presence. … … 1318 1318 EFI_TCG_PROTOCOL *TcgProtocol; 1319 1319 EFI_PHYSICAL_PRESENCE_FLAGS PpiFlags; 1320 1320 1321 1321 Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol); 1322 1322 if (EFI_ERROR (Status)) { … … 1350 1350 return FALSE; 1351 1351 } 1352 1352 1353 1353 if (TcgPpData.PPRequest == PHYSICAL_PRESENCE_NO_ACTION) { 1354 1354 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.inf
r58459 r58466 3 3 # 4 4 # This library will check and execute TPM 1.2 request from OS or BIOS. The request may 5 # ask for user confirmation before execution. This Library will also lock TPM physical 5 # ask for user confirmation before execution. This Library will also lock TPM physical 6 6 # presence at last. 7 7 # … … 27 27 MODULE_TYPE = DXE_DRIVER 28 28 VERSION_STRING = 1.0 29 LIBRARY_CLASS = TcgPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 LIBRARY_CLASS = TcgPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 30 30 CONSTRUCTOR = TcgPhysicalPresenceLibConstructor 31 31 32 32 # 33 33 # The following information is for reference only and not required by the build tools. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/PhysicalPresenceStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
r58464 r58466 17 17 18 18 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 22 22 http://opensource.org/licenses/bsd-license.php 23 23 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 25 25 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 26 26 … … 71 71 @param FileHandle Pointer to the file handle to read the PE/COFF image. 72 72 @param FileOffset Offset into the PE/COFF image to begin the read operation. 73 @param ReadSize On input, the size in bytes of the requested read operation. 73 @param ReadSize On input, the size in bytes of the requested read operation. 74 74 On output, the number of bytes actually read. 75 75 @param Buffer Output buffer that contains the data read from the PE/COFF image. 76 77 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 76 77 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 78 78 **/ 79 79 EFI_STATUS … … 158 158 // 159 159 // Read the EFI Partition Table Header 160 // 160 // 161 161 PrimaryHeader = (EFI_PARTITION_TABLE_HEADER *) AllocatePool (BlockIo->Media->BlockSize); 162 162 if (PrimaryHeader == NULL) { 163 163 return EFI_OUT_OF_RESOURCES; 164 } 164 } 165 165 Status = DiskIo->ReadDisk ( 166 166 DiskIo, … … 174 174 FreePool (PrimaryHeader); 175 175 return EFI_DEVICE_ERROR; 176 } 176 } 177 177 // 178 178 // Read the partition entry. … … 195 195 return EFI_DEVICE_ERROR; 196 196 } 197 197 198 198 // 199 199 // Count the valid partition … … 203 203 for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) { 204 204 if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mTrEEZeroGuid)) { 205 NumberOfPartition++; 205 NumberOfPartition++; 206 206 } 207 207 PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry); … … 210 210 // 211 211 // Prepare Data for Measurement 212 // 213 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 212 // 213 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 214 214 + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry); 215 215 TreeEvent = (TrEE_EVENT *) AllocateZeroPool (EventSize + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event)); … … 225 225 TreeEvent->Header.PCRIndex = 5; 226 226 TreeEvent->Header.EventType = EV_EFI_GPT_EVENT; 227 GptData = (EFI_GPT_DATA *) TreeEvent->Event; 227 GptData = (EFI_GPT_DATA *) TreeEvent->Event; 228 228 229 229 // 230 230 // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition 231 // 231 // 232 232 CopyMem ((UINT8 *)GptData, (UINT8*)PrimaryHeader, sizeof (EFI_PARTITION_TABLE_HEADER)); 233 233 GptData->NumberOfPartitions = NumberOfPartition; … … 287 287 @retval EFI_SUCCESS Successfully measure image. 288 288 @retval EFI_OUT_OF_RESOURCES No enough resource to measure image. 289 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 289 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 290 290 @retval other error value 291 291 … … 382 382 383 383 /** 384 The security handler is used to abstract platform-specific policy 385 from the DXE core response to an attempt to use a file that returns a 386 given status for the authentication check from the section extraction protocol. 387 388 The possible responses in a given SAP implementation may include locking 389 flash upon failure to authenticate, attestation logging for all signed drivers, 390 and other exception operations. The File parameter allows for possible logging 384 The security handler is used to abstract platform-specific policy 385 from the DXE core response to an attempt to use a file that returns a 386 given status for the authentication check from the section extraction protocol. 387 388 The possible responses in a given SAP implementation may include locking 389 flash upon failure to authenticate, attestation logging for all signed drivers, 390 and other exception operations. The File parameter allows for possible logging 391 391 within the SAP of the driver. 392 392 393 393 If File is NULL, then EFI_INVALID_PARAMETER is returned. 394 394 395 If the file specified by File with an authentication status specified by 395 If the file specified by File with an authentication status specified by 396 396 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. 397 397 398 If the file specified by File with an authentication status specified by 399 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 398 If the file specified by File with an authentication status specified by 399 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 400 400 then EFI_ACCESS_DENIED is returned. 401 401 402 If the file specified by File with an authentication status specified by 403 AuthenticationStatus is not safe for the DXE Core to use right now, but it 404 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 402 If the file specified by File with an authentication status specified by 403 AuthenticationStatus is not safe for the DXE Core to use right now, but it 404 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 405 405 returned. 406 406 … … 454 454 ProtocolCapability.Size = (UINT8) sizeof (ProtocolCapability); 455 455 Status = TreeProtocol->GetCapability ( 456 TreeProtocol, 456 TreeProtocol, 457 457 &ProtocolCapability 458 458 ); … … 469 469 // 470 470 OrigDevicePathNode = DuplicateDevicePath (File); 471 471 472 472 // 473 473 // 1. Check whether this device path support BlockIo protocol. … … 490 490 // 491 491 // Check whether it is a gpt partition or not 492 // 493 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 492 // 493 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 494 494 ((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->SignatureType == SIGNATURE_TYPE_GUID) { 495 495 … … 527 527 } 528 528 } 529 529 530 530 // 531 531 // 2. Measure PE image. … … 561 561 do { 562 562 Status = gBS->HandleProtocol( 563 TempHandle, 563 TempHandle, 564 564 &gEfiFirmwareVolumeBlockProtocolGuid, 565 565 (VOID**)&FvbProtocol … … 620 620 goto Finish; 621 621 } 622 622 623 623 // 624 624 // Measure only application if Application flag is set 625 625 // Measure drivers and applications if Application flag is not set 626 626 // 627 if ((!ApplicationRequired) || 628 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 627 if ((!ApplicationRequired) || 628 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 629 629 // 630 630 // Print the image path to be measured. 631 // 631 // 632 632 DEBUG_CODE_BEGIN (); 633 633 CHAR16 *ToText; … … 648 648 Status = TrEEMeasurePeImage ( 649 649 TreeProtocol, 650 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 651 FileSize, 652 (UINTN) ImageContext.ImageAddress, 653 ImageContext.ImageType, 650 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 651 FileSize, 652 (UINTN) ImageContext.ImageAddress, 653 ImageContext.ImageType, 654 654 DevicePathNode 655 655 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
r58464 r58466 2 2 # Provides security service for TPM 2.0 measured boot 3 3 # 4 # This library instance hooks LoadImage() API to measure every image that 4 # This library instance hooks LoadImage() API to measure every image that 5 5 # is not measured in PEI phase. And, it will also measure GPT partition. 6 6 # 7 7 # Caution: This module requires additional review when modified. 8 8 # This library will have external input - PE/COFF image and GPT partition. 9 # This external input must be validated carefully to avoid security issues such 9 # This external input must be validated carefully to avoid security issues such 10 10 # as buffer overflow or integer overflow. 11 11 # … … 27 27 MODULE_TYPE = DXE_DRIVER 28 28 VERSION_STRING = 1.0 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 30 30 CONSTRUCTOR = DxeTpm2MeasureBootLibConstructor 31 31 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
r58459 r58466 1 1 /** @file 2 The library instance provides security service of TPM measure boot. 2 The library instance provides security service of TPM measure boot. 3 3 4 4 Caution: This file requires additional review when modified. … … 17 17 18 18 Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 19 This program and the accompanying materials 20 are licensed and made available under the terms and conditions of the BSD License 21 which accompanies this distribution. The full text of the license may be found at 22 22 http://opensource.org/licenses/bsd-license.php 23 23 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 25 25 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 26 26 … … 70 70 @param FileHandle Pointer to the file handle to read the PE/COFF image. 71 71 @param FileOffset Offset into the PE/COFF image to begin the read operation. 72 @param ReadSize On input, the size in bytes of the requested read operation. 72 @param ReadSize On input, the size in bytes of the requested read operation. 73 73 On output, the number of bytes actually read. 74 74 @param Buffer Output buffer that contains the data read from the PE/COFF image. 75 76 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 75 76 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size 77 77 **/ 78 78 EFI_STATUS … … 159 159 // 160 160 // Read the EFI Partition Table Header 161 // 161 // 162 162 PrimaryHeader = (EFI_PARTITION_TABLE_HEADER *) AllocatePool (BlockIo->Media->BlockSize); 163 163 if (PrimaryHeader == NULL) { 164 164 return EFI_OUT_OF_RESOURCES; 165 } 165 } 166 166 Status = DiskIo->ReadDisk ( 167 167 DiskIo, … … 175 175 FreePool (PrimaryHeader); 176 176 return EFI_DEVICE_ERROR; 177 } 177 } 178 178 // 179 179 // Read the partition entry. … … 196 196 return EFI_DEVICE_ERROR; 197 197 } 198 198 199 199 // 200 200 // Count the valid partition … … 204 204 for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) { 205 205 if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mZeroGuid)) { 206 NumberOfPartition++; 206 NumberOfPartition++; 207 207 } 208 208 PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry); … … 211 211 // 212 212 // Prepare Data for Measurement 213 // 214 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 213 // 214 EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) 215 215 + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry); 216 216 TcgEvent = (TCG_PCR_EVENT *) AllocateZeroPool (EventSize + sizeof (TCG_PCR_EVENT_HDR)); … … 224 224 TcgEvent->EventType = EV_EFI_GPT_EVENT; 225 225 TcgEvent->EventSize = EventSize; 226 GptData = (EFI_GPT_DATA *) TcgEvent->Event; 226 GptData = (EFI_GPT_DATA *) TcgEvent->Event; 227 227 228 228 // 229 229 // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition 230 // 230 // 231 231 CopyMem ((UINT8 *)GptData, (UINT8*)PrimaryHeader, sizeof (EFI_PARTITION_TABLE_HEADER)); 232 232 GptData->NumberOfPartitions = NumberOfPartition; … … 289 289 @retval EFI_SUCCESS Successfully measure image. 290 290 @retval EFI_OUT_OF_RESOURCES No enough resource to measure image. 291 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 291 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. 292 292 @retval other error value 293 293 … … 419 419 if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 420 420 // 421 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 422 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 421 // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value 422 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the 423 423 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 424 424 // then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC … … 431 431 Magic = Hdr.Pe32->OptionalHeader.Magic; 432 432 } 433 433 434 434 // 435 435 // 3. Calculate the distance from the base of the image header to the image checksum address. … … 454 454 if (!HashStatus) { 455 455 goto Finish; 456 } 456 } 457 457 458 458 // … … 483 483 goto Finish; 484 484 } 485 } 485 } 486 486 } else { 487 487 // … … 497 497 // 498 498 // Use PE32+ offset 499 // 499 // 500 500 HashBase = (UINT8 *) &Hdr.Pe32Plus->OptionalHeader.CheckSum + sizeof (UINT32); 501 501 HashSize = (UINTN) ((UINT8 *)(&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY]) - HashBase); … … 526 526 HashSize = Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - (UINTN) (HashBase - ImageAddress); 527 527 } 528 528 529 529 if (HashSize != 0) { 530 530 HashStatus = Sha1Update (Sha1Ctx, HashBase, HashSize); … … 689 689 690 690 /** 691 The security handler is used to abstract platform-specific policy 692 from the DXE core response to an attempt to use a file that returns a 693 given status for the authentication check from the section extraction protocol. 694 695 The possible responses in a given SAP implementation may include locking 696 flash upon failure to authenticate, attestation logging for all signed drivers, 697 and other exception operations. The File parameter allows for possible logging 691 The security handler is used to abstract platform-specific policy 692 from the DXE core response to an attempt to use a file that returns a 693 given status for the authentication check from the section extraction protocol. 694 695 The possible responses in a given SAP implementation may include locking 696 flash upon failure to authenticate, attestation logging for all signed drivers, 697 and other exception operations. The File parameter allows for possible logging 698 698 within the SAP of the driver. 699 699 700 700 If File is NULL, then EFI_INVALID_PARAMETER is returned. 701 701 702 If the file specified by File with an authentication status specified by 702 If the file specified by File with an authentication status specified by 703 703 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. 704 704 705 If the file specified by File with an authentication status specified by 706 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 705 If the file specified by File with an authentication status specified by 706 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, 707 707 then EFI_ACCESS_DENIED is returned. 708 708 709 If the file specified by File with an authentication status specified by 710 AuthenticationStatus is not safe for the DXE Core to use right now, but it 711 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 709 If the file specified by File with an authentication status specified by 710 AuthenticationStatus is not safe for the DXE Core to use right now, but it 711 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is 712 712 returned. 713 713 … … 763 763 ProtocolCapability.Size = (UINT8) sizeof (ProtocolCapability); 764 764 Status = TcgProtocol->StatusCheck ( 765 TcgProtocol, 765 TcgProtocol, 766 766 &ProtocolCapability, 767 767 &TCGFeatureFlags, … … 780 780 // 781 781 OrigDevicePathNode = DuplicateDevicePath (File); 782 782 783 783 // 784 784 // 1. Check whether this device path support BlockIo protocol. … … 801 801 // 802 802 // Check whether it is a gpt partition or not 803 // 804 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 803 // 804 if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && 805 805 ((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->SignatureType == SIGNATURE_TYPE_GUID) { 806 806 … … 837 837 } 838 838 } 839 839 840 840 // 841 841 // 2. Measure PE image. … … 871 871 do { 872 872 Status = gBS->HandleProtocol( 873 TempHandle, 873 TempHandle, 874 874 &gEfiFirmwareVolumeBlockProtocolGuid, 875 875 (VOID**)&FvbProtocol … … 930 930 goto Finish; 931 931 } 932 932 933 933 // 934 934 // Measure only application if Application flag is set 935 935 // Measure drivers and applications if Application flag is not set 936 936 // 937 if ((!ApplicationRequired) || 938 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 937 if ((!ApplicationRequired) || 938 (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { 939 939 // 940 940 // Print the image path to be measured. 941 // 941 // 942 942 DEBUG_CODE_BEGIN (); 943 943 CHAR16 *ToText; … … 958 958 Status = TcgMeasurePeImage ( 959 959 TcgProtocol, 960 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 961 FileSize, 962 (UINTN) ImageContext.ImageAddress, 963 ImageContext.ImageType, 960 (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, 961 FileSize, 962 (UINTN) ImageContext.ImageAddress, 963 ImageContext.ImageType, 964 964 DevicePathNode 965 965 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf
r58459 r58466 2 2 # Provides security service for TPM 1.2 measured boot 3 3 # 4 # This library instance hooks LoadImage() API to measure every image that 4 # This library instance hooks LoadImage() API to measure every image that 5 5 # is not measured in PEI phase. And, it will also measure GPT partition. 6 6 # 7 7 # Caution: This module requires additional review when modified. 8 8 # This library will have external input - PE/COFF image and GPT partition. 9 # This external input must be validated carefully to avoid security issues such 9 # This external input must be validated carefully to avoid security issues such 10 10 # as buffer overflow or integer overflow. 11 11 # … … 27 27 MODULE_TYPE = DXE_DRIVER 28 28 VERSION_STRING = 1.0 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 LIBRARY_CLASS = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 30 30 CONSTRUCTOR = DxeTpmMeasureBootLibConstructor 31 31 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.c
r58464 r58466 172 172 **/ 173 173 EFI_STATUS 174 EFIAPI 174 EFIAPI 175 175 TpmMeasureAndLogData ( 176 176 IN UINT32 PcrIndex, -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
r58464 r58466 1 1 ## @file 2 2 # Provides TPM measurement functions for TPM1.2 and TPM 2.0 3 # 4 # This library provides TpmMeasureAndLogData() to to measure and log data, and 3 # 4 # This library provides TpmMeasureAndLogData() to to measure and log data, and 5 5 # extend the measurement result into a specific PCR. 6 6 # … … 21 21 MODULE_TYPE = UEFI_DRIVER 22 22 VERSION_STRING = 1.0 23 LIBRARY_CLASS = TpmMeasurementLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 23 LIBRARY_CLASS = TpmMeasurementLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 24 MODULE_UNI_FILE = DxeTpmMeasurementLib.uni 25 25 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTrEEPhysicalPresenceLib/DxeTrEEPhysicalPresenceLib.c
r58464 r58466 9 9 10 10 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 11 This program and the accompanying materials 12 are licensed and made available under the terms and conditions of the BSD License 13 which accompanies this distribution. The full text of the license may be found at 14 14 http://opensource.org/licenses/bsd-license.php 15 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 18 18 … … 110 110 @param[in] CommandCode Physical presence operation value. 111 111 @param[in, out] PpiFlags The physical presence interface flags. 112 112 113 113 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Unknown physical presence operation. 114 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 114 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or 115 115 receiving response from TPM. 116 116 @retval Others Return code from the TPM device after command execution. … … 172 172 EFI_INPUT_KEY Key; 173 173 UINT16 InputKey; 174 175 InputKey = 0; 174 175 InputKey = 0; 176 176 do { 177 177 Status = gBS->CheckEvent (gST->ConIn->WaitForKey); … … 187 187 InputKey = Key.ScanCode; 188 188 } 189 } 189 } 190 190 } while (InputKey == 0); 191 191 … … 193 193 return TRUE; 194 194 } 195 195 196 196 return FALSE; 197 197 } … … 199 199 /** 200 200 The constructor function register UNI strings into imageHandle. 201 202 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 201 202 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 203 203 204 204 @param ImageHandle The firmware allocated handle for the EFI image. 205 205 @param SystemTable A pointer to the EFI System Table. 206 206 207 207 @retval EFI_SUCCESS The constructor successfully added string package. 208 208 @retval Other value The constructor can't add string package. … … 236 236 CHAR16 *ConfirmText; 237 237 CHAR16 *TmpStr1; 238 CHAR16 *TmpStr2; 238 CHAR16 *TmpStr2; 239 239 UINTN BufSize; 240 240 BOOLEAN CautionKey; 241 241 UINT16 Index; 242 242 CHAR16 DstStr[81]; 243 243 244 244 TmpStr2 = NULL; 245 245 CautionKey = FALSE; … … 264 264 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 265 265 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 266 FreePool (TmpStr1); 266 FreePool (TmpStr1); 267 267 268 268 TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 286 286 StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 287 287 StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1); 288 FreePool (TmpStr1); 288 FreePool (TmpStr1); 289 289 290 290 TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY)); … … 312 312 DstStr[80] = L'\0'; 313 313 for (Index = 0; Index < StrLen (ConfirmText); Index += 80) { 314 StrnCpy(DstStr, ConfirmText + Index, 80); 315 Print (DstStr); 316 } 317 314 StrnCpy(DstStr, ConfirmText + Index, 80); 315 Print (DstStr); 316 } 317 318 318 FreePool (TmpStr1); 319 319 FreePool (TmpStr2); … … 324 324 } 325 325 326 return FALSE; 327 } 328 329 /** 330 Check if there is a valid physical presence command request. Also updates parameter value 326 return FALSE; 327 } 328 329 /** 330 Check if there is a valid physical presence command request. Also updates parameter value 331 331 to whether the requested physical presence command already confirmed by user 332 333 @param[in] TcgPpData EFI TrEE Physical Presence request data. 332 333 @param[in] TcgPpData EFI TrEE Physical Presence request data. 334 334 @param[in] Flags The physical presence interface flags. 335 335 @param[out] RequestConfirmed If the physical presence operation command required user confirm from UI. 336 True, it indicates the command doesn't require user confirm, or already confirmed 336 True, it indicates the command doesn't require user confirm, or already confirmed 337 337 in last boot cycle by user. 338 338 False, it indicates the command need user confirm from UI. … … 466 466 if (!RequestConfirmed) { 467 467 // 468 // Print confirm text and wait for approval. 468 // Print confirm text and wait for approval. 469 469 // 470 470 RequestConfirmed = TrEEUserConfirm (TcgPpData->PPRequest … … 478 478 NewFlags = Flags; 479 479 if (RequestConfirmed) { 480 TcgPpData->PPResponse = TrEEExecutePhysicalPresence (PlatformAuth, TcgPpData->PPRequest, 480 TcgPpData->PPResponse = TrEEExecutePhysicalPresence (PlatformAuth, TcgPpData->PPRequest, 481 481 &NewFlags); 482 482 } … … 493 493 sizeof (EFI_TREE_PHYSICAL_PRESENCE_FLAGS), 494 494 &NewFlags 495 ); 495 ); 496 496 } 497 497 … … 501 501 if ((NewFlags.PPFlags & TREE_VENDOR_LIB_FLAG_RESET_TRACK) == 0) { 502 502 TcgPpData->LastPPRequest = TcgPpData->PPRequest; 503 TcgPpData->PPRequest = TREE_PHYSICAL_PRESENCE_NO_ACTION; 503 TcgPpData->PPRequest = TREE_PHYSICAL_PRESENCE_NO_ACTION; 504 504 } 505 505 … … 548 548 Print (L"Rebooting system to make TPM2 settings in effect\n"); 549 549 gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); 550 ASSERT (FALSE); 550 ASSERT (FALSE); 551 551 } 552 552 … … 554 554 Check and execute the pending TPM request. 555 555 556 The TPM request may come from OS or BIOS. This API will display request information and wait 556 The TPM request may come from OS or BIOS. This API will display request information and wait 557 557 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after 558 the TPM request is confirmed, and one or more reset may be required to make TPM request to 558 the TPM request is confirmed, and one or more reset may be required to make TPM request to 559 559 take effect. 560 560 561 561 This API should be invoked after console in and console out are all ready as they are required 562 to display request information and get user input to confirm the request. 562 to display request information and get user input to confirm the request. 563 563 564 564 @param[in] PlatformAuth platform auth value. NULL means no platform auth change. … … 610 610 611 611 // 612 // This flags variable controls whether physical presence is required for TPM command. 612 // This flags variable controls whether physical presence is required for TPM command. 613 613 // It should be protected from malicious software. We set it as read-only variable here. 614 614 // … … 625 625 } 626 626 } 627 627 628 628 // 629 629 // Initialize physical presence variable. … … 657 657 // 658 658 // Execute pending TPM request. 659 // 659 // 660 660 TrEEExecutePendingTpmRequest (PlatformAuth, &TcgPpData, PpiFlags); 661 661 DEBUG ((EFI_D_INFO, "[TPM2] PPResponse = %x (LastPPRequest=%x, Flags=%x)\n", TcgPpData.PPResponse, TcgPpData.LastPPRequest, PpiFlags.PPFlags)); … … 668 668 The TPM request may come from OS. This API will check if TPM request exists and need user 669 669 input to confirmation. 670 670 671 671 @retval TRUE TPM needs input to confirm user physical presence. 672 672 @retval FALSE TPM doesn't need input to confirm user physical presence. … … 717 717 return FALSE; 718 718 } 719 719 720 720 if (TcgPpData.PPRequest == TREE_PHYSICAL_PRESENCE_NO_ACTION) { 721 721 // -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/DxeTrEEPhysicalPresenceLib/DxeTrEEPhysicalPresenceLib.inf
r58464 r58466 26 26 MODULE_TYPE = DXE_DRIVER 27 27 VERSION_STRING = 1.0 28 LIBRARY_CLASS = TrEEPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 28 LIBRARY_CLASS = TrEEPhysicalPresenceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 29 29 CONSTRUCTOR = TrEEPhysicalPresenceLibConstructor 30 30 31 31 # 32 32 # The following information is for reference only and not required by the build tools. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.c
r58464 r58466 119 119 120 120 FreePool (Sha1Ctx); 121 121 122 122 Tpm2SetSha1ToDigestList (DigestList, Digest); 123 123 … … 134 134 /** 135 135 The function register SHA1 instance. 136 136 137 137 @retval EFI_SUCCESS SHA1 instance is registered, or system dose not surpport registr SHA1 instance 138 138 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.c
r58464 r58466 119 119 120 120 FreePool (Sha256Ctx); 121 121 122 122 Tpm2SetSha256ToDigestList (DigestList, Digest); 123 123 … … 134 134 /** 135 135 The function register SHA256 instance. 136 136 137 137 @retval EFI_SUCCESS SHA256 instance is registered, or system dose not surpport registr SHA256 instance 138 138 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.c
r58464 r58466 217 217 CopyMem (&mHashInterface[mHashInterfaceCount], HashInterface, sizeof(*HashInterface)); 218 218 mHashInterfaceCount ++; 219 219 220 220 return EFI_SUCCESS; 221 221 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
r58464 r58466 3 3 # 4 4 # Ihis library is BaseCrypto router. It will redirect hash request to each individual 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 6 6 # mask some hash engines. 7 7 # … … 23 23 MODULE_TYPE = DXE_DRIVER 24 24 VERSION_STRING = 1.0 25 LIBRARY_CLASS = HashLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 LIBRARY_CLASS = HashLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 26 26 27 27 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c
r58464 r58466 284 284 CopyMem (&HashInterfaceHob->HashInterface[HashInterfaceHob->HashInterfaceCount], HashInterface, sizeof(*HashInterface)); 285 285 HashInterfaceHob->HashInterfaceCount ++; 286 286 287 287 return EFI_SUCCESS; 288 288 } -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
r58464 r58466 3 3 # 4 4 # Ihis library is BaseCrypto router. It will redirect hash request to each individual 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 5 # hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to 6 6 # mask some hash engines. 7 7 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.inf
r58464 r58466 2 2 # Provides hash service using TPM2 device 3 3 # 4 # This library uses TPM2 device to calculate hash. Platform can use PcdTpm2HashMask to 4 # This library uses TPM2 device to calculate hash. Platform can use PcdTpm2HashMask to 5 5 # mask some hash calculation. 6 6 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
r58464 r58466 1 1 /** @file 2 2 3 This library registers RSA 2048 SHA 256 guided section handler 3 This library registers RSA 2048 SHA 256 guided section handler 4 4 to parse RSA 2048 SHA 256 encapsulation section and extract raw data. 5 5 It uses the BaseCrypyLib based on OpenSSL to authenticate the signature. 6 6 7 7 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 16 16 **/ … … 49 49 50 50 GetInfo gets raw data size and attribute of the input guided section. 51 It first checks whether the input guid section is supported. 51 It first checks whether the input guid section is supported. 52 52 If not, EFI_INVALID_PARAMETER will return. 53 53 … … 57 57 @param SectionAttribute The attribute of the input guided section. 58 58 59 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 59 @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and 60 60 the attribute of the input section are successull retrieved. 61 61 @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid. … … 110 110 Extraction handler tries to extract raw data from the input guided section. 111 111 It also does authentication check for RSA 2048 SHA 256 signature in the input guided section. 112 It first checks whether the input guid section is supported. 112 It first checks whether the input guid section is supported. 113 113 If not, EFI_INVALID_PARAMETER will return. 114 114 … … 141 141 VOID *HashContext; 142 142 VOID *Rsa; 143 143 144 144 HashContext = NULL; 145 145 Rsa = NULL; 146 146 147 147 if (IS_SECTION2 (InputSection)) { 148 148 // … … 154 154 return EFI_INVALID_PARAMETER; 155 155 } 156 156 157 157 // 158 158 // Get the RSA 2048 SHA 256 information. … … 182 182 return EFI_INVALID_PARAMETER; 183 183 } 184 184 185 185 // 186 186 // Get the RSA 2048 SHA 256 information. … … 207 207 // 208 208 Status = EFI_SUCCESS; 209 209 210 210 // 211 211 // Fail if the HashType is not SHA 256 … … 249 249 goto Done; 250 250 } 251 251 252 252 // 253 253 // Fail if the PublicKey is not one of the public keys in PcdRsa2048Sha256PublicKeyBuffer … … 284 284 goto Done; 285 285 } 286 287 // 286 287 // 288 288 // Set RSA Key Components. 289 289 // NOTE: Only N and E are needed to be set as RSA public key for signature verification. … … 332 332 PERF_START (NULL, "RsaVerify", "PEI", 0); 333 333 CryptoStatus = RsaPkcs1Verify ( 334 Rsa, 335 Digest, 336 SHA256_DIGEST_SIZE, 337 CertBlockRsa2048Sha256->Signature, 334 Rsa, 335 Digest, 336 SHA256_DIGEST_SIZE, 337 CertBlockRsa2048Sha256->Signature, 338 338 sizeof (CertBlockRsa2048Sha256->Signature) 339 339 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.inf
r58464 r58466 1 1 ## @file 2 # This library doesn't produce any library class. The constructor function uses 2 # This library doesn't produce any library class. The constructor function uses 3 3 # ExtractGuidedSectionLib service to register an RSA 2048 SHA 256 guided section handler 4 4 # that parses RSA 2048 SHA 256 encapsulation section and extracts raw data. … … 50 50 PerformanceLib 51 51 52 [PcdEx] 52 [PcdEx] 53 53 gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer ## SOMETIMES_CONSUMES 54 54 55 55 [Guids] 56 56 gEfiCertTypeRsa2048Sha256Guid ## PRODUCES ## UNDEFINED # Specifies RSA 2048 SHA 256 authentication algorithm. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
r48674 r58466 1 1 /** @file 2 NULL PlatformSecureLib instance does NOT really detect whether a physical present 2 NULL PlatformSecureLib instance does NOT really detect whether a physical present 3 3 user exists but return TRUE directly. This instance can be used to verify security 4 4 related features during platform enabling and development. It should be replaced … … 6 6 7 7 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 11 http://opensource.org/licenses/bsd-license.php 12 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 15 … … 19 19 20 20 This function provides a platform-specific method to detect whether the platform 21 is operating by a physically present user. 21 is operating by a physically present user. 22 22 23 23 Programmatic changing of platform security policy (such as disable Secure Boot, … … 28 28 NOTE THAT: This function cannot depend on any EFI Variable Service since they are 29 29 not available when this function is called in AuthenticateVariable driver. 30 30 31 31 @retval TRUE The platform is operated by a physically present user. 32 32 @retval FALSE The platform is NOT operated by a physically present user. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
r58459 r58466 2 2 # NULL platform secure library instance that alway returns TRUE for a user physical present 3 3 # 4 # NULL PlatformSecureLib instance does NOT really detect whether a physical present 4 # NULL PlatformSecureLib instance does NOT really detect whether a physical present 5 5 # user exists but returns TRUE directly. This instance can be used to verify security 6 6 # related features during platform enabling and development. It should be replaced -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.c
r58464 r58466 3 3 4 4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 20 20 21 21 This API should be invoked in BIOS boot phase to process pending request. 22 22 23 23 Caution: This function may receive untrusted input. 24 24 25 25 If OperationRequest < 128, then ASSERT(). 26 26 … … 49 49 50 50 This API should be invoked in BIOS boot phase to process pending request. 51 51 52 52 Caution: This function may receive untrusted input. 53 53 … … 83 83 84 84 Caution: This function may receive untrusted input. 85 85 86 86 If OperationRequest < 128, then ASSERT(). 87 87 … … 110 110 111 111 Caution: This function may receive untrusted input. 112 112 113 113 If OperationRequest < 128, then ASSERT(). 114 114 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.inf
r58464 r58466 33 33 MdePkg/MdePkg.dec 34 34 SecurityPkg/SecurityPkg.dec 35 35 36 36 [LibraryClasses] 37 37 DebugLib -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
r58464 r58466 67 67 /** 68 68 Send NV DefineSpace command to TPM1.2. 69 69 70 70 @param PubInfo The public parameters of the NV area. 71 71 @param EncAuth The encrypted AuthData, only valid if the attributes require subsequent authorization. … … 197 197 /** 198 198 Send NV WriteValue command to TPM1.2. 199 199 200 200 @param NvIndex The index of the area to set. 201 201 @param Offset The offset into the NV Area. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
r58464 r58466 1 1 ## @file 2 2 # Provides TPM 1.2 TIS functions 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 1.2 command. Choosing this library means platform uses and 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 1.2 command. Choosing this library means platform uses and 6 6 # only uses TPM 1.2 device. 7 7 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
r58464 r58466 1 1 /** @file 2 2 TIS (TPM Interface Specification) functions used by TPM1.2. 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 153 153 154 154 /// 155 /// When this bit is 1, TPM is in the Ready state, 155 /// When this bit is 1, TPM is in the Ready state, 156 156 /// indicating it is ready to receive a new command. 157 157 /// … … 201 201 { 202 202 UINT8 RegRead; 203 203 204 204 RegRead = MmioRead8 ((UINTN)&TisReg->Access); 205 205 return (BOOLEAN)(RegRead != (UINT8)-1); … … 238 238 239 239 /** 240 Get BurstCount by reading the burstCount field of a TIS regiger 240 Get BurstCount by reading the burstCount field of a TIS regiger 241 241 in the time of default TIS_TIMEOUT_D. 242 242 … … 282 282 283 283 /** 284 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 284 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 285 285 to Status Register in time. 286 286 … … 313 313 314 314 /** 315 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 315 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 316 316 to ACCESS Register in the time of default TIS_TIMEOUT_A. 317 317 … … 329 329 { 330 330 EFI_STATUS Status; 331 331 332 332 if (TisReg == NULL) { 333 333 return EFI_INVALID_PARAMETER; 334 334 } 335 335 336 336 if (!Tpm12TisPcPresenceCheck (TisReg)) { 337 337 return EFI_NOT_FOUND; … … 351 351 Send a command to TPM for execution and return response data. 352 352 353 @param[in] TisReg TPM register space base address. 354 @param[in] BufferIn Buffer for command data. 355 @param[in] SizeIn Size of command data. 356 @param[in, out] BufferOut Buffer for response data. 357 @param[in, out] SizeOut Size of response data. 358 353 @param[in] TisReg TPM register space base address. 354 @param[in] BufferIn Buffer for command data. 355 @param[in] SizeIn Size of command data. 356 @param[in, out] BufferOut Buffer for response data. 357 @param[in, out] SizeOut Size of response data. 358 359 359 @retval EFI_SUCCESS Operation completed successfully. 360 360 @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small. … … 531 531 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 532 532 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 533 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 533 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 534 534 **/ 535 535 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.c
r58464 r58466 22 22 #include <IndustryStandard/Tpm12.h> 23 23 24 EFI_TCG_PROTOCOL *mTcgProtocol = NULL; 24 EFI_TCG_PROTOCOL *mTcgProtocol = NULL; 25 25 26 26 /** … … 34 34 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 35 35 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 36 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 36 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 37 37 **/ 38 38 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf
r58464 r58466 22 22 MODULE_TYPE = BASE 23 23 VERSION_STRING = 1.0 24 LIBRARY_CLASS = Tpm12DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 LIBRARY_CLASS = Tpm12DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 25 26 26 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
r58464 r58466 49 49 This command returns various information regarding the TPM and its current state. 50 50 51 The capability parameter determines the category of data returned. The property parameter 52 selects the first value of the selected category to be returned. If there is no property 51 The capability parameter determines the category of data returned. The property parameter 52 selects the first value of the selected category to be returned. If there is no property 53 53 that corresponds to the value of property, the next higher value is returned, if it exists. 54 The moreData parameter will have a value of YES if there are more values of the requested 54 The moreData parameter will have a value of YES if there are more values of the requested 55 55 type that were not returned. 56 If no next capability exists, the TPM will return a zero-length list and moreData will have 56 If no next capability exists, the TPM will return a zero-length list and moreData will have 57 57 a value of NO. 58 58 59 NOTE: 60 To simplify this function, leave returned CapabilityData for caller to unpack since there are 59 NOTE: 60 To simplify this function, leave returned CapabilityData for caller to unpack since there are 61 61 many capability categories and only few categories will be used in firmware. It means the caller 62 62 need swap the byte order for the feilds in CapabilityData. 63 63 64 64 @param[in] Capability Group selection; determines the format of the response. 65 @param[in] Property Further definition of information. 65 @param[in] Property Further definition of information. 66 66 @param[in] PropertyCount Number of properties of the indicated type to return. 67 67 @param[out] MoreData Flag to indicate if there are more values of this type. 68 68 @param[out] CapabilityData The capability data. 69 69 70 70 @retval EFI_SUCCESS Operation completed successfully. 71 71 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 96 96 SendBuffer.Property = SwapBytes32 (Property); 97 97 SendBuffer.PropertyCount = SwapBytes32 (PropertyCount); 98 98 99 99 SendBufferSize = (UINT32) sizeof (SendBuffer); 100 100 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); 101 101 102 102 // 103 103 // send Tpm command … … 121 121 // 122 122 CopyMem (CapabilityData, &RecvBuffer.CapabilityData, RecvBufferSize - sizeof (TPM2_RESPONSE_HEADER) - sizeof (UINT8)); 123 123 124 124 return EFI_SUCCESS; 125 125 } … … 131 131 132 132 @param[out] Family The Family of TPM. (a 4-octet character string) 133 133 134 134 @retval EFI_SUCCESS Operation completed successfully. 135 135 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 143 143 TPMS_CAPABILITY_DATA TpmCap; 144 144 TPMI_YES_NO MoreData; 145 EFI_STATUS Status; 146 147 Status = Tpm2GetCapability ( 148 TPM_CAP_TPM_PROPERTIES, 149 TPM_PT_FAMILY_INDICATOR, 150 1, 151 &MoreData, 145 EFI_STATUS Status; 146 147 Status = Tpm2GetCapability ( 148 TPM_CAP_TPM_PROPERTIES, 149 TPM_PT_FAMILY_INDICATOR, 150 1, 151 &MoreData, 152 152 &TpmCap 153 153 ); … … 166 166 167 167 @param[out] ManufactureId The manufacture ID of TPM. 168 168 169 169 @retval EFI_SUCCESS Operation completed successfully. 170 170 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 178 178 TPMS_CAPABILITY_DATA TpmCap; 179 179 TPMI_YES_NO MoreData; 180 EFI_STATUS Status; 181 182 Status = Tpm2GetCapability ( 183 TPM_CAP_TPM_PROPERTIES, 184 TPM_PT_MANUFACTURER, 185 1, 186 &MoreData, 180 EFI_STATUS Status; 181 182 Status = Tpm2GetCapability ( 183 TPM_CAP_TPM_PROPERTIES, 184 TPM_PT_MANUFACTURER, 185 1, 186 &MoreData, 187 187 &TpmCap 188 188 ); … … 202 202 @param[out] FirmwareVersion1 The FirmwareVersion1. 203 203 @param[out] FirmwareVersion2 The FirmwareVersion2. 204 204 205 205 @retval EFI_SUCCESS Operation completed successfully. 206 206 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 215 215 TPMS_CAPABILITY_DATA TpmCap; 216 216 TPMI_YES_NO MoreData; 217 EFI_STATUS Status; 218 219 Status = Tpm2GetCapability ( 220 TPM_CAP_TPM_PROPERTIES, 221 TPM_PT_FIRMWARE_VERSION_1, 222 1, 223 &MoreData, 217 EFI_STATUS Status; 218 219 Status = Tpm2GetCapability ( 220 TPM_CAP_TPM_PROPERTIES, 221 TPM_PT_FIRMWARE_VERSION_1, 222 1, 223 &MoreData, 224 224 &TpmCap 225 225 ); … … 230 230 231 231 Status = Tpm2GetCapability ( 232 TPM_CAP_TPM_PROPERTIES, 233 TPM_PT_FIRMWARE_VERSION_2, 234 1, 235 &MoreData, 232 TPM_CAP_TPM_PROPERTIES, 233 TPM_PT_FIRMWARE_VERSION_2, 234 1, 235 &MoreData, 236 236 &TpmCap 237 237 ); … … 251 251 @param[out] MaxCommandSize The maximum value for commandSize in a command. 252 252 @param[out] MaxResponseSize The maximum value for responseSize in a command. 253 253 254 254 @retval EFI_SUCCESS Operation completed successfully. 255 255 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 267 267 268 268 Status = Tpm2GetCapability ( 269 TPM_CAP_TPM_PROPERTIES, 270 TPM_PT_MAX_COMMAND_SIZE, 271 1, 272 &MoreData, 269 TPM_CAP_TPM_PROPERTIES, 270 TPM_PT_MAX_COMMAND_SIZE, 271 1, 272 &MoreData, 273 273 &TpmCap 274 274 ); … … 280 280 281 281 Status = Tpm2GetCapability ( 282 TPM_CAP_TPM_PROPERTIES, 283 TPM_PT_MAX_RESPONSE_SIZE, 284 1, 285 &MoreData, 282 TPM_CAP_TPM_PROPERTIES, 283 TPM_PT_MAX_RESPONSE_SIZE, 284 1, 285 &MoreData, 286 286 &TpmCap 287 287 ); … … 291 291 292 292 *MaxResponseSize = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value); 293 return EFI_SUCCESS; 293 return EFI_SUCCESS; 294 294 } 295 295 296 296 /** 297 297 This command returns Returns a list of TPMS_ALG_PROPERTIES. Each entry is an 298 algorithm ID and a set of properties of the algorithm. 298 algorithm ID and a set of properties of the algorithm. 299 299 300 300 This function parse the value got from TPM2_GetCapability and return the list. 301 301 302 302 @param[out] AlgList List of algorithm. 303 303 304 304 @retval EFI_SUCCESS Operation completed successfully. 305 305 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 315 315 UINTN Index; 316 316 EFI_STATUS Status; 317 318 Status = Tpm2GetCapability ( 319 TPM_CAP_ALGS, 320 1, 321 MAX_CAP_ALGS, 322 &MoreData, 323 &TpmCap 324 ); 325 if (EFI_ERROR (Status)) { 326 return Status; 327 } 328 317 318 Status = Tpm2GetCapability ( 319 TPM_CAP_ALGS, 320 1, 321 MAX_CAP_ALGS, 322 &MoreData, 323 &TpmCap 324 ); 325 if (EFI_ERROR (Status)) { 326 return Status; 327 } 328 329 329 CopyMem (AlgList, &TpmCap.data.algorithms, sizeof (TPML_ALG_PROPERTY)); 330 330 … … 344 344 345 345 @param[out] LockoutCounter The LockoutCounter of TPM. 346 346 347 347 @retval EFI_SUCCESS Operation completed successfully. 348 348 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 356 356 TPMS_CAPABILITY_DATA TpmCap; 357 357 TPMI_YES_NO MoreData; 358 EFI_STATUS Status; 359 360 Status = Tpm2GetCapability ( 361 TPM_CAP_TPM_PROPERTIES, 362 TPM_PT_LOCKOUT_COUNTER, 363 1, 364 &MoreData, 358 EFI_STATUS Status; 359 360 Status = Tpm2GetCapability ( 361 TPM_CAP_TPM_PROPERTIES, 362 TPM_PT_LOCKOUT_COUNTER, 363 1, 364 &MoreData, 365 365 &TpmCap 366 366 ); … … 379 379 380 380 @param[out] LockoutInterval The LockoutInterval of TPM. 381 381 382 382 @retval EFI_SUCCESS Operation completed successfully. 383 383 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 391 391 TPMS_CAPABILITY_DATA TpmCap; 392 392 TPMI_YES_NO MoreData; 393 EFI_STATUS Status; 394 395 Status = Tpm2GetCapability ( 396 TPM_CAP_TPM_PROPERTIES, 397 TPM_PT_LOCKOUT_INTERVAL, 398 1, 399 &MoreData, 393 EFI_STATUS Status; 394 395 Status = Tpm2GetCapability ( 396 TPM_CAP_TPM_PROPERTIES, 397 TPM_PT_LOCKOUT_INTERVAL, 398 1, 399 &MoreData, 400 400 &TpmCap 401 401 ); … … 415 415 @param[out] InputBufferSize The InputBufferSize of TPM. 416 416 the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER) 417 417 418 418 @retval EFI_SUCCESS Operation completed successfully. 419 419 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 427 427 TPMS_CAPABILITY_DATA TpmCap; 428 428 TPMI_YES_NO MoreData; 429 EFI_STATUS Status; 430 431 Status = Tpm2GetCapability ( 432 TPM_CAP_TPM_PROPERTIES, 433 TPM_PT_INPUT_BUFFER, 434 1, 435 &MoreData, 429 EFI_STATUS Status; 430 431 Status = Tpm2GetCapability ( 432 TPM_CAP_TPM_PROPERTIES, 433 TPM_PT_INPUT_BUFFER, 434 1, 435 &MoreData, 436 436 &TpmCap 437 437 ); … … 450 450 451 451 @param[out] Pcrs The Pcr Selection 452 452 453 453 @retval EFI_SUCCESS Operation completed successfully. 454 454 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 466 466 467 467 Status = Tpm2GetCapability ( 468 TPM_CAP_PCRS, 469 0, 470 1, 471 &MoreData, 468 TPM_CAP_PCRS, 469 0, 470 1, 471 &MoreData, 472 472 &TpmCap 473 473 ); … … 492 492 493 493 @param[out] AlgorithmSet The AlgorithmSet of TPM. 494 494 495 495 @retval EFI_SUCCESS Operation completed successfully. 496 496 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 504 504 TPMS_CAPABILITY_DATA TpmCap; 505 505 TPMI_YES_NO MoreData; 506 EFI_STATUS Status; 507 508 Status = Tpm2GetCapability ( 509 TPM_CAP_TPM_PROPERTIES, 510 TPM_PT_ALGORITHM_SET, 511 1, 512 &MoreData, 506 EFI_STATUS Status; 507 508 Status = Tpm2GetCapability ( 509 TPM_CAP_TPM_PROPERTIES, 510 TPM_PT_ALGORITHM_SET, 511 1, 512 &MoreData, 513 513 &TpmCap 514 514 ); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Context.c
r58464 r58466 37 37 38 38 @param[in] FlushHandle The handle of the item to flush. 39 39 40 40 @retval EFI_SUCCESS Operation completed successfully. 41 41 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 60 60 61 61 SendBuffer.FlushHandle = SwapBytes32 (FlushHandle); 62 62 63 63 SendBufferSize = (UINT32) sizeof (SendBuffer); 64 64 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2EnhancedAuthorization.c
r58464 r58466 88 88 @param[out] Timeout Time value used to indicate to the TPM when the ticket expires. 89 89 @param[out] PolicyTicket A ticket that includes a value indicating when the authorization expires. 90 90 91 91 @retval EFI_SUCCESS Operation completed successfully. 92 92 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 121 121 SendBuffer.AuthHandle = SwapBytes32 (AuthHandle); 122 122 SendBuffer.PolicySession = SwapBytes32 (PolicySession); 123 123 124 124 // 125 125 // Add in Auth session … … 149 149 CopyMem (Buffer, PolicyRef->buffer, PolicyRef->size); 150 150 Buffer += PolicyRef->size; 151 151 152 152 WriteUnaligned32 ((UINT32 *)Buffer, SwapBytes32((UINT32)Expiration)); 153 153 Buffer += sizeof(UINT32); … … 201 201 @param[in] PolicySession Handle for the policy session being extended. 202 202 @param[in] HashList the list of hashes to check for a match. 203 203 204 204 @retval EFI_SUCCESS Operation completed successfully. 205 205 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 266 266 @param[in] PolicySession Handle for the policy session being extended. 267 267 @param[in] Code The allowed commandCode. 268 268 269 269 @retval EFI_SUCCESS Operation completed successfully. 270 270 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 322 322 @param[in] PolicySession Handle for the policy session. 323 323 @param[out] PolicyHash the current value of the policyHash of policySession. 324 324 325 325 @retval EFI_SUCCESS Operation completed successfully. 326 326 @retval EFI_DEVICE_ERROR The command was unsuccessful. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c
r58464 r58466 74 74 75 75 Buffer = (UINT8 *)AuthSessionOut; 76 76 77 77 // 78 78 // Add in Auth session -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Hierarchy.c
r58464 r58466 207 207 @param[in] AuthHandle TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP} 208 208 @param[in] AuthSession Auth Session context 209 209 210 210 @retval EFI_SUCCESS Operation completed successfully. 211 211 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 432 432 // 433 433 Status = Tpm2SubmitCommand ( 434 CmdSize, 435 (UINT8 *)&Cmd, 434 CmdSize, 435 (UINT8 *)&Cmd, 436 436 &ResultBufSize, 437 437 ResultBuf … … 518 518 // 519 519 Status = Tpm2SubmitCommand ( 520 CmdSize, 521 (UINT8 *)&Cmd, 520 CmdSize, 521 (UINT8 *)&Cmd, 522 522 &ResultBufSize, 523 523 ResultBuf … … 604 604 // 605 605 Status = Tpm2SubmitCommand ( 606 CmdSize, 607 (UINT8 *)&Cmd, 606 CmdSize, 607 (UINT8 *)&Cmd, 608 608 &ResultBufSize, 609 609 ResultBuf … … 700 700 // 701 701 Status = Tpm2SubmitCommand ( 702 CmdSize, 703 (UINT8 *)&Cmd, 702 CmdSize, 703 (UINT8 *)&Cmd, 704 704 &ResultBufSize, 705 705 ResultBuf -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Integrity.c
r58464 r58466 121 121 // 122 122 Buffer = (UINT8 *)&Cmd.AuthSessionPcr; 123 123 124 124 // sessionInfoSize 125 125 SessionInfoSize = CopyAuthSessionCommand (NULL, Buffer); 126 126 Buffer += SessionInfoSize; 127 127 Cmd.AuthorizationSize = SwapBytes32(SessionInfoSize); 128 128 129 129 //Digest Count 130 130 WriteUnaligned32 ((UINT32 *)Buffer, SwapBytes32(Digests->count)); 131 131 Buffer += sizeof(UINT32); 132 132 133 133 //Digest 134 134 for (Index = 0; Index < Digests->count; Index++) { … … 242 242 CopyMem (Buffer, EventData->buffer, EventData->size); 243 243 Buffer += EventData->size; 244 244 245 245 CmdSize = (UINT32)((UINTN)Buffer - (UINTN)&Cmd); 246 246 Cmd.Header.paramSize = SwapBytes32(CmdSize); … … 307 307 @param[out] PcrSelectionOut The PCR in the returned list. 308 308 @param[out] PcrValues The contents of the PCR indicated in pcrSelect. 309 309 310 310 @retval EFI_SUCCESS Operation completed successfully. 311 311 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 334 334 SendBuffer.Header.tag = SwapBytes16(TPM_ST_NO_SESSIONS); 335 335 SendBuffer.Header.commandCode = SwapBytes32(TPM_CC_PCR_Read); 336 336 337 337 SendBuffer.PcrSelectionIn.count = SwapBytes32(PcrSelectionIn->count); 338 338 for (Index = 0; Index < PcrSelectionIn->count; Index++) { … … 419 419 @param[out] SizeNeeded number of octets required to satisfy the request 420 420 @param[out] SizeAvailable Number of octets available. Computed before the allocation 421 421 422 422 @retval EFI_SUCCESS Operation completed successfully. 423 423 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 486 486 // 487 487 Status = Tpm2SubmitCommand ( 488 CmdSize, 489 (UINT8 *)&Cmd, 488 CmdSize, 489 (UINT8 *)&Cmd, 490 490 &ResultBufSize, 491 491 ResultBuf -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2NVStorage.c
r58464 r58466 163 163 @param[out] NvPublic The public area of the index. 164 164 @param[out] NvName The Name of the nvIndex. 165 165 166 166 @retval EFI_SUCCESS Operation completed successfully. 167 167 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 193 193 194 194 SendBuffer.NvIndex = SwapBytes32 (NvIndex); 195 195 196 196 SendBufferSize = (UINT32) sizeof (SendBuffer); 197 197 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); … … 257 257 CopyMem (NvName, (UINT8 *)&RecvBuffer + sizeof(TPM2_RESPONSE_HEADER) + sizeof(UINT16) + NvPublicSize, NvNameSize); 258 258 NvName->size = NvNameSize; 259 259 260 260 return EFI_SUCCESS; 261 261 } … … 270 270 @param[in] Auth The authorization data. 271 271 @param[in] NvPublic The public area of the index. 272 272 273 273 @retval EFI_SUCCESS Operation completed successfully. 274 274 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 382 382 return EFI_DEVICE_ERROR; 383 383 } 384 384 385 385 return EFI_SUCCESS; 386 386 } … … 392 392 @param[in] NvIndex The NV Index. 393 393 @param[in] AuthSession Auth Session context 394 394 395 395 @retval EFI_SUCCESS Operation completed successfully. 396 396 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 486 486 @param[in] Offset Byte offset into the area. 487 487 @param[in,out] OutData The data read. 488 488 489 489 @retval EFI_SUCCESS Operation completed successfully. 490 490 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 591 591 OutData->size = SwapBytes16 (RecvBuffer.Data.size); 592 592 CopyMem (OutData->buffer, &RecvBuffer.Data.buffer, OutData->size); 593 593 594 594 return EFI_SUCCESS; 595 595 } … … 603 603 @param[in] InData The data to write. 604 604 @param[in] Offset The offset into the NV Area. 605 605 606 606 @retval EFI_SUCCESS Operation completed successfully. 607 607 @retval EFI_DEVICE_ERROR The command was unsuccessful. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c
r58464 r58466 91 91 An Event sequence starts if this is TPM_ALG_NULL. 92 92 @param[out] SequenceHandle A handle to reference the sequence 93 93 94 94 @retval EFI_SUCCESS Operation completed successfully. 95 95 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 179 179 @param[in] SequenceHandle Handle for the sequence object 180 180 @param[in] Buffer Data to be added to hash 181 181 182 182 @retval EFI_SUCCESS Operation completed successfully. 183 183 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 278 278 @param[in] Buffer Data to be added to the Event 279 279 @param[out] Results List of digests computed for the PCR 280 280 281 281 @retval EFI_SUCCESS Operation completed successfully. 282 282 @retval EFI_DEVICE_ERROR Unexpected device behavior. … … 404 404 @param[in] Buffer Data to be added to the hash/HMAC 405 405 @param[out] Result The returned HMAC or digest in a sized buffer 406 406 407 407 @retval EFI_SUCCESS Operation completed successfully. 408 408 @retval EFI_DEVICE_ERROR Unexpected device behavior. -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2CommandLib/Tpm2Session.c
r58464 r58466 54 54 @param[out] SessionHandle Handle for the newly created session. 55 55 @param[out] NonceTPM The initial nonce from the TPM, used in the computation of the sessionKey. 56 56 57 57 @retval EFI_SUCCESS Operation completed successfully. 58 58 @retval EFI_DEVICE_ERROR The command was unsuccessful. … … 137 137 WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16 (AuthHash)); 138 138 Buffer += sizeof(UINT16); 139 139 140 140 SendBufferSize = (UINT32) ((UINTN)Buffer - (UINTN)&SendBuffer); 141 141 SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize); -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.c
r58464 r58466 29 29 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 30 30 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 31 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 31 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 32 32 **/ 33 33 EFI_STATUS … … 63 63 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 64 64 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 65 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 65 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 66 66 **/ 67 67 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf
r58464 r58466 1 1 ## @file 2 2 # Provides TPM 2.0 TIS functions for DTPM 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 2.0 command. Choosing this library means platform uses and 3 # 4 # This library implements TIS (TPM Interface Specification) functions which is 5 # used for every TPM 2.0 command. Choosing this library means platform uses and 6 6 # only uses TPM 2.0 DTPM device. 7 7 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.c
r58464 r58466 32 32 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 33 33 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 34 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 34 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 35 35 **/ 36 36 EFI_STATUS … … 64 64 /** 65 65 The function register DTPM2.0 instance. 66 66 67 67 @retval EFI_SUCCESS DTPM2.0 instance is registered, or system dose not surpport registr DTPM2.0 instance 68 68 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
r58464 r58466 2 2 # Provides a DTPM instance for TPM 2.0 3 3 # 4 # This library can be registered to Tpm 2.0 device router, to be active TPM 2.0 4 # This library can be registered to Tpm 2.0 device router, to be active TPM 2.0 5 5 # engine, based on platform setting. 6 6 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c
r58464 r58466 1 1 /** @file 2 2 TIS (TPM Interface Specification) functions used by dTPM2.0 library. 3 3 4 4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 157 157 158 158 /// 159 /// When this bit is 1, TPM is in the Ready state, 159 /// When this bit is 1, TPM is in the Ready state, 160 160 /// indicating it is ready to receive a new command. 161 161 /// … … 207 207 { 208 208 UINT8 RegRead; 209 209 210 210 RegRead = MmioRead8 ((UINTN)&TisReg->Access); 211 211 return (BOOLEAN)(RegRead != (UINT8)-1); … … 244 244 245 245 /** 246 Get BurstCount by reading the burstCount field of a TIS regiger 246 Get BurstCount by reading the burstCount field of a TIS regiger 247 247 in the time of default TIS_TIMEOUT_D. 248 248 … … 288 288 289 289 /** 290 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 290 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 291 291 to Status Register in time. 292 292 … … 319 319 320 320 /** 321 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 321 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 322 322 to ACCESS Register in the time of default TIS_TIMEOUT_A. 323 323 … … 335 335 { 336 336 EFI_STATUS Status; 337 337 338 338 if (TisReg == NULL) { 339 339 return EFI_INVALID_PARAMETER; 340 340 } 341 341 342 342 if (!TisPcPresenceCheck (TisReg)) { 343 343 return EFI_NOT_FOUND; … … 357 357 Send a command to TPM for execution and return response data. 358 358 359 @param[in] TisReg TPM register space base address. 360 @param[in] BufferIn Buffer for command data. 361 @param[in] SizeIn Size of command data. 362 @param[in, out] BufferOut Buffer for response data. 363 @param[in, out] SizeOut Size of response data. 364 359 @param[in] TisReg TPM register space base address. 360 @param[in] BufferIn Buffer for command data. 361 @param[in] SizeIn Size of command data. 362 @param[in, out] BufferOut Buffer for response data. 363 @param[in, out] SizeOut Size of response data. 364 365 365 @retval EFI_SUCCESS Operation completed successfully. 366 366 @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small. … … 542 542 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 543 543 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 544 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 544 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 545 545 **/ 546 546 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.c
r58464 r58466 33 33 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 34 34 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 36 36 **/ 37 37 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
r58464 r58466 23 23 MODULE_TYPE = DXE_DRIVER 24 24 VERSION_STRING = 1.0 25 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 26 26 27 27 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterPei.c
r58464 r58466 55 55 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 56 56 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 57 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 57 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 58 58 **/ 59 59 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.c
r58464 r58466 21 21 #include <IndustryStandard/Tpm20.h> 22 22 23 EFI_TREE_PROTOCOL *mTreeProtocol = NULL; 23 EFI_TREE_PROTOCOL *mTreeProtocol = NULL; 24 24 25 25 /** … … 33 33 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received. 34 34 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 35 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. 36 36 **/ 37 37 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/Tpm2DeviceLibTrEE/Tpm2DeviceLibTrEE.inf
r58464 r58466 22 22 MODULE_TYPE = DXE_DRIVER 23 23 VERSION_STRING = 1.0 24 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 24 LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 25 25 26 26 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/CommonHeader.h
r48674 r58466 3 3 4 4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TisPc.c
r58459 r58466 3 3 4 4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 29 29 { 30 30 UINT8 RegRead; 31 31 32 32 RegRead = MmioRead8 ((UINTN)&TisReg->Access); 33 33 return (BOOLEAN)(RegRead != (UINT8)-1); … … 67 67 68 68 /** 69 Get BurstCount by reading the burstCount field of a TIS regiger 69 Get BurstCount by reading the burstCount field of a TIS regiger 70 70 in the time of default TIS_TIMEOUT_D. 71 71 … … 112 112 113 113 /** 114 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 114 Set TPM chip to ready state by sending ready command TIS_PC_STS_READY 115 115 to Status Register in time. 116 116 … … 144 144 145 145 /** 146 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 146 Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE 147 147 to ACCESS Register in the time of default TIS_TIMEOUT_A. 148 148 … … 161 161 { 162 162 EFI_STATUS Status; 163 163 164 164 if (TisReg == NULL) { 165 165 return EFI_INVALID_PARAMETER; 166 166 } 167 167 168 168 if (!TisPcPresenceCheck (TisReg)) { 169 169 return EFI_NOT_FOUND; -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TpmComm.c
r48674 r58466 3 3 4 4 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 22 22 @param[in] DataLen Size of the raw data. 23 23 @param[out] Digest Pointer to a buffer that stores the final digest. 24 24 25 25 @retval EFI_SUCCESS Always successfully calculate the final digest. 26 26 **/ -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TpmCommLib/TpmCommLib.inf
r58459 r58466 2 2 # Provides some common functions for the TCG feature 3 3 # 4 # This instance provides basic TPM Interface Specification (TIS) functions 4 # This instance provides basic TPM Interface Specification (TIS) functions 5 5 # and TPM hashall function. 6 6 # -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TrEEPpVendorLibNull/TrEEPpVendorLibNull.c
r58464 r58466 3 3 4 4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 8 http://opensource.org/licenses/bsd-license.php 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 … … 20 20 21 21 This API should be invoked in BIOS boot phase to process pending request. 22 22 23 23 Caution: This function may receive untrusted input. 24 24 25 25 If OperationRequest < 128, then ASSERT(). 26 26 … … 51 51 52 52 This API should be invoked in BIOS boot phase to process pending request. 53 53 54 54 Caution: This function may receive untrusted input. 55 55 … … 85 85 86 86 Caution: This function may receive untrusted input. 87 87 88 88 If OperationRequest < 128, then ASSERT(). 89 89 … … 112 112 113 113 Caution: This function may receive untrusted input. 114 114 115 115 If OperationRequest < 128, then ASSERT(). 116 116 -
trunk/src/VBox/Devices/EFI/Firmware/SecurityPkg/Library/TrEEPpVendorLibNull/TrEEPpVendorLibNull.inf
r58464 r58466 33 33 MdePkg/MdePkg.dec 34 34 SecurityPkg/SecurityPkg.dec 35 35 36 36 [LibraryClasses] 37 37 DebugLib
Note:
See TracChangeset
for help on using the changeset viewer.