-
Notifications
You must be signed in to change notification settings - Fork 4
/
tpm.h
60 lines (48 loc) · 1.02 KB
/
tpm.h
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* Copyright (c) 2019 Apertus Solutions, LLC
*
* Author(s):
* Daniel P. Smith <[email protected]>
*
*/
#ifndef _TPM_H
#define _TPM_H
#ifdef LINUX_USERSPACE
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#define u8 uint8_t
#define u16 uint16_t
#define u32 uint32_t
#define u64 uint64_t
#endif
#define TPM_NO_LOCALITY 0xFF
enum tpm_hw_intf {
TPM_TIS,
TPM_CRB
};
enum tpm_family {
TPM12,
TPM20
};
struct tpmbuff;
struct tpm_hw_ops {
u8 (*request_locality)(u8 l);
void (*relinquish_locality)(void);
size_t (*send)(struct tpmbuff *buf);
size_t (*recv)(enum tpm_family family, struct tpmbuff *buf);
};
struct tpm {
u32 vendor;
enum tpm_family family;
enum tpm_hw_intf intf;
struct tpm_hw_ops ops;
struct tpmbuff *buff;
};
extern struct tpm *enable_tpm(void);
extern u8 tpm_request_locality(struct tpm *t, u8 l);
extern void tpm_relinquish_locality(struct tpm *t);
extern int tpm_extend_pcr(struct tpm *t, u32 pcr, u16 algo,
u8 *digest);
extern void free_tpm(struct tpm *t);
#endif