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

Side by Side Diff: tests/rollback_index_mock.c

Issue 2711006: Import recent tpm_lite changes that make all TPM commands return a status. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: cleanup from gauravsh's feedback Created 10 years, 6 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 | « tests/Makefile ('k') | vboot_firmware/include/firmware_image_fw.h » ('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 * 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 10
10 #include <stdint.h> 11 #include <stdint.h>
11 #include <stdio.h> 12 #include <stdio.h>
12 13
13 uint16_t g_firmware_key_version = 0; 14 uint16_t g_firmware_key_version = 0;
14 uint16_t g_firmware_version = 0; 15 uint16_t g_firmware_version = 0;
15 uint16_t g_kernel_key_version = 0; 16 uint16_t g_kernel_key_version = 0;
16 uint16_t g_kernel_version = 0; 17 uint16_t g_kernel_version = 0;
17 18
18 int SetupTPM(void) { 19 uint32_t SetupTPM(void) {
19 #ifndef NDEBUG 20 #ifndef NDEBUG
20 debug("Rollback Index Library Mock: TPM initialized.\n"); 21 debug("Rollback Index Library Mock: TPM initialized.\n");
21 #endif 22 #endif
22 return 0; 23 return TPM_SUCCESS;
23 } 24 }
24 25
25 int GetStoredVersions(int type, uint16_t* key_version, uint16_t* version) { 26 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version) {
26 switch (type) { 27 switch (type) {
27 case FIRMWARE_VERSIONS: 28 case FIRMWARE_VERSIONS:
28 *key_version = g_firmware_key_version; 29 *key_version = g_firmware_key_version;
29 *version = g_firmware_version; 30 *version = g_firmware_version;
30 break; 31 break;
31 case KERNEL_VERSIONS: 32 case KERNEL_VERSIONS:
32 *key_version = g_kernel_key_version; 33 *key_version = g_kernel_key_version;
33 *version = g_kernel_version; 34 *version = g_kernel_version;
34 break; 35 break;
35 } 36 }
36 return 0; 37 return TPM_SUCCESS;
37 } 38 }
38 39
39 int WriteStoredVersions(int type, uint16_t key_version, uint16_t version) { 40 uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version) {
40 switch (type) { 41 switch (type) {
41 case FIRMWARE_VERSIONS: 42 case FIRMWARE_VERSIONS:
42 g_firmware_key_version = key_version; 43 g_firmware_key_version = key_version;
43 g_firmware_version = version; 44 g_firmware_version = version;
44 break; 45 break;
45 case KERNEL_VERSIONS: 46 case KERNEL_VERSIONS:
46 g_kernel_key_version = key_version; 47 g_kernel_key_version = key_version;
47 g_kernel_version = version; 48 g_kernel_version = version;
48 break; 49 break;
49 } 50 }
50 #ifndef NDEBUG 51 #ifndef NDEBUG
51 debug("Rollback Index Library Mock: Stored Versions written.\n"); 52 debug("Rollback Index Library Mock: Stored Versions written.\n");
52 #endif 53 #endif
53 return 0; 54 return TPM_SUCCESS;
54 } 55 }
55 56
56 int LockFirmwareVersions() { 57 uint32_t LockFirmwareVersions(void) {
57 #ifndef NDEBUG 58 #ifndef NDEBUG
58 debug("Rollback Index Library Mock: Firmware Versions Locked.\n"); 59 debug("Rollback Index Library Mock: Firmware Versions Locked.\n");
59 #endif 60 #endif
60 return 0; 61 return TPM_SUCCESS;
61 } 62 }
62 int LockKernelVersionsByLockingPP() { 63
64 uint32_t LockKernelVersionsByLockingPP(void) {
63 #ifndef NDEBUG 65 #ifndef NDEBUG
64 debug("Rollback Index Library Mock: Kernel Versions Locked.\n"); 66 debug("Rollback Index Library Mock: Kernel Versions Locked.\n");
65 #endif 67 #endif
66 return 0; 68 return TPM_SUCCESS;
67 } 69 }
OLDNEW
« no previous file with comments | « tests/Makefile ('k') | vboot_firmware/include/firmware_image_fw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698