CAT2 Peripheral Driver Library
cy_stc_cryptolite_rsa_pub_key_t Struct Reference

Description

All fields for the context structure are internal.

Firmware never reads or writes these values. Firmware allocates the structure and provides the address of the structure to the driver in the function calls. Firmware must ensure that the defined instance of this structure remains in scope while the drive is in use.

The driver uses this structure to store and manipulate the RSA public key and additional coefficients to accelerate RSA calculation.

RSA key contained from two fields:

  • n - modulus part of the key
  • e - exponent part of the key.

Other fields are accelerating coefficients and can be calculated internally

If the RSA coefficients are pre-calculated, the corresponding buffers can be const and defined in Flash memory. The private buffer must be defined in RAM.

Note
All the buffers must be 4 byte aligned. cy_stc_cryptolite_rsa_pub_key_t and must also be in little-endian order.

Data Fields

uint8_t * moduloPtr
 The pointer to the modulus part of public key (in little-endian format). More...
 
uint32_t moduloLength
 The modulus length, in bits, maximum supported size is 4096 Bits.
 
uint8_t * pubExpPtr
 The pointer to the exponent part of public key.
 
uint32_t pubExpLength
 The exponent length, in bits, maximum supported size is 256Bit.
 
uint8_t * barretCoefPtr
 The pointer to the Barrett coefficient. More...
 
uint8_t * inverseModuloPtr
 The pointer to the binary inverse of the modulo. More...
 
uint8_t * rBarPtr
 The pointer to the (2^moduloLength mod modulo). More...
 
uint8_t * privateBuffer
 The pointer to the private buffer and used by RSA decryption calculations. More...
 
bool calculateCoeff
 when set to 'false', pre-calculated coefficients must be provided in 'barretCoefPtr, 'inverseModuloPtr' and 'rBarPtr'. More...
 

Field Documentation

◆ moduloPtr

uint8_t* cy_stc_cryptolite_rsa_pub_key_t::moduloPtr

The pointer to the modulus part of public key (in little-endian format).

◆ barretCoefPtr

uint8_t* cy_stc_cryptolite_rsa_pub_key_t::barretCoefPtr

The pointer to the Barrett coefficient.

Memory for it should be allocated by user with size moduloLength + 1.

◆ inverseModuloPtr

uint8_t* cy_stc_cryptolite_rsa_pub_key_t::inverseModuloPtr

The pointer to the binary inverse of the modulo.

Memory for it should be allocated by user with size moduloLength + 1.

◆ rBarPtr

uint8_t* cy_stc_cryptolite_rsa_pub_key_t::rBarPtr

The pointer to the (2^moduloLength mod modulo).

Memory for it should be allocated by user with size moduloLength

◆ privateBuffer

uint8_t* cy_stc_cryptolite_rsa_pub_key_t::privateBuffer

The pointer to the private buffer and used by RSA decryption calculations.

Memory for it should be allocated by user with size privateBufferSize = 4*VU_BITS_TO_WORDS(2*CY_CRYPTOLITE_RSA_BIT_SIZE+1)

  • 4*VU_BITS_TO_WORDS(2*CY_CRYPTOLITE_RSA_BIT_SIZE+1)
  • 4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BIT_SIZE)

◆ calculateCoeff

bool cy_stc_cryptolite_rsa_pub_key_t::calculateCoeff

when set to 'false', pre-calculated coefficients must be provided in 'barretCoefPtr, 'inverseModuloPtr' and 'rBarPtr'.

When set to 'true', all the acceleration step coefficients will be calculated as part of Cy_Cryptolite_Rsa_Verify