tpm2-tss  3.2.1
TPM Software stack 2.0 TCG spec compliant implementation
ifapi_ima_eventlog.h
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*******************************************************************************
3  * Copyright 2018-2019, Fraunhofer SIT sponsored by Infineon Technologies AG
4  * All rights reserved.
5  *******************************************************************************/
6 #ifndef IFAPI_IMA_EVENTLOG_H
7 #define IFAPI_IMA_EVENTLOG_H
8 
9 #include <json-c/json.h>
10 
11 #include "fapi_types.h"
12 
13 /* Defines from kernel ima.h" */
14 #define TCG_EVENT_NAME_LEN_MAX 255
15 #define IMA_TEMPLATE_FIELD_ID_MAX_LEN 16
16 #define IMA_TEMPLATE_NUM_FIELDS_MAX 15
17 
18 /* Define from kernel crypt.h */
19 #define CRYPTO_MAX_ALG_NAME 128
20 
21 typedef UINT32 IFAPI_IMA_EVENT_TYPE;
22 #define IFAPI_IMA_EVENT_TAG_IMA 1
23 #define IFAPI_IMA_EVENT_TAG_NG 2
24 #define IFAPI_IMA_EVENT_TAG_SIG 3
26 /* Structure to store event header and data of IMA template */
27 typedef struct {
28  /* header is the First part of the template which will be read
29  beforte the rest of the event will be read and parsed. */
30  struct {
31  UINT32 pcr;
32  UINT8 digest[TPM2_SHA512_DIGEST_SIZE + sizeof(UINT32) + 3];
33  } header;
34  UINT32 ima_type_size;
35  size_t hash_size;
36  TPMI_ALG_HASH hash_alg;
37  char ima_type[TCG_EVENT_NAME_LEN_MAX + 1];
38  char *name;
39  UINT32 event_size;
40  UINT8 *event_buffer;
42 
45 typedef struct {
46  IFAPI_IMA_EVENT_TYPE template_name;
49 
50 TSS2_RC
52 
53 TSS2_RC
54 ifapi_json_IFAPI_IMA_EVENT_TYPE_deserialize_txt(json_object *jso,
55  IFAPI_IMA_EVENT_TYPE *out);
56 
57 TSS2_RC ifapi_read_ima_event_log(
58  const char *filename,
59  const uint32_t *pcrList,
60  const size_t pcrListSize,
61  json_object **jso_list);
62 
63 TSS2_RC
64 ifapi_get_ima_eventname(IFAPI_IMA_EVENT *event, char **name);
65 
66 #endif /* IFAPI_IMA_EVENTLOG_H */
TSS2_RC ifapi_json_IFAPI_IMA_EVENT_deserialize(json_object *jso, IFAPI_IMA_EVENT *out)
Definition: ifapi_ima_eventlog.c:775
Definition: ifapi_ima_eventlog.h:45
UINT8_ARY template_value
Definition: ifapi_ima_eventlog.h:47
Definition: ifapi_ima_eventlog.h:27
UINT8 * event_buffer
Definition: ifapi_ima_eventlog.h:40
Definition: fapi_types.h:15