Antonio de Angelis | 12bc645 | 2018-08-01 10:24:50 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __PSA_AUDIT_DEFS_H__ |
| 9 | #define __PSA_AUDIT_DEFS_H__ |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | #include <stdint.h> |
| 16 | #include "tfm_api.h" |
| 17 | #include "limits.h" |
| 18 | |
| 19 | /* The return value is shared with the TFM partition status value. The Audit |
| 20 | * Log return codes shouldn't overlap with predefined TFM status values |
| 21 | */ |
| 22 | #define PSA_AUDIT_ERR_OFFSET (TFM_PARTITION_SPECIFIC_ERROR_MIN) |
| 23 | |
| 24 | enum psa_audit_err { |
| 25 | PSA_AUDIT_ERR_SUCCESS = 0, /*!< Operation successful */ |
| 26 | PSA_AUDIT_ERR_FAILURE = PSA_AUDIT_ERR_OFFSET, /*!< Generic failure */ |
| 27 | PSA_AUDIT_ERR_NOT_SUPPORTED, /*!< Operation not supported */ |
| 28 | |
| 29 | /* Following entry is only to ensure the error code of int size */ |
| 30 | PSA_AUDIT_ERR_FORCE_INT_SIZE = INT_MAX |
| 31 | }; |
| 32 | |
| 33 | /*! |
| 34 | * \struct psa_audit_record |
| 35 | * |
| 36 | * \brief This structure contains the record that is added to the audit log |
| 37 | * by the requesting secure service |
| 38 | */ |
| 39 | struct psa_audit_record { |
| 40 | uint32_t size; /*!< Size in bytes of the id and payload fields */ |
| 41 | uint32_t id; /*!< ID of the record */ |
| 42 | uint8_t payload[]; /*!< Flexible array member for payload */ |
| 43 | }; |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | } |
| 47 | #endif |
| 48 | |
| 49 | #endif /* __PSA_AUDIT_DEFS_H__ */ |