//-----------------------------------------------------------------------------------
//    The confidential and proprietary information contained in this file may 
//    only be used by a person authorised under and to the extent permitted
//    by a subsisting licensing agreement from ARM Limited or its affiliates 
//    or between you and a party authorised by ARM
//
//           (C) COPYRIGHT [2016] ARM Limited or its affiliates
//               ALL RIGHT RESERVED
//
//    This entire notice must be reproduced on all copies of this file
//    and copies of this files may only be made by a person if such person is
//    permitted to do so under the terms of a subsisting license agreement
//    from ARM Limited or its affiliates or between you and a party authorised by ARM
//-----------------------------------------------------------------------------------



#ifndef _CRYS_DH_H
#define _CRYS_DH_H

#include "crys_rsa_types.h"
#include "crys_kdf.h"
#include "crys_rnd.h"

#ifdef __cplusplus
extern "C"
{
#endif


/*!
@file
@brief This module defines the API that supports Diffie-Hellman key exchange, as defined in [PKCS3] and in [X9.42] (key lengths 1024 and 2048 bits).
*/


/************************ Defines ******************************/

#define CRYS_DHPubKey_t  CRYSRSAPubKey_t

#define CRYS_DH_MAX_VALID_KEY_SIZE_VALUE_IN_BITS  CRYS_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BITS /*!< \internal RL restrict to 2048 */

#define CRYS_DH_MIN_VALID_KEY_SIZE_VALUE_IN_BITS  1024 /*!< Size limitation according to ANSI standard */

#define CRYS_DH_MAX_MOD_SIZE_IN_BYTES   (CRYS_DH_MAX_VALID_KEY_SIZE_VALUE_IN_BITS / 8)
#define CRYS_DH_MAX_MOD_SIZE_IN_WORDS   (CRYS_DH_MAX_MOD_SIZE_IN_BYTES/sizeof(uint32_t))

#define CRYS_DH_MAX_MOD_BUFFER_SIZE_IN_WORDS (CRYS_DH_MAX_MOD_SIZE_IN_WORDS + 2)
#define CRYS_DH_DOMAIN_GENERATION_MAX_SIZE_BITS   CRYS_RSA_MAX_KEY_GENERATION_SIZE_BITS /*!< \internal RL restrict to 2048 */

/* The following defines are for the readability of the user */
#define CRYS_DHPrimeData_t   CRYS_RSAPrimeData_t
#define CRYS_DHUserPubKey_t  CRYS_RSAUserPubKey_t
#define CRYS_DH_OtherInfo_t  CRYS_KDF_OtherInfo_t
#define CRYS_DH_COUNT_OF_OTHER_INFO_ENTRIES  CRYS_KDF_COUNT_OF_OTHER_INFO_ENTRIES
#define CRYS_DH_MAX_SIZE_OF_OTHER_INFO_ENTRY  CRYS_KDF_MAX_SIZE_OF_OTHER_INFO_ENTRY /*!< Size is in bytes */
#define CRYS_DH_MAX_SIZE_OF_KEYING_DATA  CRYS_KDF_MAX_SIZE_OF_KEYING_DATA /*!< Size is in bytes*/

/************************ Enums ********************************/

/* DH operations mode (used in some functions of DH) */
typedef enum
{
   CRYS_DH_PKCS3_mode  = 0,
   CRYS_DH_ANSI_X942_mode = 1,
   CRYS_DH_NumOfModes,

   CRYS_DH_OpModeLast    = 0x7FFFFFFF,

}CRYS_DH_OpMode_t;

/* HASH operation modes, used in DH */
typedef enum
{
	CRYS_DH_HASH_SHA1_mode		= CRYS_HASH_SHA1_mode,
	CRYS_DH_HASH_SHA224_mode	= CRYS_HASH_SHA224_mode,
	CRYS_DH_HASH_SHA256_mode	= CRYS_HASH_SHA256_mode,
	CRYS_DH_HASH_SHA384_mode	= CRYS_HASH_SHA384_mode,
	CRYS_DH_HASH_SHA512_mode	= CRYS_HASH_SHA512_mode,
	CRYS_DH_HASH_MD5_mode	        = CRYS_HASH_MD5_mode, /*!< \internal not used in DH */

	CRYS_DH_HASH_NumOfModes		= CRYS_HASH_MD5_mode,
	CRYS_DH_HASH_OperationModeLast  = 0x7FFFFFFF,

}CRYS_DH_HASH_OpMode_t;

/* key derivation modes, used in DH */
typedef enum
{
	CRYS_DH_ASN1_Der_mode    = CRYS_KDF_ASN1_DerivMode,
	CRYS_DH_Concat_Der_mode  = CRYS_KDF_ConcatDerivMode,
	CRYS_DH_X963_DerMode    = CRYS_KDF_ConcatDerivMode,

	CRYS_DH_DerivationFunc_ModeLast= 0x7FFFFFFF,

}CRYS_DH_DerivationFunc_Mode;


/************************ Typedefs  *************************************/
/* temp buffer structure used for exponentiation in DH functions */
typedef struct
{
	CRYS_DHPrimeData_t PrimeData;
	CRYS_DHPubKey_t    PubKey;
	uint32_t TempBuff[CRYS_DH_MAX_MOD_BUFFER_SIZE_IN_WORDS];
} CRYS_DH_ExpTemp_t;

/* temp buffer structure used for DH functions (non hybrid) */
typedef struct
{
	CRYS_DHPrimeData_t PrimeData;
	CRYS_DHUserPubKey_t    UserPubKey;
	uint32_t TempBuff[CRYS_DH_MAX_MOD_BUFFER_SIZE_IN_WORDS];
} CRYS_DH_Temp_t;

/* temp buffer structure used for DH hybrid functions */
typedef struct
{
	CRYS_DHPrimeData_t PrimeData;
	CRYS_DHUserPubKey_t    UserPubKey;
	uint32_t TempBuff[2*CRYS_DH_MAX_MOD_BUFFER_SIZE_IN_WORDS];
} CRYS_DH_HybrTemp_t;

/* Buffer used for FIPS KAT */
typedef struct
{
	CRYS_DHUserPubKey_t pubKey;
	CRYS_DHPrimeData_t  primeData;
	uint8_t secretBuff[CRYS_DH_MIN_VALID_KEY_SIZE_VALUE_IN_BITS/SASI_BITS_IN_BYTE];  // KAT tests uses 1024 bit key
} CRYS_DH_FipsKat_t;


/************************ Structs  **************************************/

/************************ Public Variables ******************************/

/************************ Public Functions ******************************/

/*******************************************************************************************/

/*!
@brief This function has two purposes:
<ol><li> Randomly generate the client private key according to the choosen version [PKCS3] or [ANSI X9.42].</li>
<li> Computes the client public key as follows:	ClientPub = Generator^Prv mod Prime, where '^' is the symbol of exponentiation.</li></ol>
This function should not be called directly. Instead, use the macros ::CRYS_DH_PKCS3_GeneratePubPrv and ::CRYS_DH_ANSI_X942_GeneratePubPrv.
\note
All buffer parameters should be in Big-Endian form.

@return CRYS_OK on success.
@return A non-zero value on failure as defined crys_dh_error.h
 */
CIMPORT_C CRYSError_t _DX_DH_GeneratePubPrv(
                    CRYS_RND_Context_t *rndContext_ptr,             /*!< [in/out] Pointer to the RND context buffer. */
                    uint8_t *Generator_ptr,                         /*!< [in]  Pointer to the Generator octet string. */
                    uint16_t GeneratorSize,                         /*!< [in]  The size of the Generator string (in bytes). */
                    uint8_t *Prime_ptr,                             /*!< [in]  Pointer to the Prime octet string P (used as modulus in the algorithm). */
                    uint16_t PrimeSize,                             /*!< [in]  The size of the Prime string in bytes. */
                    uint16_t L,                                     /*!< [in]  Exact size in bits of the Prime to be generated (relevant only for [PKCS3]):
                                                                               <ul><li> If L!=0, force the private key to be [2^(L-1) ? Prv < 2^L], where '^'
									        indicates exponentiation.</li>
                                                                               <li> If L = 0 then [0 < Prv < P-1].</li></ul> */
                    uint8_t *Q_ptr,                                 /*!< [in]  Relevant only for [ANSI X9.42] - Pointer to the Q octet string in the range:
                                                                                1 <= Prv <= Q-1 or 1 < Prv < Q-1. */
                    uint16_t QSize,                                 /*!< [in]  Relevant only for [ANSI X9.42] - Size of the Q string (in bytes). */
                    CRYS_DH_OpMode_t DH_mode,                       /*!< [in]  An enumerator declaring whether this is [PKCS3] or [ANSI X9.42] mode. */
                    CRYS_DHUserPubKey_t *tmpPubKey_ptr,             /*!< [in]  Pointer to a temporary buffer for public key structure. Used for the
							                       exponentiation function. */
                    CRYS_DHPrimeData_t  *tmpPrimeData_ptr,          /*!< [in]  Pointer to a structure holding internal temporary buffers. */
                    uint8_t *ClientPrvKey_ptr,                      /*!< [out] Pointer to the Private key Prv. This buffer should be at least the following
									       size (in bytes):
                                                                               <ul><li> If L is provided: (L+7)/8.</li>
                                                                               <li> If L is NULL: \p PrimeSize. </li></ul> */
                    uint16_t *ClientPrvKeySize_ptr,                 /*!< [in/out] Pointer to the Private key size:
                                                                                    <ul><li> Input - size of the given buffer.</li>
                                                                                    <li> Output - actual size of the generated private key.</li></ul> */
                    uint8_t *ClientPub1_ptr,                        /*!< [out] Pointer to the Public key. This buffer should be at least \p PrimeSize bytes. */
                    uint16_t *ClientPubSize_ptr                     /*!< [in/out] Pointer to the Public key size:
                                                                                  <ul><li> Input - size of the given buffer.</li>
                                                                                  <li> Output - actual size of the generated public key.</li></ul> */
);


/* macro for calling the GeneratePubPrv function on PKCS#3 mode:  Q is irrelevant */
/*--------------------------------------------------------------------------------*/
/*!
This macro is used to generate the public and private DH keys according to [PKCS3]. For a description of the parameters see ::_DX_DH_GeneratePubPrv.
*/
#define CRYS_DH_PKCS3_GeneratePubPrv(rndContext_ptr, Generator_ptr,GeneratorSize,\
				Prime_ptr,PrimeSize,\
				L,\
				tmpPubKey_ptr,tmpPrimeData_ptr,\
				ClientPrvKey_ptr,ClientPrvKeySize_ptr,\
				ClientPub_ptr,ClientPubSize_ptr)\
		_DX_DH_GeneratePubPrv(rndContext_ptr, (Generator_ptr),(GeneratorSize),\
				(Prime_ptr),(PrimeSize),\
				(L),\
				(uint8_t *)NULL,(uint16_t)0,\
				CRYS_DH_PKCS3_mode,\
				(tmpPubKey_ptr),(tmpPrimeData_ptr),\
				(ClientPrvKey_ptr),(ClientPrvKeySize_ptr),\
				(ClientPub_ptr),(ClientPubSize_ptr))

