MCUX CLNS
MCUX Crypto Library Normal Secure
 
Loading...
Searching...
No Matches
mcuxClRsa_KeyTypes.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2022-2023 NXP */
3/* */
4/* NXP Proprietary. 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 */
10/* license terms, then you may not retain, install, activate or otherwise */
11/* use the software. */
12/*--------------------------------------------------------------------------*/
13
19#ifndef MCUXCLRSA_KEYTYPES_H_
20#define MCUXCLRSA_KEYTYPES_H_
21
22#include <mcuxClConfig.h> // Exported features flags header
23#include <stdint.h>
24#include <stdbool.h>
25
26#include <mcuxClKey_Types.h>
27#include <mcuxClRsa_Types.h>
28
29#include <mcuxCsslAnalysis.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
42/**********************************************
43 * KEY TYPE DEFS
44 **********************************************/
45
46MCUX_CSSL_ANALYSIS_START_SUPPRESS_DECLARED_BUT_NEVER_REFERENCED("Consumed by user / customer. Hence, it is declared but never referenced. ")
47#if defined(MCUXCL_FEATURE_CIPHER_RSA_ENCRYPT)
48
55extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_Public_1024;
56extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_Public_2048;
57extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_Public_3072;
58extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_Public_4096; /* mcuxClRsa_KeyTypes_Public_Structures */
62
69static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_Public_1024 = &mcuxClKey_TypeDescriptor_Rsa_Public_1024;
70static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_Public_2048 = &mcuxClKey_TypeDescriptor_Rsa_Public_2048;
71static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_Public_3072 = &mcuxClKey_TypeDescriptor_Rsa_Public_3072;
72static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_Public_4096 = &mcuxClKey_TypeDescriptor_Rsa_Public_4096; /* mcuxClRsa_KeyTypes_Public_Pointers */
76#endif /* defined(MCUXCL_FEATURE_SIGNATURE_RSA_VERIFY) || defined(MCUXCL_FEATURE_CIPHER_RSA_ENCRYPT) || defined(MCUXCL_FEATURE_KEY_GENERATION_RSA) */
77
78#if defined(MCUXCL_FEATURE_CIPHER_RSA_DECRYPT)
79
86extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_1024;
87extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_2048;
88extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_3072;
89extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_4096; /* mcuxClRsa_KeyTypes_PrivatePlain_Structures */
93
100static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivatePlain_1024 = &mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_1024;
101static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivatePlain_2048 = &mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_2048;
102static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivatePlain_3072 = &mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_3072;
103static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivatePlain_4096 = &mcuxClKey_TypeDescriptor_Rsa_PrivatePlain_4096; /* mcuxClRsa_KeyTypes_PrivatePlain_Pointers */
107
114extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_1024;
115extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_2048;
116extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_3072;
117extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_4096; /* mcuxClRsa_KeyTypes_PrivateCrt_Structures */
121
128static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_1024 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_1024;
129static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_2048 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_2048;
130static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_3072 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_3072;
131static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_4096 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_4096; /* mcuxClRsa_KeyTypes_PrivateCrt_Pointers */
135
142extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_1024;
143extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_2048;
144extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_3072;
145extern const mcuxClKey_TypeDescriptor_t mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_4096; /* mcuxClRsa_KeyTypes_PrivateCrt_DFA_Structures */
149
156static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_DFA_1024 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_1024;
157static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_DFA_2048 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_2048;
158static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_DFA_3072 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_3072;
159static const mcuxClKey_Type_t mcuxClKey_Type_Rsa_PrivateCRT_DFA_4096 = &mcuxClKey_TypeDescriptor_Rsa_PrivateCRT_DFA_4096; /* mcuxClRsa_KeyTypes_PrivateCrt_DFA_Pointers */
163
164#endif /* defined(MCUXCL_FEATURE_SIGNATURE_RSA_SIGN) || defined(MCUXCL_FEATURE_CIPHER_RSA_DECRYPT) || defined(MCUXCL_FEATURE_KEY_GENERATION_RSA) */
165
166MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_DECLARED_BUT_NEVER_REFERENCED() /* mcuxClRsa_KeyTypes */
170
171
177/**********************************************
178 * MACROS AND DEFINITIONS TO SETUP RSA KEY
179 **********************************************/
180
181
184typedef struct
185{
189
193typedef struct
194{
202
203// TODO CLNS-6135: remove those definitions
204#define MCUXCLRSA_KEYSTRUCT_PLAIN_SIZE (sizeof(mcuxClRsa_KeyData_Plain_t))
205#define MCUXCLRSA_KEYSTRUCT_PLAIN_SIZE_IN_WORDS MCUXCLCORE_NUM_OF_CPUWORDS_CEIL(MCUXCLRSA_KEYSTRUCT_PLAIN_SIZE)
206#define MCUXCLRSA_KEYSTRUCT_CRT_SIZE (sizeof(mcuxClRsa_KeyData_Crt_t))
207#define MCUXCLRSA_KEYSTRUCT_CRT_SIZE_IN_WORDS MCUXCLCORE_NUM_OF_CPUWORDS_CEIL(MCUXCLRSA_KEYSTRUCT_CRT_SIZE) /* mcuxClRsa_KeyTypes */
211
212#ifdef __cplusplus
213} /* extern "C" */
214#endif
215
216#endif /* MCUXCLRSA_KEYTYPES_H_ */
Type definitions for the mcuxClKey component.
Type definitions for the mcuxClRsa component.
const mcuxClKey_TypeDescriptor_t * mcuxClKey_Type_t
Key type handle type.
Definition mcuxClKey_Types.h:111
struct mcuxClKey_TypeDescriptor mcuxClKey_TypeDescriptor_t
Key type descriptor type.
Definition mcuxClKey_Types.h:104
Structure type for Rsa plain key data.
Definition mcuxClRsa_KeyTypes.h:185
mcuxClRsa_KeyEntry_t modulus
Key entry for the modulus.
Definition mcuxClRsa_KeyTypes.h:186
mcuxClRsa_KeyEntry_t exponent
Key entry for the exponent - it can be the public or the private exponent, depending on the key type.
Definition mcuxClRsa_KeyTypes.h:187
Structure type for Rsa CRT key data.
Definition mcuxClRsa_KeyTypes.h:194
mcuxClRsa_KeyEntry_t e
Key entry for the public exponent E - it should be specified for a key type Rsa_PrivateCRT_DFA,...
Definition mcuxClRsa_KeyTypes.h:200
mcuxClRsa_KeyEntry_t dq
Key entry for the exponent DQ = D % (Q-1)
Definition mcuxClRsa_KeyTypes.h:199
mcuxClRsa_KeyEntry_t p
Key entry for the prime factor P.
Definition mcuxClRsa_KeyTypes.h:195
mcuxClRsa_KeyEntry_t dp
Key entry for the exponent DP = D % (P-1)
Definition mcuxClRsa_KeyTypes.h:198
mcuxClRsa_KeyEntry_t q
Key entry for the prime factor Q.
Definition mcuxClRsa_KeyTypes.h:196
mcuxClRsa_KeyEntry_t qInv
Key entry for the QInv = (1 / (Q % P))
Definition mcuxClRsa_KeyTypes.h:197
Structure type for Rsa key entries, specifying key entry length and data.
Definition mcuxClRsa_Types.h:130