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 | 9 |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 #include <stdint.h> | 11 #include <stdint.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 void SetupTPM(void) { | 18 void SetupTPM(void) { |
| 19 #ifndef NDEBUG |
19 fprintf(stderr, "Rollback Index Library Mock: TPM initialized.\n"); | 20 fprintf(stderr, "Rollback Index Library Mock: TPM initialized.\n"); |
| 21 #endif |
20 } | 22 } |
21 | 23 |
22 uint16_t GetStoredVersion(int type) { | 24 uint16_t GetStoredVersion(int type) { |
23 switch (type) { | 25 switch (type) { |
24 case FIRMWARE_KEY_VERSION: | 26 case FIRMWARE_KEY_VERSION: |
25 return g_firmware_key_version; | 27 return g_firmware_key_version; |
26 break; | 28 break; |
27 case FIRMWARE_VERSION: | 29 case FIRMWARE_VERSION: |
28 return g_firmware_version; | 30 return g_firmware_version; |
29 break; | 31 break; |
(...skipping 15 matching lines...) Expand all Loading... |
45 case FIRMWARE_VERSION: | 47 case FIRMWARE_VERSION: |
46 g_firmware_version = version; | 48 g_firmware_version = version; |
47 break; | 49 break; |
48 case KERNEL_KEY_VERSION: | 50 case KERNEL_KEY_VERSION: |
49 g_kernel_key_version = version; | 51 g_kernel_key_version = version; |
50 break; | 52 break; |
51 case KERNEL_VERSION: | 53 case KERNEL_VERSION: |
52 g_kernel_version = version; | 54 g_kernel_version = version; |
53 break; | 55 break; |
54 } | 56 } |
| 57 #ifndef NDEBUG |
55 fprintf(stderr, "Rollback Index Library Mock: Stored Version written.\n"); | 58 fprintf(stderr, "Rollback Index Library Mock: Stored Version written.\n"); |
| 59 #endif |
56 return 1; | 60 return 1; |
57 } | 61 } |
58 | 62 |
59 void LockStoredVersion(int type) { | 63 void LockStoredVersion(int type) { |
| 64 #ifndef NDEBUG |
60 fprintf(stderr, "Rollback Index Library Mock: Version Locked.\n"); | 65 fprintf(stderr, "Rollback Index Library Mock: Version Locked.\n"); |
| 66 #endif |
61 } | 67 } |
OLD | NEW |