MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClOsccaSm2_Types.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-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
38
39
40#ifndef MCUXCLOSCCASM2_TYPES_H_
41#define MCUXCLOSCCASM2_TYPES_H_
42
43
44#include <stdint.h>
45#include <mcuxClConfig.h> // Exported features flags header
46#include <mcuxClOscca_Types.h>
47#include <mcuxClCore_Macros.h>
50#include <mcuxCsslAnalysis.h>
51
52/**********************************************
53 * TYPEDEFS
54 **********************************************/
61
62/***********************************************************
63 * TYPES RELATED TO FUNCTION STATUS
64 **********************************************************/
65
69typedef uint32_t mcuxClOsccaSm2_Status_t;
70
71
72/***********************************************************
73 * MACROS
74 **********************************************************/
75#define MCUXCLOSCCASM2_CEILING(x,y) (((x) + (y) - 1u) / (y))
76#define MCUXCLOSCCASM2_BYTELEN(bitLen) (((bitLen) + 7u) / 8u)
77
84#define MCUXCLOSCCASM2_ENCDEC_FORMAT_INDICATOR_SIZE (1u)
85#define MCUXCLOSCCASM2_SM2P256_SIZE_PRIVATEKEY (32u)
86#define MCUXCLOSCCASM2_SM2P256_SIZE_PUBLICKEY (2u * MCUXCLOSCCASM2_SM2P256_SIZE_PRIVATEKEY)
87#define MCUXCLOSCCASM2_SM2P256_SIZE_SHAREDSECRET (32u)
88#define MCUXCLOSCCASM2_SM2P256_SIZE_PRIMEP (32u)
89#define MCUXCLOSCCASM2_SM2P256_SIZE_BASEPOINTORDER (32u)
90#define MCUXCLOSCCASM2_SM2P256_SIZE_MAX (32u) /* MCUXCLOSCCASM2_SM2P256_SIZE_ */
92#ifdef MCUXCL_FEATURE_SM2_SIGNATURE
93#define MCUXCLOSCCASM2_SM2P256_SIZE_SIGNATURE (2u * MCUXCLOSCCASM2_SM2P256_SIZE_BASEPOINTORDER)
94#endif /* MCUXCL_FEATURE_SM2_SIGNATURE */
95
96#ifdef MCUXCL_FEATURE_SM2_CIPHER
97#define MCUXCLOSCCASM2_SM2P256_SIZE_CIPHER_MESSAGE (128U)
98#endif /* MCUXCL_FEATURE_SM2_CIPHER */
99
100/**********************************************************/
101/* Parameter structure of mcuxClOscca SM2 APIs */
102/**********************************************************/
103typedef struct mcuxClOsccaSm2_DomainParam mcuxClOsccaSm2_DomainParam_t;
104
105#ifdef MCUXCL_FEATURE_SM2_INTERNAL
106#ifdef MCUXCL_FEATURE_SM2_SIGNATURE
107typedef struct mcuxClOsccaSm2_SignatureProtocolDescriptor mcuxClOsccaSm2_SignatureProtocolDescriptor_t;
108#endif /* MCUXCL_FEATURE_SM2_SIGNATURE */
109#endif /* MCUXCL_FEATURE_SM2_INTERNAL */
110
111/***********************************************************
112 * MACROS RELATED TO FUNCTION STATUS
113 **********************************************************/
114#define MCUXCLOSCCASM2_STATUS_OK ((mcuxClOsccaSm2_Status_t)0x011B2E03u)
115#define MCUXCLOSCCASM2_STATUS_FAILURE ((mcuxClOsccaSm2_Status_t)0x011B5354U)
116#define MCUXCLOSCCASM2_STATUS_INVALID_PARAMS ((mcuxClOsccaSm2_Status_t)0x011B5330u)
117#define MCUXCLOSCCASM2_STATUS_RNG_ERROR ((mcuxClOsccaSm2_Status_t)0x011B5334U)
118#define MCUXCLOSCCASM2_STATUS_INVALID_SIGNATURE ((mcuxClOsccaSm2_Status_t)0x011B8930u)
119#define MCUXCLOSCCASM2_STATUS_FAULT_ATTACK ((mcuxClOsccaSm2_Status_t)0x011BF0F0u)
120 /* mcuxClOsccaSm2_Types */
124
125
126#endif /* MCUXCLOSCCASM2_TYPES_H_ */
Definition of macros.
Definition of function identifiers for the flow protection mechanism.
: Global type definitions
Provides the API for the CSSL flow protection mechanism.
uint32_t mcuxClOsccaSm2_Status_t
Type for SM2 status codes.
Definition mcuxClOsccaSm2_Types.h:69