/*!
This macro is used to generate the public and private DH keys according to [ANSI X9.42]. For a description of the parameters see ::_DX_DH_GeneratePubPrv.
*/
#define CRYS_DH_ANSI_X942_GeneratePubPrv(rndContext_ptr, Generator_ptr,GeneratorSize,Prime_ptr,PrimeSize,\
				Q_ptr,QSize,\
				tmpPubKey_ptr,tmpPrimeData_ptr,\
				ClientPrvKey_ptr,ClientPrvKeySize_ptr,\
				ClientPub_ptr,ClientPubSize_ptr)\
		_DX_DH_GeneratePubPrv(rndContext_ptr, (Generator_ptr),(GeneratorSize),\
				(Prime_ptr),(PrimeSize),\
				(uint16_t)0,\
				(Q_ptr),(QSize),\
				CRYS_DH_ANSI_X942_mode,\
				(tmpPubKey_ptr),(tmpPrimeData_ptr),\
				(ClientPrvKey_ptr),(ClientPrvKeySize_ptr),\
				(ClientPub_ptr),(ClientPubSize_ptr))


/*******************************************************************************************/
/*!
@brief This function computes the shared secret key (value) accordng to [ANSI X9.42], 7.5.1:
          SecretKey = ServerPubKey ^ ClientPrvKey mod Prime.
\note <ul id="noteb"><li> All buffer parameters should be in Big-Endian form.</li>
<li>The user must obtain assurance of validity of the public key, using one of methods,
described in [ANSI X9.42] paragraph 7.4.</li>
<li>The actual size of the private key (in bits) must be not less than 2 and not greater than the actual
size of the Prime (modulus in bits).</li></ul>

@return CRYS_OK on success.
@return A non-zero value on failure as defined in crys_dh_error.h.
*/
CIMPORT_C CRYSError_t CRYS_DH_GetSecretKey(
					uint8_t *ClientPrvKey_ptr,                  /*!< [in]  Pointer to the Private key octet string Prv < Prime. */
					uint16_t ClientPrvKeySize,                  /*!< [in]  The Private key Size (in bytes). */
					uint8_t *ServerPubKey_ptr,                  /*!< [in]  Pointer to the Server public key octet string. */
					uint16_t ServerPubKeySize,                  /*!< [in]  The Server Public key Size (in bytes). */
					uint8_t *Prime_ptr,                         /*!< [in]  Pointer to the Prime octet string. */
					uint16_t PrimeSize,                         /*!< [in]  The size of the Prime string. */
					CRYS_DHUserPubKey_t *tmpPubKey_ptr,         /*!< [in]  Pointer to the public key structure. Used for the exponentiation
											 operation function. Need not be initialized. */
					CRYS_DHPrimeData_t  *tmpPrimeData_ptr,      /*!< [in]  Pointer to a structure containing internal temp buffers. */
					uint8_t *SecretKey_ptr,                     /*!< [out] Pointer to the secret key octet string. This buffer should be at
											least PrimeSize bytes. */
					uint16_t *SecretKeySize_ptr                 /*!< [in/out] Pointer to the secret key Buffer Size. This buffer should be at
											least of PrimeSize bytes:
											<ul><li> Input  - size of the given buffer.</li>
											<li> Output - actual size. </li></ul>*/
);


