| 1 |
|
| 2 |
|
| 3 |
#ifndef __SECURITY_TSPI_CRTM_H__ |
| 4 |
#define __SECURITY_TSPI_CRTM_H__ |
| 5 |
|
| 6 |
#include <program_loading.h> |
| 7 |
#include <security/tpm/tspi.h> |
| 8 |
#include <security/tpm/tss_errors.h> |
| 9 |
#include <types.h> |
| 10 |
#include <vb2_sha.h> |
| 11 |
|
| 12 |
#if CONFIG(TPM_LOG_CB) |
| 13 |
# define TPM_MEASURE_ALGO (tlcl_get_family() == TPM_1 ? VB2_HASH_SHA1 : VB2_HASH_SHA256) |
| 14 |
#elif CONFIG(TPM_LOG_TPM1) |
| 15 |
# define TPM_MEASURE_ALGO VB2_HASH_SHA1 |
| 16 |
#elif CONFIG(TPM_LOG_TPM2) |
| 17 |
# if CONFIG(TPM_HASH_SHA1) |
| 18 |
# define TPM_MEASURE_ALGO VB2_HASH_SHA1 |
| 19 |
# endif |
| 20 |
# if CONFIG(TPM_HASH_SHA256) |
| 21 |
# define TPM_MEASURE_ALGO VB2_HASH_SHA256 |
| 22 |
# endif |
| 23 |
# if CONFIG(TPM_HASH_SHA384) |
| 24 |
# define TPM_MEASURE_ALGO VB2_HASH_SHA384 |
| 25 |
# endif |
| 26 |
# if CONFIG(TPM_HASH_SHA512) |
| 27 |
# define TPM_MEASURE_ALGO VB2_HASH_SHA512 |
| 28 |
# endif |
| 29 |
#endif |
| 30 |
|
| 31 |
#if !defined(TPM_MEASURE_ALGO) |
| 32 |
# if !CONFIG(TPM_MEASURED_BOOT) |
| 33 |
# define TPM_MEASURE_ALGO VB2_HASH_INVALID |
| 34 |
# else |
| 35 |
# error "Misconfiguration: failed to determine TPM hashing algorithm" |
| 36 |
# endif |
| 37 |
#endif |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
tpm_result_t tspi_measure_cache_to_pcr(void); |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
tpm_result_t tspi_cbfs_measurement(const char *name, uint32_t type, const struct vb2_hash *hash); |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
int tspi_soc_measure_bootblock(int pcr_index); |
| 54 |
|
| 55 |
#endif |