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

Side by Side Diff: tests/rollback_index_mock.c

Issue 3084030: Add structs for TPM NV simplification (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Use new structs Created 10 years, 4 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
« firmware/lib/rollback_index.c ('K') | « tests/Makefile ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 * found in the LICENSE file.
4 *
5 * Mock rollback index library for testing.
6 */
7
8 #include "rollback_index.h"
9 #include "tss_constants.h"
10
11 #include <stdio.h>
12
13 uint16_t g_firmware_key_version = 0;
14 uint16_t g_firmware_version = 0;
15 uint16_t g_kernel_key_version = 0;
16 uint16_t g_kernel_version = 0;
17
18 /* disable MSVC warnings on unused arguments */
19 __pragma(warning (disable: 4100))
20
21 uint32_t SetupTPM(int mode, int developer_flag) {
22 #ifndef NDEBUG
23 VBDEBUG(("Rollback Index Library Mock: TPM initialized.\n"));
24 #endif
25 return TPM_SUCCESS;
26 }
27
28 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version) {
29 switch (type) {
30 case FIRMWARE_VERSIONS:
31 *key_version = g_firmware_key_version;
32 *version = g_firmware_version;
33 break;
34 case KERNEL_VERSIONS:
35 *key_version = g_kernel_key_version;
36 *version = g_kernel_version;
37 break;
38 }
39 return TPM_SUCCESS;
40 }
41
42 uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version) {
43 switch (type) {
44 case FIRMWARE_VERSIONS:
45 g_firmware_key_version = key_version;
46 g_firmware_version = version;
47 break;
48 case KERNEL_VERSIONS:
49 g_kernel_key_version = key_version;
50 g_kernel_version = version;
51 break;
52 }
53 #ifndef NDEBUG
54 VBDEBUG(("Rollback Index Library Mock: Stored Versions written.\n"));
55 #endif
56 return TPM_SUCCESS;
57 }
58
59 uint32_t LockFirmwareVersions(void) {
60 #ifndef NDEBUG
61 VBDEBUG(("Rollback Index Library Mock: Firmware Versions Locked.\n"));
62 #endif
63 return TPM_SUCCESS;
64 }
65
66 uint32_t LockKernelVersionsByLockingPP(void) {
67 #ifndef NDEBUG
68 VBDEBUG(("Rollback Index Library Mock: Kernel Versions Locked.\n"));
69 #endif
70 return TPM_SUCCESS;
71 }
OLDNEW
« firmware/lib/rollback_index.c ('K') | « tests/Makefile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698