CryptoCell RSA used definitions and enums

nRF5 SDK v15.3.0

Macros

#define CRYS_PKA_RSA_HASH_CTX_SIZE_IN_WORDS CRYS_HASH_USER_CTX_SIZE_IN_WORDS
#define CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BYTES ( CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BITS / SASI_BITS_IN_BYTE )
#define CRYS_RSA_MIN_VALID_KEY_SIZE_VALUE_IN_BITS 512
#define CRYS_RSA_VALID_KEY_SIZE_MULTIPLE_VALUE_IN_BITS 256
#define CRYS_RSA_MAX_KEY_GENERATION_SIZE_BITS CRYS_RSA_MAX_KEY_GENERATION_HW_SIZE_BITS
#define CRYS_RSA_FIPS_KEY_SIZE_1024_BITS 1024
#define CRYS_RSA_FIPS_KEY_SIZE_2048_BITS 2048
#define CRYS_RSA_FIPS_KEY_SIZE_3072_BITS 3072
#define CRYS_RSA_FIPS_MODULUS_SIZE_BITS CRYS_RSA_FIPS_KEY_SIZE_2048_BITS
#define CRYS_DH_FIPS_KEY_SIZE_1024_BITS 1024
#define CRYS_DH_FIPS_KEY_SIZE_2048_BITS 2048
#define CRYS_RSA_VERIFY_SALT_LENGTH_UNKNOWN 0xFFFF
#define CRYS_RSA_MIN_PUB_EXP_VALUE 3
#define CRYS_RSA_MIN_PRIV_EXP_VALUE 1
#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 ))
#define CRYS_PKCS1_HashFunc_t CRYS_HASH_OperationMode_t
#define CRYS_RSA_OAEP_MAX_HLEN CRYS_HASH_SHA512_DIGEST_SIZE_IN_BYTES
#define CRYS_RSA_MGF_2_POWER_32 65535
#define CRYS_RSA_SIZE_OF_T_STRING_BYTES ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *sizeof(uint32_t))
#define CRYS_RSA_OAEP_ENCODE_MAX_SEEDMASK_SIZE CRYS_RSA_OAEP_MAX_HLEN
#define CRYS_RSA_PSS_SALT_LENGTH CRYS_RSA_OAEP_MAX_HLEN
#define CRYS_RSA_PSS_PAD1_LEN 8
#define CRYS_RSA_OAEP_ENCODE_MAX_MASKDB_SIZE ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *sizeof(uint32_t))
#define CRYS_RSA_OAEP_DECODE_MAX_DBMASK_SIZE ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *sizeof(uint32_t))
#define CRYS_RSA_SIZE_IN_WORDS_OF_CRYSRSAPrivCRTKey_t ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *7/2 + 5)

Detailed Description

Macro Definition Documentation

#define CRYS_DH_FIPS_KEY_SIZE_1024_BITS   1024

FIPS 184-4 DH key size - 1024 bits.

#define CRYS_DH_FIPS_KEY_SIZE_2048_BITS   2048

FIPS 184-4 DH key size - 2048 bits.

#define CRYS_PKA_RSA_HASH_CTX_SIZE_IN_WORDS CRYS_HASH_USER_CTX_SIZE_IN_WORDS

Definition of HASH context size.

#define CRYS_PKCS1_HashFunc_t CRYS_HASH_OperationMode_t

Hash structure definition.

#define CRYS_RSA_FIPS_KEY_SIZE_1024_BITS   1024

FIPS 184-4 allowed key size - 1024 bits.

#define CRYS_RSA_FIPS_KEY_SIZE_2048_BITS   2048

FIPS 184-4 allowed key size - 2048 bits.

#define CRYS_RSA_FIPS_KEY_SIZE_3072_BITS   3072

FIPS 184-4 allowed key size - 3072 bits.

#define CRYS_RSA_FIPS_MODULUS_SIZE_BITS CRYS_RSA_FIPS_KEY_SIZE_2048_BITS

FIPS 184-4 allowed modulus size in bits.

#define CRYS_RSA_MAX_KEY_GENERATION_SIZE_BITS CRYS_RSA_MAX_KEY_GENERATION_HW_SIZE_BITS

Maximal RSA generated key size in bits.

#define CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BYTES   ( CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BITS / SASI_BITS_IN_BYTE )

Maximal key size in bytes.

#define CRYS_RSA_MGF_2_POWER_32   65535

MGF1 definitions

#define CRYS_RSA_MIN_PRIV_EXP_VALUE   1

Minimal private exponent value

#define CRYS_RSA_MIN_PUB_EXP_VALUE   3

Minimal public exponent value

#define CRYS_RSA_MIN_VALID_KEY_SIZE_VALUE_IN_BITS   512

Minimal key size in bits.

#define CRYS_RSA_OAEP_DECODE_MAX_DBMASK_SIZE   ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *sizeof(uint32_t))

OAEP decode mask size.

#define CRYS_RSA_OAEP_ENCODE_MAX_MASKDB_SIZE   ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *sizeof(uint32_t))

OAEP encode mask size.

