MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClOsccaSm2_Functions.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2022-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 MCUXCLOSCCASM2_FUNCTIONS_H_
41#define MCUXCLOSCCASM2_FUNCTIONS_H_
42
43
44#include <stdint.h>
45#include <mcuxClConfig.h> // Exported features flags header
46#include <mcuxClCore_Platform.h>
47#include <mcuxClBuffer.h>
48#include <mcuxClKey_Types.h>
49#include <mcuxClSession.h>
51#include <mcuxClKey_Types.h>
52#ifdef MCUXCL_FEATURE_SM2_CIPHER
53#include <mcuxClCipher_Types.h>
54#endif /* MCUXCL_FEATURE_SM2_CIPHER */
57
58#ifdef __cplusplus
59extern "C"
60{
61#endif
62
69/**********************************************************/
70/* Public APIs of mcuxClOsccaSm2 */
71/**********************************************************/
72#ifdef MCUXCL_FEATURE_SM2_INTERNAL
73
74#ifdef MCUXCL_FEATURE_SM2_KEYGEN
75
93MCUX_CSSL_FP_FUNCTION_DECL(mcuxClOsccaSm2_GenerateKeyPair, mcuxClKey_KeyGenFct_t)
94MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClKey_Status_t) mcuxClOsccaSm2_GenerateKeyPair(
96 mcuxClKey_Generation_t generation,
97 mcuxClKey_Handle_t privKey,
99);
100
101#endif /* MCUXCL_FEATURE_SM2_KEYGEN */
102
103#ifdef MCUXCL_FEATURE_SM2_CIPHER
104
105MCUX_CSSL_FP_FUNCTION_DECL(mcuxClOsccaSm2_Cipher_SkeletonSM2, mcuxClCipher_CryptFunc_t)
106MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClCipher_Status_t) mcuxClOsccaSm2_Cipher_SkeletonSM2(
108 mcuxClCipher_Context_t * const pContext,
112 uint32_t ivLength,
114 uint32_t inLength,
115 mcuxCl_Buffer_t pOut,
116 uint32_t * const pOutLength,
117 uint32_t steps
118);
119
120#endif /* MCUXCL_FEATURE_SM2_CIPHER */
121
122#ifdef MCUXCL_FEATURE_SM2_KEYAGREEMENT
123MCUX_CSSL_FP_FUNCTION_DECL(mcuxClOsccaSm2_key_agreement, mcuxClKey_AgreementFct_t)
124MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClKey_Status_t) mcuxClOsccaSm2_key_agreement(
126 mcuxClKey_Agreement_t agreement,
128 mcuxClKey_Handle_t otherKey,
129 mcuxClKey_Agreement_AdditionalInput_t additionalInputs[],
130 uint32_t numberOfInputs,
131 uint8_t * pOut,
132 uint32_t * const pOutLength
133);
134
135MCUX_CSSL_FP_FUNCTION_DECL(mcuxClOsccaSm2_KeyAgreement_SelfTest, mcuxClKey_Agreement_SelfTestFct_t)
136MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClKey_Status_t) mcuxClOsccaSm2_KeyAgreement_SelfTest(
138 mcuxClKey_Agreement_t agreement
139);
140#endif /* MCUXCL_FEATURE_SM2_KEYAGREEMENT */
141#endif /* MCUXCL_FEATURE_SM2_INTERNAL */
142
143MCUX_CSSL_FP_FUNCTION_DECL(mcuxClOsccaSm2_Signature_PreHash)
144MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClOsccaSm2_Status_t) mcuxClOsccaSm2_Signature_PreHash(
147 mcuxCl_InputBuffer_t pIdentifier,
148 uint16_t identifierSize,
149 mcuxCl_Buffer_t pPrehash,
150 uint32_t * const prehashSize
151);
152 /* mcuxClOsccaSm2_Functions */
156
157#ifdef __cplusplus
158} /* extern "C" */
159#endif
160
161#endif /* MCUXCLOSCCASM2_FUNCTIONS_H_ */
Top-level include file for the mcuxClBuffer component.
Type definitions for the mcuxClCipher component.
Type definitions for the mcuxClKey component.
Type definitions of mcuxClOsccaSm2 component.
Definition of function identifiers for the flow protection mechanism.
Top-level include file for the mcuxClSession component.
Provides the API for the CSSL flow protection mechanism.
const uint8_t * mcuxCl_InputBuffer_t
Input buffer type.
Definition mcuxClBuffer_Pointer.h:58
uint8_t * mcuxCl_Buffer_t
Input/output buffer type.
Definition mcuxClBuffer_Pointer.h:67
struct mcuxClCipher_Context mcuxClCipher_Context_t
Cipher context type.
Definition mcuxClCipher_Types.h:120
const mcuxClCipher_ModeDescriptor_t *const mcuxClCipher_Mode_t
Cipher mode/algorithm type.
Definition mcuxClCipher_Types.h:81
uint32_t mcuxClCipher_Status_t
Cipher status code.
Definition mcuxClCipher_Types.h:128
uint32_t mcuxClKey_Status_t
Type for Key component error codes.
Definition mcuxClKey_Types.h:67
const mcuxClKey_GenerationDescriptor_t *const mcuxClKey_Generation_t
Key generation type.
Definition mcuxClKey_Types.h:245
mcuxClKey_Descriptor_t *const mcuxClKey_Handle_t
Key handle type.
Definition mcuxClKey_Types.h:108
uint32_t mcuxClOsccaSm2_Status_t
Type for SM2 status codes.
Definition mcuxClOsccaSm2_Types.h:69
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