TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ps_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __PS_UTILS_H__
9 #define __PS_UTILS_H__
10 
11 #include <stdint.h>
12 
13 #include "psa/error.h"
14 #include "psa/protected_storage.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #define PS_INVALID_FID 0
21 #define PS_DEFAULT_EMPTY_BUFF_VAL 0
22 
35 #define PS_UTILS_BOUND_CHECK(err_msg, data_size, data_buf_size) \
36 typedef char err_msg[(data_size <= data_buf_size)*2 - 1]
37 
41 #define PS_UTILS_MIN(x, y) (((x) < (y)) ? (x) : (y))
42 
61 psa_status_t ps_utils_check_contained_in(uint32_t superset_size,
62  uint32_t subset_offset,
63  uint32_t subset_size);
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif /* __PS_UTILS_H__ */
psa_status_t ps_utils_check_contained_in(uint32_t superset_size, uint32_t subset_offset, uint32_t subset_size)
Checks if a subset region is fully contained within a superset region.
Definition: ps_utils.c:10
Standard error codes for the SPM and RoT Services.
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:43