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

Side by Side Diff: firmware/lib/rollback_index.c

Issue 3470013: Move initialization of g_recovery_mode. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: version change 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 | « no previous file | 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 * Functions for querying, manipulating and locking rollback indices 5 * Functions for querying, manipulating and locking rollback indices
6 * stored in the TPM NVRAM. 6 * stored in the TPM NVRAM.
7 */ 7 */
8 8
9 #include "rollback_index.h" 9 #include "rollback_index.h"
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 RollbackSpaceFirmware* rsf) { 177 RollbackSpaceFirmware* rsf) {
178 178
179 int rsf_dirty = 0; 179 int rsf_dirty = 0;
180 uint8_t new_flags = 0; 180 uint8_t new_flags = 0;
181 uint8_t disable; 181 uint8_t disable;
182 uint8_t deactivated; 182 uint8_t deactivated;
183 uint32_t result; 183 uint32_t result;
184 184
185 VBDEBUG(("TPM: SetupTPM(r%d, d%d)\n", recovery_mode, developer_mode)); 185 VBDEBUG(("TPM: SetupTPM(r%d, d%d)\n", recovery_mode, developer_mode));
186 186
187 if (recovery_mode)
188 g_rollback_recovery_mode = 1; /* Global variables are usable in
189 * recovery mode */
190
187 /* TODO: TlclLibInit() should be able to return failure */ 191 /* TODO: TlclLibInit() should be able to return failure */
188 TlclLibInit(); 192 TlclLibInit();
189 193
190 RETURN_ON_FAILURE(TlclStartup()); 194 RETURN_ON_FAILURE(TlclStartup());
191 /* Use ContinueSelfTest rather than SelfTestFull(). It enables 195 /* Use ContinueSelfTest rather than SelfTestFull(). It enables
192 * access to the subset of TPM commands we need in the firmware, and 196 * access to the subset of TPM commands we need in the firmware, and
193 * allows the full self test to run in paralle with firmware 197 * allows the full self test to run in paralle with firmware
194 * startup. By the time we get to the OS, self test will have 198 * startup. By the time we get to the OS, self test will have
195 * completed. */ 199 * completed. */
196 RETURN_ON_FAILURE(TlclContinueSelfTest()); 200 RETURN_ON_FAILURE(TlclContinueSelfTest());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 /* Clears ownership if developer flag has toggled */ 238 /* Clears ownership if developer flag has toggled */
235 if ((developer_mode ? FLAG_LAST_BOOT_DEVELOPER : 0) != 239 if ((developer_mode ? FLAG_LAST_BOOT_DEVELOPER : 0) !=
236 (rsf->flags & FLAG_LAST_BOOT_DEVELOPER)) { 240 (rsf->flags & FLAG_LAST_BOOT_DEVELOPER)) {
237 VBDEBUG(("TPM: Developer flag changed; clearing owner.\n")); 241 VBDEBUG(("TPM: Developer flag changed; clearing owner.\n"));
238 RETURN_ON_FAILURE(TPMClearAndReenable()); 242 RETURN_ON_FAILURE(TPMClearAndReenable());
239 } 243 }
240 244
241 /* Updates flags */ 245 /* Updates flags */
242 if (developer_mode) 246 if (developer_mode)
243 new_flags |= FLAG_LAST_BOOT_DEVELOPER; 247 new_flags |= FLAG_LAST_BOOT_DEVELOPER;
244 if (recovery_mode)
245 g_rollback_recovery_mode = 1; /* Global variables are usable in
246 * recovery mode */
247
248 if (rsf->flags != new_flags) { 248 if (rsf->flags != new_flags) {
249 rsf->flags = new_flags; 249 rsf->flags = new_flags;
250 rsf_dirty = 1; 250 rsf_dirty = 1;
251 } 251 }
252 252
253 /* If firmware space is dirty, this flushes it back to the TPM */ 253 /* If firmware space is dirty, this flushes it back to the TPM */
254 if (rsf_dirty) { 254 if (rsf_dirty) {
255 VBDEBUG(("TPM: Updating firmware space.\n")); 255 VBDEBUG(("TPM: Updating firmware space.\n"));
256 RETURN_ON_FAILURE(WriteSpaceFirmware(rsf)); 256 RETURN_ON_FAILURE(WriteSpaceFirmware(rsf));
257 } 257 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 uint32_t RollbackKernelLock(void) { 433 uint32_t RollbackKernelLock(void) {
434 if (g_rollback_recovery_mode) { 434 if (g_rollback_recovery_mode) {
435 return TPM_SUCCESS; 435 return TPM_SUCCESS;
436 } else { 436 } else {
437 return TlclLockPhysicalPresence(); 437 return TlclLockPhysicalPresence();
438 } 438 }
439 } 439 }
440 440
441 #endif // DISABLE_ROLLBACK_TPM 441 #endif // DISABLE_ROLLBACK_TPM
OLDNEW
« no previous file with comments | « no previous file | firmware/version.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698