xref: /netbsd-src/crypto/external/cpl/trousers/dist/src/include/tcsem.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-2006
8  *
9  */
10 
11 #ifndef _TCSEM_H_
12 #define _TCSEM_H_
13 
14 struct ext_log_source {
15         int (*open)(void *, FILE **);
16         TSS_RESULT (*get_entries_by_pcr)(FILE *, UINT32, UINT32, UINT32 *, TSS_PCR_EVENT **);
17         TSS_RESULT (*get_entry)(FILE *, UINT32, UINT32 *, TSS_PCR_EVENT **);
18         int (*close)(FILE *);
19 };
20 
21 struct event_wrapper {
22 	TSS_PCR_EVENT event;
23 	struct event_wrapper *next;
24 };
25 
26 struct event_log {
27 	MUTEX_DECLARE(lock);
28 	struct ext_log_source *firmware_source;
29 	struct ext_log_source *kernel_source;
30 	struct event_wrapper **lists;
31 };
32 
33 /* include the compiled-in log sources and struct references here */
34 #include "imaem.h"
35 #include "biosem.h"
36 
37 #ifdef EVLOG_SOURCE_IMA
38 #define EVLOG_IMA_SOURCE	&ima_source
39 #else
40 #define EVLOG_IMA_SOURCE	NULL
41 #endif
42 
43 #ifdef EVLOG_SOURCE_BIOS
44 #define EVLOG_BIOS_SOURCE	&bios_source
45 #else
46 #define EVLOG_BIOS_SOURCE	NULL
47 #endif
48 
49 
50 TSS_RESULT event_log_init();
51 TSS_RESULT event_log_final();
52 TSS_RESULT copy_pcr_event(TSS_PCR_EVENT *, TSS_PCR_EVENT *);
53 TSS_RESULT event_log_add(TSS_PCR_EVENT *, UINT32 *);
54 TSS_PCR_EVENT *get_pcr_event(UINT32, UINT32);
55 UINT32 get_num_events(UINT32);
56 TSS_PCR_EVENT *concat_pcr_events(TSS_PCR_EVENT **, UINT32, TSS_PCR_EVENT *, UINT32);
57 UINT32 get_pcr_event_size(TSS_PCR_EVENT *);
58 void free_external_events(UINT32, TSS_PCR_EVENT *);
59 
60 extern struct event_log *tcs_event_log;
61 
62 #endif
63