TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_memory_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __TFM_MEMORY_UTILS_H__
9 #define __TFM_MEMORY_UTILS_H__
10 
11 #include <string.h>
12 #include "cmsis_compiler.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /* FIXME: The following functions are wrappers around standard C library
19  * functions: memcpy, memcmp, memset
20  * In long term standard C library might be removed from TF-M project or
21  * replaced with a secure implementation due to security concerns.
22  */
23 __attribute__ ((always_inline)) __STATIC_INLINE
24 void *tfm_memcpy(void *dest, const void *src, size_t num)
25 {
26  return (memcpy(dest, src, num));
27 }
28 
29 __attribute__ ((always_inline)) __STATIC_INLINE
30 int tfm_memcmp(const void *ptr1, const void *ptr2, size_t num)
31 {
32  return (memcmp(ptr1, ptr2, num));
33 }
34 
35 __attribute__ ((always_inline)) __STATIC_INLINE
36 void *tfm_memset(void *ptr, int value, size_t num)
37 {
38  return (memset(ptr, value, num));
39 }
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* __TFM_MEMORY_UTILS_H__ */
__STATIC_INLINE void * tfm_memset(void *ptr, int value, size_t num)
int memcmp(const void *s1, const void *s2, size_t n)
Definition: crt_memcmp.c:11
__STATIC_INLINE void * tfm_memcpy(void *dest, const void *src, size_t num)
void * memcpy(void *dest, const void *src, size_t n)
Definition: crt_memcpy.c:10
__STATIC_INLINE int tfm_memcmp(const void *ptr1, const void *ptr2, size_t num)
void * memset(void *s, int c, size_t n)
Definition: crt_memset.c:10