blob: 8517833f8613b7e51b1216ab09ff6b4419ea14ec [file] [log] [blame]
Miquel Raynalff322452018-05-15 11:57:08 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (c) 2018 Bootlin
4 * Author: Miquel Raynal <miquel.raynal@bootlin.com>
5 */
6
Simon Glass09140112020-05-10 11:40:03 -06007#include <command.h>
Miquel Raynalff322452018-05-15 11:57:08 +02008#include <dm.h>
9#include <log.h>
Miquel Raynal6284be52018-05-15 11:57:15 +020010#include <mapmem.h>
Miquel Raynalff322452018-05-15 11:57:08 +020011#include <tpm-common.h>
12#include <tpm-v2.h>
13#include "tpm-user-utils.h"
14
Simon Glass09140112020-05-10 11:40:03 -060015static int do_tpm2_startup(struct cmd_tbl *cmdtp, int flag, int argc,
16 char *const argv[])
Miquel Raynal1922df22018-05-15 11:57:12 +020017{
18 enum tpm2_startup_types mode;
Simon Glassabdc7b82018-11-18 14:22:27 -070019 struct udevice *dev;
20 int ret;
Miquel Raynal1922df22018-05-15 11:57:12 +020021
Simon Glassabdc7b82018-11-18 14:22:27 -070022 ret = get_tpm(&dev);
23 if (ret)
24 return ret;
Miquel Raynal1922df22018-05-15 11:57:12 +020025 if (argc != 2)
26 return CMD_RET_USAGE;
27
28 if (!strcasecmp("TPM2_SU_CLEAR", argv[1])) {
29 mode = TPM2_SU_CLEAR;
30 } else if (!strcasecmp("TPM2_SU_STATE", argv[1])) {
31 mode = TPM2_SU_STATE;
32 } else {
33 printf("Couldn't recognize mode string: %s\n", argv[1]);
34 return CMD_RET_FAILURE;
35 }
36
Simon Glassabdc7b82018-11-18 14:22:27 -070037 return report_return_code(tpm2_startup(dev, mode));
Miquel Raynal1922df22018-05-15 11:57:12 +020038}
39
Simon Glass09140112020-05-10 11:40:03 -060040static int do_tpm2_self_test(struct cmd_tbl *cmdtp, int flag, int argc,
41 char *const argv[])
Miquel Raynal2dc6d972018-05-15 11:57:13 +020042{
43 enum tpm2_yes_no full_test;
Simon Glassabdc7b82018-11-18 14:22:27 -070044 struct udevice *dev;
45 int ret;
Miquel Raynal2dc6d972018-05-15 11:57:13 +020046
Simon Glassabdc7b82018-11-18 14:22:27 -070047 ret = get_tpm(&dev);
48 if (ret)
49 return ret;
Miquel Raynal2dc6d972018-05-15 11:57:13 +020050 if (argc != 2)
51 return CMD_RET_USAGE;
52
53 if (!strcasecmp("full", argv[1])) {
54 full_test = TPMI_YES;
55 } else if (!strcasecmp("continue", argv[1])) {
56 full_test = TPMI_NO;
57 } else {
58 printf("Couldn't recognize test mode: %s\n", argv[1]);
59 return CMD_RET_FAILURE;
60 }
61
Simon Glassabdc7b82018-11-18 14:22:27 -070062 return report_return_code(tpm2_self_test(dev, full_test));
Miquel Raynal2dc6d972018-05-15 11:57:13 +020063}
64
Simon Glass09140112020-05-10 11:40:03 -060065static int do_tpm2_clear(struct cmd_tbl *cmdtp, int flag, int argc,
66 char *const argv[])
Miquel Raynalbad8ff52018-05-15 11:57:14 +020067{
68 u32 handle = 0;
69 const char *pw = (argc < 3) ? NULL : argv[2];
70 const ssize_t pw_sz = pw ? strlen(pw) : 0;
Simon Glassabdc7b82018-11-18 14:22:27 -070071 struct udevice *dev;
72 int ret;
73
74 ret = get_tpm(&dev);
75 if (ret)
76 return ret;
Miquel Raynalbad8ff52018-05-15 11:57:14 +020077
78 if (argc < 2 || argc > 3)
79 return CMD_RET_USAGE;
80
81 if (pw_sz > TPM2_DIGEST_LEN)
82 return -EINVAL;
83
84 if (!strcasecmp("TPM2_RH_LOCKOUT", argv[1]))
85 handle = TPM2_RH_LOCKOUT;
86 else if (!strcasecmp("TPM2_RH_PLATFORM", argv[1]))
87 handle = TPM2_RH_PLATFORM;
88 else
89 return CMD_RET_USAGE;
90
Simon Glassabdc7b82018-11-18 14:22:27 -070091 return report_return_code(tpm2_clear(dev, handle, pw, pw_sz));
Miquel Raynalbad8ff52018-05-15 11:57:14 +020092}
93
Simon Glass09140112020-05-10 11:40:03 -060094static int do_tpm2_pcr_extend(struct cmd_tbl *cmdtp, int flag, int argc,
95 char *const argv[])
Miquel Raynal6284be52018-05-15 11:57:15 +020096{
97 struct udevice *dev;
98 struct tpm_chip_priv *priv;
99 u32 index = simple_strtoul(argv[1], NULL, 0);
100 void *digest = map_sysmem(simple_strtoul(argv[2], NULL, 0), 0);
Tim Harvey89aa8462024-05-25 13:00:49 -0700101 int algo = TPM2_ALG_SHA256;
102 int algo_len;
Miquel Raynal6284be52018-05-15 11:57:15 +0200103 int ret;
104 u32 rc;
105
Tim Harvey89aa8462024-05-25 13:00:49 -0700106 if (argc < 3 || argc > 4)
Miquel Raynal6284be52018-05-15 11:57:15 +0200107 return CMD_RET_USAGE;
Tim Harvey89aa8462024-05-25 13:00:49 -0700108 if (argc == 4) {
109 algo = tpm2_name_to_algorithm(argv[3]);
110 if (algo < 0)
111 return CMD_RET_FAILURE;
112 }
113 algo_len = tpm2_algorithm_to_len(algo);
Miquel Raynal6284be52018-05-15 11:57:15 +0200114
Simon Glassabdc7b82018-11-18 14:22:27 -0700115 ret = get_tpm(&dev);
Miquel Raynal6284be52018-05-15 11:57:15 +0200116 if (ret)
117 return ret;
118
119 priv = dev_get_uclass_priv(dev);
120 if (!priv)
121 return -EINVAL;
122
123 if (index >= priv->pcr_count)
124 return -EINVAL;
125
Tim Harvey89aa8462024-05-25 13:00:49 -0700126 rc = tpm2_pcr_extend(dev, index, algo, digest, algo_len);
127 if (!rc) {
128 printf("PCR #%u extended with %d byte %s digest\n", index,
129 algo_len, tpm2_algorithm_name(algo));
130 print_byte_string(digest, algo_len);
131 }
Miquel Raynal6284be52018-05-15 11:57:15 +0200132
133 unmap_sysmem(digest);
134
135 return report_return_code(rc);
136}
137
Simon Glass09140112020-05-10 11:40:03 -0600138static int do_tpm_pcr_read(struct cmd_tbl *cmdtp, int flag, int argc,
139 char *const argv[])
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200140{
Tim Harvey89aa8462024-05-25 13:00:49 -0700141 enum tpm2_algorithms algo = TPM2_ALG_SHA256;
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200142 struct udevice *dev;
143 struct tpm_chip_priv *priv;
144 u32 index, rc;
Tim Harvey89aa8462024-05-25 13:00:49 -0700145 int algo_len;
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200146 unsigned int updates;
147 void *data;
148 int ret;
149
Tim Harvey89aa8462024-05-25 13:00:49 -0700150 if (argc < 3 || argc > 4)
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200151 return CMD_RET_USAGE;
Tim Harvey89aa8462024-05-25 13:00:49 -0700152 if (argc == 4) {
153 algo = tpm2_name_to_algorithm(argv[3]);
154 if (algo < 0)
155 return CMD_RET_FAILURE;
156 }
157 algo_len = tpm2_algorithm_to_len(algo);
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200158
Simon Glassabdc7b82018-11-18 14:22:27 -0700159 ret = get_tpm(&dev);
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200160 if (ret)
161 return ret;
162
163 priv = dev_get_uclass_priv(dev);
164 if (!priv)
165 return -EINVAL;
166
167 index = simple_strtoul(argv[1], NULL, 0);
168 if (index >= priv->pcr_count)
169 return -EINVAL;
170
171 data = map_sysmem(simple_strtoul(argv[2], NULL, 0), 0);
172
Tim Harvey89aa8462024-05-25 13:00:49 -0700173 rc = tpm2_pcr_read(dev, index, priv->pcr_select_min, algo,
174 data, algo_len, &updates);
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200175 if (!rc) {
Tim Harvey89aa8462024-05-25 13:00:49 -0700176 printf("PCR #%u %s %d byte content (%u known updates):\n", index,
177 tpm2_algorithm_name(algo), algo_len, updates);
178 print_byte_string(data, algo_len);
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200179 }
180
181 unmap_sysmem(data);
182
183 return report_return_code(rc);
184}
185
Simon Glass09140112020-05-10 11:40:03 -0600186static int do_tpm_get_capability(struct cmd_tbl *cmdtp, int flag, int argc,
187 char *const argv[])
Miquel Raynal69cd8f02018-05-15 11:57:17 +0200188{
189 u32 capability, property, rc;
190 u8 *data;
191 size_t count;
192 int i, j;
Simon Glassabdc7b82018-11-18 14:22:27 -0700193 struct udevice *dev;
194 int ret;
195
196 ret = get_tpm(&dev);
197 if (ret)
198 return ret;
Miquel Raynal69cd8f02018-05-15 11:57:17 +0200199
200 if (argc != 5)
201 return CMD_RET_USAGE;
202
203 capability = simple_strtoul(argv[1], NULL, 0);
204 property = simple_strtoul(argv[2], NULL, 0);
205 data = map_sysmem(simple_strtoul(argv[3], NULL, 0), 0);
206 count = simple_strtoul(argv[4], NULL, 0);
207
Simon Glassabdc7b82018-11-18 14:22:27 -0700208 rc = tpm2_get_capability(dev, capability, property, data, count);
Miquel Raynal69cd8f02018-05-15 11:57:17 +0200209 if (rc)
210 goto unmap_data;
211
212 printf("Capabilities read from TPM:\n");
213 for (i = 0; i < count; i++) {
214 printf("Property 0x");
215 for (j = 0; j < 4; j++)
Ilias Apalodimasa322f542020-11-05 23:58:43 +0200216 printf("%02x", data[(i * 8) + j + sizeof(u32)]);
Miquel Raynal69cd8f02018-05-15 11:57:17 +0200217 printf(": 0x");
218 for (j = 4; j < 8; j++)
Ilias Apalodimasa322f542020-11-05 23:58:43 +0200219 printf("%02x", data[(i * 8) + j + sizeof(u32)]);
Miquel Raynal69cd8f02018-05-15 11:57:17 +0200220 printf("\n");
221 }
222
223unmap_data:
224 unmap_sysmem(data);
225
226 return report_return_code(rc);
227}
228
Simon Glass09140112020-05-10 11:40:03 -0600229static int do_tpm_dam_reset(struct cmd_tbl *cmdtp, int flag, int argc,
Miquel Raynalda9c3392018-05-15 11:57:18 +0200230 char *const argv[])
231{
232 const char *pw = (argc < 2) ? NULL : argv[1];
233 const ssize_t pw_sz = pw ? strlen(pw) : 0;
Simon Glassabdc7b82018-11-18 14:22:27 -0700234 struct udevice *dev;
235 int ret;
236
237 ret = get_tpm(&dev);
238 if (ret)
239 return ret;
Miquel Raynalda9c3392018-05-15 11:57:18 +0200240
241 if (argc > 2)
242 return CMD_RET_USAGE;
243
244 if (pw_sz > TPM2_DIGEST_LEN)
245 return -EINVAL;
246
Simon Glassabdc7b82018-11-18 14:22:27 -0700247 return report_return_code(tpm2_dam_reset(dev, pw, pw_sz));
Miquel Raynalda9c3392018-05-15 11:57:18 +0200248}
249
Simon Glass09140112020-05-10 11:40:03 -0600250static int do_tpm_dam_parameters(struct cmd_tbl *cmdtp, int flag, int argc,
Miquel Raynalda9c3392018-05-15 11:57:18 +0200251 char *const argv[])
252{
253 const char *pw = (argc < 5) ? NULL : argv[4];
254 const ssize_t pw_sz = pw ? strlen(pw) : 0;
255 /*
256 * No Dictionary Attack Mitigation (DAM) means:
257 * maxtries = 0xFFFFFFFF, recovery_time = 1, lockout_recovery = 0
258 */
259 unsigned long int max_tries;
260 unsigned long int recovery_time;
261 unsigned long int lockout_recovery;
Simon Glassabdc7b82018-11-18 14:22:27 -0700262 struct udevice *dev;
263 int ret;
264
265 ret = get_tpm(&dev);
266 if (ret)
267 return ret;
Miquel Raynalda9c3392018-05-15 11:57:18 +0200268
269 if (argc < 4 || argc > 5)
270 return CMD_RET_USAGE;
271
272 if (pw_sz > TPM2_DIGEST_LEN)
273 return -EINVAL;
274
275 if (strict_strtoul(argv[1], 0, &max_tries))
276 return CMD_RET_USAGE;
277
278 if (strict_strtoul(argv[2], 0, &recovery_time))
279 return CMD_RET_USAGE;
280
281 if (strict_strtoul(argv[3], 0, &lockout_recovery))
282 return CMD_RET_USAGE;
283
284 log(LOGC_NONE, LOGL_INFO, "Changing dictionary attack parameters:\n");
285 log(LOGC_NONE, LOGL_INFO, "- maxTries: %lu", max_tries);
286 log(LOGC_NONE, LOGL_INFO, "- recoveryTime: %lu\n", recovery_time);
287 log(LOGC_NONE, LOGL_INFO, "- lockoutRecovery: %lu\n", lockout_recovery);
288
Simon Glassabdc7b82018-11-18 14:22:27 -0700289 return report_return_code(tpm2_dam_parameters(dev, pw, pw_sz, max_tries,
Miquel Raynalda9c3392018-05-15 11:57:18 +0200290 recovery_time,
291 lockout_recovery));
292}
293
Simon Glass09140112020-05-10 11:40:03 -0600294static int do_tpm_change_auth(struct cmd_tbl *cmdtp, int flag, int argc,
Miquel Raynaldc26e912018-05-15 11:57:19 +0200295 char *const argv[])
296{
297 u32 handle;
298 const char *newpw = argv[2];
299 const char *oldpw = (argc == 3) ? NULL : argv[3];
300 const ssize_t newpw_sz = strlen(newpw);
301 const ssize_t oldpw_sz = oldpw ? strlen(oldpw) : 0;
Simon Glassabdc7b82018-11-18 14:22:27 -0700302 struct udevice *dev;
303 int ret;
304
305 ret = get_tpm(&dev);
306 if (ret)
307 return ret;
Miquel Raynaldc26e912018-05-15 11:57:19 +0200308
309 if (argc < 3 || argc > 4)
310 return CMD_RET_USAGE;
311
312 if (newpw_sz > TPM2_DIGEST_LEN || oldpw_sz > TPM2_DIGEST_LEN)
313 return -EINVAL;
314
315 if (!strcasecmp("TPM2_RH_LOCKOUT", argv[1]))
316 handle = TPM2_RH_LOCKOUT;
317 else if (!strcasecmp("TPM2_RH_ENDORSEMENT", argv[1]))
318 handle = TPM2_RH_ENDORSEMENT;
319 else if (!strcasecmp("TPM2_RH_OWNER", argv[1]))
320 handle = TPM2_RH_OWNER;
321 else if (!strcasecmp("TPM2_RH_PLATFORM", argv[1]))
322 handle = TPM2_RH_PLATFORM;
323 else
324 return CMD_RET_USAGE;
325
Simon Glassabdc7b82018-11-18 14:22:27 -0700326 return report_return_code(tpm2_change_auth(dev, handle, newpw, newpw_sz,
Miquel Raynaldc26e912018-05-15 11:57:19 +0200327 oldpw, oldpw_sz));
328}
329
Simon Glass09140112020-05-10 11:40:03 -0600330static int do_tpm_pcr_setauthpolicy(struct cmd_tbl *cmdtp, int flag, int argc,
331 char *const argv[])
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200332{
333 u32 index = simple_strtoul(argv[1], NULL, 0);
334 char *key = argv[2];
335 const char *pw = (argc < 4) ? NULL : argv[3];
336 const ssize_t pw_sz = pw ? strlen(pw) : 0;
Simon Glassabdc7b82018-11-18 14:22:27 -0700337 struct udevice *dev;
338 int ret;
339
340 ret = get_tpm(&dev);
341 if (ret)
342 return ret;
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200343
344 if (strlen(key) != TPM2_DIGEST_LEN)
345 return -EINVAL;
346
347 if (argc < 3 || argc > 4)
348 return CMD_RET_USAGE;
349
Simon Glassabdc7b82018-11-18 14:22:27 -0700350 return report_return_code(tpm2_pcr_setauthpolicy(dev, pw, pw_sz, index,
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200351 key));
352}
353
Simon Glass09140112020-05-10 11:40:03 -0600354static int do_tpm_pcr_setauthvalue(struct cmd_tbl *cmdtp, int flag,
355 int argc, char *const argv[])
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200356{
357 u32 index = simple_strtoul(argv[1], NULL, 0);
358 char *key = argv[2];
359 const ssize_t key_sz = strlen(key);
360 const char *pw = (argc < 4) ? NULL : argv[3];
361 const ssize_t pw_sz = pw ? strlen(pw) : 0;
Simon Glassabdc7b82018-11-18 14:22:27 -0700362 struct udevice *dev;
363 int ret;
364
365 ret = get_tpm(&dev);
366 if (ret)
367 return ret;
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200368
369 if (strlen(key) != TPM2_DIGEST_LEN)
370 return -EINVAL;
371
372 if (argc < 3 || argc > 4)
373 return CMD_RET_USAGE;
374
Simon Glassabdc7b82018-11-18 14:22:27 -0700375 return report_return_code(tpm2_pcr_setauthvalue(dev, pw, pw_sz, index,
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200376 key, key_sz));
377}
378
Simon Glass09140112020-05-10 11:40:03 -0600379static struct cmd_tbl tpm2_commands[] = {
Philippe Reynes3780e2d2020-01-09 18:45:46 +0100380 U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""),
Miquel Raynalff322452018-05-15 11:57:08 +0200381 U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
Simon Glass3bb4db42022-08-30 21:05:36 -0600382 U_BOOT_CMD_MKENT(state, 0, 1, do_tpm_report_state, "", ""),
Miquel Raynalff322452018-05-15 11:57:08 +0200383 U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""),
Miquel Raynal1922df22018-05-15 11:57:12 +0200384 U_BOOT_CMD_MKENT(startup, 0, 1, do_tpm2_startup, "", ""),
Miquel Raynal2dc6d972018-05-15 11:57:13 +0200385 U_BOOT_CMD_MKENT(self_test, 0, 1, do_tpm2_self_test, "", ""),
Miquel Raynalbad8ff52018-05-15 11:57:14 +0200386 U_BOOT_CMD_MKENT(clear, 0, 1, do_tpm2_clear, "", ""),
Miquel Raynal6284be52018-05-15 11:57:15 +0200387 U_BOOT_CMD_MKENT(pcr_extend, 0, 1, do_tpm2_pcr_extend, "", ""),
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200388 U_BOOT_CMD_MKENT(pcr_read, 0, 1, do_tpm_pcr_read, "", ""),
Miquel Raynal69cd8f02018-05-15 11:57:17 +0200389 U_BOOT_CMD_MKENT(get_capability, 0, 1, do_tpm_get_capability, "", ""),
Miquel Raynalda9c3392018-05-15 11:57:18 +0200390 U_BOOT_CMD_MKENT(dam_reset, 0, 1, do_tpm_dam_reset, "", ""),
391 U_BOOT_CMD_MKENT(dam_parameters, 0, 1, do_tpm_dam_parameters, "", ""),
Miquel Raynaldc26e912018-05-15 11:57:19 +0200392 U_BOOT_CMD_MKENT(change_auth, 0, 1, do_tpm_change_auth, "", ""),
Ilias Apalodimase663b2f2023-06-07 12:18:10 +0300393 U_BOOT_CMD_MKENT(autostart, 0, 1, do_tpm_autostart, "", ""),
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200394 U_BOOT_CMD_MKENT(pcr_setauthpolicy, 0, 1,
395 do_tpm_pcr_setauthpolicy, "", ""),
396 U_BOOT_CMD_MKENT(pcr_setauthvalue, 0, 1,
397 do_tpm_pcr_setauthvalue, "", ""),
Miquel Raynalff322452018-05-15 11:57:08 +0200398};
399
Simon Glass09140112020-05-10 11:40:03 -0600400struct cmd_tbl *get_tpm2_commands(unsigned int *size)
Miquel Raynalff322452018-05-15 11:57:08 +0200401{
402 *size = ARRAY_SIZE(tpm2_commands);
403
404 return tpm2_commands;
405}
406
Miquel Raynal2a2096e2018-07-19 22:35:09 +0200407U_BOOT_CMD(tpm2, CONFIG_SYS_MAXARGS, 1, do_tpm, "Issue a TPMv2.x command",
Miquel Raynalff322452018-05-15 11:57:08 +0200408"<command> [<arguments>]\n"
409"\n"
Philippe Reynes3780e2d2020-01-09 18:45:46 +0100410"device [num device]\n"
411" Show all devices or set the specified device\n"
Miquel Raynalff322452018-05-15 11:57:08 +0200412"info\n"
413" Show information about the TPM.\n"
Simon Glass3bb4db42022-08-30 21:05:36 -0600414"state\n"
415" Show internal state from the TPM (if available)\n"
Ilias Apalodimase663b2f2023-06-07 12:18:10 +0300416"autostart\n"
417" Initalize the tpm, perform a Startup(clear) and run a full selftest\n"
418" sequence\n"
Miquel Raynalff322452018-05-15 11:57:08 +0200419"init\n"
420" Initialize the software stack. Always the first command to issue.\n"
Ilias Apalodimase663b2f2023-06-07 12:18:10 +0300421" 'tpm startup' is the only acceptable command after a 'tpm init' has been\n"
422" issued\n"
Miquel Raynal1922df22018-05-15 11:57:12 +0200423"startup <mode>\n"
424" Issue a TPM2_Startup command.\n"
425" <mode> is one of:\n"
426" * TPM2_SU_CLEAR (reset state)\n"
427" * TPM2_SU_STATE (preserved state)\n"
Miquel Raynal2dc6d972018-05-15 11:57:13 +0200428"self_test <type>\n"
429" Test the TPM capabilities.\n"
430" <type> is one of:\n"
431" * full (perform all tests)\n"
432" * continue (only check untested tests)\n"
Miquel Raynalbad8ff52018-05-15 11:57:14 +0200433"clear <hierarchy>\n"
434" Issue a TPM2_Clear command.\n"
435" <hierarchy> is one of:\n"
436" * TPM2_RH_LOCKOUT\n"
437" * TPM2_RH_PLATFORM\n"
Tim Harvey89aa8462024-05-25 13:00:49 -0700438"pcr_extend <pcr> <digest_addr> [<digest_algo>]\n"
439" Extend PCR #<pcr> with digest at <digest_addr> with digest_algo.\n"
Miquel Raynal6284be52018-05-15 11:57:15 +0200440" <pcr>: index of the PCR\n"
Tim Harvey89aa8462024-05-25 13:00:49 -0700441" <digest_addr>: address of digest of digest_algo type (defaults to SHA256)\n"
442"pcr_read <pcr> <digest_addr> [<digest_algo>]\n"
443" Read PCR #<pcr> to memory address <digest_addr> with <digest_algo>.\n"
Miquel Raynal1c4ea8f2018-05-15 11:57:16 +0200444" <pcr>: index of the PCR\n"
Tim Harvey89aa8462024-05-25 13:00:49 -0700445" <digest_addr>: address of digest of digest_algo type (defaults to SHA256)\n"
Miquel Raynal69cd8f02018-05-15 11:57:17 +0200446"get_capability <capability> <property> <addr> <count>\n"
447" Read and display <count> entries indexed by <capability>/<property>.\n"
448" Values are 4 bytes long and are written at <addr>.\n"
449" <capability>: capability\n"
450" <property>: property\n"
451" <addr>: address to store <count> entries of 4 bytes\n"
452" <count>: number of entries to retrieve\n"
Miquel Raynaldc26e912018-05-15 11:57:19 +0200453"dam_reset [<password>]\n"
454" If the TPM is not in a LOCKOUT state, reset the internal error counter.\n"
455" <password>: optional password\n"
456"dam_parameters <max_tries> <recovery_time> <lockout_recovery> [<password>]\n"
457" If the TPM is not in a LOCKOUT state, set the DAM parameters\n"
458" <maxTries>: maximum number of failures before lockout,\n"
459" 0 means always locking\n"
460" <recoveryTime>: time before decrement of the error counter,\n"
461" 0 means no lockout\n"
462" <lockoutRecovery>: time of a lockout (before the next try),\n"
463" 0 means a reboot is needed\n"
464" <password>: optional password of the LOCKOUT hierarchy\n"
465"change_auth <hierarchy> <new_pw> [<old_pw>]\n"
466" <hierarchy>: the hierarchy\n"
467" <new_pw>: new password for <hierarchy>\n"
468" <old_pw>: optional previous password of <hierarchy>\n"
Miquel Raynalb9dd4fab2018-05-15 11:57:20 +0200469"pcr_setauthpolicy|pcr_setauthvalue <pcr> <key> [<password>]\n"
470" Change the <key> to access PCR #<pcr>.\n"
471" hierarchy and may be empty.\n"
472" /!\\WARNING: untested function, use at your own risks !\n"
473" <pcr>: index of the PCR\n"
474" <key>: secret to protect the access of PCR #<pcr>\n"
475" <password>: optional password of the PLATFORM hierarchy\n"
Miquel Raynalff322452018-05-15 11:57:08 +0200476);