Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: firmware/lib/tpm_lite/tlcl.c

Issue 3163045: Add a command to enable the physical presence command. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: extra upload for version.c Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « firmware/lib/tpm_lite/include/tlcl_structures.h ('k') | firmware/version.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 /* A lightweight TPM command library. 6 /* A lightweight TPM command library.
7 * 7 *
8 * The general idea is that TPM commands are array of bytes whose 8 * The general idea is that TPM commands are array of bytes whose
9 * fields are mostly compile-time constant. The goal is to build much 9 * fields are mostly compile-time constant. The goal is to build much
10 * of the commands at compile time (or build time) and change some of 10 * of the commands at compile time (or build time) and change some of
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 uint32_t TlclReadLock(uint32_t index) { 169 uint32_t TlclReadLock(uint32_t index) {
170 VBDEBUG(("TPM: Read lock 0x%x\n", index)); 170 VBDEBUG(("TPM: Read lock 0x%x\n", index));
171 return TlclRead(index, NULL, 0); 171 return TlclRead(index, NULL, 0);
172 } 172 }
173 173
174 uint32_t TlclAssertPhysicalPresence(void) { 174 uint32_t TlclAssertPhysicalPresence(void) {
175 VBDEBUG(("TPM: Asserting physical presence\n")); 175 VBDEBUG(("TPM: Asserting physical presence\n"));
176 return Send(tpm_ppassert_cmd.buffer); 176 return Send(tpm_ppassert_cmd.buffer);
177 } 177 }
178 178
179 uint32_t TlclPhysicalPresenceCMDEnable(void) {
180 VBDEBUG(("TPM: Enable the physical presence command\n"));
181 return Send(tpm_ppenable_cmd.buffer);
182 }
183
179 uint32_t TlclAssertPhysicalPresenceResult(void) { 184 uint32_t TlclAssertPhysicalPresenceResult(void) {
180 uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE]; 185 uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
181 return TlclSendReceive(tpm_ppassert_cmd.buffer, response, sizeof(response)); 186 return TlclSendReceive(tpm_ppassert_cmd.buffer, response, sizeof(response));
182 } 187 }
183 188
184 uint32_t TlclLockPhysicalPresence(void) { 189 uint32_t TlclLockPhysicalPresence(void) {
185 VBDEBUG(("TPM: Lock physical presence\n")); 190 VBDEBUG(("TPM: Lock physical presence\n"));
186 return Send(tpm_pplock_cmd.buffer); 191 return Send(tpm_pplock_cmd.buffer);
187 } 192 }
188 193
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 *disable = pflags.disable; 267 *disable = pflags.disable;
263 if (deactivated) 268 if (deactivated)
264 *deactivated = pflags.deactivated; 269 *deactivated = pflags.deactivated;
265 if (nvlocked) 270 if (nvlocked)
266 *nvlocked = pflags.nvLocked; 271 *nvlocked = pflags.nvLocked;
267 VBDEBUG(("TPM: Got flags disable=%d, deactivated=%d, nvlocked=%d\n", 272 VBDEBUG(("TPM: Got flags disable=%d, deactivated=%d, nvlocked=%d\n",
268 pflags.disable, pflags.deactivated, pflags.nvLocked)); 273 pflags.disable, pflags.deactivated, pflags.nvLocked));
269 } 274 }
270 return result; 275 return result;
271 } 276 }
272 277
273 uint32_t TlclSetGlobalLock(void) { 278 uint32_t TlclSetGlobalLock(void) {
274 uint32_t x; 279 uint32_t x;
275 VBDEBUG(("TPM: Set global lock\n")); 280 VBDEBUG(("TPM: Set global lock\n"));
276 return TlclWrite(TPM_NV_INDEX0, (uint8_t*) &x, 0); 281 return TlclWrite(TPM_NV_INDEX0, (uint8_t*) &x, 0);
277 } 282 }
278 283
279 uint32_t TlclExtend(int pcr_num, uint8_t* in_digest, uint8_t* out_digest) { 284 uint32_t TlclExtend(int pcr_num, uint8_t* in_digest, uint8_t* out_digest) {
280 struct s_tpm_extend_cmd cmd; 285 struct s_tpm_extend_cmd cmd;
281 uint8_t response[kTpmResponseHeaderLength + kPcrDigestLength]; 286 uint8_t response[kTpmResponseHeaderLength + kPcrDigestLength];
282 uint32_t result; 287 uint32_t result;
(...skipping 20 matching lines...) Expand all
303 Memcpy(&cmd, &tpm_getpermissions_cmd, sizeof(cmd)); 308 Memcpy(&cmd, &tpm_getpermissions_cmd, sizeof(cmd));
304 ToTpmUint32(cmd.buffer + tpm_getpermissions_cmd.index, index); 309 ToTpmUint32(cmd.buffer + tpm_getpermissions_cmd.index, index);
305 result = TlclSendReceive(cmd.buffer, response, sizeof(response)); 310 result = TlclSendReceive(cmd.buffer, response, sizeof(response));
306 if (result != TPM_SUCCESS) 311 if (result != TPM_SUCCESS)
307 return result; 312 return result;
308 313
309 nvdata = response + kTpmResponseHeaderLength + sizeof(size); 314 nvdata = response + kTpmResponseHeaderLength + sizeof(size);
310 FromTpmUint32(nvdata + kNvDataPublicPermissionsOffset, permissions); 315 FromTpmUint32(nvdata + kNvDataPublicPermissionsOffset, permissions);
311 return result; 316 return result;
312 } 317 }
OLDNEW
« no previous file with comments | « firmware/lib/tpm_lite/include/tlcl_structures.h ('k') | firmware/version.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698