MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClOscca_Memory.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2016, 2021, 2023 NXP */
3 /* */
4 /* NXP Confidential. This software is owned or controlled by NXP and may */
5 /* only be used strictly in accordance with the applicable license terms. */
6 /* By expressly accepting such terms or by downloading, installing, */
7 /* activating and/or otherwise using the software, you are agreeing that */
8 /* you have read, and that you agree to comply with and are bound by, such */
9 /* license terms. If you do not agree to be bound by the applicable license */
10 /* terms, then you may not retain, install, activate or otherwise use the */
11 /* software. */
12 /*--------------------------------------------------------------------------*/
13 /* Security Classification: Company Confidential */
14 /*--------------------------------------------------------------------------*/
15 
23 #ifndef MCUXCLOSCCA_MEMORY_H_
24 #define MCUXCLOSCCA_MEMORY_H_
25 
26 #include <mcuxClConfig.h> // Exported features flags header
27 #include <mcuxCsslFlowProtection.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define MCUXCLOSCCA_SIZE_ALIGN_OFFSET (sizeof(size_t) - 1U)
35 
36 #define mcuxClOscca_alignAddress(address) \
37  ((void*)( (((size_t)(address)) + (sizeof(size_t) - 1U)) \
38  & ((size_t)(~(sizeof(size_t) - 1U))) ))
39 
40 #define mcuxClOscca_alignSize(size) \
41  ((size_t)(((size_t)(size)) + (sizeof(size_t) - 1U)) \
42  & ((size_t)(~(sizeof(size_t) - 1U))) )
43 
44 #define mcuxClOscca_alignAddressWithOffset(address, offset) \
45  ((void*)( (((size_t)(address) + (size_t)(offset)) + (sizeof(size_t) - 1U)) \
46  & ((size_t)(~(sizeof(size_t) - 1U))) ))
47 
48 #define mcuxClOscca_alignAddressToBoundary(address, boundary) \
49  ((void*)( (((size_t)(address)) + (boundary - 1U)) \
50  & ((size_t)(~(boundary - 1U))) ))
51 
52 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClOscca_FastSecureXor)
53 MCUX_CSSL_FP_PROTECTED_TYPE(void) mcuxClOscca_FastSecureXor(void *pTgt,
54  void *pSrc1,
55  void *pSrc2,
56  uint32_t length);
57 
58 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClOscca_switch_endianness)
59 MCUX_CSSL_FP_PROTECTED_TYPE(void) mcuxClOscca_switch_endianness(uint32_t *ptr, uint32_t length);
60 
61 #ifdef __cplusplus
62 } /* extern "C" */
63 #endif
64 
65 #endif /* MCUXCLOSCCA_MEMORY_H_ */
Definition of function identifiers for the flow protection mechanism.
Provides the API for the CSSL flow protection mechanism.
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition: mcuxCsslFlowProtection.h:125
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition: mcuxCsslFlowProtection.h:81