/******************************************************************************************/
/*!
@brief 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.

\note
<ul id="noteb"><li> The "other info" argument and its AlgorithmID entry are mandatory only for ASN1 key derivation, and optional for
the other derivation modes. </li>
<li>If used, all entries of the structure should be initialized with relevant data and size, prior to calling this function
(entry size of empty fields must be set to 0).</li>
<li>All buffers arguments are represented in Big-Endian form.</li></ul>

@return CRYS_OK on success.
@return A non-zero value on failure as defined in crys_dh_error.h.
*/
 CIMPORT_C CRYSError_t CRYS_DH_X942_GetSecretData(
                    uint8_t                  *ClientPrvKey_ptr,        /*!< [in] Pointer to the Private key octet string. */
                    uint16_t                  ClientPrvKeySize,         /*!< [in] The Private key size (in bytes). */
                    uint8_t                  *ServerPubKey_ptr,         /*!< [in] Pointer to the Server public key octet string. */
		    uint16_t                  ServerPubKeySize,         /*!< [in] The Server Public key size (in bytes). */
                    uint8_t                  *Prime_ptr,                /*!< [in] Pointer to the Prime octet string. */
                    uint16_t                  PrimeSize,                /*!< [in] The size of the Prime string. */
                    CRYS_DH_OtherInfo_t        *otherInfo_ptr,          /*!< [in] Pointer to structure containing other data, shared by two entities
										  sharing the secret keying data.
                                                                                  The Maximal size of each data entry of "other info" is limited - see crys_kdf.h
										  for the defined value. */
                    CRYS_DH_HASH_OpMode_t       hashMode,               /*!< [in] One of the supported SHA-x HASH modes. The supported modes are according to the supported
								        	  HASH modes for the product (and MD5 is not supported). */
                    CRYS_DH_DerivationFunc_Mode DerivFunc_mode,         /*!< [in] The enumerator ID of key derivation function mode. ASN1 or Concatenation
										  modes are supported. */
                    CRYS_DH_Temp_t             *tmpBuff_ptr,            /*!< [in] A pointer to the DH temp buffer structure. Not initialized. */
                    uint8_t                  *SecretKeyingData_ptr,     /*!< [out] Pointer to the secret key octet string. This buffer should be at least
										   PrimeSize bytes. */
                    uint16_t                  SecretKeyingDataSize      /*!< [in] The required Secret Keying data size (in bytes). Must be larger than 0,
										  and smaller than the maximal - CRYS_DH_MAX_SIZE_OF_KEYING_DATA. */
);

