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 * Mock rollback index library for testing. | 5 * Mock rollback index library for testing. |
6 */ | 6 */ |
7 | 7 |
8 #include "rollback_index.h" | 8 #include "rollback_index.h" |
9 #include "tss_constants.h" | 9 #include "tss_constants.h" |
10 | 10 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 | 12 |
13 uint16_t g_firmware_key_version = 0; | 13 uint16_t g_firmware_key_version = 0; |
14 uint16_t g_firmware_version = 0; | 14 uint16_t g_firmware_version = 0; |
15 uint16_t g_kernel_key_version = 0; | 15 uint16_t g_kernel_key_version = 0; |
16 uint16_t g_kernel_version = 0; | 16 uint16_t g_kernel_version = 0; |
17 | 17 |
18 /* disable MSVC warnings on unused arguments */ | 18 /* disable MSVC warnings on unused arguments */ |
19 __pragma(warning (disable: 4100)) | 19 __pragma(warning (disable: 4100)) |
20 | 20 |
21 uint32_t SetupTPM(int mode, int developer_flag) { | 21 uint32_t SetupTPM(int mode, int developer_flag) { |
22 #ifndef NDEBUG | 22 #ifndef NDEBUG |
23 debug("Rollback Index Library Mock: TPM initialized.\n"); | 23 VBDEBUG(("Rollback Index Library Mock: TPM initialized.\n")); |
24 #endif | 24 #endif |
25 return TPM_SUCCESS; | 25 return TPM_SUCCESS; |
26 } | 26 } |
27 | 27 |
28 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version) { | 28 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version) { |
29 switch (type) { | 29 switch (type) { |
30 case FIRMWARE_VERSIONS: | 30 case FIRMWARE_VERSIONS: |
31 *key_version = g_firmware_key_version; | 31 *key_version = g_firmware_key_version; |
32 *version = g_firmware_version; | 32 *version = g_firmware_version; |
33 break; | 33 break; |
(...skipping 10 matching lines...) Expand all Loading... |
44 case FIRMWARE_VERSIONS: | 44 case FIRMWARE_VERSIONS: |
45 g_firmware_key_version = key_version; | 45 g_firmware_key_version = key_version; |
46 g_firmware_version = version; | 46 g_firmware_version = version; |
47 break; | 47 break; |
48 case KERNEL_VERSIONS: | 48 case KERNEL_VERSIONS: |
49 g_kernel_key_version = key_version; | 49 g_kernel_key_version = key_version; |
50 g_kernel_version = version; | 50 g_kernel_version = version; |
51 break; | 51 break; |
52 } | 52 } |
53 #ifndef NDEBUG | 53 #ifndef NDEBUG |
54 debug("Rollback Index Library Mock: Stored Versions written.\n"); | 54 VBDEBUG(("Rollback Index Library Mock: Stored Versions written.\n")); |
55 #endif | 55 #endif |
56 return TPM_SUCCESS; | 56 return TPM_SUCCESS; |
57 } | 57 } |
58 | 58 |
59 uint32_t LockFirmwareVersions(void) { | 59 uint32_t LockFirmwareVersions(void) { |
60 #ifndef NDEBUG | 60 #ifndef NDEBUG |
61 debug("Rollback Index Library Mock: Firmware Versions Locked.\n"); | 61 VBDEBUG(("Rollback Index Library Mock: Firmware Versions Locked.\n")); |
62 #endif | 62 #endif |
63 return TPM_SUCCESS; | 63 return TPM_SUCCESS; |
64 } | 64 } |
65 | 65 |
66 uint32_t LockKernelVersionsByLockingPP(void) { | 66 uint32_t LockKernelVersionsByLockingPP(void) { |
67 #ifndef NDEBUG | 67 #ifndef NDEBUG |
68 debug("Rollback Index Library Mock: Kernel Versions Locked.\n"); | 68 VBDEBUG(("Rollback Index Library Mock: Kernel Versions Locked.\n")); |
69 #endif | 69 #endif |
70 return TPM_SUCCESS; | 70 return TPM_SUCCESS; |
71 } | 71 } |
OLD | NEW |