MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClBuffer_Pointer.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2022-2025 NXP */
3/* */
4/* SPDX-License-Identifier: BSD-3-Clause */
5/* */
6/* Redistribution and use in source and binary forms, with or without */
7/* modification, are permitted provided that the following conditions are */
8/* met: */
9/* */
10/* 1. Redistributions of source code must retain the above copyright */
11/* notice, this list of conditions and the following disclaimer. */
12/* */
13/* 2. Redistributions in binary form must reproduce the above copyright */
14/* notice, this list of conditions and the following disclaimer in the */
15/* documentation and/or other materials provided with the distribution. */
16/* */
17/* 3. Neither the name of the copyright holder nor the names of its */
18/* contributors may be used to endorse or promote products derived from */
19/* this software without specific prior written permission. */
20/* */
21/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS */
22/* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
23/* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
24/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
25/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
26/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
27/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
28/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
29/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
30/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
31/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
32/*--------------------------------------------------------------------------*/
33
38
39#ifndef MCUXCLBUFFER_POINTER_H_
40#define MCUXCLBUFFER_POINTER_H_
41
42#include <mcuxClCore_Platform.h>
44
50
58typedef const uint8_t * mcuxCl_InputBuffer_t;
59
67typedef uint8_t * mcuxCl_Buffer_t;
68
79MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClBuffer_Status_t) mcuxClBuffer_import(mcuxCl_InputBuffer_t bufSrc, uint32_t offset, uint8_t *pDst, uint32_t byteLength);
80
91MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClBuffer_Status_t) mcuxClBuffer_export(mcuxCl_Buffer_t bufDst, uint32_t offset, const uint8_t *pSrc, uint32_t byteLength);
92
106#define MCUXCLBUFFER_INIT_PLAIN_RO_IMPL(_name, _info, _ptr, _size) \
107 mcuxCl_InputBuffer_t (_name) = (mcuxCl_InputBuffer_t)(_ptr)
108
122#define MCUXCLBUFFER_INIT_PLAIN_RW_IMPL(_name, _info, _ptr, _size) \
123 mcuxCl_Buffer_t (_name) = (mcuxCl_Buffer_t)(_ptr)
124
138#define MCUXCLBUFFER_INIT_DMA_RO_IMPL(_name, _info, _ptr, _size) \
139 MCUXCLBUFFER_INIT_PLAIN_RO_IMPL(_name, _info, _ptr, _size)
140
154#define MCUXCLBUFFER_INIT_DMA_RW_IMPL(_name, _info, _ptr, _size) \
155 MCUXCLBUFFER_INIT_PLAIN_RW_IMPL(_name, _info, _ptr, _size)
156
171#define MCUXCLBUFFER_INIT_CUSTOM_IMPL(_name, _handler, _info, _spec, _ptr, _size) \
172 MCUXCLBUFFER_INIT_PLAIN_RW_IMPL(_name, _info, _ptr, _size)
173
174
183#define MCUXCLBUFFER_UPDATE_IMPL(_name, _offset) \
184 do { (_name) += (_offset); } while(false)
185
195#define MCUXCLBUFFER_DERIVE_RO_IMPL(_name, _original, _offset) \
196 mcuxCl_InputBuffer_t (_name) = (mcuxCl_InputBuffer_t) &(_original)[_offset]
197
207#define MCUXCLBUFFER_DERIVE_RW_IMPL(_name, _original, _offset) \
208 mcuxCl_Buffer_t (_name) = (mcuxCl_Buffer_t) &(_original)[_offset]
209
219#define MCUXCLBUFFER_SET_IMPL(_name, _ptr, _size) \
220 do { (_name) = (_ptr); } while(false)
221
229#define MCUXCLBUFFER_GET_IMPL(_name) \
230 (_name)
231
239#define MCUXCLBUFFER_IS_NULL_IMPL(_name) \
240 (NULL == MCUXCLBUFFER_GET_IMPL(_name))
241
242
243#endif /* MCUXCLBUFFER_POINTER_H_ */
uint32_t mcuxClBuffer_Status_t
Buffer status code.
Definition mcuxClBuffer_Constants.h:54
mcuxClBuffer_Status_t mcuxClBuffer_import(mcuxCl_InputBuffer_t bufSrc, uint32_t offset, uint8_t *pDst, uint32_t byteLength)
Perform a read from the buffer.
mcuxClBuffer_Status_t mcuxClBuffer_export(mcuxCl_Buffer_t bufDst, uint32_t offset, const uint8_t *pSrc, uint32_t byteLength)
Perform a write to the buffer.
Provides the API for the CSSL flow protection mechanism.
const uint8_t * mcuxCl_InputBuffer_t
Input buffer type.
Definition mcuxClBuffer_Pointer.h:58
uint8_t * mcuxCl_Buffer_t
Input/output buffer type.
Definition mcuxClBuffer_Pointer.h:67
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition mcuxCsslFlowProtection.h:186
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:158