MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClRsa_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#ifndef MCUXCLRSA_TYPES_H_
40#define MCUXCLRSA_TYPES_H_
41
42#include <stdint.h>
43#include <stddef.h>
44#include <stdbool.h>
45#include <mcuxClConfig.h> // Exported features flags header
46#include <mcuxClSession.h>
49
50/***********************************************************
51 * MACROS
52 **********************************************************/
53
60
61/***********************************************************
62 * MACROS RELATED TO FUNCTION STATUS
63 **********************************************************/
64
71#define MCUXCLRSA_STATUS_VERIFYPRIMITIVE_OK ((mcuxClRsa_Status_t) 0x0FF62E0Bu )
72#define MCUXCLRSA_STATUS_SIGN_OK ((mcuxClRsa_Status_t) 0x0FF62E07u )
73#define MCUXCLRSA_STATUS_VERIFY_OK ((mcuxClRsa_Status_t) 0x0FF62E03u )
74#define MCUXCLRSA_STATUS_OK ((mcuxClRsa_Status_t) 0x0FF62E17u )
75#define MCUXCLRSA_STATUS_ERROR ((mcuxClRsa_Status_t) 0x0FF65330u )
76#define MCUXCLRSA_STATUS_INVALID_INPUT ((mcuxClRsa_Status_t) 0x0FF653F8u )
77#define MCUXCLRSA_STATUS_VERIFY_FAILED ((mcuxClRsa_Status_t) 0x0FF68930u )
78#define MCUXCLRSA_STATUS_FAULT_ATTACK ((mcuxClRsa_Status_t) 0x0FF6F0F0u )
79#define MCUXCLRSA_STATUS_KEYGENERATION_OK ((mcuxClRsa_Status_t) 0x0FF62E0Fu )
80#define MCUXCLRSA_STATUS_KEYGENERATION_ITERATIONSEXCEEDED ((mcuxClRsa_Status_t) 0x0FF68934u )
81#define MCUXCLRSA_STATUS_RNG_ERROR ((mcuxClRsa_Status_t) 0x0FF65338u )
82#define MCUXCLRSA_STATUS_ERROR_MEMORY_ALLOCATION ((mcuxClRsa_Status_t) 0x0FF65334u )
83
84
86
87
88/***********************************************************
89 * MACROS RELATED TO RSA KEY
90 **********************************************************/
97#define MCUXCLRSA_KEY_PUBLIC (0xA5A5A5A5U)
98#define MCUXCLRSA_KEY_PRIVATEPLAIN (0x5A5A5A5AU)
99#define MCUXCLRSA_KEY_PRIVATECRT (0xB4B4B4B4U)
100#define MCUXCLRSA_KEY_PRIVATECRT_DFA (0x4B4B4B4BU)
102
103
104/***********************************************************
105 * MACROS RELATED TO PUBLIC FUNCTIONS' OPTIONS
106 **********************************************************/
113#define MCUXCLRSA_OPTION_MESSAGE_PLAIN (0XA5U)
114#define MCUXCLRSA_OPTION_MESSAGE_DIGEST (0X5AU)
115#define MCUXCLRSA_OPTION_MESSAGE_MASK (MCUXCLRSA_OPTION_MESSAGE_PLAIN | MCUXCLRSA_OPTION_MESSAGE_DIGEST)
120
121/**********************************************
122 * TYPEDEFS
123 **********************************************/
130
131/***********************************************************
132 * TYPES RELATED TO FUNCTION STATUS
133 **********************************************************/
134
138typedef uint32_t mcuxClRsa_Status_t;
139
144
145/***********************************************************
146 * TYPES RELATED TO RSA KEY
147 **********************************************************/
151typedef struct
152{
153 uint8_t* pKeyEntryData;
154 uint32_t keyEntryLength;
156
160// TODO CLNS-6135: replace all occurrences of "mcuxClRsa_KeyEntry" by "mcuxClRsa_KeyEntry_t *", which is more explicit for a type
162
193
194
195/***********************************************************
196 * TYPES RELATED TO SIGN / VERIFY FUNCTIONALITY
197 **********************************************************/
198
203
208
212
213
214#endif /* MCUXCLRSA_TYPES_H_ */
215
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.
mcuxClRsa_KeyEntry_t * mcuxClRsa_KeyEntry
Pointer type to Rsa key entries.
Definition mcuxClRsa_Types.h:161
mcuxClRsa_Status_t mcuxClRsa_Status_Protected_t
Deprecated type for RSA protected status codes.
Definition mcuxClRsa_Types.h:143
mcuxClRsa_SignVerifyMode_t * mcuxClRsa_SignVerifyMode
Pointer type to Sign/Verify mode.
Definition mcuxClRsa_Types.h:207
uint32_t mcuxClRsa_Status_t
Type for RSA status codes.
Definition mcuxClRsa_Types.h:138
struct mcuxClRsa_SignVerifyMode_t mcuxClRsa_SignVerifyMode_t
Forward declaration of Sign/Verify mode struct.
Definition mcuxClRsa_Types.h:202
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:101
Structure type for Rsa key entries, specifying key entry length and data.
Definition mcuxClRsa_Types.h:152
uint8_t * pKeyEntryData
Pointer to buffer containing the key entry data in big-endian byte order.
Definition mcuxClRsa_Types.h:153
uint32_t keyEntryLength
Byte-length of the buffer pointed to by pKeyEntryData.
Definition mcuxClRsa_Types.h:154
Structure type for Rsa key, specifying key type and key entries.
Definition mcuxClRsa_Types.h:167
mcuxClRsa_KeyEntry_t * pExp3
Pointer to sixth key entry:
Definition mcuxClRsa_Types.h:189
mcuxClRsa_KeyEntry_t * pExp1
Pointer to fourth key entry:
Definition mcuxClRsa_Types.h:182
uint32_t keytype
Key type specifier:
Definition mcuxClRsa_Types.h:168
mcuxClRsa_KeyEntry_t * pQInv
Pointer to third key entry:
Definition mcuxClRsa_Types.h:179
mcuxClRsa_KeyEntry_t * pMod2
Pointer to second key entry:
Definition mcuxClRsa_Types.h:176
mcuxClRsa_KeyEntry_t * pMod1
Pointer to first key entry:
Definition mcuxClRsa_Types.h:173
mcuxClRsa_KeyEntry_t * pExp2
Pointer to fifth key entry:
Definition mcuxClRsa_Types.h:186