Mistake on this page?
Report an issue in GitHub or email us
crys_rsa_types.h
Go to the documentation of this file.
1 /**************************************************************************************
2 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
3 * *
4 * This file and the related binary are licensed under the following license: *
5 * *
6 * ARM Object Code and Header Files License, v1.0 Redistribution. *
7 * *
8 * Redistribution and use of object code, header files, and documentation, without *
9 * modification, are permitted provided that the following conditions are met: *
10 * *
11 * 1) Redistributions must reproduce the above copyright notice and the *
12 * following disclaimer in the documentation and/or other materials *
13 * provided with the distribution. *
14 * *
15 * 2) Unless to the extent explicitly permitted by law, no reverse *
16 * engineering, decompilation, or disassembly of is permitted. *
17 * *
18 * 3) Redistribution and use is permitted solely for the purpose of *
19 * developing or executing applications that are targeted for use *
20 * on an ARM-based product. *
21 * *
22 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
23 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
24 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
25 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
33 **************************************************************************************/
34 
35 
36 #ifndef CRYS_RSA_TYPES_H
37 #define CRYS_RSA_TYPES_H
38 
39 #include "crys_hash.h"
40 #include "crys_pka_defs_hw.h"
41 #include "ssi_pal_types.h"
42 #include "ssi_pal_compiler.h"
43 
44 #ifdef DX_SOFT_KEYGEN
46 #endif
47 
48 
49 #ifdef __cplusplus
50 extern "C"
51 {
52 #endif
53 /*!
54 @file
55 @brief This file contains all of the enums and definitions that are used for the CRYS RSA APIs.
56 @defgroup crys_rsa_types CryptoCell RSA used definitions and enums
57 @{
58 @ingroup crys_rsa
59 */
60 
61 /************************ Defines ******************************/
62 
63 /*! Definition of HASH context size. */
64 #define CRYS_PKA_RSA_HASH_CTX_SIZE_IN_WORDS CRYS_HASH_USER_CTX_SIZE_IN_WORDS
65 
66 /*! Maximal key size in bytes. */
67 #define CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BYTES (CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BITS / SASI_BITS_IN_BYTE)
68 
69 /*! Minimal key size in bits. */
70 #define CRYS_RSA_MIN_VALID_KEY_SIZE_VALUE_IN_BITS 512
71 /*! Valid key size multiplications in RSA. */
72 #define CRYS_RSA_VALID_KEY_SIZE_MULTIPLE_VALUE_IN_BITS 256
73 
74 /*! Maximal RSA generated key size in bits. */
75 #define CRYS_RSA_MAX_KEY_GENERATION_SIZE_BITS CRYS_RSA_MAX_KEY_GENERATION_HW_SIZE_BITS
76 
77 /* FIPS 184-4 definitions for allowed RSA and FFC DH key sizes */
78 /*! FIPS 184-4 allowed key size - 1024 bits. */
79 #define CRYS_RSA_FIPS_KEY_SIZE_1024_BITS 1024
80 /*! FIPS 184-4 allowed key size - 2048 bits. */
81 #define CRYS_RSA_FIPS_KEY_SIZE_2048_BITS 2048
82 /*! FIPS 184-4 allowed key size - 3072 bits. */
83 #define CRYS_RSA_FIPS_KEY_SIZE_3072_BITS 3072
84 /*! FIPS 184-4 allowed modulus size in bits. */
85 #define CRYS_RSA_FIPS_MODULUS_SIZE_BITS CRYS_RSA_FIPS_KEY_SIZE_2048_BITS
86 
87 /*! FIPS 184-4 DH key size - 1024 bits. */
88 #define CRYS_DH_FIPS_KEY_SIZE_1024_BITS 1024
89 /*! FIPS 184-4 DH key size - 2048 bits. */
90 #define CRYS_DH_FIPS_KEY_SIZE_2048_BITS 2048
91 
92 
93 /*! Salt length definition - if the salt length is not available in verify operation, the user can use this define and the algorithm will
94  calculate the salt length alone*/
95 /*!\note Security wise: it is not recommended to use this flag.*/
96 #define CRYS_RSA_VERIFY_SALT_LENGTH_UNKNOWN 0xFFFF
97 
98 /*! Minimal public exponent value */
99 #define CRYS_RSA_MIN_PUB_EXP_VALUE 3
100 /*! Minimal private exponent value */
101 #define CRYS_RSA_MIN_PRIV_EXP_VALUE 1
102 
103 /* The maximum buffer size for the 'H' value */
104 /*! Temporary buffer size definition.*/
105 #define CRYS_RSA_TMP_BUFF_SIZE (CRYS_RSA_OAEP_ENCODE_MAX_MASKDB_SIZE + CRYS_RSA_OAEP_ENCODE_MAX_SEEDMASK_SIZE + CRYS_PKA_RSA_HASH_CTX_SIZE_IN_WORDS*sizeof(uint32_t) + sizeof(CRYS_HASH_Result_t))
106 
107 /*! Hash structure definition.*/
108 #define CRYS_PKCS1_HashFunc_t CRYS_HASH_OperationMode_t
109 
110 /*! OAEP maximal H length.*/
111 #define CRYS_RSA_OAEP_MAX_HLEN CRYS_HASH_SHA512_DIGEST_SIZE_IN_BYTES
112 
113 /*! MGF1 definitions */
114 #define CRYS_RSA_MGF_2_POWER_32 65535 /*!< \internal 0xFFFF This is the 2^32 of the 2^32*hLen boundary check */
115 /*! MGF1 definitions */
116 #define CRYS_RSA_SIZE_OF_T_STRING_BYTES (CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS*sizeof(uint32_t))
117 
118 /***********************************************************
119  *
120  * RSA PKCS#1 v2.1 DEFINES
121  *
122  ***********************************************************/
123 /*! Size of OEAP seed. */
124 #define CRYS_RSA_OAEP_ENCODE_MAX_SEEDMASK_SIZE CRYS_RSA_OAEP_MAX_HLEN
125 /*! Maximal PSS salt size. */
126 #define CRYS_RSA_PSS_SALT_LENGTH CRYS_RSA_OAEP_MAX_HLEN
127 /*! PSS padding length. */
128 #define CRYS_RSA_PSS_PAD1_LEN 8
129 
130 /*! OAEP encode mask size. */
131 #define CRYS_RSA_OAEP_ENCODE_MAX_MASKDB_SIZE (CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS*sizeof(uint32_t)) /*!< \internal For OAEP Encode; the max size is emLen */
132 /*! OAEP decode mask size. */
133 #define CRYS_RSA_OAEP_DECODE_MAX_DBMASK_SIZE (CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS*sizeof(uint32_t)) /*!< \internal For OAEP Decode; the max size is emLen */
134 
135 /************************ Enums ********************************/
136 
137 /*! Defines the enum for the HASH operation mode. */
138 typedef enum
139 {
140  CRYS_RSA_HASH_MD5_mode = 0, /*!< For PKCS1 v1.5 only. The input data will be hashed with MD5 */
141  CRYS_RSA_HASH_SHA1_mode = 1, /*!< The input data will be hashed with SHA1. */
142  CRYS_RSA_HASH_SHA224_mode = 2, /*!< The input data will be hashed with SHA224. */
143  CRYS_RSA_HASH_SHA256_mode = 3, /*!< The input data will be hashed with SHA256. */
144  CRYS_RSA_HASH_SHA384_mode = 4, /*!< The input data will be hashed with SHA384. */
145  CRYS_RSA_HASH_SHA512_mode = 5, /*!< The input data will be hashed with SHA512. */
146  CRYS_RSA_After_MD5_mode = 6, /*!< For PKCS1 v1.5 only. The input data is a digest of MD5 and will not be hashed. */
147  CRYS_RSA_After_SHA1_mode = 7, /*!< The input data is a digest of SHA1 and will not be hashed. */
148  CRYS_RSA_After_SHA224_mode = 8, /*!< The input data is a digest of SHA224 and will not be hashed. */
149  CRYS_RSA_After_SHA256_mode = 9, /*!< The input data is a digest of SHA256 and will not be hashed. */
150  CRYS_RSA_After_SHA384_mode = 10, /*!< The input data is a digest of SHA384 and will not be hashed. */
151  CRYS_RSA_After_SHA512_mode = 11, /*!< The input data is a digest of SHA512 and will not be hashed. */
152  CRYS_RSA_After_HASH_NOT_KNOWN_mode = 12, /*!< \internal used only for PKCS#1 Ver 1.5 - possible to perform verify operation without hash mode input,
153  the hash mode is derived from the signature.*/
154  CRYS_RSA_HASH_NO_HASH_mode = 13, /*!< Used for PKCS1 v1.5 Encrypt and Decrypt.*/
155  CRYS_RSA_HASH_NumOfModes, /*!< Maximal number of hash operations modes. */
156 
157  CRYS_RSA_HASH_OpModeLast = 0x7FFFFFFF, /*! Reserved.*/
158 
160 
161 
162 /*! Defines the enum of the RSA decryption mode. */
163 typedef enum
164 {
165  CRYS_RSA_NoCrt = 10, /*!< Decryption no CRT mode.*/
166  CRYS_RSA_Crt = 11, /*!< Decryption CRT mode.*/
167 
168  CRYS_RSADecryptionNumOfOptions, /*! Reserved.*/
169 
170  CRYS_RSA_DecryptionModeLast= 0x7FFFFFFF, /*! Reserved.*/
171 
173 
174 /*! RSA Key source definition. */
175 typedef enum
176 {
177  CRYS_RSA_ExternalKey = 1, /*!< External key.*/
178  CRYS_RSA_InternalKey = 2, /*!< Internal key.*/
179 
180  CRYS_RSA_KeySourceLast= 0x7FFFFFFF, /*!< Reserved. */
181 
183 
184 /*! MGF values. */
185 typedef enum
186 {
187  CRYS_PKCS1_MGF1 = 0, /*! MGF1. */
188  CRYS_PKCS1_NO_MGF = 1, /*! No MGF. */
189  CRYS_RSA_NumOfMGFFunctions, /*! Maximal number of MGF options. */
190 
191  CRYS_PKCS1_MGFLast= 0x7FFFFFFF, /*! Reserved.*/
192 
194 
195 /*! Defines the enum of the various PKCS1 versions. */
196 typedef enum
197 {
198  CRYS_PKCS1_VER15 = 0, /*! PKCS1 version 15. */
199  CRYS_PKCS1_VER21 = 1, /*! PKCS1 version 21. */
200 
201  CRYS_RSA_NumOf_PKCS1_versions, /*! Maximal number of PKCS versions. */
202 
203  CRYS_PKCS1_versionLast= 0x7FFFFFFF, /*! Reserved.*/
204 
206 
207 
208 /*! Enum defining primality testing mode in Rabin-Miller
209  and Lucas-Lehmer tests (internal tests). */
210 typedef enum
211 {
212  /* P and Q primes */
213  CRYS_RSA_PRIME_TEST_MODE = 0, /*!< PRIME test. */
214  /* FFC (DH, DSA) primes */
215  CRYS_DH_PRIME_TEST_MODE = 1, /*!< DH Prime test. */
216 
218 
220 
221 /************************ Public and private key database Structs ******************************/
222 
223 /* .................. The public key definitions ...................... */
224 /* --------------------------------------------------------------------- */
225 
226 /*! Public key data structure (used internally). */
227 typedef struct
228 {
229  /*! RSA modulus buffer. */
231  /*! RSA modulus size in bits. */
232  uint32_t nSizeInBits;
233 
234  /*! RSA public exponent buffer. */
236  /*! RSA public exponent buffer. */
237  uint32_t eSizeInBits;
238 
239  /*! Buffer for internal usage.*/
241 
243 
244 /*! The public key's user structure prototype. This structure must be saved by the user, and is used as input to the RSA functions
245 (such as ::SaSi_RsaSchemesEncrypt etc.) */
246 typedef struct CRYS_RSAUserPubKey_t
247 {
248  /*! Validation tag. */
249  uint32_t valid_tag;
250  /*! Public key data. */
251  uint32_t PublicKeyDbBuff[ sizeof(CRYSRSAPubKey_t)/sizeof(uint32_t) + 1 ];
252 
253 
255 
256 /* .................. The private key definitions ...................... */
257 /* --------------------------------------------------------------------- */
258 
259 /*! Private key on non-CRT mode data structure (used internally). */
260 typedef struct
261 {
262  /*! RSA private exponent buffer. */
264  /*! RSA private exponent size in bits. */
265  uint32_t dSizeInBits;
266 
267  /*! RSA public exponent buffer. */
269  /*! RSA public exponent size in bits. */
270  uint32_t eSizeInBits;
271 
273 
274 /*! Private key on CRT mode data structure (used internally). */
275 #ifndef CRYS_NO_RSA_SMALL_CRT_BUFFERS_SUPPORT
276 /* use small CRT buffers */
277 typedef struct
278 {
279  /*! First factor buffer. */
281  /*! First factor size in bits. */
282  uint32_t PSizeInBits;
283 
284  /*! Second factor buffer. */
286  /*! Second factor size in bits. */
287  uint32_t QSizeInBits;
288 
289  /*! First CRT exponent buffer. */
291  /*! First CRT exponent size in bits. */
292  uint32_t dPSizeInBits;
293 
294  /*! Second CRT exponent buffer. */
296  /*! Second CRT exponent size in bits. */
297  uint32_t dQSizeInBits;
298 
299  /*! First CRT coefficient buffer. */
301  /*! First CRT coefficient size in bits. */
302  uint32_t qInvSizeInBits;
303 
305 
306 /*! Size of CRYSRSAPrivCRTKey_t structure in words (used for temp buffers allocation). */
307 #define CRYS_RSA_SIZE_IN_WORDS_OF_CRYSRSAPrivCRTKey_t (CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS*7/2 + 5)
308 
309 #else /* use large CRT buffers */
310 typedef struct
311 {
312  /* The first factor buffer and size in bits */
314  uint32_t PSizeInBits;
315 
316  /* The second factor buffer and its size in bits */
318  uint32_t QSizeInBits;
319 
320  /* The first CRT exponent buffer and its size in bits */
322  uint32_t dPSizeInBits;
323 
324  /* The second CRT exponent buffer and its size in bits */
326  uint32_t dQSizeInBits;
327 
328  /* The first CRT coefficient buffer and its size in bits */
330  uint32_t qInvSizeInBits;
331 
333 
334 /* size of CRYSRSAPrivCRTKey_t structure in words (used for temp buffers allocation) */
335 #define CRYS_RSA_SIZE_IN_WORDS_OF_CRYSRSAPrivCRTKey_t (CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS*5 + 5)
336 
337 #endif
338 
339 /*! Private key data structure (used internally). */
340 typedef struct
341 {
342  /*! RSA modulus buffer. */
344  /*! RSA modulus size in bits. */
345  uint32_t nSizeInBits;
346 
347  /*! Decryption operation mode. */
349 
350  /*! Key source ( internal or external ). */
352 
353 
354  /*! Union between the CRT and non-CRT data structures. */
355  union
356  {
357  CRYSRSAPrivNonCRTKey_t NonCrt; /*!< Non CRT data structure. */
358  CRYSRSAPrivCRTKey_t Crt; /*!< CRT data structure. */
359  }PriveKeyDb;
360 
361  /*! Internal buffer. */
362  uint32_t crysRSAPrivKeyIntBuff[CRYS_PKA_PRIV_KEY_BUFF_SIZE_IN_WORDS];
363 
365 
366 /*! The private key's user structure prototype. This structure must be saved by the user, and is used as input to the RSA functions
367 (such as ::SaSi_RsaSchemesDecrypt etc.). */
368 typedef struct CRYS_RSAUserPrivKey_t
369 {
370  /*! Validation tag.*/
371  uint32_t valid_tag;
372  /*! Private key data. */
373  uint32_t PrivateKeyDbBuff[ sizeof(CRYSRSAPrivKey_t)/sizeof(uint32_t) + 1 ] ;
374 
376 
377 /*! Temporary buffers for RSA usage. */
378 typedef struct CRYS_RSAPrimeData_t
379 {
380  /* The aligned input and output data buffers */
381  uint32_t DataIn[CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS]; /*!< Temporary buffer for data in.*/
382  uint32_t DataOut[CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS]; /*!< Temporary buffer for data out.*/
383  /*! Temporary buffer for internal data.*/
384  uint8_t InternalBuff[CRYS_RSA_TMP_BUFF_SIZE] SASI_PAL_COMPILER_ALIGN (4);
385 
387 
388 /*! KG data type. */
389 typedef union CRYS_RSAKGData_t
390 {
391  /*! RSA Key Generation buffers definitions. */
392  struct
393  {
394  /* The aligned input and output data buffers */
395  /*! First factor buffer. */
397  /*! Second factor buffer. */
399  union {
400  /*! Internal buffer. */
401  uint32_t crysRSAKGDataIntBuff[CRYS_PKA_KGDATA_BUFF_SIZE_IN_WORDS];
402  #ifdef DX_SOFT_KEYGEN
403  /* # added for compatibility with size of KGData SW type */
404  uint32_t TempbuffExp[PKI_KEY_GEN_TEMP_BUFF_SIZE_WORDS];
405  #endif
406  }kg_buf;
407  }KGData;
408 
409  /*! Buffers for internal usage. */
410  union {
411  /*! Internally used buffer.*/
412  struct {
413  CRYS_RSAPrimeData_t PrimData;
414  }primExt;
415  #ifdef DX_SOFT_KEYGEN
416  /* # added for compatibility with size of SW CRYSRSAPrivKey_t type */
417  SW_Shared_CRYS_RSAPrimeData_t SW_Shared_PrimData;
418  #endif
419  }prim;
421 
422  /*************
423  * RSA contexts
424  **************/
425 /************************ CRYS RSA struct for Private Key ******************************/
426 
427 /*! Context definition for operations that use the RSA private key. */
428 typedef struct
429 {
430 
431  /*! Private key data. */
433 
434  /*! RSA PKCS#1 Version 1.5 or 2.1 */
435  uint8_t PKCS1_Version;
436 
437  /*! MGF to be used for the PKCS1 Ver 2.1 sign or verify operations. */
438  uint8_t MGF_2use;
439 
440  /*! Salt random length for PKCS#1 PSS Ver 2.1*/
441  uint16_t SaltLen;
442 
443  /*! Internal buffer. */
445 
446  /*! HASH context buffer. */
447  uint32_t CRYSPKAHashCtxBuff[CRYS_PKA_RSA_HASH_CTX_SIZE_IN_WORDS];
448  /*! HASH result buffer. */
450  /*! HASH result size in words. */
451  uint16_t HASH_Result_Size; /*in words*/
452  /*! RSA HASH operation mode (all modes RSA supports).*/
454  /*! HASH operation mode.*/
456  /*! HASH block size (in words).*/
457  uint16_t HashBlockSize; /*in words*/
458  /*! HASH flag. */
459  bool doHash;
460 
461  /* Used for sensitive data manipulation in the context space, which is safer and which saves stack space */
462  /*! Internal buffer.*/
464  /*! Internal bufffer used size in bits. */
465  uint32_t EBDSizeInBits;
466 
467  /* Used for sensitive data manipulation in the context space, which is safer and which saves stack space */
468  /*! Internal buffer.*/
470  /*! Internal buffer used size.*/
471  uint16_t T_BufSize;
472 
473  /*! Buffer for the use of the Ber encoder in the case of PKCS#1 Ver 1.5. */
475  /*! Ber encoder buffer size.*/
476  uint16_t BERSize;
477 
478  /*! Internal buffer.*/
479  uint8_t DummyBufAESBlockSize[16];
480 
482 
483 /*! The user's context prototype - the argument type that is passed by the user
484  to the RSA APIs. The context saves the state of the operation and must be saved by the user
485  till the end of the APIs flow . */
487 {
488  /*! Validation tag. */
489  uint32_t valid_tag;
490  /*! Internally used value.*/
491  uint32_t AES_iv;
492  /*! Private data context buffer. */
493  uint8_t context_buff[ sizeof(RSAPrivContext_t) + sizeof(uint32_t)] SASI_PAL_COMPILER_ALIGN (4); /* must be aligned to 4 */
494 
496 
497 
498 /************************ CRYS RSA struct for Public Key ******************************/
499 
500 /*! Context definition for operations that use the RSA public key. */
501 typedef struct
502 {
503 
504  /*! RSA public key structure. */
506 
507  /*! Public key size in bytes */
508  uint32_t nSizeInBytes;
509 
510  /*! RSA PKCS#1 Version 1.5 or 2.1 */
511  uint8_t PKCS1_Version;
512 
513  /*! MGF to be used for the PKCS1 Ver 2.1 Sign or Verify operations */
514  uint8_t MGF_2use;
515 
516  /*! Salt random length for PKCS#1 PSS Ver 2.1*/
517  uint16_t SaltLen;
518 
519  /*! Internal buffer. */
521 
522  /*! HASH context. */
523  uint32_t CRYSPKAHashCtxBuff[CRYS_PKA_RSA_HASH_CTX_SIZE_IN_WORDS];
524  /*! HASH result buffer. */
526  /*! HASH result size. */
527  uint16_t HASH_Result_Size; /* denotes the length, in words, of the hash function output */
528  /*! RSA HASH operation mode (all modes RSA supports). */
530  /*! HASH operation mode. */
532  /*! HASH block size. */
533  uint16_t HashBlockSize; /*in words*/
534  /*! HASH flag.*/
535  bool doHash;
536 
537  /* Used for sensitive data manipulation in the context space, which is safer and which saves stack space */
538  /*! Internal buffer.*/
540  /*! Internal bufffer used size in bits. */
541  uint32_t EBDSizeInBits;
542 
543  /* Used for sensitive data manipulation in the context space, which is safer and which saves stack space */
544  /*! Internal buffer.*/
546  /*! Internal buffer used size.*/
547  uint16_t T_BufSize;
548 
549  /*! Internal buffer.*/
550  uint8_t DummyBufAESBlockSize[16];
551 
553 
554 /*! Temporary buffers for the RSA usage. */
556 {
557  /*! Validation tag. */
558  uint32_t valid_tag;
559  /*! Internally used value.*/
560  uint32_t AES_iv; /* For the use of the AES CBC mode of Encryption and Decryption of the context in CCM */
561  /*! Public data context buffer. */
562  uint32_t context_buff[ sizeof(RSAPubContext_t)/sizeof(uint32_t) + 1] ;
563 
565 
566 
567 
568 /*! Required for internal FIPS verification for RSA key generation. */
569 typedef struct CRYS_RSAKGFipsContext_t{
570  /*! Internal buffer. */
572  /*! Buffer used for decryption. */
574  /*! Buffer used for encryption. */
577 
578 /*! Required for internal FIPS verification for RSA KAT. The RSA KAT tests defined for scheme 2.1 with modulus key size of 2048. */
580  /*! RSA user's key (either public or private).*/
581  union {
582  /*! RSA user's public key. */
583  CRYS_RSAUserPubKey_t userPubKey; // used for RsaEnc and RsaVerify
584  /*! RSA user's private key. */
585  CRYS_RSAUserPrivKey_t userPrivKey; // used for RsaDec and RsaSign
586  }userKey;
587  /*! RSA user's context (either public or private).*/
588  union {
589  /*! RSA user's private context. */
591  /*! RSA public user's context. */
593  /*! Internal buffers. */
594  CRYS_RSAPrimeData_t primData; // used for RsaEnc and RsaDec
595  }userContext;
596  /*! RSA user's data. */
597  union {
598  struct { // used for RsaEnc and RsaDec
599  /*! Buffer for encrypted data. */
601  /*! Buffer for decrypted data. */
603  }userOaepData;
604  /*! Buffer for Signed data. */
605  uint8_t signBuff[CRYS_RSA_FIPS_MODULUS_SIZE_BITS/SASI_BITS_IN_BYTE]; // used for RsaSign and RsaVerify
606  }userData;
608 
609 
610 #ifdef __cplusplus
611 }
612 #endif
613 /**
614 @}
615  */
616 #endif
struct CRYS_RSAFipsKatContext_t CRYS_RSAFipsKatContext_t
CRYS_HASH_OperationMode_t HashOperationMode
CRYS_RSA_DecryptionMode_t
CRYS_RSAUserPubKey_t userPubKey
CRYS_RSAUserPubKey_t PubUserKey
CRYS_RSA_KeySource_t
CRYS_HASH_OperationMode_t HashOperationMode
This file contains compiler related definitions.
union CRYS_RSAKGData_t CRYS_RSAKGData_t
This file contains the types for the CCSW RSA module.
#define CRYS_RSA_FIPS_MODULUS_SIZE_BITS
#define CRYS_HASH_SHA1_DIGEST_SIZE_IN_BYTES
Definition: crys_hash.h:95
#define CRYS_RSA_MIN_VALID_KEY_SIZE_VALUE_IN_BITS
#define CRYS_PKA_BARRETT_MOD_TAG_BUFF_SIZE_IN_WORDS
#define CRYS_PKA_PRIV_KEY_BUFF_SIZE_IN_WORDS
The file contains all of the enums and definitions that are used in the PKA related code...
uint16_t HASH_Result_Size
CRYS_HASH_OperationMode_t
Definition: crys_hash.h:145
struct CRYS_RSAUserPrivKey_t CRYS_RSAUserPrivKey_t
struct CRYS_RSAPubUserContext_t CRYS_RSAPubUserContext_t
uint16_t HashBlockSize
CRYS_PKCS1_version
#define CRYS_RSA_TMP_BUFF_SIZE
CRYS_RSA_DecryptionMode_t OperationMode
CRYS_RSAPrimeData_t primData
uint16_t HashBlockSize
uint16_t HASH_Result_Size
CRYSRSAPrivCRTKey_t Crt
#define SASI_BITS_IN_BYTE
Definition: ssi_pal_types.h:65
uint32_t nSizeInBytes
struct CRYS_RSAUserPubKey_t CRYS_RSAUserPubKey_t
CRYS_RSAUserPrivKey_t PrivUserKey
#define CRYS_RSA_SIZE_OF_T_STRING_BYTES
#define CRYS_PKA_RSA_HASH_CTX_SIZE_IN_WORDS
uint32_t CRYS_HASH_Result_t[16]
Definition: crys_hash.h:162
CRYS_RSAPrimeData_t PrimeData
#define CRYS_PKA_KGDATA_BUFF_SIZE_IN_WORDS
CRYS_RSAPrimeData_t PrimeData
CRYS_RSA_DH_PrimeTestMode_t
This file contains all of the enums and definitions that are used for the CRYS HASH APIs...
CRYS_RSAPubUserContext_t userPubContext
CRYS_RSA_HASH_OpMode_t RsaHashOperationMode
CRYS_RSAUserPrivKey_t userPrivKey
uint32_t EBDSizeInBits
uint32_t PublicKeyDbBuff[sizeof(CRYSRSAPubKey_t)/sizeof(uint32_t)+1]
CRYS_PKCS1_MGF_t
CRYS_RSA_KeySource_t KeySource
uint32_t EBDSizeInBits
struct CRYS_RSAPrivUserContext_t CRYS_RSAPrivUserContext_t
This file contains the platform dependent definitions and types.
CRYS_RSAPrivUserContext_t userPrivContext
CRYS_RSA_HASH_OpMode_t RsaHashOperationMode
uint32_t nSizeInBits
CRYSRSAPrivNonCRTKey_t NonCrt
struct CRYS_RSAPrimeData_t CRYS_RSAPrimeData_t
CRYS_HASH_Result_t HASH_Result
#define CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS
uint32_t eSizeInBits
CRYS_RSAPrimeData_t primData
CRYS_HASH_Result_t HASH_Result
CRYS_RSA_HASH_OpMode_t
struct CRYS_RSAKGFipsContext_t CRYS_RSAKGFipsContext_t
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.