/****************************************************************/
/*!
This macro implements the DH [ANSI X9.42] standard. It derives a secret key using the Derivation function based on ASN.1. For a
description of the parameters see ::CRYS_DH_X942_GetSecretData.*/
#define CRYS_DH_X942_GetSecretDataAsn1(ClientPrvKey_ptr,ClientPrvKeySize,ServerPubKey_ptr,ServerPubKeySize,Prime_ptr,PrimeSize,otherInfo_ptr,hashMode,tmpBuff_ptr,SecretKeyingData_ptr,SecretKeyingDataSize)\
	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))
/*!
This macro implements the DH [ANSI X9.42] standard. It derives a secret key using the Derivation function based on concatenation of HASHed data.
For a description of the parameters see ::CRYS_DH_X942_GetSecretData.*/
#define CRYS_DH_X942_GetSecretDataConcat(ClientPrvKey_ptr,ClientPrvKeySize,ServerPubKey_ptr,ServerPubKeySize,Prime_ptr,PrimeSize,otherInfo_ptr,hashMode,tmpBuff_ptr,SecretKeyingData_ptr,SecretKeyingDataSize)\
	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))


/****************************************************************/
/*!
@brief The function computes shared secret data using two pairs of public and private keys:

<ul><li> SecretKey1 = ServerPubKey1^ClientPrvKey1 mod Prime. </li>
<li> SecretKey2 = ServerPubKey2^ClientPrvKey2 mod Prime. </li></ul>
It uses the Derivation function to derive secret keying data from the two secret keys (values).
This function may be called directly, or by using macros ::CRYS_DH_X942_HybridGetSecretDataAsn1 and ::CRYS_DH_X942_HybridGetSecretDataConcat
described above.

\note
<ul id="noteb"><li> The "other info" argument and its AlgorithmID entry are mandatory only for ASN1 key derivation, and optional for the other derivation modes.</li>
If used, all entries of the structure should be initialized with relevant data and size, prior to calling this function
(entry size of empty fields must be set to 0).
<li> All buffers arguments are represented in Big-Endian form. </li></ul>

@return CRYS_OK on success.
@return A non-zero value on failure as defined in crys_dh_error.h or crys_kdf_error.h.
*/
CIMPORT_C CRYSError_t CRYS_DH_X942_HybridGetSecretData(
                uint8_t            *ClientPrvKey_ptr1,          /*!< [in]  Pointer to the First Private key octet string number. */
                uint16_t            ClientPrvKeySize1,          /*!< [in]  The First Private key Size (in bytes). */
                uint8_t            *ClientPrvKey_ptr2,          /*!< [in]  Pointer to the Second Private key octet string. */
		uint16_t            ClientPrvKeySize2,          /*!< [in]  The Second Private key Size (in bytes). */
                uint8_t            *ServerPubKey_ptr1,          /*!< [in]  Pointer to the First Server public key octet string. */
                uint16_t            ServerPubKeySize1,          /*!< [in]  The First Server Public key Size (in bytes). */
                uint8_t            *ServerPubKey_ptr2,          /*!< [in]  Pointer to the Second Server public key octet string. */
                uint16_t            ServerPubKeySize2,          /*!< [in]  The Second Server Public key Size (in bytes). */
                uint8_t            *Prime_ptr,                  /*!< [in]  Pointer to the Prime octet string. */
                uint16_t            PrimeSize,                  /*!< [in]  The size of the Prime string. */
                CRYS_DH_OtherInfo_t  *otherInfo_ptr,            /*!< [in]  Pointer to structure containing optional other data, shared by two entities
								 sharing the secret keying data. */
                CRYS_DH_HASH_OpMode_t hashMode,                 /*!< [in]  One of the supported SHA-x HASH modes. The supported modes are according to the supported
								           HASH modes for the product (and MD5 is not supported). */
                CRYS_DH_DerivationFunc_Mode DerivFunc_mode,     /*!< [in]  The type of function to use to derive the secret key to the key data.
								 ASN.1 or Concatenation modes are supported. */
                CRYS_DH_HybrTemp_t   *tmpDhHybr_ptr,            /*!< [in]  Pointer to a CRYS_DH_Temp_t structure that contains temp buffers for
								 internal operations. */
                uint8_t            *SecretKeyingData_ptr,       /*!< [out] Pointer to the secret key octet string. This buffer should be at least
								 of size PrimeSize bytes. */
                uint16_t            SecretKeyingDataSize        /*!< [in]  The required Secret Keying data size (in bytes). Must be larger than 0,
								 and smaller than CRYS_DH_MAX_SIZE_OF_KEYING_DATA. */
);


