1 /* Copyright (c) 2012 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  * Functions for querying, manipulating and locking rollback indices
6  * stored in the TPM NVRAM.
7  */
8 
9 #include "sysincludes.h"
10 #include "utility.h"
11 
12 #include "rollback_index.h"
13 
14 #include "tss_constants.h"
15 
16 
SetVirtualDevMode(int val)17 uint32_t SetVirtualDevMode(int val) {
18   return TPM_SUCCESS;
19 }
20 
21 
TPMClearAndReenable(void)22 uint32_t TPMClearAndReenable(void) {
23   return TPM_SUCCESS;
24 }
25 
26 
SetupTPM(int developer_mode,int disable_dev_request,int clear_tpm_owner_request,RollbackSpaceFirmware * rsf)27 uint32_t SetupTPM(int developer_mode, int disable_dev_request,
28                   int clear_tpm_owner_request, RollbackSpaceFirmware* rsf) {
29   return TPM_SUCCESS;
30 }
31 
32 
RollbackS3Resume(void)33 uint32_t RollbackS3Resume(void) {
34   return TPM_SUCCESS;
35 }
36 
37 
RollbackFirmwareSetup(int is_hw_dev,int disable_dev_request,int clear_tpm_owner_request,int * is_virt_dev,uint32_t * version)38 uint32_t RollbackFirmwareSetup(int is_hw_dev,
39                                int disable_dev_request,
40                                int clear_tpm_owner_request,
41                                int *is_virt_dev, uint32_t *version) {
42   *version = 0;
43   return TPM_SUCCESS;
44 }
45 
46 
RollbackFirmwareWrite(uint32_t version)47 uint32_t RollbackFirmwareWrite(uint32_t version) {
48   return TPM_SUCCESS;
49 }
50 
51 
RollbackFirmwareLock(void)52 uint32_t RollbackFirmwareLock(void) {
53   return TPM_SUCCESS;
54 }
55 
56 
RollbackKernelRead(uint32_t * version)57 uint32_t RollbackKernelRead(uint32_t* version) {
58   *version = 0;
59   return TPM_SUCCESS;
60 }
61 
62 
RollbackKernelWrite(uint32_t version)63 uint32_t RollbackKernelWrite(uint32_t version) {
64   return TPM_SUCCESS;
65 }
66 
67 
RollbackKernelLock(int recovery_mode)68 uint32_t RollbackKernelLock(int recovery_mode) {
69   return TPM_SUCCESS;
70 }
71 
72 static uint8_t rollback_backup[BACKUP_NV_SIZE];
73 
RollbackBackupRead(uint8_t * raw)74 uint32_t RollbackBackupRead(uint8_t *raw)
75 {
76 	Memcpy(raw, rollback_backup, BACKUP_NV_SIZE);
77 	return TPM_SUCCESS;
78 }
79 
RollbackBackupWrite(uint8_t * raw)80 uint32_t RollbackBackupWrite(uint8_t *raw)
81 {
82 	Memcpy(rollback_backup, raw, BACKUP_NV_SIZE);
83 	return TPM_SUCCESS;
84 }
85