62 #define CRYS_DHPubKey_t CRYSRSAPubKey_t 65 #define CRYS_DH_MAX_VALID_KEY_SIZE_VALUE_IN_BITS CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BITS 67 #define CRYS_DH_MIN_VALID_KEY_SIZE_VALUE_IN_BITS 1024 69 #define CRYS_DH_MAX_MOD_SIZE_IN_BYTES (CRYS_DH_MAX_VALID_KEY_SIZE_VALUE_IN_BITS / SASI_BITS_IN_BYTE) 71 #define CRYS_DH_MAX_MOD_SIZE_IN_WORDS (CRYS_DH_MAX_MOD_SIZE_IN_BYTES/sizeof(uint32_t)) 74 #define CRYS_DH_MAX_MOD_BUFFER_SIZE_IN_WORDS (CRYS_DH_MAX_MOD_SIZE_IN_WORDS + 2) 76 #define CRYS_DH_DOMAIN_GENERATION_MAX_SIZE_BITS CRYS_RSA_MAX_KEY_GENERATION_SIZE_BITS 79 #define CRYS_DHPrimeData_t CRYS_RSAPrimeData_t 81 #define CRYS_DHUserPubKey_t CRYS_RSAUserPubKey_t 83 #define CRYS_DH_OtherInfo_t CRYS_KDF_OtherInfo_t 86 #define CRYS_DH_MAX_SIZE_OF_KEYING_DATA CRYS_KDF_MAX_SIZE_OF_KEYING_DATA 210 uint8_t *Generator_ptr,
211 uint16_t GeneratorSize,
225 uint8_t *ClientPrvKey_ptr,
229 uint16_t *ClientPrvKeySize_ptr,
232 uint8_t *ClientPub1_ptr,
233 uint16_t *ClientPubSize_ptr
244 #define CRYS_DH_PKCS3_GeneratePubPrv(rndState_ptr, rndGenerateVectFunc, Generator_ptr,GeneratorSize,\ 245 Prime_ptr,PrimeSize,\ 247 tmpPubKey_ptr,tmpPrimeData_ptr,\ 248 ClientPrvKey_ptr,ClientPrvKeySize_ptr,\ 249 ClientPub_ptr,ClientPubSize_ptr)\ 250 _DX_DH_GeneratePubPrv(rndState_ptr, rndGenerateVectFunc, (Generator_ptr),(GeneratorSize),\ 251 (Prime_ptr),(PrimeSize),\ 253 (uint8_t *)NULL,(uint16_t)0,\ 255 (tmpPubKey_ptr),(tmpPrimeData_ptr),\ 256 (ClientPrvKey_ptr),(ClientPrvKeySize_ptr),\ 257 (ClientPub_ptr),(ClientPubSize_ptr)) 262 #define CRYS_DH_ANSI_X942_GeneratePubPrv(rndState_ptr, rndGenerateVectFunc, Generator_ptr,GeneratorSize,Prime_ptr,PrimeSize,\ 264 tmpPubKey_ptr,tmpPrimeData_ptr,\ 265 ClientPrvKey_ptr,ClientPrvKeySize_ptr,\ 266 ClientPub_ptr,ClientPubSize_ptr)\ 267 _DX_DH_GeneratePubPrv(rndState_ptr, rndGenerateVectFunc, (Generator_ptr),(GeneratorSize),\ 268 (Prime_ptr),(PrimeSize),\ 271 CRYS_DH_ANSI_X942_mode,\ 272 (tmpPubKey_ptr),(tmpPrimeData_ptr),\ 273 (ClientPrvKey_ptr),(ClientPrvKeySize_ptr),\ 274 (ClientPub_ptr),(ClientPubSize_ptr)) 291 uint8_t *ClientPrvKey_ptr,
292 uint16_t ClientPrvKeySize,
293 uint8_t *ServerPubKey_ptr,
294 uint16_t ServerPubKeySize,
300 uint8_t *SecretKey_ptr,
302 uint16_t *SecretKeySize_ptr
325 uint8_t *ClientPrvKey_ptr,
326 uint16_t ClientPrvKeySize,
327 uint8_t *ServerPubKey_ptr,
328 uint16_t ServerPubKeySize,
340 uint8_t *SecretKeyingData_ptr,
342 uint16_t SecretKeyingDataSize
350 #define CRYS_DH_X942_GetSecretDataAsn1(ClientPrvKey_ptr,ClientPrvKeySize,ServerPubKey_ptr,ServerPubKeySize,Prime_ptr,PrimeSize,otherInfo_ptr,hashMode,tmpBuff_ptr,SecretKeyingData_ptr,SecretKeyingDataSize)\ 351 CRYS_DH_X942_GetSecretData((ClientPrvKey_ptr),(ClientPrvKeySize),(ServerPubKey_ptr),(ServerPubKeySize),(Prime_ptr),(PrimeSize),(otherInfo_ptr),(hashMode),(CRYS_DH_ASN1_Der_mode),(tmpBuff_ptr),(SecretKeyingData_ptr),(SecretKeyingDataSize)) 355 #define CRYS_DH_X942_GetSecretDataConcat(ClientPrvKey_ptr,ClientPrvKeySize,ServerPubKey_ptr,ServerPubKeySize,Prime_ptr,PrimeSize,otherInfo_ptr,hashMode,tmpBuff_ptr,SecretKeyingData_ptr,SecretKeyingDataSize)\ 356 CRYS_DH_X942_GetSecretData((ClientPrvKey_ptr),(ClientPrvKeySize),(ServerPubKey_ptr),(ServerPubKeySize),(Prime_ptr),(PrimeSize),(otherInfo_ptr),(hashMode),(CRYS_DH_Concat_Der_mode),(tmpBuff_ptr),(SecretKeyingData_ptr),(SecretKeyingDataSize)) 379 uint8_t *ClientPrvKey_ptr1,
380 uint16_t ClientPrvKeySize1,
381 uint8_t *ClientPrvKey_ptr2,
382 uint16_t ClientPrvKeySize2,
383 uint8_t *ServerPubKey_ptr1,
384 uint16_t ServerPubKeySize1,
385 uint8_t *ServerPubKey_ptr2,
386 uint16_t ServerPubKeySize2,
397 uint8_t *SecretKeyingData_ptr,
399 uint16_t SecretKeyingDataSize
408 #define CRYS_DH_X942_HybridGetSecretDataAsn1(ClientPrvKey_ptr1,ClientPrvKeySize1,ClientPrvKey_ptr2,ClientPrvKeySize2,ServerPubKey_ptr1,ServerPubKeySize1,ServerPubKey_ptr2,ServerPubKeySize2,Prime_ptr,PrimeSize,otherInfo_ptr,hashFunc,tmpDhHybr_ptr,SecretKeyingData_ptr,SecretKeyingDataSize)\ 409 CRYS_DH_X942_HybridGetSecretData((ClientPrvKey_ptr1),(ClientPrvKeySize1),(ClientPrvKey_ptr2),(ClientPrvKeySize2),(ServerPubKey_ptr1),(ServerPubKeySize1),(ServerPubKey_ptr2),(ServerPubKeySize2),(Prime_ptr),(PrimeSize),(otherInfo_ptr),(hashFunc),CRYS_DH_ASN1_Der_mode,(tmpDhHybr_ptr),(SecretKeyingData_ptr),(SecretKeyingDataSize)) 415 #define CRYS_DH_X942_HybridGetSecretDataConcat(ClientPrvKey_ptr1,ClientPrvKeySize1,ClientPrvKey_ptr2,ClientPrvKeySize2,ServerPubKey_ptr1,ServerPubKeySize1,ServerPubKey_ptr2,ServerPubKeySize2,Prime_ptr,PrimeSize,otherInfo_ptr,hashFunc,tmpDhHybr_ptr,SecretKeyingData_ptr,SecretKeyingDataSize)\ 416 CRYS_DH_X942_HybridGetSecretData((ClientPrvKey_ptr1),(ClientPrvKeySize1),(ClientPrvKey_ptr2),(ClientPrvKeySize2),(ServerPubKey_ptr1),(ServerPubKeySize1),(ServerPubKey_ptr2),(ServerPubKeySize2),(Prime_ptr),(PrimeSize),(otherInfo_ptr),(hashFunc),CRYS_DH_Concat_Der_mode,(tmpDhHybr_ptr),(SecretKeyingData_ptr),(SecretKeyingDataSize)) 431 uint32_t modPsizeBytes,
433 uint32_t orderQsizeBytes,
435 uint32_t pubKeySizeBytes,
CRYS_RSAUserPubKey_t UserPubKey
#define CRYS_DH_MAX_MOD_BUFFER_SIZE_IN_WORDS
CRYSError_t CRYS_DH_CheckPubKey(uint8_t *modP_ptr, uint32_t modPsizeBytes, uint8_t *orderQ_ptr, uint32_t orderQsizeBytes, uint8_t *pubKey_ptr, uint32_t pubKeySizeBytes, CRYS_DH_Temp_t *tempBuff_ptr)
The function checks the obtained DH public key according to its domain parameters [ANSI X9...
#define CRYS_DH_OtherInfo_t
CRYS_RSAUserPubKey_t pubKey
CRYS_RSAPrimeData_t PrimeData
#define CRYS_DHPrimeData_t
CRYSError_t CRYS_DH_GetSecretKey(uint8_t *ClientPrvKey_ptr, uint16_t ClientPrvKeySize, uint8_t *ServerPubKey_ptr, uint16_t ServerPubKeySize, uint8_t *Prime_ptr, uint16_t PrimeSize, CRYS_RSAUserPubKey_t *tmpPubKey_ptr, CRYS_RSAPrimeData_t *tmpPrimeData_ptr, uint8_t *SecretKey_ptr, uint16_t *SecretKeySize_ptr)
This function computes the shared secret key (value) accordng to [ANSI X9.42], 7.5.1: SecretKey = ServerPubKey ^ ClientPrvKey mod Prime.
#define SASI_BITS_IN_BYTE
CRYSError_t _DX_DH_GeneratePubPrv(void *rndState_ptr, SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, uint8_t *Generator_ptr, uint16_t GeneratorSize, uint8_t *Prime_ptr, uint16_t PrimeSize, uint16_t L, uint8_t *Q_ptr, uint16_t QSize, CRYS_DH_OpMode_t DH_mode, CRYS_RSAUserPubKey_t *tmpPubKey_ptr, CRYS_RSAPrimeData_t *tmpPrimeData_ptr, uint8_t *ClientPrvKey_ptr, uint16_t *ClientPrvKeySize_ptr, uint8_t *ClientPub1_ptr, uint16_t *ClientPubSize_ptr)
This function has two purposes:
CRYS_RSAUserPubKey_t UserPubKey
CRYS_RSAPrimeData_t PrimeData
CRYS_DH_DerivationFunc_Mode
CRYSError_t CRYS_DH_X942_GetSecretData(uint8_t *ClientPrvKey_ptr, uint16_t ClientPrvKeySize, uint8_t *ServerPubKey_ptr, uint16_t ServerPubKeySize, uint8_t *Prime_ptr, uint16_t PrimeSize, CRYS_KDF_OtherInfo_t *otherInfo_ptr, CRYS_DH_HASH_OpMode_t hashMode, CRYS_DH_DerivationFunc_Mode DerivFunc_mode, CRYS_DH_Temp_t *tmpBuff_ptr, uint8_t *SecretKeyingData_ptr, uint16_t SecretKeyingDataSize)
This function extracts the shared secret keying data from the shared secret value. It should be called by using macros CRYS_DH_X942_GetSecretDataAsn1 and CRYS_DH_X942_GetSecretDataConcat.
#define CRYS_DH_MIN_VALID_KEY_SIZE_VALUE_IN_BITS
CRYSError_t CRYS_DH_X942_HybridGetSecretData(uint8_t *ClientPrvKey_ptr1, uint16_t ClientPrvKeySize1, uint8_t *ClientPrvKey_ptr2, uint16_t ClientPrvKeySize2, uint8_t *ServerPubKey_ptr1, uint16_t ServerPubKeySize1, uint8_t *ServerPubKey_ptr2, uint16_t ServerPubKeySize2, uint8_t *Prime_ptr, uint16_t PrimeSize, CRYS_KDF_OtherInfo_t *otherInfo_ptr, CRYS_DH_HASH_OpMode_t hashMode, CRYS_DH_DerivationFunc_Mode DerivFunc_mode, CRYS_DH_HybrTemp_t *tmpDhHybr_ptr, uint8_t *SecretKeyingData_ptr, uint16_t SecretKeyingDataSize)
The function computes shared secret data using two pairs of public and private keys: ...
#define CRYS_DHUserPubKey_t
This file contains the CRYS APIs used for random number generation. The random-number generation modu...
CRYS_RSAPrimeData_t primeData
CRYS_RSAPrimeData_t PrimeData
This file contains all of the enums and definitions that are used for the CRYS RSA APIs...
This module defines the API that supports Key derivation function in modes as defined in PKCS#3...
uint32_t(* SaSiRndGenerateVectWorkFunc_t)(void *rndState_ptr, uint16_t outSizeBytes, uint8_t *out_ptr)