OLD | NEW |
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 |
11 #include "tlcl.h" | 11 #include "tlcl.h" |
12 #include "tss_constants.h" | 12 #include "tss_constants.h" |
13 #include "utility.h" | 13 #include "utility.h" |
14 | 14 |
15 static int g_rollback_recovery_mode = 0; | 15 static int g_rollback_recovery_mode = 0; |
16 | 16 |
17 /* disable MSVC warning on const logical expression (as in } while(0);) */ | 17 /* disable MSVC warning on const logical expression (as in } while(0);) */ |
18 __pragma(warning (disable: 4127)) | 18 __pragma(warning (disable: 4127)) |
19 | 19 |
20 #define RETURN_ON_FAILURE(tpm_command) do { \ | 20 #define RETURN_ON_FAILURE(tpm_command) do { \ |
21 uint32_t result; \ | 21 uint32_t result; \ |
22 if ((result = (tpm_command)) != TPM_SUCCESS) { \ | 22 if ((result = (tpm_command)) != TPM_SUCCESS) { \ |
| 23 VBDEBUG(("Rollback: %08x returned by " #tpm_command "\n", (int)result)); \ |
23 return result; \ | 24 return result; \ |
24 } \ | 25 } \ |
25 } while (0) | 26 } while (0) |
26 | 27 |
27 uint32_t TPMClearAndReenable(void) { | 28 uint32_t TPMClearAndReenable(void) { |
28 RETURN_ON_FAILURE(TlclForceClear()); | 29 RETURN_ON_FAILURE(TlclForceClear()); |
29 RETURN_ON_FAILURE(TlclSetEnable()); | 30 RETURN_ON_FAILURE(TlclSetEnable()); |
30 RETURN_ON_FAILURE(TlclSetDeactivated(0)); | 31 RETURN_ON_FAILURE(TlclSetDeactivated(0)); |
31 return TPM_SUCCESS; | 32 return TPM_SUCCESS; |
32 } | 33 } |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 return TPM_SUCCESS; | 343 return TPM_SUCCESS; |
343 } | 344 } |
344 | 345 |
345 uint32_t RollbackKernelLock(void) { | 346 uint32_t RollbackKernelLock(void) { |
346 if (!g_rollback_recovery_mode) { | 347 if (!g_rollback_recovery_mode) { |
347 return TlclLockPhysicalPresence(); | 348 return TlclLockPhysicalPresence(); |
348 } else { | 349 } else { |
349 return TPM_SUCCESS; | 350 return TPM_SUCCESS; |
350 } | 351 } |
351 } | 352 } |
OLD | NEW |