MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClRsa_Types.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2020-2023 NXP */
3 /* */
4 /* NXP Confidential. This software is owned or controlled by NXP and may */
5 /* only be used strictly in accordance with the applicable license terms. */
6 /* By expressly accepting such terms or by downloading, installing, */
7 /* activating and/or otherwise using the software, you are agreeing that */
8 /* you have read, and that you agree to comply with and are bound by, such */
9 /* license terms. If you do not agree to be bound by the applicable license */
10 /* terms, then you may not retain, install, activate or otherwise use the */
11 /* software. */
12 /*--------------------------------------------------------------------------*/
13 
19 #ifndef MCUXCLRSA_TYPES_H_
20 #define MCUXCLRSA_TYPES_H_
21 
22 #include <stdint.h>
23 #include <stddef.h>
24 #include <stdbool.h>
25 #include <mcuxClConfig.h> // Exported features flags header
26 #include <mcuxClSession.h>
27 #include <mcuxCsslFlowProtection.h>
29 
30 /***********************************************************
31  * MACROS
32  **********************************************************/
33 
41 /***********************************************************
42  * MACROS RELATED TO FUNCTION STATUS
43  **********************************************************/
44 
51 #define MCUXCLRSA_STATUS_SIGN_OK ((mcuxClRsa_Status_t) 0x0FF62E03u )
52 #define MCUXCLRSA_STATUS_VERIFY_OK ((mcuxClRsa_Status_t) 0x0FF62E07u )
53 #define MCUXCLRSA_STATUS_VERIFYPRIMITIVE_OK ((mcuxClRsa_Status_t) 0x0FF62E0Bu )
54 #define MCUXCLRSA_STATUS_ERROR ((mcuxClRsa_Status_t) 0x0FF65330u )
55 #define MCUXCLRSA_STATUS_INVALID_INPUT ((mcuxClRsa_Status_t) 0x0FF653F8u )
56 #define MCUXCLRSA_STATUS_VERIFY_FAILED ((mcuxClRsa_Status_t) 0x0FF68930u )
57 #define MCUXCLRSA_STATUS_FAULT_ATTACK ((mcuxClRsa_Status_t) 0x0FF6F0F0u )
58 #define MCUXCLRSA_STATUS_KEYGENERATION_OK ((mcuxClRsa_Status_t) 0x0FF62E0Fu )
59 #define MCUXCLRSA_STATUS_KEYGENERATION_ITERATIONSEXCEEDED ((mcuxClRsa_Status_t) 0x0FF68934u )
60 #define MCUXCLRSA_STATUS_RNG_ERROR ((mcuxClRsa_Status_t) 0x0FF65338u )
61 
62 
65 /***********************************************************
66  * MACROS RELATED TO RSA KEY
67  **********************************************************/
74 #define MCUXCLRSA_KEY_PUBLIC (0xA5A5A5A5U)
75 #define MCUXCLRSA_KEY_PRIVATEPLAIN (0x5A5A5A5AU)
76 #define MCUXCLRSA_KEY_PRIVATECRT (0xB4B4B4B4U)
77 #define MCUXCLRSA_KEY_PRIVATECRT_DFA (0x4B4B4B4BU)
78 
81 /***********************************************************
82  * MACROS RELATED TO PUBLIC FUNCTIONS' OPTIONS
83  **********************************************************/
84 
90 #define MCUXCLRSA_OPTION_MESSAGE_PLAIN (0XA5U)
91 #define MCUXCLRSA_OPTION_MESSAGE_DIGEST (0X5AU)
92 #define MCUXCLRSA_OPTION_MESSAGE_MASK (MCUXCLRSA_OPTION_MESSAGE_PLAIN | MCUXCLRSA_OPTION_MESSAGE_DIGEST)
93 
98 /**********************************************
99  * TYPEDEFS
100  **********************************************/
101 
108 /***********************************************************
109  * TYPES RELATED TO FUNCTION STATUS
110  **********************************************************/
111 
115 typedef uint32_t mcuxClRsa_Status_t;
116 
121 
122 /***********************************************************
123  * TYPES RELATED TO RSA KEY
124  **********************************************************/
128 typedef struct
129 {
130  uint8_t* pKeyEntryData;
131  uint32_t keyEntryLength;
133 
137 // TODO CLNS-6135: replace all occurrences of "mcuxClRsa_KeyEntry" by "mcuxClRsa_KeyEntry_t *", which is more explicit for a type
139 
143 typedef struct mcuxClRsa_Key
144 {
145  uint32_t keytype;
167 } mcuxClRsa_Key;
170 
171 
172 /***********************************************************
173  * TYPES RELATED TO SIGN / VERIFY FUNCTIONALITY
174  **********************************************************/
175 
180 
185 
191 #endif /* MCUXCLRSA_TYPES_H_ */
192 
mcuxClRsa_KeyEntry_t * pQInv
Pointer to third key entry:
Definition: mcuxClRsa_Types.h:156
uint32_t mcuxClRsa_Status_t
Type for RSA status codes.
Definition: mcuxClRsa_Types.h:115
uint32_t keytype
Key type specifier:
Definition: mcuxClRsa_Types.h:145
Structure type for Rsa key, specifying key type and key entries.
Definition: mcuxClRsa_Types.h:143
mcuxClRsa_KeyEntry_t * pExp2
Pointer to fifth key entry:
Definition: mcuxClRsa_Types.h:163
uint32_t keyEntryLength
Byte-length of the buffer pointed to by pKeyEntryData.
Definition: mcuxClRsa_Types.h:131
mcuxClRsa_SignVerifyMode_t * mcuxClRsa_SignVerifyMode
Pointer type to Sign/Verify mode.
Definition: mcuxClRsa_Types.h:184
Provides the API for the CSSL flow protection mechanism.
uint8_t * pKeyEntryData
Pointer to buffer containing the key entry data in big-endian byte order.
Definition: mcuxClRsa_Types.h:130
mcuxClRsa_KeyEntry_t * pExp3
Pointer to sixth key entry:
Definition: mcuxClRsa_Types.h:166
mcuxClRsa_KeyEntry_t * pMod2
Pointer to second key entry:
Definition: mcuxClRsa_Types.h:153
struct mcuxClRsa_SignVerifyMode_t mcuxClRsa_SignVerifyMode_t
Forward declaration of Sign/Verify mode struct.
Definition: mcuxClRsa_Types.h:179
mcuxClRsa_KeyEntry_t * pMod1
Pointer to first key entry:
Definition: mcuxClRsa_Types.h:150
mcuxClRsa_KeyEntry_t * pExp1
Pointer to fourth key entry:
Definition: mcuxClRsa_Types.h:159
Top-level include file for the mcuxClSession component.
struct mcuxClRsa_Key mcuxClRsa_Key
Structure type for Rsa key, specifying key type and key entries.
Definition of function identifiers for the flow protection mechanism.
Structure type for Rsa key entries, specifying key entry length and data.
Definition: mcuxClRsa_Types.h:128
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition: mcuxCsslFlowProtection.h:81
mcuxClRsa_Status_t mcuxClRsa_Status_Protected_t
Deprecated type for RSA protected status codes.
Definition: mcuxClRsa_Types.h:120
mcuxClRsa_KeyEntry_t * mcuxClRsa_KeyEntry
Pointer type to Rsa key entries.
Definition: mcuxClRsa_Types.h:138