Home | History | Annotate | Download | only in TcgService
      1 /*++
      2 
      3 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 Module Name:
     13 
     14   TcgService.h
     15 
     16 Abstract:
     17 
     18   TCG Service Protocol as defined in TCG_EFI_Protocol_1_20_Final
     19 
     20   See http://trustedcomputinggroup.org for the latest specification
     21 
     22 --*/
     23 
     24 #ifndef _TCG_SERVICE_PROTOCOL_H_
     25 #define _TCG_SERVICE_PROTOCOL_H_
     26 
     27 #include "EfiTpm.h"
     28 
     29 #define EFI_TCG_PROTOCOL_GUID  \
     30   {0xf541796d, 0xa62e, 0x4954, {0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd}}
     31 
     32 #define EFI_TCG_PLATFORM_PROTOCOL_GUID  \
     33   { 0x8c4c9a41, 0xbf56, 0x4627, {0x9e, 0xa, 0xc8, 0x38, 0x6d, 0x66, 0x11, 0x5c} }
     34 
     35 #define TSS_EVENT_DATA_MAX_SIZE   256
     36 
     37 #define EFI_CALLING_EFI_APPLICATION         \
     38   "Calling EFI Application from Boot Option"
     39 #define EFI_RETURNING_FROM_EFI_APPLICATOIN  \
     40   "Returning from EFI Application from Boot Option"
     41 #define EFI_EXIT_BOOT_SERVICES_INVOCATION   \
     42   "Exit Boot Services Invocation"
     43 #define EFI_EXIT_BOOT_SERVICES_FAILED       \
     44   "Exit Boot Services Returned with Failure"
     45 #define EFI_EXIT_BOOT_SERVICES_SUCCEEDED    \
     46   "Exit Boot Services Returned with Success"
     47 
     48 EFI_FORWARD_DECLARATION (EFI_TCG_PROTOCOL);
     49 
     50 //
     51 // Set structure alignment to 1-byte
     52 //
     53 #pragma pack (1)
     54 
     55 typedef struct {
     56   UINT8  Major;
     57   UINT8  Minor;
     58   UINT8  RevMajor;
     59   UINT8  RevMinor;
     60 } TCG_VERSION;
     61 
     62 typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {
     63   UINT8          Size;                // Size of this structure
     64   TCG_VERSION    StructureVersion;
     65   TCG_VERSION    ProtocolSpecVersion;
     66   UINT8          HashAlgorithmBitmap; // Hash algorithms
     67                                       // this protocol is capable of : 01=SHA-1
     68   BOOLEAN        TPMPresentFlag;      // 00h = TPM not present
     69   BOOLEAN        TPMDeactivatedFlag;  // 01h = TPM currently deactivated
     70 } TCG_EFI_BOOT_SERVICE_CAPABILITY;
     71 
     72 typedef UINT32   TCG_ALGORITHM_ID;
     73 
     74 //
     75 // Restore original structure alignment
     76 //
     77 #pragma pack ()
     78 
     79 typedef
     80 EFI_STATUS
     81 (EFIAPI *EFI_TCG_STATUS_CHECK) (
     82   IN      EFI_TCG_PROTOCOL          *This,
     83   OUT     TCG_EFI_BOOT_SERVICE_CAPABILITY
     84                                     *ProtocolCapability,
     85   OUT     UINT32                    *TCGFeatureFlags,
     86   OUT     EFI_PHYSICAL_ADDRESS      *EventLogLocation,
     87   OUT     EFI_PHYSICAL_ADDRESS      *EventLogLastEntry
     88   );
     89 
     90 typedef
     91 EFI_STATUS
     92 (EFIAPI *EFI_TCG_HASH_ALL) (
     93   IN      EFI_TCG_PROTOCOL          *This,
     94   IN      UINT8                     *HashData,
     95   IN      UINT64                    HashDataLen,
     96   IN      TCG_ALGORITHM_ID          AlgorithmId,
     97   IN OUT  UINT64                    *HashedDataLen,
     98   IN OUT  UINT8                     **HashedDataResult
     99   );
    100 
    101 typedef
    102 EFI_STATUS
    103 (EFIAPI *EFI_TCG_LOG_EVENT) (
    104   IN      EFI_TCG_PROTOCOL          *This,
    105   IN      TCG_PCR_EVENT             *TCGLogData,
    106   IN OUT  UINT32                    *EventNumber,
    107   IN      UINT32                    Flags
    108   );
    109 
    110 typedef
    111 EFI_STATUS
    112 (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM) (
    113   IN      EFI_TCG_PROTOCOL          *This,
    114   IN      UINT32                    TpmInputParameterBlockSize,
    115   IN      UINT8                     *TpmInputParameterBlock,
    116   IN      UINT32                    TpmOutputParameterBlockSize,
    117   IN      UINT8                     *TpmOutputParameterBlock
    118   );
    119 
    120 typedef
    121 EFI_STATUS
    122 (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT) (
    123   IN      EFI_TCG_PROTOCOL          *This,
    124   IN      EFI_PHYSICAL_ADDRESS      HashData,
    125   IN      UINT64                    HashDataLen,
    126   IN      TCG_ALGORITHM_ID          AlgorithmId,
    127   IN OUT  TCG_PCR_EVENT             *TCGLogData,
    128   IN OUT  UINT32                    *EventNumber,
    129      OUT  EFI_PHYSICAL_ADDRESS      *EventLogLastEntry
    130   );
    131 
    132 struct _EFI_TCG_PROTOCOL {
    133   EFI_TCG_STATUS_CHECK              StatusCheck;
    134   EFI_TCG_HASH_ALL                  HashAll;
    135   EFI_TCG_LOG_EVENT                 LogEvent;
    136   EFI_TCG_PASS_THROUGH_TO_TPM       PassThroughToTpm;
    137   EFI_TCG_HASH_LOG_EXTEND_EVENT     HashLogExtendEvent;
    138 };
    139 
    140 extern EFI_GUID gEfiTcgProtocolGuid;
    141 
    142 //
    143 // EFI TCG Platform Protocol
    144 //
    145 typedef
    146 EFI_STATUS
    147 (EFIAPI *EFI_TCG_MEASURE_PE_IMAGE) (
    148   IN      BOOLEAN                   BootPolicy,
    149   IN      EFI_PHYSICAL_ADDRESS      ImageAddress,
    150   IN      UINTN                     ImageSize,
    151   IN      UINTN                     LinkTimeBase,
    152   IN      UINT16                    ImageType,
    153   IN      EFI_HANDLE                DeviceHandle,
    154   IN      EFI_DEVICE_PATH_PROTOCOL  *FilePath
    155   );
    156 
    157 typedef
    158 EFI_STATUS
    159 (EFIAPI *EFI_TCG_MEASURE_ACTION) (
    160   IN      CHAR8                     *ActionString
    161   );
    162 
    163 typedef
    164 EFI_STATUS
    165 (EFIAPI *EFI_TCG_MEASURE_GPT_TABLE) (
    166   IN      EFI_DEVICE_PATH_PROTOCOL  *DevicePath
    167   );
    168 
    169 typedef struct _EFI_TCG_PLATFORM_PROTOCOL {
    170   EFI_TCG_MEASURE_PE_IMAGE          MeasurePeImage;
    171   EFI_TCG_MEASURE_ACTION            MeasureAction;
    172   EFI_TCG_MEASURE_GPT_TABLE         MeasureGptTable;
    173 } EFI_TCG_PLATFORM_PROTOCOL;
    174 
    175 extern EFI_GUID                     gEfiTcgPlatformProtocolGuid;
    176 
    177 #endif
    178