/****************************************************************/
/*!
This macro implements the DH [X9.42] standard deriving a hybrid secret key from two public-private pair of keys using the Derivation function based on ASN.1.
For a description of the parameters see ::CRYS_DH_X942_HybridGetSecretData.*/
#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)\
	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))

/*!
This macro implements the DH [X9.42] standard, deriving a hybrid secret key from two pairs of public-private keys, using the Derivation
function based on concatenation using SHA-x HASH. For a description of the parameters see ::CRYS_DH_X942_HybridGetSecretData.
*/
#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)\
	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))


/******************************************************************************************/
/*!
@brief The function checks the obtained DH public key according to its domain parameters [ANSI X9.42-2001]

\note
Assuming: The DH domain parameters are valid.

@return CRYS_OK on success.
@return A non-zero value on failure as defined in crys_dh_error.h.
*/
CIMPORT_C CRYSError_t CRYS_DH_CheckPubKey(
					uint8_t              *modP_ptr,            /*!< [in] The pointer to the modulus (prime) P. */
					uint32_t              modPsizeBytes,        /*!< [in]  The modulus size in bytes. */
					uint8_t              *orderQ_ptr,           /*!< [in]  The pointer to the prime order Q of generator. */
					uint32_t              orderQsizeBytes,      /*!< [in]  The size of order of generator in bytes. */
					uint8_t              *pubKey_ptr,           /*!< [in]  The pointer to the public key to be validated. */
					uint32_t              pubKeySizeBytes,      /*!< [in]  The public key size in bytes. */
					CRYS_DH_Temp_t       *tempBuff_ptr         /*!< [in]  The temp buffer for internal calculations. */
);


#ifdef __cplusplus
}
#endif

#endif
