MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClExample_ELS_Key_Helper.h
1/*--------------------------------------------------------------------------*/
2/* Copyright 2022 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
34#ifndef MCUXCLEXAMPLE_ELS_KEY_HELPER_H_
35#define MCUXCLEXAMPLE_ELS_KEY_HELPER_H_
36
37#include <mcuxClConfig.h> // Exported features flags header
38#include <mcuxClCore_Platform.h>
39#include <mcuxClEls.h>
40#include <mcuxClExample_RFC3394_Helper.h>
43
48static inline bool mcuxClExample_Els_KeyDelete(mcuxClEls_KeyIndex_t keyIdx)
49{
51 // mcuxClEls_KeyDelete_Async is a flow-protected function: Check the protection token and the return value
53 {
54 return false; // Expect that no error occurred, meaning that the mcuxClEls_KeyDelete_Async operation was started.
55 }
57
58 MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(result, token, mcuxClEls_WaitForOperation(MCUXCLELS_ERROR_FLAGS_CLEAR)); // Wait for the mcuxClEls_KeyDelete_Async operation to complete.
59 // mcuxClEls_WaitForOperation is a flow-protected function: Check the protection token and the return value
61 {
62 return false;
63 }
65 return true;
66}
67
71static inline bool mcuxClExample_Els_KeyDeleteAll(void)
72{
74 // mcuxClEls_Reset_Async is a flow-protected function: Check the protection token and the return value
76 {
77 return false;
78 }
80
81 MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(result, token, mcuxClEls_WaitForOperation(MCUXCLELS_ERROR_FLAGS_CLEAR)); // Wait for the mcuxClEls_Reset_Async operation to complete.
82 // mcuxClEls_WaitForOperation is a flow-protected function: Check the protection token and the return value
84 {
85 return false;
86 }
88 return true;
89}
90
91
92#endif /* MCUXCLEXAMPLE_ELS_KEY_HELPER_H_ */
Definition of function identifiers for the flow protection mechanism.
Top-level include file for the ELS driver.
Provides the API for the CSSL flow protection mechanism.
#define MCUXCLELS_ERROR_FLAGS_CLEAR
Set this option at mcuxClEls_ErrorHandling_t to clear all ELS error flags.
Definition mcuxClEls_Common.h:130
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Reset_Async(mcuxClEls_ResetOption_t options)
Perform a synchronous reset of the ELS.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_WaitForOperation(mcuxClEls_ErrorHandling_t errorHandling)
Wait for an ELS operation and optionally clear the error status.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_KeyDelete_Async(mcuxClEls_KeyIndex_t keyIdx)
Deletes a key from keystore at the given index.
#define MCUXCLELS_STATUS_OK
No error occurred.
Definition mcuxClEls_Types.h:191
#define MCUXCLELS_STATUS_OK_WAIT
An _Async function successfully started an ELS command. Call mcuxClEls_WaitForOperation to complete i...
Definition mcuxClEls_Types.h:192
uint32_t mcuxClEls_KeyIndex_t
Type for ELS keystore indices.
Definition mcuxClEls_Types.h:242
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition mcuxCsslFlowProtection.h:601
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:755
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition mcuxCsslFlowProtection.h:636