Home | History | Annotate | Line # | Download | only in include
      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
      8  *
      9  */
     10 
     11 #ifndef _TCSPS_H_
     12 #define _TCSPS_H_
     13 
     14 #include "threads.h"
     15 
     16 extern struct key_disk_cache *key_disk_cache_head;
     17 /* file handles for the persistent stores */
     18 extern int system_ps_fd;
     19 /* The lock that surrounds all manipulations of the disk cache */
     20 MUTEX_DECLARE_EXTERN(disk_cache_lock);
     21 
     22 int		   get_file();
     23 int		   put_file(int);
     24 void		   close_file(int);
     25 void		   ps_destroy();
     26 
     27 TSS_RESULT  read_data(int, void *, UINT32);
     28 TSS_RESULT  write_data(int, void *, UINT32);
     29 
     30 int		   write_key_init(int, UINT32, UINT32, UINT32);
     31 TSS_RESULT	   cache_key(UINT32, UINT16, TSS_UUID *, TSS_UUID *, UINT16, UINT32, UINT32);
     32 TSS_RESULT	   UnloadBlob_KEY_PS(UINT16 *, BYTE *, TSS_KEY *);
     33 TSS_RESULT	   psfile_get_parent_uuid_by_uuid(int, TSS_UUID *, TSS_UUID *);
     34 TSS_RESULT	   psfile_remove_key_by_uuid(int, TSS_UUID *);
     35 TSS_RESULT	   psfile_get_key_by_uuid(int, TSS_UUID *, BYTE *, UINT16 *);
     36 TSS_RESULT	   psfile_get_key_by_cache_entry(int, struct key_disk_cache *, BYTE *, UINT16 *);
     37 TSS_RESULT	   psfile_get_ps_type_by_uuid(int, TSS_UUID *, UINT32 *);
     38 TSS_RESULT	   psfile_get_vendor_data(int, struct key_disk_cache *, UINT32 *, BYTE **);
     39 TSS_RESULT	   psfile_is_pub_registered(int, TCPA_STORE_PUBKEY *, TSS_BOOL *);
     40 TSS_RESULT	   psfile_get_uuid_by_pub(int, TCPA_STORE_PUBKEY *, TSS_UUID **);
     41 TSS_RESULT	   psfile_write_key(int, TSS_UUID *, TSS_UUID *, UINT32 *, BYTE *, UINT32, BYTE *, UINT16);
     42 TSS_RESULT	   psfile_remove_key(int, struct key_disk_cache *);
     43 TCPA_STORE_PUBKEY *psfile_get_pub_by_tpm_handle(int, TCPA_KEY_HANDLE);
     44 TSS_RESULT	   psfile_get_tpm_handle_by_pub(int, TCPA_STORE_PUBKEY *, TCPA_KEY_HANDLE *);
     45 TSS_RESULT	   psfile_get_tcs_handle_by_pub(int, TCPA_STORE_PUBKEY *, TCS_KEY_HANDLE *);
     46 TSS_RESULT	   psfile_get_parent_tcs_handle_by_pub(int, TCPA_STORE_PUBKEY *, TCS_KEY_HANDLE *);
     47 TCPA_STORE_PUBKEY *psfile_get_pub_by_tcs_handle(int, TCS_KEY_HANDLE);
     48 TSS_RESULT	   psfile_get_key_by_pub(int, TCPA_STORE_PUBKEY *, UINT32 *, BYTE **);
     49 TSS_RESULT	   ps_remove_key(TSS_UUID *);
     50 int		   init_disk_cache(int);
     51 int		   close_disk_cache(int);
     52 TSS_RESULT	   clean_disk_cache(int);
     53 
     54 TSS_RESULT	   ps_write_key(TSS_UUID *, TSS_UUID *, BYTE *, UINT32, BYTE *, UINT32);
     55 TSS_RESULT	   ps_get_key_by_uuid(TSS_UUID *, BYTE *, UINT16 *);
     56 TSS_RESULT	   ps_get_key_by_cache_entry(struct key_disk_cache *, BYTE *, UINT16 *);
     57 TSS_RESULT	   ps_get_vendor_data(struct key_disk_cache *, UINT32 *, BYTE **);
     58 TSS_RESULT	   ps_init_disk_cache();
     59 void		   ps_close_disk_cache();
     60 TSS_RESULT	   ps_get_key_by_pub(TCPA_STORE_PUBKEY *, UINT32 *, BYTE **);
     61 
     62 #ifdef TSS_BUILD_PS
     63 #define PS_init_disk_cache()	ps_init_disk_cache()
     64 #define PS_close_disk_cache()	ps_close_disk_cache()
     65 #else
     66 #define PS_init_disk_cache()	(TSS_SUCCESS)
     67 #define PS_close_disk_cache()
     68 #endif
     69 
     70 #endif
     71