Debian Codegraph @

src/boot/proto/tcg.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "efi.h"
5
6 #define EFI_TCG2_PROTOCOL_GUID \
7 GUID_DEF(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
8
9 #define EFI_TCG2_EVENT_HEADER_VERSION 1
10 #define EV_IPL 13
11 #define EV_EVENT_TAG UINT32_C(6)
12
13 typedef struct {
14 uint8_t Major;
15 uint8_t Minor;
16 } EFI_TCG2_VERSION;
17
18 typedef struct {
19 uint8_t Size;
20 EFI_TCG2_VERSION StructureVersion;
21 EFI_TCG2_VERSION ProtocolVersion;
22 uint32_t HashAlgorithmBitmap;
23 uint32_t SupportedEventLogs;
24 bool TPMPresentFlag;
25 uint16_t MaxCommandSize;
26 uint16_t MaxResponseSize;
27 uint32_t ManufacturerID;
28 uint32_t NumberOfPCRBanks;
29 uint32_t ActivePcrBanks;
30 } EFI_TCG2_BOOT_SERVICE_CAPABILITY;
31
32 typedef struct {
33 uint32_t HeaderSize;
34 uint16_t HeaderVersion;
35 uint32_t PCRIndex;
36 uint32_t EventType;
37 } _packed_ EFI_TCG2_EVENT_HEADER;
38
39 typedef struct {
40 uint32_t Size;
41 EFI_TCG2_EVENT_HEADER Header;
42 uint8_t Event[];
43 } _packed_ EFI_TCG2_EVENT;
44
45 typedef struct {
46 uint32_t Size;
47 EFI_TCG2_EVENT_HEADER Header;
48 uint32_t EventId;
49 uint32_t EventSize;
50 uint8_t Event[];
51 } _packed_ EFI_TCG2_TAGGED_EVENT;
52
53 typedef struct EFI_TCG2_PROTOCOL EFI_TCG2_PROTOCOL;
54 struct EFI_TCG2_PROTOCOL {
55 EFI_STATUS (EFIAPI *GetCapability)(
56 EFI_TCG2_PROTOCOL *This,
57 EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability);
58 void *GetEventLog;
59 EFI_STATUS (EFIAPI *HashLogExtendEvent)(
60 EFI_TCG2_PROTOCOL *This,
61 uint64_t Flags,
62 EFI_PHYSICAL_ADDRESS DataToHash,
63 uint64_t DataToHashLen,
64 EFI_TCG2_EVENT *EfiTcgEvent);
65 void *SubmitCommand;
66 EFI_STATUS (EFIAPI *GetActivePcrBanks)(
67 EFI_TCG2_PROTOCOL *This,
68 uint32_t *ActivePcrBanks);
69 void *SetActivePcrBanks;
70 void *GetResultOfSetActivePcrBanks;
71 };