1 /*
2  * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef BL1_UTIL_H
9 #define BL1_UTIL_H
10 
11 #include <stddef.h>
12 
13 #include "fih.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /**
20  * \brief                  Compares the given regions of memory for equality.
21  *
22  * \param[in]  ptr1        Pointer to the first memory region.
23  * \param[in]  ptr2        Pointer to the second memory region.
24  * \param[in]  size        Size of the two memory regions.
25  *
26  * \note                   This function is hardened against fault injection.
27  *
28  * \note                   This function only checks equality, and does not
29  *                         return any information about the elements which
30  *                         differ, so is semantically different to memcmp.
31  *
32  * \retval FIH_SUCCESS     The two given memory regions are identical.
33  * \retval FIH_FAILURE     The two given memory regions are not identical, or a
34  *                         failure has occurred and they cannot be compared.
35  */
36 fih_int bl_fih_memeql(const void *ptr1, const void *ptr2, size_t num);
37 
38 #ifdef __cplusplus
39 }
40 #endif
41 
42 #endif /* BL1_UTIL_H */
43