Commit 0bbe5b0e authored by Kuppuswamy Sathyanarayanan's avatar Kuppuswamy Sathyanarayanan Committed by Ard Biesheuvel

efi/libstub: Add Confidential Computing (CC) measurement typedefs

If the virtual firmware implements TPM support, TCG2 protocol will be
used for kernel measurements and event logging support. But in CC
environment, not all platforms support or enable the TPM feature. UEFI
specification [1] exposes protocol and interfaces used for kernel
measurements in CC platforms without TPM support.

More details about the EFI CC measurements and logging can be found
in [1].

Link: https://uefi.org/specs/UEFI/2.10/38_Confidential_Computing.html#efi-cc-measurement-protocol [1]
Signed-off-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
[ardb: Drop code changes, keep typedefs and #define's only]
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 7a1381e8
......@@ -882,6 +882,85 @@ union efi_tcg2_protocol {
} mixed_mode;
};
typedef struct {
u8 major;
u8 minor;
} efi_cc_version_t;
typedef struct {
u8 type;
u8 sub_type;
} efi_cc_type_t;
/* EFI CC type/subtype defines */
#define EFI_CC_TYPE_NONE 0
#define EFI_CC_TYPE_AMD_SEV 1
#define EFI_CC_TYPE_INTEL_TDX 2
typedef u32 efi_cc_mr_index_t;
struct efi_cc_event {
u32 event_size;
struct {
u32 header_size;
u16 header_version;
u32 mr_index;
u32 event_type;
} __packed event_header;
/* u8[] event follows here */
} __packed;
typedef struct efi_cc_event efi_cc_event_t;
typedef u32 efi_cc_event_log_bitmap_t;
typedef u32 efi_cc_event_log_format_t;
typedef u32 efi_cc_event_algorithm_bitmap_t;
typedef struct {
u8 size;
efi_cc_version_t structure_version;
efi_cc_version_t protocol_version;
efi_cc_event_algorithm_bitmap_t hash_algorithm_bitmap;
efi_cc_event_log_bitmap_t supported_event_logs;
efi_cc_type_t cc_type;
} efi_cc_boot_service_cap_t;
#define EFI_CC_EVENT_HEADER_VERSION 1
#define EFI_CC_BOOT_HASH_ALG_SHA384 0x00000004
typedef union efi_cc_protocol efi_cc_protocol_t;
union efi_cc_protocol {
struct {
efi_status_t
(__efiapi *get_capability)(efi_cc_protocol_t *,
efi_cc_boot_service_cap_t *);
efi_status_t
(__efiapi *get_event_log)(efi_cc_protocol_t *,
efi_cc_event_log_format_t,
efi_physical_addr_t *,
efi_physical_addr_t *,
efi_bool_t *);
efi_status_t
(__efiapi *hash_log_extend_event)(efi_cc_protocol_t *, u64,
efi_physical_addr_t, u64,
const efi_cc_event_t *);
efi_status_t
(__efiapi *map_pcr_to_mr_index)(efi_cc_protocol_t *, u32,
efi_cc_mr_index_t *);
};
struct {
u32 get_capability;
u32 get_event_log;
u32 hash_log_extend_event;
u32 map_pcr_to_mr_index;
} mixed_mode;
};
struct riscv_efi_boot_protocol {
u64 revision;
......
......@@ -401,6 +401,7 @@ void efi_native_runtime_setup(void);
#define EFI_CERT_X509_GUID EFI_GUID(0xa5c059a1, 0x94e4, 0x4aa7, 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72)
#define EFI_CERT_X509_SHA256_GUID EFI_GUID(0x3bd2a492, 0x96c0, 0x4079, 0xb4, 0x20, 0xfc, 0xf9, 0x8e, 0xf1, 0x03, 0xed)
#define EFI_CC_BLOB_GUID EFI_GUID(0x067b1f5f, 0xcf26, 0x44c5, 0x85, 0x54, 0x93, 0xd7, 0x77, 0x91, 0x2d, 0x42)
#define EFI_CC_MEASUREMENT_PROTOCOL_GUID EFI_GUID(0x96751a3d, 0x72f4, 0x41a6, 0xa7, 0x94, 0xed, 0x5d, 0x0e, 0x67, 0xae, 0x6b)
/*
* This GUID is used to pass to the kernel proper the struct screen_info
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment