TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
audit_core.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
3  * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  */
8 
9 #ifndef __AUDIT_CORE_H__
10 #define __AUDIT_CORE_H__
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include <stdint.h>
17 #include <stddef.h>
18 #include <limits.h>
19 
20 #include "psa_audit_defs.h"
21 #include "psa/error.h"
22 
23 #define UNIFORM_SIGNATURE_API(api_name) \
24  psa_status_t api_name(psa_invec[], size_t, psa_outvec[], size_t)
25 
60 #define LOG_MIN_SIZE (4)
61 
71 
72  /* This is used to force the maximum size */
73  TLV_TYPE_MAX = INT_MAX
74 };
75 
83  uint32_t length;
84  uint8_t value[];
85 };
86 
92 #define LOG_MAC_SIZE (4)
93 
99 struct log_hdr {
100  uint64_t timestamp;
101  uint32_t iv_counter;
102  int32_t partition_id;
103  uint32_t size;
104  uint32_t id;
105 };
106 
112 struct log_tlr {
113  uint8_t mac[LOG_MAC_SIZE];
114 };
115 
121 #define LOG_HDR_SIZE (sizeof(struct log_hdr))
122 
128 #define LOG_TLR_SIZE (sizeof(struct log_tlr))
129 
138 
139 #define LIST_TFM_AUDIT_UNIFORM_SIGNATURE_API \
140  X(audit_core_delete_record) \
141  X(audit_core_get_info) \
142  X(audit_core_get_record_info) \
143  X(audit_core_add_record) \
144  X(audit_core_retrieve_record) \
145 
146 #define X(api_name) UNIFORM_SIGNATURE_API(api_name);
148 #undef X
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif /* __AUDIT_CORE_H__ */
uint32_t length
Definition: audit_core.h:83
uint32_t size
Definition: audit_core.h:103
#define LIST_TFM_AUDIT_UNIFORM_SIGNATURE_API
Definition: audit_core.h:139
uint32_t iv_counter
Definition: audit_core.h:101
Fixed size header for a log record.
Definition: audit_core.h:99
#define LOG_MAC_SIZE
Size in bytes of the MAC for each entry.
Definition: audit_core.h:92
Standard error codes for the SPM and RoT Services.
uint8_t mac[(4)]
Definition: audit_core.h:113
TLV entry structure with a flexible array member.
Definition: audit_core.h:81
uint32_t id
Definition: audit_core.h:104
uint8_t value[]
Definition: audit_core.h:84
enum audit_tlv_type type
Definition: audit_core.h:82
psa_status_t audit_core_init(void)
Initializes the Audit logging service during the TFM boot up process.
Definition: audit_core.c:465
Fixed size logging entry trailer.
Definition: audit_core.h:112
int32_t partition_id
Definition: audit_core.h:102
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:43
audit_tlv_type
Possible types for a TLV entry in payload.
Definition: audit_core.h:68
uint64_t timestamp
Definition: audit_core.h:100