Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 2 | /* |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 3 | * Copyright (c) 2013 The Chromium OS Authors. |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 7 | #include <command.h> |
Simon Glass | 313112a | 2019-08-01 09:46:46 -0600 | [diff] [blame] | 8 | #include <env.h> |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 9 | #include <malloc.h> |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 10 | #include <asm/unaligned.h> |
Miquel Raynal | 4c6759e | 2018-05-15 11:57:06 +0200 | [diff] [blame] | 11 | #include <tpm-common.h> |
| 12 | #include <tpm-v1.h> |
| 13 | #include "tpm-user-utils.h" |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 14 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 15 | static int do_tpm_startup(struct cmd_tbl *cmdtp, int flag, int argc, |
| 16 | char *const argv[]) |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 17 | { |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 18 | enum tpm_startup_type mode; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 19 | struct udevice *dev; |
| 20 | int rc; |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 21 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 22 | rc = get_tpm(&dev); |
| 23 | if (rc) |
| 24 | return rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 25 | if (argc != 2) |
| 26 | return CMD_RET_USAGE; |
| 27 | if (!strcasecmp("TPM_ST_CLEAR", argv[1])) { |
| 28 | mode = TPM_ST_CLEAR; |
| 29 | } else if (!strcasecmp("TPM_ST_STATE", argv[1])) { |
| 30 | mode = TPM_ST_STATE; |
| 31 | } else if (!strcasecmp("TPM_ST_DEACTIVATED", argv[1])) { |
| 32 | mode = TPM_ST_DEACTIVATED; |
| 33 | } else { |
| 34 | printf("Couldn't recognize mode string: %s\n", argv[1]); |
| 35 | return CMD_RET_FAILURE; |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 38 | return report_return_code(tpm_startup(dev, mode)); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 39 | } |
| 40 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 41 | static int do_tpm_nv_define_space(struct cmd_tbl *cmdtp, int flag, int argc, |
| 42 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 43 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 44 | u32 index, perm, size; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 45 | struct udevice *dev; |
| 46 | int rc; |
| 47 | |
| 48 | rc = get_tpm(&dev); |
| 49 | if (rc) |
| 50 | return rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 51 | |
| 52 | if (argc != 4) |
| 53 | return CMD_RET_USAGE; |
| 54 | index = simple_strtoul(argv[1], NULL, 0); |
| 55 | perm = simple_strtoul(argv[2], NULL, 0); |
| 56 | size = simple_strtoul(argv[3], NULL, 0); |
| 57 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 58 | return report_return_code(tpm_nv_define_space(dev, index, perm, size)); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 59 | } |
| 60 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 61 | static int do_tpm_nv_read_value(struct cmd_tbl *cmdtp, int flag, int argc, |
| 62 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 63 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 64 | u32 index, count, rc; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 65 | struct udevice *dev; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 66 | void *data; |
| 67 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 68 | rc = get_tpm(&dev); |
| 69 | if (rc) |
| 70 | return rc; |
| 71 | |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 72 | if (argc != 4) |
| 73 | return CMD_RET_USAGE; |
| 74 | index = simple_strtoul(argv[1], NULL, 0); |
| 75 | data = (void *)simple_strtoul(argv[2], NULL, 0); |
| 76 | count = simple_strtoul(argv[3], NULL, 0); |
| 77 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 78 | rc = tpm_nv_read_value(dev, index, data, count); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 79 | if (!rc) { |
| 80 | puts("area content:\n"); |
| 81 | print_byte_string(data, count); |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 82 | } |
| 83 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 84 | return report_return_code(rc); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 85 | } |
| 86 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 87 | static int do_tpm_nv_write_value(struct cmd_tbl *cmdtp, int flag, int argc, |
| 88 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 89 | { |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 90 | struct udevice *dev; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 91 | u32 index, rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 92 | size_t count; |
| 93 | void *data; |
| 94 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 95 | rc = get_tpm(&dev); |
| 96 | if (rc) |
| 97 | return rc; |
| 98 | |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 99 | if (argc != 3) |
| 100 | return CMD_RET_USAGE; |
| 101 | index = simple_strtoul(argv[1], NULL, 0); |
| 102 | data = parse_byte_string(argv[2], NULL, &count); |
| 103 | if (!data) { |
| 104 | printf("Couldn't parse byte string %s\n", argv[2]); |
| 105 | return CMD_RET_FAILURE; |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 106 | } |
| 107 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 108 | rc = tpm_nv_write_value(dev, index, data, count); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 109 | free(data); |
| 110 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 111 | return report_return_code(rc); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 112 | } |
| 113 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 114 | static int do_tpm_extend(struct cmd_tbl *cmdtp, int flag, int argc, |
| 115 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 116 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 117 | u8 in_digest[20], out_digest[20]; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 118 | struct udevice *dev; |
| 119 | u32 index, rc; |
| 120 | |
| 121 | rc = get_tpm(&dev); |
| 122 | if (rc) |
| 123 | return rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 124 | |
| 125 | if (argc != 3) |
| 126 | return CMD_RET_USAGE; |
| 127 | index = simple_strtoul(argv[1], NULL, 0); |
| 128 | if (!parse_byte_string(argv[2], in_digest, NULL)) { |
| 129 | printf("Couldn't parse byte string %s\n", argv[2]); |
| 130 | return CMD_RET_FAILURE; |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 131 | } |
| 132 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 133 | rc = tpm_extend(dev, index, in_digest, out_digest); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 134 | if (!rc) { |
| 135 | puts("PCR value after execution of the command:\n"); |
| 136 | print_byte_string(out_digest, sizeof(out_digest)); |
| 137 | } |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 138 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 139 | return report_return_code(rc); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 142 | static int do_tpm_pcr_read(struct cmd_tbl *cmdtp, int flag, int argc, |
| 143 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 144 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 145 | u32 index, count, rc; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 146 | struct udevice *dev; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 147 | void *data; |
| 148 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 149 | rc = get_tpm(&dev); |
| 150 | if (rc) |
| 151 | return rc; |
| 152 | |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 153 | if (argc != 4) |
| 154 | return CMD_RET_USAGE; |
| 155 | index = simple_strtoul(argv[1], NULL, 0); |
| 156 | data = (void *)simple_strtoul(argv[2], NULL, 0); |
| 157 | count = simple_strtoul(argv[3], NULL, 0); |
| 158 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 159 | rc = tpm_pcr_read(dev, index, data, count); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 160 | if (!rc) { |
| 161 | puts("Named PCR content:\n"); |
| 162 | print_byte_string(data, count); |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 163 | } |
| 164 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 165 | return report_return_code(rc); |
Vadim Bendebury | 7acba0b | 2011-10-15 15:13:34 +0000 | [diff] [blame] | 166 | } |
| 167 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 168 | static int do_tpm_tsc_physical_presence(struct cmd_tbl *cmdtp, int flag, |
| 169 | int argc, char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 170 | { |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 171 | struct udevice *dev; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 172 | u16 presence; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 173 | int rc; |
| 174 | |
| 175 | rc = get_tpm(&dev); |
| 176 | if (rc) |
| 177 | return rc; |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 178 | |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 179 | if (argc != 2) |
| 180 | return CMD_RET_USAGE; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 181 | presence = (u16)simple_strtoul(argv[1], NULL, 0); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 182 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 183 | return report_return_code(tpm_tsc_physical_presence(dev, presence)); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 184 | } |
| 185 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 186 | static int do_tpm_read_pubek(struct cmd_tbl *cmdtp, int flag, int argc, |
| 187 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 188 | { |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 189 | struct udevice *dev; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 190 | u32 count, rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 191 | void *data; |
| 192 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 193 | rc = get_tpm(&dev); |
| 194 | if (rc) |
| 195 | return rc; |
| 196 | |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 197 | if (argc != 3) |
| 198 | return CMD_RET_USAGE; |
| 199 | data = (void *)simple_strtoul(argv[1], NULL, 0); |
| 200 | count = simple_strtoul(argv[2], NULL, 0); |
| 201 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 202 | rc = tpm_read_pubek(dev, data, count); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 203 | if (!rc) { |
| 204 | puts("pubek value:\n"); |
| 205 | print_byte_string(data, count); |
| 206 | } |
| 207 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 208 | return report_return_code(rc); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 209 | } |
| 210 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 211 | static int do_tpm_physical_set_deactivated(struct cmd_tbl *cmdtp, int flag, |
| 212 | int argc, char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 213 | { |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 214 | struct udevice *dev; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 215 | u8 state; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 216 | int rc; |
| 217 | |
| 218 | rc = get_tpm(&dev); |
| 219 | if (rc) |
| 220 | return rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 221 | |
| 222 | if (argc != 2) |
| 223 | return CMD_RET_USAGE; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 224 | state = (u8)simple_strtoul(argv[1], NULL, 0); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 225 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 226 | return report_return_code(tpm_physical_set_deactivated(dev, state)); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 227 | } |
| 228 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 229 | static int do_tpm_get_capability(struct cmd_tbl *cmdtp, int flag, int argc, |
| 230 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 231 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 232 | u32 cap_area, sub_cap, rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 233 | void *cap; |
| 234 | size_t count; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 235 | struct udevice *dev; |
| 236 | |
| 237 | rc = get_tpm(&dev); |
| 238 | if (rc) |
| 239 | return rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 240 | |
| 241 | if (argc != 5) |
| 242 | return CMD_RET_USAGE; |
| 243 | cap_area = simple_strtoul(argv[1], NULL, 0); |
| 244 | sub_cap = simple_strtoul(argv[2], NULL, 0); |
| 245 | cap = (void *)simple_strtoul(argv[3], NULL, 0); |
| 246 | count = simple_strtoul(argv[4], NULL, 0); |
| 247 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 248 | rc = tpm_get_capability(dev, cap_area, sub_cap, cap, count); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 249 | if (!rc) { |
| 250 | puts("capability information:\n"); |
| 251 | print_byte_string(cap, count); |
| 252 | } |
| 253 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 254 | return report_return_code(rc); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 257 | static int do_tpm_raw_transfer(struct cmd_tbl *cmdtp, int flag, int argc, |
| 258 | char *const argv[]) |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 259 | { |
Christophe Ricard | 52d309b | 2015-10-06 22:54:43 +0200 | [diff] [blame] | 260 | struct udevice *dev; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 261 | void *command; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 262 | u8 response[1024]; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 263 | size_t count, response_length = sizeof(response); |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 264 | u32 rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 265 | |
| 266 | command = parse_byte_string(argv[1], NULL, &count); |
| 267 | if (!command) { |
| 268 | printf("Couldn't parse byte string %s\n", argv[1]); |
| 269 | return CMD_RET_FAILURE; |
| 270 | } |
| 271 | |
Simon Glass | 3e4f2fd | 2015-08-22 18:31:32 -0600 | [diff] [blame] | 272 | rc = get_tpm(&dev); |
| 273 | if (rc) |
| 274 | return rc; |
| 275 | |
| 276 | rc = tpm_xfer(dev, command, count, response, &response_length); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 277 | free(command); |
| 278 | if (!rc) { |
| 279 | puts("tpm response:\n"); |
| 280 | print_byte_string(response, response_length); |
| 281 | } |
| 282 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 283 | return report_return_code(rc); |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 284 | } |
| 285 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 286 | static int do_tpm_nv_define(struct cmd_tbl *cmdtp, int flag, int argc, |
| 287 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 288 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 289 | u32 index, perm, size; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 290 | struct udevice *dev; |
| 291 | int rc; |
| 292 | |
| 293 | rc = get_tpm(&dev); |
| 294 | if (rc) |
| 295 | return rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 296 | |
| 297 | if (argc != 4) |
| 298 | return CMD_RET_USAGE; |
| 299 | size = type_string_get_space_size(argv[1]); |
| 300 | if (!size) { |
| 301 | printf("Couldn't parse arguments\n"); |
| 302 | return CMD_RET_USAGE; |
| 303 | } |
| 304 | index = simple_strtoul(argv[2], NULL, 0); |
| 305 | perm = simple_strtoul(argv[3], NULL, 0); |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 306 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 307 | return report_return_code(tpm_nv_define_space(dev, index, perm, size)); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 308 | } |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 309 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 310 | static int do_tpm_nv_read(struct cmd_tbl *cmdtp, int flag, int argc, |
| 311 | char *const argv[]) |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 312 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 313 | u32 index, count, err; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 314 | struct udevice *dev; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 315 | void *data; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 316 | int rc; |
| 317 | |
| 318 | rc = get_tpm(&dev); |
| 319 | if (rc) |
| 320 | return rc; |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 321 | |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 322 | if (argc < 3) |
| 323 | return CMD_RET_USAGE; |
| 324 | if (argc != 3 + type_string_get_num_values(argv[1])) |
| 325 | return CMD_RET_USAGE; |
| 326 | index = simple_strtoul(argv[2], NULL, 0); |
| 327 | data = type_string_alloc(argv[1], &count); |
| 328 | if (!data) { |
| 329 | printf("Couldn't parse arguments\n"); |
| 330 | return CMD_RET_USAGE; |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 331 | } |
| 332 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 333 | err = tpm_nv_read_value(dev, index, data, count); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 334 | if (!err) { |
| 335 | if (type_string_write_vars(argv[1], data, argv + 3)) { |
| 336 | printf("Couldn't write to variables\n"); |
| 337 | err = ~0; |
| 338 | } |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 339 | } |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 340 | free(data); |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 341 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 342 | return report_return_code(err); |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 343 | } |
| 344 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 345 | static int do_tpm_nv_write(struct cmd_tbl *cmdtp, int flag, int argc, |
| 346 | char *const argv[]) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 347 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 348 | u32 index, count, err; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 349 | struct udevice *dev; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 350 | void *data; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 351 | int rc; |
| 352 | |
| 353 | rc = get_tpm(&dev); |
| 354 | if (rc) |
| 355 | return rc; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 356 | |
| 357 | if (argc < 3) |
| 358 | return CMD_RET_USAGE; |
| 359 | if (argc != 3 + type_string_get_num_values(argv[1])) |
| 360 | return CMD_RET_USAGE; |
| 361 | index = simple_strtoul(argv[2], NULL, 0); |
| 362 | data = type_string_alloc(argv[1], &count); |
| 363 | if (!data) { |
| 364 | printf("Couldn't parse arguments\n"); |
| 365 | return CMD_RET_USAGE; |
| 366 | } |
| 367 | if (type_string_pack(argv[1], argv + 3, data)) { |
| 368 | printf("Couldn't parse arguments\n"); |
| 369 | free(data); |
| 370 | return CMD_RET_USAGE; |
| 371 | } |
| 372 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 373 | err = tpm_nv_write_value(dev, index, data, count); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 374 | free(data); |
| 375 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 376 | return report_return_code(err); |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | #ifdef CONFIG_TPM_AUTH_SESSIONS |
| 380 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 381 | static int do_tpm_oiap(struct cmd_tbl *cmdtp, int flag, int argc, |
| 382 | char *const argv[]) |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 383 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 384 | u32 auth_handle, err; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 385 | struct udevice *dev; |
| 386 | int rc; |
| 387 | |
| 388 | rc = get_tpm(&dev); |
| 389 | if (rc) |
| 390 | return rc; |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 391 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 392 | err = tpm_oiap(dev, &auth_handle); |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 393 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 394 | return report_return_code(err); |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 395 | } |
| 396 | |
mario.six@gdsys.cc | a5a7ea2 | 2017-03-20 10:28:28 +0100 | [diff] [blame] | 397 | #ifdef CONFIG_TPM_LOAD_KEY_BY_SHA1 |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 398 | static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc, |
| 399 | char *const argv[]) |
mario.six@gdsys.cc | a5a7ea2 | 2017-03-20 10:28:28 +0100 | [diff] [blame] | 400 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 401 | u32 parent_handle = 0; |
| 402 | u32 key_len, key_handle, err; |
| 403 | u8 usage_auth[DIGEST_LENGTH]; |
| 404 | u8 parent_hash[DIGEST_LENGTH]; |
mario.six@gdsys.cc | a5a7ea2 | 2017-03-20 10:28:28 +0100 | [diff] [blame] | 405 | void *key; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 406 | struct udevice *dev; |
| 407 | |
| 408 | rc = get_tpm(&dev); |
| 409 | if (rc) |
| 410 | return rc; |
mario.six@gdsys.cc | a5a7ea2 | 2017-03-20 10:28:28 +0100 | [diff] [blame] | 411 | |
| 412 | if (argc < 5) |
| 413 | return CMD_RET_USAGE; |
| 414 | |
| 415 | parse_byte_string(argv[1], parent_hash, NULL); |
| 416 | key = (void *)simple_strtoul(argv[2], NULL, 0); |
| 417 | key_len = simple_strtoul(argv[3], NULL, 0); |
| 418 | if (strlen(argv[4]) != 2 * DIGEST_LENGTH) |
| 419 | return CMD_RET_FAILURE; |
| 420 | parse_byte_string(argv[4], usage_auth, NULL); |
| 421 | |
| 422 | err = tpm_find_key_sha1(usage_auth, parent_hash, &parent_handle); |
| 423 | if (err) { |
| 424 | printf("Could not find matching parent key (err = %d)\n", err); |
| 425 | return CMD_RET_FAILURE; |
| 426 | } |
| 427 | |
| 428 | printf("Found parent key %08x\n", parent_handle); |
| 429 | |
| 430 | err = tpm_load_key2_oiap(parent_handle, key, key_len, usage_auth, |
| 431 | &key_handle); |
| 432 | if (!err) { |
| 433 | printf("Key handle is 0x%x\n", key_handle); |
Simon Glass | 4d949a2 | 2017-08-03 12:22:10 -0600 | [diff] [blame] | 434 | env_set_hex("key_handle", key_handle); |
mario.six@gdsys.cc | a5a7ea2 | 2017-03-20 10:28:28 +0100 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | return report_return_code(err); |
| 438 | } |
| 439 | #endif /* CONFIG_TPM_LOAD_KEY_BY_SHA1 */ |
| 440 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 441 | static int do_tpm_load_key2_oiap(struct cmd_tbl *cmdtp, int flag, int argc, |
| 442 | char *const argv[]) |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 443 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 444 | u32 parent_handle, key_len, key_handle, err; |
| 445 | u8 usage_auth[DIGEST_LENGTH]; |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 446 | void *key; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 447 | struct udevice *dev; |
| 448 | int rc; |
| 449 | |
| 450 | rc = get_tpm(&dev); |
| 451 | if (rc) |
| 452 | return rc; |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 453 | |
| 454 | if (argc < 5) |
| 455 | return CMD_RET_USAGE; |
| 456 | |
| 457 | parent_handle = simple_strtoul(argv[1], NULL, 0); |
| 458 | key = (void *)simple_strtoul(argv[2], NULL, 0); |
| 459 | key_len = simple_strtoul(argv[3], NULL, 0); |
| 460 | if (strlen(argv[4]) != 2 * DIGEST_LENGTH) |
| 461 | return CMD_RET_FAILURE; |
| 462 | parse_byte_string(argv[4], usage_auth, NULL); |
| 463 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 464 | err = tpm_load_key2_oiap(dev, parent_handle, key, key_len, usage_auth, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 465 | &key_handle); |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 466 | if (!err) |
| 467 | printf("Key handle is 0x%x\n", key_handle); |
| 468 | |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 469 | return report_return_code(err); |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 470 | } |
| 471 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 472 | static int do_tpm_get_pub_key_oiap(struct cmd_tbl *cmdtp, int flag, int argc, |
| 473 | char *const argv[]) |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 474 | { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 475 | u32 key_handle, err; |
| 476 | u8 usage_auth[DIGEST_LENGTH]; |
| 477 | u8 pub_key_buffer[TPM_PUBKEY_MAX_LENGTH]; |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 478 | size_t pub_key_len = sizeof(pub_key_buffer); |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 479 | struct udevice *dev; |
| 480 | int rc; |
| 481 | |
| 482 | rc = get_tpm(&dev); |
| 483 | if (rc) |
| 484 | return rc; |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 485 | |
| 486 | if (argc < 3) |
| 487 | return CMD_RET_USAGE; |
| 488 | |
| 489 | key_handle = simple_strtoul(argv[1], NULL, 0); |
| 490 | if (strlen(argv[2]) != 2 * DIGEST_LENGTH) |
| 491 | return CMD_RET_FAILURE; |
| 492 | parse_byte_string(argv[2], usage_auth, NULL); |
| 493 | |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 494 | err = tpm_get_pub_key_oiap(dev, key_handle, usage_auth, pub_key_buffer, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 495 | &pub_key_len); |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 496 | if (!err) { |
| 497 | printf("dump of received pub key structure:\n"); |
| 498 | print_byte_string(pub_key_buffer, pub_key_len); |
| 499 | } |
Simon Glass | 8105c44 | 2015-08-22 18:31:34 -0600 | [diff] [blame] | 500 | return report_return_code(err); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 501 | } |
| 502 | |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 503 | TPM_COMMAND_NO_ARG(tpm_end_oiap) |
| 504 | |
| 505 | #endif /* CONFIG_TPM_AUTH_SESSIONS */ |
| 506 | |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 507 | #ifdef CONFIG_TPM_FLUSH_RESOURCES |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 508 | static int do_tpm_flush(struct cmd_tbl *cmdtp, int flag, int argc, |
| 509 | char *const argv[]) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 510 | { |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 511 | struct udevice *dev; |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 512 | int type = 0; |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 513 | int rc; |
| 514 | |
| 515 | rc = get_tpm(&dev); |
| 516 | if (rc) |
| 517 | return rc; |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 518 | |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 519 | if (argc != 3) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 520 | return CMD_RET_USAGE; |
| 521 | |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 522 | if (!strcasecmp(argv[1], "key")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 523 | type = TPM_RT_KEY; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 524 | else if (!strcasecmp(argv[1], "auth")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 525 | type = TPM_RT_AUTH; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 526 | else if (!strcasecmp(argv[1], "hash")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 527 | type = TPM_RT_HASH; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 528 | else if (!strcasecmp(argv[1], "trans")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 529 | type = TPM_RT_TRANS; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 530 | else if (!strcasecmp(argv[1], "context")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 531 | type = TPM_RT_CONTEXT; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 532 | else if (!strcasecmp(argv[1], "counter")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 533 | type = TPM_RT_COUNTER; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 534 | else if (!strcasecmp(argv[1], "delegate")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 535 | type = TPM_RT_DELEGATE; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 536 | else if (!strcasecmp(argv[1], "daa_tpm")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 537 | type = TPM_RT_DAA_TPM; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 538 | else if (!strcasecmp(argv[1], "daa_v0")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 539 | type = TPM_RT_DAA_V0; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 540 | else if (!strcasecmp(argv[1], "daa_v1")) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 541 | type = TPM_RT_DAA_V1; |
| 542 | |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 543 | if (!type) { |
| 544 | printf("Resource type %s unknown.\n", argv[1]); |
| 545 | return -1; |
| 546 | } |
| 547 | |
| 548 | if (!strcasecmp(argv[2], "all")) { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 549 | u16 res_count; |
| 550 | u8 buf[288]; |
| 551 | u8 *ptr; |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 552 | int err; |
| 553 | uint i; |
| 554 | |
| 555 | /* fetch list of already loaded resources in the TPM */ |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 556 | err = tpm_get_capability(dev, TPM_CAP_HANDLE, type, buf, |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 557 | sizeof(buf)); |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 558 | if (err) { |
| 559 | printf("tpm_get_capability returned error %d.\n", err); |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 560 | return -1; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 561 | } |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 562 | res_count = get_unaligned_be16(buf); |
| 563 | ptr = buf + 2; |
| 564 | for (i = 0; i < res_count; ++i, ptr += 4) |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 565 | tpm_flush_specific(dev, get_unaligned_be32(ptr), type); |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 566 | } else { |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 567 | u32 handle = simple_strtoul(argv[2], NULL, 0); |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 568 | |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 569 | if (!handle) { |
| 570 | printf("Illegal resource handle %s\n", argv[2]); |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 571 | return -1; |
mario.six@gdsys.cc | 9ae8814 | 2017-03-20 10:28:29 +0100 | [diff] [blame] | 572 | } |
Simon Glass | 8ceca1d | 2018-11-18 14:22:27 -0700 | [diff] [blame] | 573 | tpm_flush_specific(dev, cpu_to_be32(handle), type); |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 574 | } |
| 575 | |
| 576 | return 0; |
| 577 | } |
| 578 | #endif /* CONFIG_TPM_FLUSH_RESOURCES */ |
| 579 | |
mario.six@gdsys.cc | a5bfcc5 | 2017-03-20 10:28:30 +0100 | [diff] [blame] | 580 | #ifdef CONFIG_TPM_LIST_RESOURCES |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 581 | static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc, |
| 582 | char *const argv[]) |
mario.six@gdsys.cc | a5bfcc5 | 2017-03-20 10:28:30 +0100 | [diff] [blame] | 583 | { |
| 584 | int type = 0; |
Miquel Raynal | d790f55 | 2018-05-15 11:56:59 +0200 | [diff] [blame] | 585 | u16 res_count; |
| 586 | u8 buf[288]; |
| 587 | u8 *ptr; |
mario.six@gdsys.cc | a5bfcc5 | 2017-03-20 10:28:30 +0100 | [diff] [blame] | 588 | int err; |
| 589 | uint i; |
| 590 | |
| 591 | if (argc != 2) |
| 592 | return CMD_RET_USAGE; |
| 593 | |
| 594 | if (!strcasecmp(argv[1], "key")) |
| 595 | type = TPM_RT_KEY; |
| 596 | else if (!strcasecmp(argv[1], "auth")) |
| 597 | type = TPM_RT_AUTH; |
| 598 | else if (!strcasecmp(argv[1], "hash")) |
| 599 | type = TPM_RT_HASH; |
| 600 | else if (!strcasecmp(argv[1], "trans")) |
| 601 | type = TPM_RT_TRANS; |
| 602 | else if (!strcasecmp(argv[1], "context")) |
| 603 | type = TPM_RT_CONTEXT; |
| 604 | else if (!strcasecmp(argv[1], "counter")) |
| 605 | type = TPM_RT_COUNTER; |
| 606 | else if (!strcasecmp(argv[1], "delegate")) |
| 607 | type = TPM_RT_DELEGATE; |
| 608 | else if (!strcasecmp(argv[1], "daa_tpm")) |
| 609 | type = TPM_RT_DAA_TPM; |
| 610 | else if (!strcasecmp(argv[1], "daa_v0")) |
| 611 | type = TPM_RT_DAA_V0; |
| 612 | else if (!strcasecmp(argv[1], "daa_v1")) |
| 613 | type = TPM_RT_DAA_V1; |
| 614 | |
| 615 | if (!type) { |
| 616 | printf("Resource type %s unknown.\n", argv[1]); |
| 617 | return -1; |
| 618 | } |
| 619 | |
| 620 | /* fetch list of already loaded resources in the TPM */ |
| 621 | err = tpm_get_capability(TPM_CAP_HANDLE, type, buf, |
| 622 | sizeof(buf)); |
| 623 | if (err) { |
| 624 | printf("tpm_get_capability returned error %d.\n", err); |
| 625 | return -1; |
| 626 | } |
| 627 | res_count = get_unaligned_be16(buf); |
| 628 | ptr = buf + 2; |
| 629 | |
| 630 | printf("Resources of type %s (%02x):\n", argv[1], type); |
| 631 | if (!res_count) { |
| 632 | puts("None\n"); |
| 633 | } else { |
| 634 | for (i = 0; i < res_count; ++i, ptr += 4) |
| 635 | printf("Index %d: %08x\n", i, get_unaligned_be32(ptr)); |
| 636 | } |
| 637 | |
| 638 | return 0; |
| 639 | } |
| 640 | #endif /* CONFIG_TPM_LIST_RESOURCES */ |
| 641 | |
Miquel Raynal | 4c6759e | 2018-05-15 11:57:06 +0200 | [diff] [blame] | 642 | TPM_COMMAND_NO_ARG(tpm_self_test_full) |
| 643 | TPM_COMMAND_NO_ARG(tpm_continue_self_test) |
| 644 | TPM_COMMAND_NO_ARG(tpm_force_clear) |
| 645 | TPM_COMMAND_NO_ARG(tpm_physical_enable) |
| 646 | TPM_COMMAND_NO_ARG(tpm_physical_disable) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 647 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 648 | static struct cmd_tbl tpm1_commands[] = { |
Philippe Reynes | cbe9739 | 2020-01-09 18:45:46 +0100 | [diff] [blame] | 649 | U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""), |
Simon Glass | aa6ac63 | 2015-08-22 18:31:40 -0600 | [diff] [blame] | 650 | U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""), |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 651 | U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 652 | U_BOOT_CMD_MKENT(startup, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 653 | do_tpm_startup, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 654 | U_BOOT_CMD_MKENT(self_test_full, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 655 | do_tpm_self_test_full, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 656 | U_BOOT_CMD_MKENT(continue_self_test, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 657 | do_tpm_continue_self_test, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 658 | U_BOOT_CMD_MKENT(force_clear, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 659 | do_tpm_force_clear, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 660 | U_BOOT_CMD_MKENT(physical_enable, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 661 | do_tpm_physical_enable, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 662 | U_BOOT_CMD_MKENT(physical_disable, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 663 | do_tpm_physical_disable, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 664 | U_BOOT_CMD_MKENT(nv_define_space, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 665 | do_tpm_nv_define_space, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 666 | U_BOOT_CMD_MKENT(nv_read_value, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 667 | do_tpm_nv_read_value, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 668 | U_BOOT_CMD_MKENT(nv_write_value, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 669 | do_tpm_nv_write_value, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 670 | U_BOOT_CMD_MKENT(extend, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 671 | do_tpm_extend, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 672 | U_BOOT_CMD_MKENT(pcr_read, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 673 | do_tpm_pcr_read, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 674 | U_BOOT_CMD_MKENT(tsc_physical_presence, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 675 | do_tpm_tsc_physical_presence, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 676 | U_BOOT_CMD_MKENT(read_pubek, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 677 | do_tpm_read_pubek, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 678 | U_BOOT_CMD_MKENT(physical_set_deactivated, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 679 | do_tpm_physical_set_deactivated, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 680 | U_BOOT_CMD_MKENT(get_capability, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 681 | do_tpm_get_capability, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 682 | U_BOOT_CMD_MKENT(raw_transfer, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 683 | do_tpm_raw_transfer, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 684 | U_BOOT_CMD_MKENT(nv_define, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 685 | do_tpm_nv_define, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 686 | U_BOOT_CMD_MKENT(nv_read, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 687 | do_tpm_nv_read, "", ""), |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 688 | U_BOOT_CMD_MKENT(nv_write, 0, 1, |
Miquel Raynal | 886ccc0 | 2018-05-15 11:57:00 +0200 | [diff] [blame] | 689 | do_tpm_nv_write, "", ""), |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 690 | #ifdef CONFIG_TPM_AUTH_SESSIONS |
| 691 | U_BOOT_CMD_MKENT(oiap, 0, 1, |
| 692 | do_tpm_oiap, "", ""), |
| 693 | U_BOOT_CMD_MKENT(end_oiap, 0, 1, |
| 694 | do_tpm_end_oiap, "", ""), |
| 695 | U_BOOT_CMD_MKENT(load_key2_oiap, 0, 1, |
| 696 | do_tpm_load_key2_oiap, "", ""), |
mario.six@gdsys.cc | a5a7ea2 | 2017-03-20 10:28:28 +0100 | [diff] [blame] | 697 | #ifdef CONFIG_TPM_LOAD_KEY_BY_SHA1 |
| 698 | U_BOOT_CMD_MKENT(load_key_by_sha1, 0, 1, |
| 699 | do_tpm_load_key_by_sha1, "", ""), |
| 700 | #endif /* CONFIG_TPM_LOAD_KEY_BY_SHA1 */ |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 701 | U_BOOT_CMD_MKENT(get_pub_key_oiap, 0, 1, |
| 702 | do_tpm_get_pub_key_oiap, "", ""), |
| 703 | #endif /* CONFIG_TPM_AUTH_SESSIONS */ |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 704 | #ifdef CONFIG_TPM_FLUSH_RESOURCES |
| 705 | U_BOOT_CMD_MKENT(flush, 0, 1, |
| 706 | do_tpm_flush, "", ""), |
| 707 | #endif /* CONFIG_TPM_FLUSH_RESOURCES */ |
mario.six@gdsys.cc | a5bfcc5 | 2017-03-20 10:28:30 +0100 | [diff] [blame] | 708 | #ifdef CONFIG_TPM_LIST_RESOURCES |
| 709 | U_BOOT_CMD_MKENT(list, 0, 1, |
| 710 | do_tpm_list, "", ""), |
| 711 | #endif /* CONFIG_TPM_LIST_RESOURCES */ |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 712 | }; |
| 713 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 714 | struct cmd_tbl *get_tpm1_commands(unsigned int *size) |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 715 | { |
Miquel Raynal | 4c6759e | 2018-05-15 11:57:06 +0200 | [diff] [blame] | 716 | *size = ARRAY_SIZE(tpm1_commands); |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 717 | |
Miquel Raynal | 4c6759e | 2018-05-15 11:57:06 +0200 | [diff] [blame] | 718 | return tpm1_commands; |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm, |
Miquel Raynal | 4c6759e | 2018-05-15 11:57:06 +0200 | [diff] [blame] | 722 | "Issue a TPMv1.x command", |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 723 | "cmd args...\n" |
| 724 | " - Issue TPM command <cmd> with arguments <args...>.\n" |
| 725 | "Admin Startup and State Commands:\n" |
Philippe Reynes | cbe9739 | 2020-01-09 18:45:46 +0100 | [diff] [blame] | 726 | " device [num device]\n" |
| 727 | " - Show all devices or set the specified device\n" |
Simon Glass | aa6ac63 | 2015-08-22 18:31:40 -0600 | [diff] [blame] | 728 | " info - Show information about the TPM\n" |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 729 | " init\n" |
| 730 | " - Put TPM into a state where it waits for 'startup' command.\n" |
| 731 | " startup mode\n" |
| 732 | " - Issue TPM_Starup command. <mode> is one of TPM_ST_CLEAR,\n" |
| 733 | " TPM_ST_STATE, and TPM_ST_DEACTIVATED.\n" |
| 734 | "Admin Testing Commands:\n" |
| 735 | " self_test_full\n" |
| 736 | " - Test all of the TPM capabilities.\n" |
| 737 | " continue_self_test\n" |
| 738 | " - Inform TPM that it should complete the self-test.\n" |
| 739 | "Admin Opt-in Commands:\n" |
| 740 | " physical_enable\n" |
| 741 | " - Set the PERMANENT disable flag to FALSE using physical presence as\n" |
| 742 | " authorization.\n" |
| 743 | " physical_disable\n" |
| 744 | " - Set the PERMANENT disable flag to TRUE using physical presence as\n" |
| 745 | " authorization.\n" |
| 746 | " physical_set_deactivated 0|1\n" |
| 747 | " - Set deactivated flag.\n" |
| 748 | "Admin Ownership Commands:\n" |
| 749 | " force_clear\n" |
| 750 | " - Issue TPM_ForceClear command.\n" |
| 751 | " tsc_physical_presence flags\n" |
| 752 | " - Set TPM device's Physical Presence flags to <flags>.\n" |
| 753 | "The Capability Commands:\n" |
| 754 | " get_capability cap_area sub_cap addr count\n" |
| 755 | " - Read <count> bytes of TPM capability indexed by <cap_area> and\n" |
| 756 | " <sub_cap> to memory address <addr>.\n" |
mario.six@gdsys.cc | a5bfcc5 | 2017-03-20 10:28:30 +0100 | [diff] [blame] | 757 | #if defined(CONFIG_TPM_FLUSH_RESOURCES) || defined(CONFIG_TPM_LIST_RESOURCES) |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 758 | "Resource management functions\n" |
mario.six@gdsys.cc | a5bfcc5 | 2017-03-20 10:28:30 +0100 | [diff] [blame] | 759 | #endif |
| 760 | #ifdef CONFIG_TPM_FLUSH_RESOURCES |
Mario Six | 4eceb6c | 2017-01-11 16:00:50 +0100 | [diff] [blame] | 761 | " flush resource_type id\n" |
| 762 | " - flushes a resource of type <resource_type> (may be one of key, auth,\n" |
| 763 | " hash, trans, context, counter, delegate, daa_tpm, daa_v0, daa_v1),\n" |
| 764 | " and id <id> from the TPM. Use an <id> of \"all\" to flush all\n" |
| 765 | " resources of that type.\n" |
| 766 | #endif /* CONFIG_TPM_FLUSH_RESOURCES */ |
mario.six@gdsys.cc | a5bfcc5 | 2017-03-20 10:28:30 +0100 | [diff] [blame] | 767 | #ifdef CONFIG_TPM_LIST_RESOURCES |
| 768 | " list resource_type\n" |
| 769 | " - lists resources of type <resource_type> (may be one of key, auth,\n" |
| 770 | " hash, trans, context, counter, delegate, daa_tpm, daa_v0, daa_v1),\n" |
| 771 | " contained in the TPM.\n" |
| 772 | #endif /* CONFIG_TPM_LIST_RESOURCES */ |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 773 | #ifdef CONFIG_TPM_AUTH_SESSIONS |
| 774 | "Storage functions\n" |
| 775 | " loadkey2_oiap parent_handle key_addr key_len usage_auth\n" |
| 776 | " - loads a key data from memory address <key_addr>, <key_len> bytes\n" |
| 777 | " into TPM using the parent key <parent_handle> with authorization\n" |
| 778 | " <usage_auth> (20 bytes hex string).\n" |
mario.six@gdsys.cc | a5a7ea2 | 2017-03-20 10:28:28 +0100 | [diff] [blame] | 779 | #ifdef CONFIG_TPM_LOAD_KEY_BY_SHA1 |
| 780 | " load_key_by_sha1 parent_hash key_addr key_len usage_auth\n" |
| 781 | " - loads a key data from memory address <key_addr>, <key_len> bytes\n" |
| 782 | " into TPM using the parent hash <parent_hash> (20 bytes hex string)\n" |
| 783 | " with authorization <usage_auth> (20 bytes hex string).\n" |
| 784 | #endif /* CONFIG_TPM_LOAD_KEY_BY_SHA1 */ |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 785 | " get_pub_key_oiap key_handle usage_auth\n" |
| 786 | " - get the public key portion of a loaded key <key_handle> using\n" |
| 787 | " authorization <usage auth> (20 bytes hex string)\n" |
| 788 | #endif /* CONFIG_TPM_AUTH_SESSIONS */ |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 789 | "Endorsement Key Handling Commands:\n" |
| 790 | " read_pubek addr count\n" |
| 791 | " - Read <count> bytes of the public endorsement key to memory\n" |
| 792 | " address <addr>\n" |
| 793 | "Integrity Collection and Reporting Commands:\n" |
| 794 | " extend index digest_hex_string\n" |
| 795 | " - Add a new measurement to a PCR. Update PCR <index> with the 20-bytes\n" |
| 796 | " <digest_hex_string>\n" |
| 797 | " pcr_read index addr count\n" |
| 798 | " - Read <count> bytes from PCR <index> to memory address <addr>.\n" |
Reinhard Pfau | 4fece43 | 2013-06-26 15:55:13 +0200 | [diff] [blame] | 799 | #ifdef CONFIG_TPM_AUTH_SESSIONS |
| 800 | "Authorization Sessions\n" |
| 801 | " oiap\n" |
| 802 | " - setup an OIAP session\n" |
| 803 | " end_oiap\n" |
| 804 | " - terminates an active OIAP session\n" |
| 805 | #endif /* CONFIG_TPM_AUTH_SESSIONS */ |
Che-liang Chiou | c18f901 | 2013-02-28 09:34:57 +0000 | [diff] [blame] | 806 | "Non-volatile Storage Commands:\n" |
| 807 | " nv_define_space index permission size\n" |
| 808 | " - Establish a space at index <index> with <permission> of <size> bytes.\n" |
| 809 | " nv_read_value index addr count\n" |
| 810 | " - Read <count> bytes from space <index> to memory address <addr>.\n" |
| 811 | " nv_write_value index addr count\n" |
| 812 | " - Write <count> bytes from memory address <addr> to space <index>.\n" |
| 813 | "Miscellaneous helper functions:\n" |
| 814 | " raw_transfer byte_string\n" |
| 815 | " - Send a byte string <byte_string> to TPM and print the response.\n" |
| 816 | " Non-volatile storage helper functions:\n" |
| 817 | " These helper functions treat a non-volatile space as a non-padded\n" |
| 818 | " sequence of integer values. These integer values are defined by a type\n" |
| 819 | " string, which is a text string of 'bwd' characters: 'b' means a 8-bit\n" |
| 820 | " value, 'w' 16-bit value, 'd' 32-bit value. All helper functions take\n" |
| 821 | " a type string as their first argument.\n" |
| 822 | " nv_define type_string index perm\n" |
| 823 | " - Define a space <index> with permission <perm>.\n" |
| 824 | " nv_read types_string index vars...\n" |
| 825 | " - Read from space <index> to environment variables <vars...>.\n" |
| 826 | " nv_write types_string index values...\n" |
| 827 | " - Write to space <index> from values <values...>.\n" |
Luigi Semenzato | 04d1bd2 | 2012-12-05 14:46:44 +0000 | [diff] [blame] | 828 | ); |