VirtualBox

source: vbox/trunk/src/libs/libtpms-0.9.0/src/tpm12/tpm_pcr.h@ 91612

最後變更 在這個檔案從91612是 91612,由 vboxsync 提交於 3 年 前

src/libs: Export libtpms-0.9.0, bugref:10078

檔案大小: 17.1 KB
 
1/********************************************************************************/
2/* */
3/* PCR Handler */
4/* Written by Ken Goldman */
5/* IBM Thomas J. Watson Research Center */
6/* $Id: tpm_pcr.h 4620 2011-09-07 21:43:19Z kgoldman $ */
7/* */
8/* (c) Copyright IBM Corporation 2006, 2010. */
9/* */
10/* All rights reserved. */
11/* */
12/* Redistribution and use in source and binary forms, with or without */
13/* modification, are permitted provided that the following conditions are */
14/* met: */
15/* */
16/* Redistributions of source code must retain the above copyright notice, */
17/* this list of conditions and the following disclaimer. */
18/* */
19/* Redistributions in binary form must reproduce the above copyright */
20/* notice, this list of conditions and the following disclaimer in the */
21/* documentation and/or other materials provided with the distribution. */
22/* */
23/* Neither the names of the IBM Corporation nor the names of its */
24/* contributors may be used to endorse or promote products derived from */
25/* this software without specific prior written permission. */
26/* */
27/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
28/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
29/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
30/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
31/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
32/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
33/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
34/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
35/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
36/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
37/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
38/********************************************************************************/
39
40#ifndef TPM_PCR_H
41#define TPM_PCR_H
42
43#include "tpm_global.h"
44#include "tpm_sizedbuffer.h"
45#include "tpm_store.h"
46
47/*
48 Locality Utilities
49*/
50
51TPM_RESULT TPM_Locality_Set(TPM_LOCALITY_SELECTION *tpm_locality_selection,
52 TPM_MODIFIER_INDICATOR tpm_modifier_indicator);
53TPM_RESULT TPM_Locality_Check(TPM_LOCALITY_SELECTION tpm_locality_selection,
54 TPM_MODIFIER_INDICATOR localityModifier);
55
56TPM_RESULT TPM_LocalitySelection_CheckLegal(TPM_LOCALITY_SELECTION tpm_locality_selection);
57TPM_RESULT TPM_LocalityModifier_CheckLegal(TPM_MODIFIER_INDICATOR localityModifier);
58
59void TPM_PCRLocality_Compare(TPM_BOOL *match,
60 TPM_LOCALITY_SELECTION tpm_locality_selection1,
61 TPM_LOCALITY_SELECTION tpm_locality_selection2);
62
63/*
64 state PCR's
65*/
66
67TPM_RESULT TPM_PCR_CheckRange(TPM_PCRINDEX index);
68void TPM_PCR_Init(TPM_PCRVALUE *tpm_pcrs,
69 const TPM_PCR_ATTRIBUTES *tpm_pcr_attributes,
70 size_t pcrIndex);
71void TPM_PCR_Reset(TPM_PCRVALUE *tpm_pcrs,
72 TPM_BOOL TOSPresent,
73 TPM_PCRINDEX pcrIndex);
74TPM_RESULT TPM_PCR_Load(TPM_PCRVALUE dest_pcr,
75 TPM_PCRVALUE *tpm_pcrs,
76 TPM_PCRINDEX index);
77TPM_RESULT TPM_PCR_Store(TPM_PCRVALUE *tpm_pcrs,
78 TPM_PCRINDEX index,
79 TPM_PCRVALUE src_pcr);
80
81/*
82 TPM_SELECT_SIZE
83*/
84
85void TPM_SelectSize_Init(TPM_SELECT_SIZE *tpm_select_size);
86TPM_RESULT TPM_SelectSize_Load(TPM_SELECT_SIZE *tpm_select_size,
87 unsigned char **stream,
88 uint32_t *stream_size);
89
90
91/*
92 TPM_PCR_SELECTION
93*/
94
95void TPM_PCRSelection_Init(TPM_PCR_SELECTION *tpm_pcr_selection);
96TPM_RESULT TPM_PCRSelection_Load(TPM_PCR_SELECTION *tpm_pcr_selection,
97 unsigned char **stream,
98 uint32_t *stream_size);
99TPM_RESULT TPM_PCRSelection_Store(TPM_STORE_BUFFER *sbuffer,
100 const TPM_PCR_SELECTION *tpm_pcr_selection);
101void TPM_PCRSelection_Delete(TPM_PCR_SELECTION *tpm_pcr_selection);
102/* copy */
103TPM_RESULT TPM_PCRSelection_Copy(TPM_PCR_SELECTION *destination,
104 TPM_PCR_SELECTION *source);
105/* setters */
106TPM_RESULT TPM_PCRSelection_GenerateDigest(TPM_DIGEST tpm_digest,
107 TPM_PCR_SELECTION *tpm_pcr_selection,
108 TPM_PCRVALUE *tpm_pcrs);
109TPM_RESULT TPM_PCRSelection_GenerateDigest2(TPM_DIGEST tpm_digest,
110 TPM_PCR_COMPOSITE *tpm_pcr_composite,
111 TPM_PCR_SELECTION *tpm_pcr_selection,
112 TPM_PCRVALUE *tpm_pcrs);
113/* getters */
114TPM_RESULT TPM_PCRSelection_GetPCRUsage(TPM_BOOL *pcrUsage,
115 const TPM_PCR_SELECTION *tpm_pcr_selection,
116 size_t start_index);
117/* checkers */
118TPM_RESULT TPM_PCRSelection_CheckRange(const TPM_PCR_SELECTION *tpm_pcr_selection);
119void TPM_PCRSelection_Compare(TPM_BOOL *match,
120 TPM_PCR_SELECTION *tpm_pcr_selection1,
121 TPM_PCR_SELECTION *tpm_pcr_selection2);
122#if 0
123void TPM_PCRSelection_LessThan(TPM_BOOL *lessThan,
124 TPM_PCR_SELECTION *tpm_pcr_selection_new,
125 TPM_PCR_SELECTION *tpm_pcr_selection_old);
126#endif
127
128/* TPM_PCR_ATTRIBUTES */
129
130void TPM_PCRAttributes_Init(TPM_PCR_ATTRIBUTES *tpm_pcr_attributes);
131
132void TPM_PCRInfo_Trace(const char *message,
133 TPM_PCR_SELECTION pcrSelection,
134 TPM_COMPOSITE_HASH digestAtRelease);
135/*
136 PCRs - Functions that act on the entire set of PCRs
137*/
138
139void TPM_PCRs_Init(TPM_PCRVALUE *tpm_pcrs,
140 const TPM_PCR_ATTRIBUTES *tpm_pcr_attributes);
141TPM_RESULT TPM_PCRs_Load(TPM_PCRVALUE *tpm_pcrs,
142 const TPM_PCR_ATTRIBUTES *tpm_pcr_attributes,
143 unsigned char **stream,
144 uint32_t *stream_size);
145TPM_RESULT TPM_PCRs_Store(TPM_STORE_BUFFER *sbuffer,
146 TPM_PCRVALUE *tpm_pcrs,
147 const TPM_PCR_ATTRIBUTES *tpm_pcr_attributes);
148
149/*
150 TPM_PCR_INFO
151*/
152
153void TPM_PCRInfo_Init(TPM_PCR_INFO *tpm_pcr_info);
154TPM_RESULT TPM_PCRInfo_Load(TPM_PCR_INFO *tpm_pcr_info,
155 unsigned char **stream,
156 uint32_t *stream_size);
157TPM_RESULT TPM_PCRInfo_Store(TPM_STORE_BUFFER *sbuffer,
158 const TPM_PCR_INFO *tpm_pcr_info);
159void TPM_PCRInfo_Delete(TPM_PCR_INFO *tpm_pcr_info);
160/* create */
161TPM_RESULT TPM_PCRInfo_Create(TPM_PCR_INFO **tpm_pcr_info);
162/* load */
163TPM_RESULT TPM_PCRInfo_LoadFromBuffer(TPM_PCR_INFO *tpm_pcr_info,
164 const TPM_SIZED_BUFFER *tpm_sized_buffer);
165TPM_RESULT TPM_PCRInfo_CreateFromBuffer(TPM_PCR_INFO **tpm_pcr_info,
166 const TPM_SIZED_BUFFER *tpm_sized_buffer);
167/* copy */
168TPM_RESULT TPM_PCRInfo_Copy(TPM_PCR_INFO *dest_tpm_pcr_info,
169 TPM_PCR_INFO *src_tpm_pcr_info);
170TPM_RESULT TPM_PCRInfo_CopyInfoLong(TPM_PCR_INFO *dest_tpm_pcr_info,
171 TPM_PCR_INFO_LONG *src_tpm_pcr_info_long);
172TPM_RESULT TPM_PCRInfo_CreateFromInfo(TPM_PCR_INFO **dest_tpm_pcr_info,
173 TPM_PCR_INFO *src_tpm_pcr_info);
174TPM_RESULT TPM_PCRInfo_CreateFromInfoLong(TPM_PCR_INFO **dest_tpm_pcr_info,
175 TPM_PCR_INFO_LONG *src_tpm_pcr_info_long);
176TPM_RESULT TPM_PCRInfo_CreateFromKey(TPM_PCR_INFO **dest_tpm_pcr_info,
177 TPM_KEY *tpm_key);
178
179/* setters */
180TPM_RESULT TPM_PCRInfo_GenerateDigest(TPM_DIGEST tpm_digest,
181 TPM_PCR_INFO *tpm_pcr_info,
182 TPM_PCRVALUE *tpm_pcrs);
183TPM_RESULT TPM_PCRInfo_CheckDigest(TPM_PCR_INFO *tpm_pcr_info,
184 TPM_PCRVALUE *tpm_pcrs);
185TPM_RESULT TPM_PCRInfo_SetDigestAtCreation(TPM_PCR_INFO *tpm_pcr_info,
186 TPM_PCRVALUE *tpm_pcrs);
187/* getters */
188TPM_RESULT TPM_PCRInfo_GetPCRUsage(TPM_BOOL *pcrUsage,
189 TPM_PCR_INFO *tpm_pcr_info,
190 size_t start_index);
191
192/*
193 TPM_PCR_INFO_LONG
194*/
195
196void TPM_PCRInfoLong_Init(TPM_PCR_INFO_LONG *tpm_pcr_info_long);
197TPM_RESULT TPM_PCRInfoLong_Load(TPM_PCR_INFO_LONG *tpm_pcr_info_long,
198 unsigned char **stream,
199 uint32_t *stream_size);
200TPM_RESULT TPM_PCRInfoLong_Store(TPM_STORE_BUFFER *sbuffer,
201 const TPM_PCR_INFO_LONG *tpm_pcr_info_long);
202void TPM_PCRInfoLong_Delete(TPM_PCR_INFO_LONG *tpm_pcr_info_long);
203/* create */
204TPM_RESULT TPM_PCRInfoLong_Create(TPM_PCR_INFO_LONG **tpm_pcr_info_long);
205/* load */
206TPM_RESULT TPM_PCRInfoLong_LoadFromBuffer(TPM_PCR_INFO_LONG *tpm_pcr_info_long,
207 const TPM_SIZED_BUFFER *tpm_sized_buffer);
208TPM_RESULT TPM_PCRInfoLong_CreateFromBuffer(TPM_PCR_INFO_LONG **tpm_pcr_info_long,
209 const TPM_SIZED_BUFFER *tpm_sized_buffer);
210/* copy */
211TPM_RESULT TPM_PCRInfoLong_Copy(TPM_PCR_INFO_LONG *dest_tpm_pcr_info_long,
212 TPM_PCR_INFO_LONG *src_tpm_pcr_info_long);
213TPM_RESULT TPM_PCRInfoLong_CreateFromInfoLong(TPM_PCR_INFO_LONG **dest_tpm_pcr_info_long,
214 TPM_PCR_INFO_LONG *src_tpm_pcr_info_long);
215/* setters */
216TPM_RESULT TPM_PCRInfoLong_GenerateDigest(TPM_DIGEST tpm_digest,
217 TPM_PCR_INFO_LONG *tpm_pcr_info_long,
218 TPM_PCRVALUE *tpm_pcrs);
219TPM_RESULT TPM_PCRInfoLong_CheckDigest(TPM_PCR_INFO_LONG *tpm_pcr_info_long,
220 TPM_PCRVALUE *tpm_pcrs,
221 TPM_MODIFIER_INDICATOR localityModifier);
222TPM_RESULT TPM_PCRInfoLong_SetDigestAtCreation(TPM_PCR_INFO_LONG *tpm_pcr_info_long,
223 TPM_PCRVALUE *tpm_pcrs);
224/* getters */
225TPM_RESULT TPM_PCRInfoLong_GetPCRUsage(TPM_BOOL *pcrUsage,
226 TPM_PCR_INFO_LONG *tpm_pcr_info_long,
227 size_t start_index);
228
229/*
230 TPM_PCR_INFO_SHORT
231*/
232
233void TPM_PCRInfoShort_Init(TPM_PCR_INFO_SHORT *tpm_pcr_info_short);
234TPM_RESULT TPM_PCRInfoShort_Load(TPM_PCR_INFO_SHORT *tpm_pcr_info_short,
235 unsigned char **stream,
236 uint32_t *stream_size,
237 TPM_BOOL optimize);
238TPM_RESULT TPM_PCRInfoShort_Store(TPM_STORE_BUFFER *sbuffer,
239 const TPM_PCR_INFO_SHORT *tpm_pcr_info_short,
240 TPM_BOOL optimize);
241void TPM_PCRInfoShort_Delete(TPM_PCR_INFO_SHORT *tpm_pcr_info_short);
242/* create */
243TPM_RESULT TPM_PCRInfoShort_Create(TPM_PCR_INFO_SHORT **tpm_pcr_info_short);
244/* load */
245TPM_RESULT TPM_PCRInfoShort_LoadFromBuffer(TPM_PCR_INFO_SHORT *tpm_pcr_info_short,
246 const TPM_SIZED_BUFFER *tpm_sized_buffer);
247TPM_RESULT TPM_PCRInfoShort_CreateFromBuffer(TPM_PCR_INFO_SHORT **tpm_pcr_info_short,
248 const TPM_SIZED_BUFFER *tpm_sized_buffer);
249/* copy */
250TPM_RESULT TPM_PCRInfoShort_Copy(TPM_PCR_INFO_SHORT *dest_tpm_pcr_info_short,
251 TPM_PCR_INFO_SHORT *src_tpm_pcr_info_short);
252TPM_RESULT TPM_PCRInfoShort_CopyInfo(TPM_PCR_INFO_SHORT *dest_tpm_pcr_info_short,
253 TPM_PCR_INFO *src_tpm_pcr_info);
254TPM_RESULT TPM_PCRInfoShort_CopyInfoLong(TPM_PCR_INFO_SHORT *dest_tpm_pcr_info_short,
255 TPM_PCR_INFO_LONG *src_tpm_pcr_info_long);
256TPM_RESULT TPM_PCRInfoShort_CreateFromInfo(TPM_PCR_INFO_SHORT **dest_tpm_pcr_info_short,
257 TPM_PCR_INFO *src_tpm_pcr_info);
258TPM_RESULT TPM_PCRInfoShort_CreateFromInfoLong(TPM_PCR_INFO_SHORT **dest_tpm_pcr_info_short,
259 TPM_PCR_INFO_LONG *src_tpm_pcr_info_long);
260TPM_RESULT TPM_PCRInfoShort_CreateFromKey(TPM_PCR_INFO_SHORT **dest_tpm_pcr_info_short,
261 TPM_KEY *tpm_key);
262
263/* setters */
264TPM_RESULT TPM_PCRInfoShort_GenerateDigest(TPM_DIGEST tpm_digest,
265 TPM_PCR_INFO_SHORT *tpm_pcr_info_short,
266 TPM_PCRVALUE *tpm_pcrs);
267TPM_RESULT TPM_PCRInfoShort_CheckDigest(TPM_PCR_INFO_SHORT *tpm_pcr_info_short,
268 TPM_PCRVALUE *tpm_pcrs,
269 TPM_MODIFIER_INDICATOR localityModifier);
270
271/* getters */
272TPM_RESULT TPM_PCRInfoShort_GetPCRUsage(TPM_BOOL *pcrUsage,
273 TPM_PCR_INFO_SHORT *tpm_pcr_info_short);
274
275/*
276 TPM_PCR_COMPOSITE
277*/
278
279void TPM_PCRComposite_Init(TPM_PCR_COMPOSITE *tpm_pcr_composite);
280TPM_RESULT TPM_PCRComposite_Store(TPM_STORE_BUFFER *sbuffer,
281 const TPM_PCR_COMPOSITE *tpm_pcr_composite);
282void TPM_PCRComposite_Delete(TPM_PCR_COMPOSITE *tpm_pcr_composite);
283
284TPM_RESULT TPM_PCRComposite_Set(TPM_PCR_COMPOSITE *tpm_pcr_composite,
285 TPM_PCR_SELECTION *tpm_pcr_selection,
286 TPM_PCRVALUE *tpm_pcrs);
287
288/*
289 TPM_QUOTE_INFO
290*/
291
292void TPM_QuoteInfo_Init(TPM_QUOTE_INFO *tpm_quote_info);
293#if 0
294TPM_RESULT TPM_QuoteInfo_Load(TPM_QUOTE_INFO *tpm_quote_info,
295 unsigned char **stream,
296 uint32_t *stream_size);
297#endif
298TPM_RESULT TPM_QuoteInfo_Store(TPM_STORE_BUFFER *sbuffer,
299 const TPM_QUOTE_INFO *tpm_quote_info);
300void TPM_QuoteInfo_Delete(TPM_QUOTE_INFO *tpm_quote_info);
301
302/*
303 TPM_QUOTE_INFO2
304*/
305
306void TPM_QuoteInfo2_Init(TPM_QUOTE_INFO2 *tpm_quote_info2);
307#if 0
308TPM_RESULT TPM_QuoteInfo2_Load(TPM_QUOTE_INFO2 *tpm_quote_info2,
309 unsigned char **stream,
310 uint32_t *stream_size);
311#endif
312TPM_RESULT TPM_QuoteInfo2_Store(TPM_STORE_BUFFER *sbuffer,
313 const TPM_QUOTE_INFO2 *tpm_quote_info2);
314void TPM_QuoteInfo2_Delete(TPM_QUOTE_INFO2 *tpm_quote_info2);
315
316
317/*
318 Common command processing
319*/
320
321TPM_RESULT TPM_ExtendCommon(TPM_PCRVALUE outDigest,
322 tpm_state_t *tpm_state,
323 TPM_COMMAND_CODE ordinal,
324 TPM_PCRINDEX pcrNum,
325 TPM_DIGEST inDigest);
326/*
327 Command Processing
328*/
329
330TPM_RESULT TPM_Process_PcrRead(tpm_state_t *tpm_state,
331 TPM_STORE_BUFFER *response,
332 TPM_TAG tag,
333 uint32_t paramSize,
334 TPM_COMMAND_CODE ordinal,
335 unsigned char *command,
336 TPM_TRANSPORT_INTERNAL *transportInternal);
337TPM_RESULT TPM_Process_Quote(tpm_state_t *tpm_state,
338 TPM_STORE_BUFFER *response,
339 TPM_TAG tag,
340 uint32_t paramSize,
341 TPM_COMMAND_CODE ordinal,
342 unsigned char *command,
343 TPM_TRANSPORT_INTERNAL *transportInternal);
344TPM_RESULT TPM_Process_Quote2(tpm_state_t *tpm_state,
345 TPM_STORE_BUFFER *response,
346 TPM_TAG tag,
347 uint32_t paramSize,
348 TPM_COMMAND_CODE ordinal,
349 unsigned char *command,
350 TPM_TRANSPORT_INTERNAL *transportInternal);
351
352TPM_RESULT TPM_Process_Extend(tpm_state_t *tpm_state,
353 TPM_STORE_BUFFER *response,
354 TPM_TAG tag,
355 uint32_t paramSize,
356 TPM_COMMAND_CODE ordinal,
357 unsigned char *command,
358 TPM_TRANSPORT_INTERNAL *transportInternal);
359
360TPM_RESULT TPM_Process_PcrReset(tpm_state_t *tpm_state,
361 TPM_STORE_BUFFER *response,
362 TPM_TAG tag,
363 uint32_t paramSize,
364 TPM_COMMAND_CODE ordinal,
365 unsigned char *command,
366 TPM_TRANSPORT_INTERNAL *transportInternal);
367#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette