summaryrefslogtreecommitdiff
path: root/src/security/vboot/secdata_tpm_private.h
blob: 3fce40d8b7ea7f16d8abf07a9b316782df97e614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* SPDX-License-Identifier: BSD-3-Clause */

#ifndef __VBOOT_SECDATA_TPM_PRIVATE_H__
#define __VBOOT_SECDATA_TPM_PRIVATE_H__

#include <console/console.h>
#include <security/tpm/tis.h>
#include <vb2_api.h>

#define VBDEBUG(format, args...) \
	printk(BIOS_INFO, "%s():%d: " format, __func__, __LINE__, ## args)

#define RETURN_ON_FAILURE(tpm_cmd) do {                                          \
		tpm_result_t rc_;                                                \
		if ((rc_ = (tpm_cmd)) != TPM_SUCCESS) {                          \
			VBDEBUG("Antirollback: %08x returned by " #tpm_cmd "\n", \
				(tpm_result_t)rc_);                              \
			return rc_;                                              \
		}                                                                \
	} while (0)

tpm_result_t safe_write(uint32_t index, const void *data, uint32_t length);

tpm_result_t factory_initialize_tpm1(struct vb2_context *ctx);

tpm_result_t factory_initialize_tpm2(struct vb2_context *ctx);

#endif /* __VBOOT_SECDATA_TPM_PRIVATE_H__ */