linux/include/linux/tpm_eventlog.h

/* SPDX-License-Identifier: GPL-2.0 */

#ifndef __LINUX_TPM_EVENTLOG_H__
#define __LINUX_TPM_EVENTLOG_H__

#include <linux/tpm.h>

#define TCG_EVENT_NAME_LEN_MAX
#define MAX_TEXT_EVENT
#define ACPI_TCPA_SIG

#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2
#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2

#ifdef CONFIG_PPC64
#define do_endian_conversion
#else
#define do_endian_conversion(x)
#endif

enum bios_platform_class {};

struct tcpa_event {};

enum tcpa_event_types {};

struct tcpa_pc_event {};

enum tcpa_pc_event_ids {};

/* http://www.trustedcomputinggroup.org/tcg-efi-protocol-specification/ */

struct tcg_efi_specid_event_algs {} __packed;

#define TCG_SPECID_SIG

struct tcg_efi_specid_event_head {} __packed;

struct tcg_pcr_event {} __packed;

struct tcg_event_field {} __packed;

struct tcg_pcr_event2_head {} __packed;

struct tcg_algorithm_size {};

struct tcg_algorithm_info {};

#ifndef TPM_MEMREMAP
#define TPM_MEMREMAP(start, size)
#endif

#ifndef TPM_MEMUNMAP
#define TPM_MEMUNMAP(start, size)
#endif

/**
 * __calc_tpm2_event_size - calculate the size of a TPM2 event log entry
 * @event:        Pointer to the event whose size should be calculated
 * @event_header: Pointer to the initial event containing the digest lengths
 * @do_mapping:   Whether or not the event needs to be mapped
 *
 * The TPM2 event log format can contain multiple digests corresponding to
 * separate PCR banks, and also contains a variable length of the data that
 * was measured. This requires knowledge of how long each digest type is,
 * and this information is contained within the first event in the log.
 *
 * We calculate the length by examining the number of events, and then looking
 * at each event in turn to determine how much space is used for events in
 * total. Once we've done this we know the offset of the data length field,
 * and can calculate the total size of the event.
 *
 * Return: size of the event on success, 0 on failure
 */

static __always_inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
					 struct tcg_pcr_event *event_header,
					 bool do_mapping)
{}

#endif