blob: 8e96ec1139f7b7b85066f05bad13e02cbfa4d732 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Mock rollback index library for testing.
*/
#include "rollback_index.h"
#include "tss_constants.h"
#include <stdio.h>
uint16_t g_firmware_key_version = 0;
uint16_t g_firmware_version = 0;
uint16_t g_kernel_key_version = 0;
uint16_t g_kernel_version = 0;
/* disable MSVC warnings on unused arguments */
__pragma(warning (disable: 4100))
uint32_t SetupTPM(int mode, int developer_flag) {
#ifndef NDEBUG
VBDEBUG(("Rollback Index Library Mock: TPM initialized.\n"));
#endif
return TPM_SUCCESS;
}
uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version) {
switch (type) {
case FIRMWARE_VERSIONS:
*key_version = g_firmware_key_version;
*version = g_firmware_version;
break;
case KERNEL_VERSIONS:
*key_version = g_kernel_key_version;
*version = g_kernel_version;
break;
}
return TPM_SUCCESS;
}
uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version) {
switch (type) {
case FIRMWARE_VERSIONS:
g_firmware_key_version = key_version;
g_firmware_version = version;
break;
case KERNEL_VERSIONS:
g_kernel_key_version = key_version;
g_kernel_version = version;
break;
}
#ifndef NDEBUG
VBDEBUG(("Rollback Index Library Mock: Stored Versions written.\n"));
#endif
return TPM_SUCCESS;
}
uint32_t LockFirmwareVersions(void) {
#ifndef NDEBUG
VBDEBUG(("Rollback Index Library Mock: Firmware Versions Locked.\n"));
#endif
return TPM_SUCCESS;
}
uint32_t LockKernelVersionsByLockingPP(void) {
#ifndef NDEBUG
VBDEBUG(("Rollback Index Library Mock: Kernel Versions Locked.\n"));
#endif
return TPM_SUCCESS;
}
|