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

Side by Side Diff: firmware/stub/tpm_lite_stub.c

Issue 3078028: Pay attention to TPM communication errors (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Fix whitespace Created 10 years, 4 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
« no previous file with comments | « firmware/lib/tpm_lite/tlcl.c ('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 * Stub implementations of utility functions which call their linux-specific 5 * Stub implementations of utility functions which call their linux-specific
6 * equivalents. 6 * equivalents.
7 */ 7 */
8 8
9 #define _STUB_IMPLEMENTATION_ 9 #define _STUB_IMPLEMENTATION_
10 #include "tlcl.h" 10 #include "tlcl.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 device_path = TPM_DEVICE_PATH; 122 device_path = TPM_DEVICE_PATH;
123 } 123 }
124 124
125 tpm_fd = open(device_path, O_RDWR); 125 tpm_fd = open(device_path, O_RDWR);
126 if (tpm_fd < 0) { 126 if (tpm_fd < 0) {
127 error("cannot open TPM device %s: %s\n", device_path, strerror(errno)); 127 error("cannot open TPM device %s: %s\n", device_path, strerror(errno));
128 } 128 }
129 } 129 }
130 130
131 131
132 void TlclStubSendReceive(uint8_t* request, int request_length, 132 uint32_t TlclStubSendReceive(uint8_t* request, int request_length,
133 uint8_t* response, int max_length) { 133 uint8_t* response, int max_length) {
134 /* 134 /*
135 * In a real firmware implementation, this function should contain 135 * In a real firmware implementation, this function should contain
136 * the equivalent API call for the firmware TPM driver which takes a 136 * the equivalent API call for the firmware TPM driver which takes a
137 * raw sequence of bytes as input command and a pointer to the 137 * raw sequence of bytes as input command and a pointer to the
138 * output buffer for putting in the results. 138 * output buffer for putting in the results.
139 * 139 *
140 * For EFI firmwares, this can make use of the EFI TPM driver as 140 * For EFI firmwares, this can make use of the EFI TPM driver as
141 * follows (based on page 16, of TCG EFI Protocol Specs Version 1.20 141 * follows (based on page 16, of TCG EFI Protocol Specs Version 1.20
142 * availaible from the TCG website): 142 * availaible from the TCG website):
143 * 143 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 tag = TpmTag(request); 176 tag = TpmTag(request);
177 response_tag = TpmTag(response); 177 response_tag = TpmTag(response);
178 assert( 178 assert(
179 (tag == TPM_TAG_RQU_COMMAND && 179 (tag == TPM_TAG_RQU_COMMAND &&
180 response_tag == TPM_TAG_RSP_COMMAND) || 180 response_tag == TPM_TAG_RSP_COMMAND) ||
181 (tag == TPM_TAG_RQU_AUTH1_COMMAND && 181 (tag == TPM_TAG_RQU_AUTH1_COMMAND &&
182 response_tag == TPM_TAG_RSP_AUTH1_COMMAND) || 182 response_tag == TPM_TAG_RSP_AUTH1_COMMAND) ||
183 (tag == TPM_TAG_RQU_AUTH2_COMMAND && 183 (tag == TPM_TAG_RQU_AUTH2_COMMAND &&
184 response_tag == TPM_TAG_RSP_AUTH2_COMMAND)); 184 response_tag == TPM_TAG_RSP_AUTH2_COMMAND));
185 assert(response_length == TpmResponseSize(response)); 185 assert(response_length == TpmResponseSize(response));
186
187 return 0; /* Success */
186 } 188 }
OLDNEW
« no previous file with comments | « firmware/lib/tpm_lite/tlcl.c ('k') | firmware/version.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698