MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClPkc_Functions.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2020-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 
20 #ifndef MCUXCLPKC_FUNCTIONS_H_
21 #define MCUXCLPKC_FUNCTIONS_H_
22 
23 
24 #include <mcuxClCore_Platform.h>
26 #include <mcuxCsslFlowProtection.h>
27 #include <mcuxClSession.h>
28 #include <mcuxClPkc_Types.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
42 /**********************************************************/
43 /* PKC initialization and deinitialization */
44 /**********************************************************/
54 typedef struct
55 {
56  uint16_t ctrl;
57  uint16_t cfg;
59 
60 
68 MCUX_CSSL_FP_FUNCTION_POINTER(mcuxClPkc_PkcInitializeEngine_t,
69 typedef MCUX_CSSL_FP_PROTECTED_TYPE(void) (* mcuxClPkc_PkcInitializeEngine_t)(mcuxClPkc_State_t *pState));
70 
78 MCUX_CSSL_FP_FUNCTION_POINTER(mcuxClPkc_PkcDeInitializeEngine_t,
79 typedef MCUX_CSSL_FP_PROTECTED_TYPE(void) (* mcuxClPkc_PkcDeInitializeEngine_t)(const mcuxClPkc_State_t *pState));
80 
89 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClPkc_Initialize, mcuxClPkc_PkcInitializeEngine_t)
91  mcuxClPkc_State_t *pState
92  );
94 #define MCUXCLPKC_FP_INITIALIZE(pState) \
95  MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_Initialize(pState))
96 
105 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClPkc_Deinitialize, mcuxClPkc_PkcDeInitializeEngine_t)
107  const mcuxClPkc_State_t *pState
108  );
110 #define MCUXCLPKC_FP_DEINITIALIZE(pState) \
111  MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_Deinitialize(pState))
112 
113  /* mcuxClPkc_Functions_Init */
117 
118 
119 /**********************************************************/
120 /* UPTR table */
121 /**********************************************************/
155  uint16_t *pUPTRT,
156  const uint8_t *pBaseBuffer,
157  uint16_t bufferLength,
158  uint8_t noOfBuffer
159  );
161 #define MCUXCLPKC_FP_GENERATEUPTRT(pUPTRT, pBaseBuffer, bufferSize, noOfBuffer) \
162  MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_GenerateUPTRT(pUPTRT, pBaseBuffer, bufferSize, noOfBuffer))
163 
196  mcuxClSession_Handle_t pSession,
197  uint16_t *pUPTRT,
198  uint8_t noOfBuffer
199  );
200 
236  mcuxClSession_Handle_t pSession,
237  uint16_t *pUPTRT,
238  uint16_t bufferLength,
239  uint8_t noOfBuffer
240  );
241  /* mcuxClPkc_Functions_UPTRT */
245 
246 
247 /**********************************************************/
248 /* PKC calculation */
249 /**********************************************************/
270  uint16_t param_mode,
271  uint32_t iR_iX_iY_iZ
272  );
273 
290  uint16_t param_mode,
291  uint32_t iR_iX_iY_C
292  );
293 
295 typedef const struct mcuxClPkc_FUPEntry * mcuxClPkc_PtrFUPEntry_t;
296 
310  uint8_t uLength
311  );
313 #define MCUXCLPKC_FP_CALCFUP(pUPTR, ulen) \
314  MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_CalcFup(pUPTR, ulen))
315 
317 #define MCUXCLPKC_FP_CALCFUP_OFFSET(pUPTR, skipLen, ulen) \
318  MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_CalcFup(&((mcuxClPkc_PtrFUPEntry_t) (pUPTR))[(skipLen)], ulen))
319  /* mcuxClPkc_Functions_Calculation */
323 
324 
325 /**********************************************************/
326 /* PKC wait functions */
327 /**********************************************************/
343 #define MCUXCLPKC_FP_WAITFORFINISH() \
344  MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_WaitForFinish())
345 
354 #define MCUXCLPKC_FP_WAITFORREADY() \
355  MCUX_CSSL_FP_FUNCTION_CALL_VOID(mcuxClPkc_WaitForReady())
356 
357  /* mcuxClPkc_Functions_Wait */
361  /* mcuxClPkc_Functions */
365 
366 #ifdef __cplusplus
367 } /* extern "C" */
368 #endif
369 
370 #endif /* MCUXCLPKC_FUNCTIONS_H_ */
void mcuxClPkc_CalcConst(uint16_t param_mode, uint32_t iR_iX_iY_C)
Start a PKC calculation with one constant parameter.
mcuxClPkc_Status_t mcuxClPkc_RandomizeUPTRT(mcuxClSession_Handle_t pSession, uint16_t *pUPTRT, uint8_t noOfBuffer)
Randomize UPTR table.
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition: mcuxClSession_Types.h:133
MCUX_CSSL_FP_FUNCTION_POINTER(mcuxClPkc_PkcInitializeEngine_t, typedef void(*mcuxClPkc_PkcInitializeEngine_t)(mcuxClPkc_State_t *pState))
Function type for PKC initialization engine.
Definition of function identifiers for the flow protection mechanism.
Top-level include file for the mcuxClSession component.
const struct mcuxClPkc_FUPEntry * mcuxClPkc_PtrFUPEntry_t
type of FUP program address.
Definition: mcuxClPkc_Functions.h:295
void mcuxClPkc_WaitForFinish(void)
Wait until PKC finishes calculations.
Type definitions of mcuxClPkc component.
Structure of PKC state backup.
Definition: mcuxClPkc_Functions.h:54
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition: mcuxCsslFlowProtection.h:125
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:55
void mcuxClPkc_Initialize(mcuxClPkc_State_t *pState)
initialize PKC hardware
void mcuxClPkc_CalcFup(mcuxClPkc_PtrFUPEntry_t pUPTR, uint8_t uLength)
Start a PKC FUP program calculation.
uint16_t cfg
backup of PKC CFG bits
Definition: mcuxClPkc_Functions.h:57
Provides the API for the CSSL flow protection mechanism.
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition: mcuxCsslFlowProtection.h:81
uint16_t ctrl
backup of PKC CTRL bits
Definition: mcuxClPkc_Functions.h:56
void mcuxClPkc_Deinitialize(const mcuxClPkc_State_t *pState)
deinitialize 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_Calc(uint16_t param_mode, uint32_t iR_iX_iY_iZ)
Start a PKC calculation.
void mcuxClPkc_GenerateUPTRT(uint16_t *pUPTRT, const uint8_t *pBaseBuffer, uint16_t bufferLength, uint8_t noOfBuffer)
Initialize UPTR table.