xref: /netbsd-src/crypto/external/cpl/trousers/dist/src/include/obj.h (revision 2d5f7628c5531eb583b9313ac2fd1cf8582b4479)
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_H_
12 #define _OBJ_H_
13 
14 #include "threads.h"
15 
16 /* definitions */
17 
18 /* When TRUE, the object has PCRs associated with it */
19 #define TSS_OBJ_FLAG_PCRS	0x00000001
20 /* When TRUE, the object has a usage auth secret associated with it */
21 #define TSS_OBJ_FLAG_USAGEAUTH	0x00000002
22 /* When TRUE, the object has a migration auth secret associated with it */
23 #define TSS_OBJ_FLAG_MIGAUTH	0x00000004
24 /* When TRUE, the object has previously been registered in USER PS */
25 #define TSS_OBJ_FLAG_USER_PS	0x00000008
26 /* When TRUE, the object has previously been registered in SYSTEM PS */
27 #define TSS_OBJ_FLAG_SYSTEM_PS	0x00000010
28 /* When TRUE, the key has been created and cannot be altered */
29 #define TSS_OBJ_FLAG_KEY_SET	0x00000020
30 
31 /* structures */
32 struct tsp_object {
33 	UINT32 handle;
34 	UINT32 tspContext;
35 	TSS_FLAG flags;
36 	void *data;
37 	struct tsp_object *next;
38 };
39 
40 struct obj_list {
41 	struct tsp_object *head;
42 	MUTEX_DECLARE(lock);
43 };
44 
45 /* prototypes */
46 TSS_RESULT	   obj_getTpmObject(UINT32, TSS_HOBJECT *);
47 TSS_HOBJECT	   obj_GetPolicyOfObject(UINT32, UINT32);
48 void		   __tspi_obj_list_init();
49 TSS_HOBJECT	   obj_get_next_handle();
50 TSS_RESULT	   obj_list_add(struct obj_list *, UINT32, TSS_FLAG, void *, TSS_HOBJECT *);
51 TSS_RESULT	   obj_list_remove(struct obj_list *, void (*)(void *), TSS_HOBJECT, TSS_HCONTEXT);
52 void		   obj_list_put(struct obj_list *);
53 struct tsp_object *obj_list_get_obj(struct obj_list *, UINT32);
54 struct tsp_object *obj_list_get_tspcontext(struct obj_list *, UINT32);
55 void		   obj_list_close(struct obj_list *, void (*)(void *), TSS_HCONTEXT);
56 void		   obj_connectContext(TSS_HCONTEXT, TCS_CONTEXT_HANDLE);
57 void		   obj_close_context(TSS_HCONTEXT);
58 void               obj_lists_remove_policy_refs(TSS_HPOLICY, TSS_HCONTEXT);
59 
60 /* prototypes for functions that may traverse more than one list */
61 TSS_RESULT	   obj_tcskey_get_pubkeyhash(TCS_KEY_HANDLE, BYTE *);
62 
63 #include "obj_tpm.h"
64 #include "obj_context.h"
65 #include "obj_hash.h"
66 #include "obj_pcrs.h"
67 #include "obj_policy.h"
68 #include "obj_rsakey.h"
69 #include "obj_encdata.h"
70 #include "obj_daacred.h"
71 #include "obj_daaarakey.h"
72 #include "obj_daaissuerkey.h"
73 #include "obj_nv.h"
74 #include "obj_delfamily.h"
75 #include "obj_migdata.h"
76 
77 
78 TPM_LIST_DECLARE_EXTERN;
79 CONTEXT_LIST_DECLARE_EXTERN;
80 HASH_LIST_DECLARE_EXTERN;
81 PCRS_LIST_DECLARE_EXTERN;
82 POLICY_LIST_DECLARE_EXTERN;
83 RSAKEY_LIST_DECLARE_EXTERN;
84 ENCDATA_LIST_DECLARE_EXTERN;
85 DAACRED_LIST_DECLARE_EXTERN;
86 DAAARAKEY_LIST_DECLARE_EXTERN;
87 DAAISSUERKEY_LIST_DECLARE_EXTERN;
88 NVSTORE_LIST_DECLARE_EXTERN;
89 DELFAMILY_LIST_DECLARE_EXTERN;
90 MIGDATA_LIST_DECLARE_EXTERN;
91 
92 #endif
93