xref: /netbsd-src/crypto/external/cpl/trousers/dist/src/include/obj_pcrs.h (revision 1023804e3833a0bd94414f2545512128f6502c74)
1 
2 /*
3  * Licensed Materials - Property of IBM
4  *
5  * trousers - An open source TCG Software Stack
6  *
7  * (C) Copyright International Business Machines Corp. 2004-2007
8  *
9  */
10 
11 #ifndef _OBJ_PCRS_H_
12 #define _OBJ_PCRS_H_
13 
14 #ifdef TSS_BUILD_PCRS_LIST
15 
16 /* structures */
17 struct tr_pcrs_obj {
18 	UINT32 type;
19 	union {
20 		TPM_PCR_INFO info11;
21 		TPM_PCR_INFO_SHORT infoshort;
22 		TPM_PCR_INFO_LONG infolong;
23 	} info;
24 	TPM_PCRVALUE *pcrs;
25 };
26 
27 /* obj_pcrs.c */
28 void       pcrs_free(void *data);
29 TSS_BOOL   obj_is_pcrs(TSS_HOBJECT);
30 TSS_RESULT obj_pcrs_get_tsp_context(TSS_HPCRS, TSS_HCONTEXT *);
31 TSS_RESULT obj_pcrs_add(TSS_HCONTEXT, UINT32, TSS_HOBJECT *);
32 TSS_RESULT obj_pcrs_remove(TSS_HOBJECT, TSS_HCONTEXT);
33 TSS_RESULT obj_pcrs_get_type(TSS_HPCRS, UINT32 *);
34 TSS_RESULT obj_pcrs_select_index(TSS_HPCRS, UINT32);
35 TSS_RESULT obj_pcrs_select_index_ex(TSS_HPCRS, UINT32, UINT32);
36 TSS_RESULT obj_pcrs_get_value(TSS_HPCRS, UINT32, UINT32 *, BYTE **);
37 TSS_RESULT obj_pcrs_set_value(TSS_HPCRS, UINT32, UINT32, BYTE *);
38 TSS_RESULT obj_pcrs_set_values(TSS_HPCRS hPcrs, TCPA_PCR_COMPOSITE *);
39 TSS_RESULT obj_pcrs_get_selection(TSS_HPCRS, UINT32 *, BYTE *);
40 TSS_RESULT obj_pcrs_get_digest_at_release(TSS_HPCRS, UINT32 *, BYTE **);
41 TSS_RESULT obj_pcrs_set_digest_at_release(TSS_HPCRS, TPM_COMPOSITE_HASH);
42 TSS_RESULT obj_pcrs_create_info_type(TSS_HPCRS, UINT32 *, UINT32 *, BYTE **);
43 TSS_RESULT obj_pcrs_create_info(TSS_HPCRS, UINT32 *, BYTE **);
44 TSS_RESULT obj_pcrs_create_info_long(TSS_HPCRS, UINT32 *, BYTE **);
45 TSS_RESULT obj_pcrs_create_info_short(TSS_HPCRS, UINT32 *, BYTE **);
46 TSS_RESULT obj_pcrs_get_locality(TSS_HPCRS, UINT32 *);
47 TSS_RESULT obj_pcrs_set_locality(TSS_HPCRS, UINT32);
48 
49 #define PCRS_LIST_DECLARE		struct obj_list pcrs_list
50 #define PCRS_LIST_DECLARE_EXTERN	extern struct obj_list pcrs_list
51 #define PCRS_LIST_INIT()		tspi_list_init(&pcrs_list)
52 #define PCRS_LIST_CONNECT(a,b)		obj_connectContext_list(&pcrs_list, a, b)
53 #define PCRS_LIST_CLOSE(a)		obj_list_close(&pcrs_list, &pcrs_free, a)
54 
55 #else
56 
57 #define obj_is_pcrs(a)	FALSE
58 
59 #define PCRS_LIST_DECLARE
60 #define PCRS_LIST_DECLARE_EXTERN
61 #define PCRS_LIST_INIT()
62 #define PCRS_LIST_CONNECT(a,b)
63 #define PCRS_LIST_CLOSE(a)
64 
65 #endif
66 
67 #endif
68