-
Notifications
You must be signed in to change notification settings - Fork 4
/
tpm2.h
88 lines (73 loc) · 1.95 KB
/
tpm2.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* Copyright (c) 2019 Apertus Solutions, LLC
*
* Author(s):
* Daniel P. Smith <[email protected]>
*
* The definitions in this header are extracted and/or dervied from the
* Trusted Computing Group's TPM 2.0 Library Specification Parts 1&2.
*
*/
#ifndef _TPM2_H
#define _TPM2_H
#include "tpm_common.h"
#include "tpm2_constants.h"
/* Table 192 Definition of TPM2B_TEMPLATE Structure:
* Using this as the base structure similar to the spec
*/
struct tpm2b {
u16 size;
u8 buffer[0];
};
// Table 32 Definition of TPMA_SESSION Bits < IN/OUT>
struct tpma_session {
u8 continue_session : 1;
u8 audit_exclusive : 1;
u8 audit_reset : 1;
u8 reserved3_4 : 2;
u8 decrypt : 1;
u8 encrypt : 1;
u8 audit : 1;
};
// Table 72 Definition of TPMT_HA Structure < IN/OUT>
struct tpmt_ha {
u16 alg; /* TPMI_ALG_HASH */
u8 digest[0]; /* TPMU_HA */
};
// Table 100 Definition of TPML_DIGEST_VALUES Structure
struct tpml_digest_values {
u32 count;
struct tpmt_ha digests[0];
};
// Table 124 Definition of TPMS_AUTH_COMMAND Structure < IN>
struct tpms_auth_cmd {
u32 *handle;
struct tpm2b *nonce;
struct tpma_session *attributes;
struct tpm2b *hmac;
};
// Table 125 Definition of TPMS_AUTH_RESPONSE Structure < OUT>
struct tpms_auth_resp {
struct tpm2b *nonce;
struct tpma_session *attributes;
struct tpm2b *hmac;
};
struct tpm2_cmd {
struct tpm_header *header;
u32 *handles; /* TPM Handles array */
u32 *auth_size; /* Size of Auth Area */
u8 *auth; /* Authorization Area */
u8 *params; /* Parameters */
u8 *raw; /* internal raw buffer */
};
struct tpm2_resp {
struct tpm_header *header;
u32 *handles; /* TPM Handles array */
u32 *param_size; /* Size of Parameters */
struct tpm2b *params; /* Parameters */
u8 *auth; /* Authorization Area */
u8 *raw; /* internal raw buffer */
};
int tpm2_extend_pcr(struct tpm *t, u32 pcr,
struct tpml_digest_values *digests);
#endif