Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
CryptoCell DH Key Generation APIs
[CryptoCell DH APIs]
Data Structures | |
struct | CRYS_DHKGData_t |
struct | CRYS_DHKG_CheckTemp_t |
Typedefs | |
typedef struct CRYS_DHKGData_t | CRYS_DHKGData_t |
typedef struct CRYS_DHKG_CheckTemp_t | CRYS_DHKG_CheckTemp_t |
Functions | |
CIMPORT_C CRYSError_t | CRYS_DH_CreateDomainParams (void *rndState_ptr, SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, uint32_t modPsizeBits, uint32_t orderQsizeBits, uint32_t seedSizeBits, uint8_t *modP_ptr, uint8_t *orderQ_ptr, uint8_t *generatorG_ptr, uint32_t *generGsizeBytes_ptr, uint8_t *factorJ_ptr, uint32_t *JsizeBytes_ptr, uint8_t *seedS_ptr, int8_t generateSeed, uint32_t *pgenCounter_ptr, CRYS_DHKGData_t *DHKGbuff_ptr) |
This function generates DH domain parameters in Galois prime field according to standard [ANS X9.42]. It receives the required sizes (in bits) of the modulus, the generator's order, and the seed, and then generates the prime modulus and the generator according to given sizes. If generateSeed argument is set to 1, the function generates and outputs the random seed. Otherwise (if set to 0), the seed has to be passed as an input argument. According to implementation the seed should be not greate, than (2^seedSizeBits - 2^32). The seed and some additional parameters, generated by the function (factorJ, pgenCounter), are used for checking that all domain parameters are generated according to the standard and not forged. | |
CIMPORT_C CRYSError_t | CRYS_DH_CheckDomainParams (void *rndState_ptr, SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, uint8_t *modP_ptr, uint32_t modPsizeBytes, uint8_t *orderQ_ptr, uint32_t orderQsizeBytes, uint8_t *generatorG_ptr, uint32_t generatorSizeBytes, uint8_t *seedS_ptr, uint32_t seedSizeBits, uint32_t pgenCounter, CRYS_DHKG_CheckTemp_t *checkTempBuff_ptr) |
This function receives DH domain parameters, seed and prime generation counter and then verifies that the domain was created according to the standard [ANS X9.42]. According to implementation, the value of the user passed seed should be not greate, than (2^seedSizeBits - 2^32), otherwise an error is returned. |
Typedef Documentation
typedef struct CRYS_DHKG_CheckTemp_t CRYS_DHKG_CheckTemp_t |
Temporary buffer structure .
typedef struct CRYS_DHKGData_t CRYS_DHKGData_t |
Temporary data buffer structure for domain parameters generation in DH.
Function Documentation
CIMPORT_C CRYSError_t CRYS_DH_CheckDomainParams | ( | void * | rndState_ptr, |
SaSiRndGenerateVectWorkFunc_t | rndGenerateVectFunc, | ||
uint8_t * | modP_ptr, | ||
uint32_t | modPsizeBytes, | ||
uint8_t * | orderQ_ptr, | ||
uint32_t | orderQsizeBytes, | ||
uint8_t * | generatorG_ptr, | ||
uint32_t | generatorSizeBytes, | ||
uint8_t * | seedS_ptr, | ||
uint32_t | seedSizeBits, | ||
uint32_t | pgenCounter, | ||
CRYS_DHKG_CheckTemp_t * | checkTempBuff_ptr | ||
) |
This function receives DH domain parameters, seed and prime generation counter and then verifies that the domain was created according to the standard [ANS X9.42]. According to implementation, the value of the user passed seed should be not greate, than (2^seedSizeBits - 2^32), otherwise an error is returned.
- Note:
- All buffer parameters should be in Big-Endian form. For more detailed description of the parameters see CRYS_DH_CreateDomainParams.
- Returns:
- CRYS_OK on success.
- A non-zero value on failure as defined crys_dh_error.h, crys_rnd_error.h or crys_hash_error.h.
- Parameters:
-
[in,out] rndState_ptr Pointer to the RND state. [in,out] rndGenerateVectFunc Pointer to the RND Generate vector function pointer. [in] modP_ptr Pointer to the modulus (Prime). [in] modPsizeBytes Size of the modulus (Prime) in bytes. [in] orderQ_ptr Pointer to the order Q of generator. The size of the buffer for output generated value must be no less than the order size. [in] orderQsizeBytes Size of the Generator's order in bytes. [in] generatorG_ptr Pointer to the generator of the multiplicative subgroup in GF(P). [in] generatorSizeBytes Size of the generator in bytes. [in] seedS_ptr Random seed used for prime generation. [in] seedSizeBits Seed size in bits. [in] pgenCounter Counter of prime generation attempts. [in] checkTempBuff_ptr Temporary buffer for internal calculations.
CIMPORT_C CRYSError_t CRYS_DH_CreateDomainParams | ( | void * | rndState_ptr, |
SaSiRndGenerateVectWorkFunc_t | rndGenerateVectFunc, | ||
uint32_t | modPsizeBits, | ||
uint32_t | orderQsizeBits, | ||
uint32_t | seedSizeBits, | ||
uint8_t * | modP_ptr, | ||
uint8_t * | orderQ_ptr, | ||
uint8_t * | generatorG_ptr, | ||
uint32_t * | generGsizeBytes_ptr, | ||
uint8_t * | factorJ_ptr, | ||
uint32_t * | JsizeBytes_ptr, | ||
uint8_t * | seedS_ptr, | ||
int8_t | generateSeed, | ||
uint32_t * | pgenCounter_ptr, | ||
CRYS_DHKGData_t * | DHKGbuff_ptr | ||
) |
This function generates DH domain parameters in Galois prime field according to standard [ANS X9.42]. It receives the required sizes (in bits) of the modulus, the generator's order, and the seed, and then generates the prime modulus and the generator according to given sizes. If generateSeed argument is set to 1, the function generates and outputs the random seed. Otherwise (if set to 0), the seed has to be passed as an input argument. According to implementation the seed should be not greate, than (2^seedSizeBits - 2^32). The seed and some additional parameters, generated by the function (factorJ, pgenCounter), are used for checking that all domain parameters are generated according to the standard and not forged.
- Note:
- All buffer parameters should be in Big-Endian form.
- Returns:
- CRYS_OK on success.
- A non-zero value on failure as defined crys_dh_error.h, crys_rnd_error.h or crys_hash_error.h.
- Parameters:
-
[in,out] rndState_ptr Pointer to the RND state structure. [in] rndGenerateVectFunc Pointer to a random vector generation function. [in] modPsizeBits Size of the modulus (Prime) in bits equal 256*n, where n >= 4. FIPS 186-4 defines sizes 1024 and 2048 bit. [in] orderQsizeBits Size of the Generator's order in bits. FIPS 186-4 defines orderQSizeBits = 160 for modulus 1024 bit and 224 or 256 bit for modPSizeBits = 2048. We not recommend sizes > 256 and returns an error if orderQSizeBits > modPSizeBits/4 [in] seedSizeBits Seed size in bits. Requirements: modPSizeBits >= seedSizeBits >= orderQSizeBits (the first is required by our implementation). [out] modP_ptr Pointer to the modulus (prime) buffer. The size of the buffer for output generated value must be no less than given modulus size. [out] orderQ_ptr Pointer to the order Q of generator. The size of the buffer for output generated value must be no less than the given order size. [out] generatorG_ptr Pointer to the generator of multiplicative subgroup in GF(P). If the user does not need this output, then both the pointer and the buffer size must be set to 0. [in,out] generGsizeBytes_ptr Pointer to the one word buffer for outputting the generator's size. The passed size (if needed) must be not less than modulus size and the function returns the actual size of the generator. [out] factorJ_ptr Pointer to the buffer for integer factor J. If NULL, the function does not output this parameter (in this case JsizeBytes_ptr also must be set to NULL, else the function returns an error). [in,out] JsizeBytes_ptr Pointer to the size of integer factor J. If NULL, the function does not output this parameter. [in,out] seedS_ptr Random seed used for prime generation. The size of the buffer must be at least the seed size. [in] generateSeed Flag, defining whether the seed should be generated randomly by the function (1) or is passed by the user (0). [out] pgenCounter_ptr Pointer to counter of tries to generate the primes. If NULL, the function does not output this parameter. [out] DHKGbuff_ptr The temp buffer of defined structure for internal calculations.
Generated on Tue Jul 12 2022 13:55:21 by