#define CRYS_RSA_OAEP_ENCODE_MAX_SEEDMASK_SIZE CRYS_RSA_OAEP_MAX_HLEN

Size of OEAP seed.

#define CRYS_RSA_OAEP_MAX_HLEN CRYS_HASH_SHA512_DIGEST_SIZE_IN_BYTES

OAEP maximal H length.

#define CRYS_RSA_PSS_PAD1_LEN   8

PSS padding length.

#define CRYS_RSA_PSS_SALT_LENGTH CRYS_RSA_OAEP_MAX_HLEN

Maximal PSS salt size.

#define CRYS_RSA_SIZE_IN_WORDS_OF_CRYSRSAPrivCRTKey_t   ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *7/2 + 5)

Size of CRYSRSAPrivCRTKey_t structure in words (used for temp buffers allocation).

#define CRYS_RSA_SIZE_OF_T_STRING_BYTES   ( CRYS_RSA_MAXIMUM_MOD_BUFFER_SIZE_IN_WORDS *sizeof(uint32_t))

MGF1 definitions

Temporary buffer size definition.

#define CRYS_RSA_VALID_KEY_SIZE_MULTIPLE_VALUE_IN_BITS   256

Valid key size multiplications in RSA.

#define CRYS_RSA_VERIFY_SALT_LENGTH_UNKNOWN   0xFFFF

Salt length definition - if the salt length is not available in verify operation, the user can use this define and the algorithm will calculate the salt length alone

Note
Security wise: it is not recommended to use this flag.

Typedef Documentation

Required for internal FIPS verification for RSA KAT. The RSA KAT tests defined for scheme 2.1 with modulus key size of 2048.

KG data type.

Required for internal FIPS verification for RSA key generation.

Temporary buffers for RSA usage.

The user's context prototype - the argument type that is passed by the user to the RSA APIs. The context saves the state of the operation and must be saved by the user till the end of the APIs flow .

Temporary buffers for the RSA usage.

The private key's user structure prototype. This structure must be saved by the user, and is used as input to the RSA functions (such as SaSi_RsaSchemesDecrypt etc.).

The public key's user structure prototype. This structure must be saved by the user, and is used as input to the RSA functions (such as SaSi_RsaSchemesEncrypt etc.)

Enumeration Type Documentation

MGF values.

Enumerator
CRYS_PKCS1_NO_MGF

MGF1.

CRYS_RSA_NumOfMGFFunctions

No MGF.

CRYS_PKCS1_MGFLast

Maximal number of MGF options.

Defines the enum of the various PKCS1 versions.

Enumerator
CRYS_PKCS1_VER21

PKCS1 version 15.

CRYS_RSA_NumOf_PKCS1_versions

PKCS1 version 21.

CRYS_PKCS1_versionLast

Maximal number of PKCS versions.

Defines the enum of the RSA decryption mode.

Enumerator
CRYS_RSA_NoCrt

Decryption no CRT mode.

CRYS_RSA_Crt

Decryption CRT mode.

CRYS_RSA_DecryptionModeLast

Reserved.

Enum defining primality testing mode in Rabin-Miller and Lucas-Lehmer tests (internal tests).

Enumerator
CRYS_RSA_PRIME_TEST_MODE

PRIME test.

CRYS_DH_PRIME_TEST_MODE

DH Prime test.

CRYS_RSA_DH_PRIME_TEST_OFF_MODE

Reserved.

Defines the enum for the HASH operation mode.

Enumerator
CRYS_RSA_HASH_MD5_mode

For PKCS1 v1.5 only. The input data will be hashed with MD5

CRYS_RSA_HASH_SHA1_mode

The input data will be hashed with SHA1.

CRYS_RSA_HASH_SHA224_mode

The input data will be hashed with SHA224.

CRYS_RSA_HASH_SHA256_mode

The input data will be hashed with SHA256.

CRYS_RSA_HASH_SHA384_mode

The input data will be hashed with SHA384.

CRYS_RSA_HASH_SHA512_mode

The input data will be hashed with SHA512.

CRYS_RSA_After_MD5_mode

For PKCS1 v1.5 only. The input data is a digest of MD5 and will not be hashed.

CRYS_RSA_After_SHA1_mode

The input data is a digest of SHA1 and will not be hashed.

CRYS_RSA_After_SHA224_mode

The input data is a digest of SHA224 and will not be hashed.

CRYS_RSA_After_SHA256_mode

The input data is a digest of SHA256 and will not be hashed.

CRYS_RSA_After_SHA384_mode

The input data is a digest of SHA384 and will not be hashed.

CRYS_RSA_After_SHA512_mode

The input data is a digest of SHA512 and will not be hashed.

CRYS_RSA_HASH_NO_HASH_mode

Used for PKCS1 v1.5 Encrypt and Decrypt.

CRYS_RSA_HASH_NumOfModes

Maximal number of hash operations modes.

RSA Key source definition.

Enumerator
CRYS_RSA_ExternalKey

External key.

CRYS_RSA_InternalKey

Internal key.

CRYS_RSA_KeySourceLast

Reserved.