MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClOsccaSm2_CommonParams.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2022-2024 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
39
40
41#ifndef MCUXCLOSCCASM2_COMMONPARAMS_H_
42#define MCUXCLOSCCASM2_COMMONPARAMS_H_
43
44#include <mcuxClCore_Examples.h>
45#if MCUXCL_FEATURE_RANDOMMODES_OSCCA_TRNG == 0
46#include <mcuxClRandom.h>
47#include <mcuxClRandomModes.h>
48#include <mcuxClMemory.h>
50#endif
51
52#if MCUXCL_FEATURE_RANDOMMODES_OSCCA_TRNG == 0
53static const uint8_t mcuxClOsscaSm2_Example_PatchedRngValue[MCUXCLOSCCASM2_EXAMPLE_PATCH_SIZE] = {
54 0xa1, 0xba, 0xf0, 0xb2, 0x9f, 0x2b, 0x3d, 0x0d,
55 0x12, 0x73, 0x2f, 0x43, 0x36, 0xb6, 0x6e, 0x77,
56 0xd5, 0x21, 0x95, 0x72, 0x1e, 0xdb, 0x9a, 0x52,
57 0xf8, 0x6d, 0x0a, 0x56, 0x55, 0xc2, 0x45, 0x82,
58 0x10, 0x08, 0xe9, 0xd4, 0xbd, 0xce, 0xcd, 0x72,
59 0x74, 0xd4, 0x70, 0x85, 0x09, 0x25, 0x7a, 0xe5,
60 0xcf, 0x00, 0x98, 0x91, 0xce, 0x55, 0x5a, 0xce,
61 0x5c, 0x81, 0xc2, 0x29, 0xda, 0xd5, 0x1b, 0x83
62};
63
64static mcuxClRandom_Status_t RNG_Patch_function(
66 mcuxClRandom_Context_t pCustomCtx,
67 uint8_t *pOut,
68 uint32_t outLength
69)
70{
71 (void)pCustomCtx;
72 (void)session;
73 if(outLength > sizeof(mcuxClOsscaSm2_Example_PatchedRngValue))
74 {
76 }
77 MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN(memCopyToken, mcuxClMemory_copy(pOut, mcuxClOsscaSm2_Example_PatchedRngValue, outLength, outLength));
79 {
80 return MCUXCLEXAMPLE_STATUS_ERROR;
81 }
83
85}
86#endif /* MCUXCL_FEATURE_RANDOMMODES_PATCHMODE */
87
91
92#endif /* MCUXCLOSCCASM2_COMMONPARAMS_H_ */
Definition of function identifiers for the flow protection mechanism.
Top-level include file for the memory operations.
Top level header of mcuxClRandom component.
Top level header of mcuxClRandomModes component.
void mcuxClMemory_copy(uint8_t *pDst, uint8_t const *pSrc, size_t length, size_t bufLength)
Copies a memory buffer to another location.
uint32_t mcuxClRandom_Status_t
Type for status codes of mcuxClRandom component functions.
Definition mcuxClRandom_Types.h:68
mcuxClRandom_ContextDescriptor_t * mcuxClRandom_Context_t
Random context type.
Definition mcuxClRandom_Types.h:91
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition mcuxClSession_Types.h:133
#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN(...)
Call a flow protected void function and check the protection token.
Definition mcuxCsslFlowProtection.h:672
#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_END(...)
End a void function call section started by MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN.
Definition mcuxCsslFlowProtection.h:703
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:755
#define MCUXCLRANDOM_STATUS_ERROR
Random function returned error.
Definition mcuxClRandom_Constants.h:63
#define MCUXCLRANDOM_STATUS_OK
Random function returned successfully.
Definition mcuxClRandom_Constants.h:66