MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClExample_ELS_Helper.h
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2022 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 
14 #ifndef MCUXCLEXAMPLE_ELS_HELPER_H_
15 #define MCUXCLEXAMPLE_ELS_HELPER_H_
16 
17 #include <mcuxClConfig.h> // Exported features flags header
18 #include <mcuxClCore_Platform.h>
19 #include <mcuxClEls.h>
20 #include <mcuxCsslFlowProtection.h>
22 
28 static inline bool mcuxClExample_Els_Init(mcuxClEls_ResetOption_t options)
29 {
30  /* Enable ELS */
31  MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(result, token, mcuxClEls_Enable_Async()); // Enable the ELS.
32  // mcuxClEls_Enable_Async is a flow-protected function: Check the protection token and the return value
34  {
35  return false;
36  }
38 
39  MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(result, token, mcuxClEls_WaitForOperation(MCUXCLELS_ERROR_FLAGS_CLEAR)); // Wait for the mcuxClEls_Enable_Async operation to complete.
40  // mcuxClEls_WaitForOperation is a flow-protected function: Check the protection token and the return value
42  {
43  return false;
44  }
46 
47  /* Reset ELS */
49  // mcuxClEls_Reset_Async is a flow-protected function: Check the protection token and the return value
51  {
52  return false;
53  }
55 
56  MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(result, token, mcuxClEls_WaitForOperation(MCUXCLELS_ERROR_FLAGS_CLEAR)); // Wait for the mcuxClEls_Reset_Async operation to complete.
57  // mcuxClEls_WaitForOperation is a flow-protected function: Check the protection token and the return value
59  {
60  return false;
61  }
63  return true;
64 }
65 
69 static inline bool mcuxClExample_Els_Disable(void)
70 {
71  MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(result, token, mcuxClEls_Disable()); // Disable the ELS.
72  // mcuxClEls_Disable is a flow-protected function: Check the protection token and the return value
74  {
75  return false;
76  }
78  return true;
79 }
80 
81 #endif /* MCUXCLEXAMPLE_ELS_HELPER_H_ */
Top-level include file for the ELS driver.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Disable(void)
Disable the ELS.
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition: mcuxCsslFlowProtection.h:730
Provides the API for the CSSL flow protection mechanism.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_WaitForOperation(mcuxClEls_ErrorHandling_t errorHandling)
Wait for an ELS operation and optionally clear the error status.
#define MCUXCLELS_STATUS_OK
No error occurred.
Definition: mcuxClEls_Types.h:170
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Enable_Async(void)
Enables the ELS.
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition: mcuxCsslFlowProtection.h:576
uint32_t mcuxClEls_ResetOption_t
Type to handle ELS reset options.
Definition: mcuxClEls_Common.h:292
Definition of function identifiers for the flow protection mechanism.
#define MCUXCLELS_STATUS_OK_WAIT
An _Async function successfully started an ELS command. Call mcuxClEls_WaitForOperation to complete i...
Definition: mcuxClEls_Types.h:171
#define MCUXCLELS_ERROR_FLAGS_CLEAR
Set this option at mcuxClEls_ErrorHandling_t to clear all ELS error flags.
Definition: mcuxClEls_Common.h:137
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Reset_Async(mcuxClEls_ResetOption_t options)
Perform a synchronous reset of the ELS.
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition: mcuxCsslFlowProtection.h:611