• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <stdint.h>
4 
5 const struct s_tpm_extend_cmd{
6 	uint8_t buffer[34];
7 	uint16_t pcrNum;
8 	uint16_t inDigest;
9 } tpm_extend_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x22, 0x0, 0x0, 0x0, 0x14, },
10 10, 14, };
11 
12 const struct s_tpm_get_random_cmd{
13 	uint8_t buffer[14];
14 	uint16_t bytesRequested;
15 } tpm_get_random_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x46, },
16 10, };
17 
18 const struct s_tpm_getownership_cmd{
19 	uint8_t buffer[22];
20 } tpm_getownership_cmd = {
21 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65,
22 	0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x11, },
23 };
24 
25 const struct s_tpm_getpermissions_cmd{
26 	uint8_t buffer[22];
27 	uint16_t index;
28 } tpm_getpermissions_cmd = {
29 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65,
30 	0x0, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x4, },
31 18, };
32 
33 const struct s_tpm_getstclearflags_cmd{
34 	uint8_t buffer[22];
35 } tpm_getstclearflags_cmd = {
36 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65,
37 	0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x9, },
38 };
39 
40 const struct s_tpm_getflags_cmd{
41 	uint8_t buffer[22];
42 } tpm_getflags_cmd = {
43 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0x65,
44 	0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, 0x8, },
45 };
46 
47 const struct s_tpm_physicalsetdeactivated_cmd{
48 	uint8_t buffer[11];
49 	uint16_t deactivated;
50 } tpm_physicalsetdeactivated_cmd = {
51 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xb, 0x0, 0x0, 0x0, 0x72, },
52 10, };
53 
54 const struct s_tpm_physicalenable_cmd{
55 	uint8_t buffer[10];
56 } tpm_physicalenable_cmd = {
57 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x6f, },
58 };
59 
60 const struct s_tpm_physicaldisable_cmd{
61 	uint8_t buffer[10];
62 } tpm_physicaldisable_cmd = {
63 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x70, },
64 };
65 
66 const struct s_tpm_forceclear_cmd{
67 	uint8_t buffer[10];
68 } tpm_forceclear_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x5d, },
69 };
70 
71 const struct s_tpm_readpubek_cmd{
72 	uint8_t buffer[30];
73 } tpm_readpubek_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x1e, 0x0, 0x0, 0x0, 0x7c, },
74 };
75 
76 const struct s_tpm_continueselftest_cmd{
77 	uint8_t buffer[10];
78 } tpm_continueselftest_cmd = {
79 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x53, },
80 };
81 
82 const struct s_tpm_selftestfull_cmd{
83 	uint8_t buffer[10];
84 } tpm_selftestfull_cmd = {
85 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x50, },
86 };
87 
88 const struct s_tpm_resume_cmd{
89 	uint8_t buffer[12];
90 } tpm_resume_cmd = {
91 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x2, },
92 };
93 
94 const struct s_tpm_savestate_cmd{
95 	uint8_t buffer[10];
96 } tpm_savestate_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x98, },
97 };
98 
99 const struct s_tpm_startup_cmd{
100 	uint8_t buffer[12];
101 } tpm_startup_cmd = {
102 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x99, 0x0, 0x1, },
103 };
104 
105 const struct s_tpm_finalizepp_cmd{
106 	uint8_t buffer[12];
107 } tpm_finalizepp_cmd = {
108 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x2, 0xa0, },
109 };
110 
111 const struct s_tpm_pplock_cmd{
112 	uint8_t buffer[12];
113 } tpm_pplock_cmd = {
114 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x4, },
115 };
116 
117 const struct s_tpm_ppenable_cmd{
118 	uint8_t buffer[12];
119 } tpm_ppenable_cmd = {
120 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x20, },
121 };
122 
123 const struct s_tpm_ppassert_cmd{
124 	uint8_t buffer[12];
125 } tpm_ppassert_cmd = {
126 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0xc, 0x40, 0x0, 0x0, 0xa, 0x0, 0x8, },
127 };
128 
129 const struct s_tpm_pcr_read_cmd{
130 	uint8_t buffer[14];
131 	uint16_t pcrNum;
132 } tpm_pcr_read_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x15, },
133 10, };
134 
135 const struct s_tpm_nv_read_cmd{
136 	uint8_t buffer[22];
137 	uint16_t index;
138 	uint16_t length;
139 } tpm_nv_read_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x16, 0x0, 0x0, 0x0, 0xcf, },
140 10, 18, };
141 
142 const struct s_tpm_nv_write_cmd{
143 	uint8_t buffer[256];
144 	uint16_t index;
145 	uint16_t length;
146 	uint16_t data;
147 } tpm_nv_write_cmd = {{0x0, 0xc1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, },
148 10, 18, 22, };
149 
150 const struct s_tpm_nv_definespace_cmd{
151 	uint8_t buffer[101];
152 	uint16_t index;
153 	uint16_t perm;
154 	uint16_t size;
155 } tpm_nv_definespace_cmd = {
156 	{0x0, 0xc1, 0x0, 0x0, 0x0, 0x65, 0x0, 0x0, 0x0, 0xcc,
157 	0x0, 0x18, 0, 0, 0, 0, 0x0, 0x3, 0, 0, 0, 0x1f, 0, 0,
158 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
159 	0x0, 0x3, 0, 0, 0, 0x1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
160 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0, 0x17,
161 	},
162 	12, 70, 77,
163 };
164 
165 const int kWriteInfoLength = 12;
166 const int kNvDataPublicPermissionsOffset = 60;
167