SecurityPkg/Tcg/TrEESmm/TrEESmm.c File Reference


Functions

EFI_STATUS EFIAPI PhysicalPresenceCallback (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize)
EFI_STATUS EFIAPI MemoryClearCallback (IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize)
VOID * AssignOpRegion (EFI_ACPI_DESCRIPTION_HEADER *Table, UINT32 Name, UINT16 Size)
EFI_STATUS PublishAcpiTable (VOID)
EFI_STATUS PublishTpm2 (VOID)
EFI_STATUS EFIAPI InitializeTcgSmm (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)

Variables

EFI_TPM2_ACPI_TABLE mTpm2AcpiTemplate
EFI_SMM_VARIABLE_PROTOCOL * mSmmVariable
TCG_NVSmTcgNvs

Detailed Description

It updates TPM2 items in ACPI table and registers SMI2 callback functions for TrEE physical presence, ClearMemory, and sample for dTPM StartMethod.

Caution: This module requires additional review when modified. This driver will have external input - variable and ACPINvs data in SMM mode. This external input must be validated carefully to avoid security issue.

PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.

Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Function Documentation

VOID* AssignOpRegion ( EFI_ACPI_DESCRIPTION_HEADER *  Table,
UINT32  Name,
UINT16  Size 
)

Find the operation region in TCG ACPI table by given Name and Size, and initialize it if the region is found.

Parameters:
[in,out] Table The TPM item in ACPI table.
[in] Name The name string to find in TPM table.
[in] Size The size of the region to find.
Returns:
The allocated address for the found region.

References AML_OP_REGION_32_8::BytePrefix, AML_OP_REGION_32_8::DWordPrefix, EFI_STATUS(), AML_OP_REGION_32_8::NameString, AML_OP_REGION_32_8::OpRegionOp, AML_OP_REGION_32_8::RegionLen, AML_OP_REGION_32_8::RegionOffset, and UINTN().

EFI_STATUS EFIAPI InitializeTcgSmm ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE *  SystemTable 
)

The driver's entry point.

It install callbacks for TPM physical presence and MemoryClear, and locate SMM variable to be used in the callback function.

Parameters:
[in] ImageHandle The firmware allocated handle for the EFI image.
[in] SystemTable A pointer to the EFI System Table.
Return values:
EFI_SUCCESS The entry point is executed successfully.
Others Some error occurs when executing this entry point.

References EFI_STATUS(), gEfiTpmDeviceInstanceTpm20DtpmGuid, TCG_NVS::MemoryClear, MemoryClearCallback(), TCG_NVS::PhysicalPresence, PhysicalPresenceCallback(), PublishAcpiTable(), PublishTpm2(), MEMORY_CLEAR_NVS::SoftwareSmi, PHYSICAL_PRESENCE_NVS::SoftwareSmi, and UINTN().

EFI_STATUS EFIAPI MemoryClearCallback ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *  Context,
IN OUT VOID *  CommBuffer,
IN OUT UINTN *  CommBufferSize 
)

Software SMI callback for MemoryClear which is called from ACPI method.

Caution: This function may receive untrusted input. Variable and ACPINvs are external input, so this function will validate its data structure to be valid value.

Parameters:
[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
[in] Context Points to an optional handler context which was specified when the handler was registered.
[in,out] CommBuffer A pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
[in,out] CommBufferSize The size of the CommBuffer.
Return values:
EFI_SUCCESS The interrupt was handled successfully.

References ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE, ACPI_FUNCTION_PTS_CLEAR_MOR_BIT, EFI_STATUS(), TCG_NVS::MemoryClear, MOR_REQUEST_GENERAL_FAILURE, MOR_REQUEST_SUCCESS, MEMORY_CLEAR_NVS::Parameter, MEMORY_CLEAR_NVS::Request, MEMORY_CLEAR_NVS::ReturnCode, and UINTN().

EFI_STATUS EFIAPI PhysicalPresenceCallback ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *  Context,
IN OUT VOID *  CommBuffer,
IN OUT UINTN *  CommBufferSize 
)

Software SMI callback for TPM physical presence which is called from ACPI method.

Caution: This function may receive untrusted input. Variable and ACPINvs are external input, so this function will validate its data structure to be valid value.

Parameters:
[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
[in] Context Points to an optional handler context which was specified when the handler was registered.
[in,out] CommBuffer A pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
[in,out] CommBufferSize The size of the CommBuffer.
Return values:
EFI_SUCCESS The interrupt was handled successfully.

References ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST, ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS, ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS, ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2, BOOLEAN(), EFI_STATUS(), gEfiTrEEPhysicalPresenceGuid, EFI_TREE_PHYSICAL_PRESENCE::LastPPRequest, PHYSICAL_PRESENCE_NVS::LastRequest, PHYSICAL_PRESENCE_NVS::Parameter, TCG_NVS::PhysicalPresence, PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE, PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS, EFI_TREE_PHYSICAL_PRESENCE_FLAGS::PPFlags, EFI_TREE_PHYSICAL_PRESENCE::PPRequest, EFI_TREE_PHYSICAL_PRESENCE::PPResponse, PHYSICAL_PRESENCE_NVS::Request, PHYSICAL_PRESENCE_NVS::Response, PHYSICAL_PRESENCE_NVS::ReturnCode, TREE_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_CLEAR, TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR, TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_2, TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_3, TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_4, TREE_PHYSICAL_PRESENCE_FLAGS_VARIABLE, TREE_PHYSICAL_PRESENCE_NO_ACTION_MAX, TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_FALSE, TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_TRUE, TREE_PHYSICAL_PRESENCE_VARIABLE, TREE_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION, TREE_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_NOT_REQUIRED, TREE_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED, TREE_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION, TREE_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED, TREE_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE, TREE_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED, TREE_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS, TrEEPpVendorLibGetUserConfirmationStatusFunction(), TrEEPpVendorLibSubmitRequestToPreOSFunction(), TRUE, and UINTN().

EFI_STATUS PublishAcpiTable ( VOID   ) 

Initialize and publish TPM items in ACPI table.

Return values:
EFI_SUCCESS The TCG ACPI table is published successfully.
Others The TCG ACPI table is not published.

References AssignOpRegion(), EFI_STATUS(), TpmMeasureAndLogData(), and UINTN().

EFI_STATUS PublishTpm2 ( VOID   ) 

Publish TPM2 ACPI table

Return values:
EFI_SUCCESS The TPM2 ACPI table is published successfully.
Others The TPM2 ACPI table is not published.

References EFI_STATUS(), mTpm2AcpiTemplate, TpmMeasureAndLogData(), and UINTN().


Variable Documentation

EFI_SMM_VARIABLE_PROTOCOL* mSmmVariable

EFI_TPM2_ACPI_TABLE mTpm2AcpiTemplate

Initial value:

 {
  {
    EFI_ACPI_5_0_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE,
    sizeof (mTpm2AcpiTemplate),
    EFI_TPM2_ACPI_TABLE_REVISION,
    
    
    
    
  },
  0, 
  0, 
  EFI_TPM2_ACPI_TABLE_START_METHOD_TIS, 
}


Generated on Thu Sep 24 23:44:24 2015 for SecurityPkg[ALL] by  doxygen 1.5.7.1