blob: 45dc42cb0260fcb9795b7ff55137305207ebfbcc [file] [log] [blame]
Antonio de Angelis2eeac642018-08-21 14:23:22 +01001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __TFM_AUDIT_VENEERS_H__
9#define __TFM_AUDIT_VENEERS_H__
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include <stdint.h>
16#include "psa_audit_defs.h"
17#include "audit_wrappers.h"
18
19/**
20 * \brief Retrieves a record at the specified index (Veneer)
21 *
22 * \details The function retrieves an item specified by index and returns
23 * it on the buffer provided. The token is passed as a challenge
24 * value for the encryption scheme
25 *
26 * \note Currently the cryptography support is not yet enabled, so the
27 * token value is not used and must be passed as NULL, with 0 size
28 *
29 * \param[in] input_s Pointer to the structure containing input parameters
30 * associated with \ref psa_audit_retrieve_record
31 * \param[out] output_s Pointer to the structure containing output parameters
32 * associated with \ref psa_audit_retrieve_record
33 *
34 * \return Returns values as specified by the \ref psa_audit_err
35 *
36 */
37enum psa_audit_err tfm_audit_veneer_retrieve_record(
38 const struct audit_core_retrieve_input *input_s,
39 struct audit_core_retrieve_output *output_s);
40/**
41 * \brief Adds a record (Veneer)
42 *
43 * \details This function adds a record. This is a Secure only callable function
44 *
45 * \note This is a Secure only callable API, Non-Secure calls will
46 * always return error
47 *
48 * \param[in] record Pointer to the memory buffer containing the record
49 * to be added
50 *
51 * \return Returns values as specified by the \ref psa_audit_err
52 *
53 */
54enum psa_audit_err tfm_audit_veneer_add_record(
55 const struct psa_audit_record *record);
56
57/**
58 * \brief Returns the total number and size of the records stored (Veneer)
59 *
60 * \details The function returns the total size in bytes and the
61 * total number of records stored
62 *
63 * \param[out] num_records Total number of records stored
64 * \param[out] size Total size of the records stored, in bytes
65 *
66 * \return Returns values as specified by the \ref psa_audit_err
67 *
68 */
69enum psa_audit_err tfm_audit_veneer_get_info(uint32_t *num_records,
70 uint32_t *size);
71/**
72 * \brief Returns the size of the record at the specified index (Veneer)
73 *
74 * \details The function returns the size of the record at the given index
75 * provided as input
76 *
77 * \param[in] record_index Index of the record to return the size
78 * \param[out] size Size of the specified record, in bytes
79 *
80 * \return Returns values as specified by the \ref psa_audit_err
81 *
82 */
83enum psa_audit_err tfm_audit_veneer_get_record_info(const uint32_t record_index,
84 uint32_t *size);
85/**
86 * \brief Deletes a record at the specified index (Veneer)
87 *
88 * \details The function removes a record at the specified index. It passes
89 * an authorisation token for removal which is a MAC of the plain text
90 *
91 * \note Currently the cryptography support is not yet enabled, so the
92 * token value is not used and must be passed as NULL, with 0 size
93 *
94 * \note This is an experimental API function
95 *
96 * \param[in] record_index Index of the record to be removed. Currently, only
97 * the removal of the oldest entry, i.e. record_index 0
98 * is supported
99 * \param[in] token Must be set to NULL. Token used as authorisation for
100 * removal of the specified record_index
101 * \param[in] token_size Must be set to 0. Size in bytes of the token used as
102 * authorisation for removal
103 *
104 * \return Returns values as specified by the \ref psa_audit_err
105 *
106 */
107enum psa_audit_err tfm_audit_veneer_delete_record(const uint32_t record_index,
108 const uint8_t *token,
109 const uint32_t token_size);
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* __TFM_AUDIT_VENEERS_H__ */