• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
6 #include "sysincludes.h"
7 
8 #include "tlcl.h"
9 #include "tlcl_internal.h"
10 #include "utility.h"
11 #include "vboot_api.h"
12 
TlclLibInit(void)13 uint32_t TlclLibInit(void) {
14   return VbExTpmInit();
15 }
16 
TlclLibClose(void)17 uint32_t TlclLibClose(void) {
18   return TPM_SUCCESS;
19 }
20 
TlclStartup(void)21 uint32_t TlclStartup(void) {
22   return TPM_SUCCESS;
23 }
24 
TlclSaveState(void)25 uint32_t TlclSaveState(void) {
26   return TPM_SUCCESS;
27 }
28 
TlclResume(void)29 uint32_t TlclResume(void) {
30   return TPM_SUCCESS;
31 }
32 
TlclSelfTestFull(void)33 uint32_t TlclSelfTestFull(void) {
34   return TPM_SUCCESS;
35 }
36 
TlclContinueSelfTest(void)37 uint32_t TlclContinueSelfTest(void) {
38   return TPM_SUCCESS;
39 }
40 
TlclDefineSpace(uint32_t index,uint32_t perm,uint32_t size)41 uint32_t TlclDefineSpace(uint32_t index, uint32_t perm, uint32_t size) {
42   return TPM_SUCCESS;
43 }
44 
TlclWrite(uint32_t index,const void * data,uint32_t length)45 uint32_t TlclWrite(uint32_t index, const void* data, uint32_t length) {
46   return TPM_SUCCESS;
47 }
48 
TlclRead(uint32_t index,void * data,uint32_t length)49 uint32_t TlclRead(uint32_t index, void* data, uint32_t length) {
50   Memset(data, '\0', length);
51   return TPM_SUCCESS;
52 }
53 
TlclPCRRead(uint32_t index,void * data,uint32_t length)54 uint32_t TlclPCRRead(uint32_t index, void* data, uint32_t length) {
55   Memset(data, '\0', length);
56   return TPM_SUCCESS;
57 }
58 
TlclWriteLock(uint32_t index)59 uint32_t TlclWriteLock(uint32_t index) {
60   return TPM_SUCCESS;
61 }
62 
TlclReadLock(uint32_t index)63 uint32_t TlclReadLock(uint32_t index) {
64   return TPM_SUCCESS;
65 }
66 
TlclAssertPhysicalPresence(void)67 uint32_t TlclAssertPhysicalPresence(void) {
68   return TPM_SUCCESS;
69 }
70 
TlclPhysicalPresenceCMDEnable(void)71 uint32_t TlclPhysicalPresenceCMDEnable(void) {
72   return TPM_SUCCESS;
73 }
74 
TlclFinalizePhysicalPresence(void)75 uint32_t TlclFinalizePhysicalPresence(void) {
76   return TPM_SUCCESS;
77 }
78 
TlclAssertPhysicalPresenceResult(void)79 uint32_t TlclAssertPhysicalPresenceResult(void) {
80   return TPM_SUCCESS;
81 }
82 
TlclLockPhysicalPresence(void)83 uint32_t TlclLockPhysicalPresence(void) {
84   return TPM_SUCCESS;
85 }
86 
TlclSetNvLocked(void)87 uint32_t TlclSetNvLocked(void) {
88   return TPM_SUCCESS;
89 }
90 
TlclIsOwned(void)91 int TlclIsOwned(void) {
92   return 0;
93 }
94 
TlclForceClear(void)95 uint32_t TlclForceClear(void) {
96   return TPM_SUCCESS;
97 }
98 
TlclSetEnable(void)99 uint32_t TlclSetEnable(void) {
100   return TPM_SUCCESS;
101 }
102 
TlclClearEnable(void)103 uint32_t TlclClearEnable(void) {
104   return TPM_SUCCESS;
105 }
106 
TlclSetDeactivated(uint8_t flag)107 uint32_t TlclSetDeactivated(uint8_t flag) {
108   return TPM_SUCCESS;
109 }
110 
TlclGetPermanentFlags(TPM_PERMANENT_FLAGS * pflags)111 uint32_t TlclGetPermanentFlags(TPM_PERMANENT_FLAGS* pflags) {
112   Memset(pflags, '\0', sizeof(*pflags));
113   return TPM_SUCCESS;
114 }
115 
TlclGetSTClearFlags(TPM_STCLEAR_FLAGS * vflags)116 uint32_t TlclGetSTClearFlags(TPM_STCLEAR_FLAGS* vflags) {
117   Memset(vflags, '\0', sizeof(*vflags));
118   return TPM_SUCCESS;
119 }
120 
TlclGetFlags(uint8_t * disable,uint8_t * deactivated,uint8_t * nvlocked)121 uint32_t TlclGetFlags(uint8_t* disable,
122                       uint8_t* deactivated,
123                       uint8_t *nvlocked) {
124   *disable = 0;
125   *deactivated = 0;
126   *nvlocked = 0;
127   return TPM_SUCCESS;
128 }
129 
TlclSetGlobalLock(void)130 uint32_t TlclSetGlobalLock(void) {
131   return TPM_SUCCESS;
132 }
133 
TlclExtend(int pcr_num,const uint8_t * in_digest,uint8_t * out_digest)134 uint32_t TlclExtend(int pcr_num, const uint8_t* in_digest,
135                     uint8_t* out_digest) {
136   Memcpy(out_digest, in_digest, kPcrDigestLength);
137   return TPM_SUCCESS;
138 }
139 
TlclGetPermissions(uint32_t index,uint32_t * permissions)140 uint32_t TlclGetPermissions(uint32_t index, uint32_t* permissions) {
141   *permissions = 0;
142   return TPM_SUCCESS;
143 }
144 
TlclGetOwnership(uint8_t * owned)145 uint32_t TlclGetOwnership(uint8_t* owned) {
146   *owned = 0;
147   return TPM_SUCCESS;
148 }
149 
TlclGetRandom(uint8_t * data,uint32_t length,uint32_t * size)150 uint32_t TlclGetRandom(uint8_t* data, uint32_t length, uint32_t *size) {
151   *size = length;
152   /* http://dilbert.com/strips/comic/2001-10-25/ */
153   Memset(data, '\x9', *size);
154   return TPM_SUCCESS;
155 }
156 
TlclPacketSize(const uint8_t * packet)157 int TlclPacketSize(const uint8_t* packet)
158 {
159   uint32_t size;
160   FromTpmUint32(packet + sizeof(uint16_t), &size);
161   return (int) size;
162 }
163 
TlclSendReceive(const uint8_t * request,uint8_t * response,int max_length)164 uint32_t TlclSendReceive(const uint8_t* request, uint8_t* response,
165                          int max_length)
166 {
167   return TPM_SUCCESS;
168 }
169