MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClPkc_Functions.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-2023 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
40#ifndef MCUXCLPKC_FUNCTIONS_H_
41#define MCUXCLPKC_FUNCTIONS_H_
42
43
44#include <mcuxClCore_Platform.h>
47#include <mcuxClSession.h>
48#include <mcuxClPkc_Types.h>
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
60
61
62/**********************************************************/
63/* PKC initialization and deinitialization */
64/**********************************************************/
70
74typedef struct
75{
76 uint16_t ctrl;
77 uint16_t cfg;
79
80
88MCUX_CSSL_FP_FUNCTION_POINTER(mcuxClPkc_PkcInitializeEngine_t,
89typedef MCUX_CSSL_FP_PROTECTED_TYPE(void) (* mcuxClPkc_PkcInitializeEngine_t)(mcuxClPkc_State_t *pState));
90
98MCUX_CSSL_FP_FUNCTION_POINTER(mcuxClPkc_PkcDeInitializeEngine_t,
99typedef MCUX_CSSL_FP_PROTECTED_TYPE(void) (* mcuxClPkc_PkcDeInitializeEngine_t)(const mcuxClPkc_State_t *pState));
100
109MCUX_CSSL_FP_FUNCTION_DECL(mcuxClPkc_Initialize, mcuxClPkc_PkcInitializeEngine_t)
111 mcuxClPkc_State_t *pState
112 );
114#define MCUXCLPKC_FP_INITIALIZE(pState) \
115 MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_Initialize(pState))
116
125MCUX_CSSL_FP_FUNCTION_DECL(mcuxClPkc_Deinitialize, mcuxClPkc_PkcDeInitializeEngine_t)
127 const mcuxClPkc_State_t *pState
128 );
130#define MCUXCLPKC_FP_DEINITIALIZE(pState) \
131 MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_Deinitialize(pState))
132
133 /* mcuxClPkc_Functions_Init */
137
138
139/**********************************************************/
140/* UPTR table */
141/**********************************************************/
147
175 uint16_t *pUPTRT,
176 const uint8_t *pBaseBuffer,
177 uint16_t bufferLength,
178 uint8_t noOfBuffer
179 );
181#define MCUXCLPKC_FP_GENERATEUPTRT(pUPTRT, pBaseBuffer, bufferSize, noOfBuffer) \
182 MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_GenerateUPTRT(pUPTRT, pBaseBuffer, bufferSize, noOfBuffer))
183
216 mcuxClSession_Handle_t pSession,
217 uint16_t *pUPTRT,
218 uint8_t noOfBuffer
219 );
220
256 mcuxClSession_Handle_t pSession,
257 uint16_t *pUPTRT,
258 uint16_t bufferLength,
259 uint8_t noOfBuffer
260 );
261 /* mcuxClPkc_Functions_UPTRT */
265
266
267/**********************************************************/
268/* PKC calculation */
269/**********************************************************/
275
290 uint16_t param_mode,
291 uint32_t iR_iX_iY_iZ
292 );
293
310 uint16_t param_mode,
311 uint32_t iR_iX_iY_C
312 );
313
315typedef const struct mcuxClPkc_FUPEntry * mcuxClPkc_PtrFUPEntry_t;
316
330 uint8_t uLength
331 );
333#define MCUXCLPKC_FP_CALCFUP(pUPTR, ulen) \
334 MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_CalcFup(pUPTR, ulen))
335
337#define MCUXCLPKC_FP_CALCFUP_OFFSET(pUPTR, skipLen, ulen) \
338 MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_CalcFup(&((mcuxClPkc_PtrFUPEntry_t) (pUPTR))[(skipLen)], ulen))
339 /* mcuxClPkc_Functions_Calculation */
343
344
345/**********************************************************/
346/* PKC wait functions */
347/**********************************************************/
353
363#define MCUXCLPKC_FP_WAITFORFINISH() \
364 MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_WaitForFinish())
365
374#define MCUXCLPKC_FP_WAITFORREADY() \
375 MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_WaitForReady())
376
377 /* mcuxClPkc_Functions_Wait */
381 /* mcuxClPkc_Functions */
385
386#ifdef __cplusplus
387} /* extern "C" */
388#endif
389
390#endif /* MCUXCLPKC_FUNCTIONS_H_ */
Definition of function identifiers for the flow protection mechanism.
Type definitions of mcuxClPkc component.
Top-level include file for the mcuxClSession component.
Provides the API for the CSSL flow protection mechanism.
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition mcuxClSession_Types.h:133
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition mcuxCsslFlowProtection.h:145
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:101
#define MCUX_CSSL_FP_FUNCTION_POINTER(type, definition)
Definition of a flow protected function pointer.
Definition mcuxCsslFlowProtection.h:215
void mcuxClPkc_Deinitialize(const mcuxClPkc_State_t *pState)
deinitialize PKC hardware
void mcuxClPkc_Initialize(mcuxClPkc_State_t *pState)
initialize PKC hardware
mcuxClPkc_Status_t mcuxClPkc_ReRandomizeUPTRT(mcuxClSession_Handle_t pSession, uint16_t *pUPTRT, uint16_t bufferLength, uint8_t noOfBuffer)
Randomize UPTR table and operands in PKC workarea.
void mcuxClPkc_GenerateUPTRT(uint16_t *pUPTRT, const uint8_t *pBaseBuffer, uint16_t bufferLength, uint8_t noOfBuffer)
Initialize UPTR table.
mcuxClPkc_Status_t mcuxClPkc_RandomizeUPTRT(mcuxClSession_Handle_t pSession, uint16_t *pUPTRT, uint8_t noOfBuffer)
Randomize UPTR table.
void mcuxClPkc_Calc(uint16_t param_mode, uint32_t iR_iX_iY_iZ)
Start a PKC calculation.
void mcuxClPkc_CalcConst(uint16_t param_mode, uint32_t iR_iX_iY_C)
Start a PKC calculation with one constant parameter.
const struct mcuxClPkc_FUPEntry * mcuxClPkc_PtrFUPEntry_t
type of FUP program address.
Definition mcuxClPkc_Functions.h:315
void mcuxClPkc_CalcFup(mcuxClPkc_PtrFUPEntry_t pUPTR, uint8_t uLength)
Start a PKC FUP program calculation.
void mcuxClPkc_WaitForFinish(void)
Wait until PKC finishes calculations.
void mcuxClPkc_WaitForReady(void)
Wait until PKC is ready to accept new calculation.
uint32_t mcuxClPkc_Status_t
Type for error codes used by PKC component functions.
Definition mcuxClPkc_Types.h:74
Structure of PKC state backup.
Definition mcuxClPkc_Functions.h:75
uint16_t ctrl
backup of PKC CTRL bits
Definition mcuxClPkc_Functions.h:76
uint16_t cfg
backup of PKC CFG bits
Definition mcuxClPkc_Functions.h:77