This file contains all of the enums and definitions that are used for the CRYS SRP APIs, as well as the APIs themselves.
More...
|
#define | CRYS_SRP_MODULUS_SIZE_1024_BITS 1024 |
|
#define | CRYS_SRP_MODULUS_SIZE_1536_BITS 1536 |
|
#define | CRYS_SRP_MODULUS_SIZE_2048_BITS 2048 |
|
#define | CRYS_SRP_MODULUS_SIZE_3072_BITS 3072 |
|
#define | CRYS_SRP_MAX_MODULUS_IN_BITS CRYS_SRP_MODULUS_SIZE_3072_BITS |
|
#define | CRYS_SRP_MAX_MODULUS (CRYS_SRP_MAX_MODULUS_IN_BITS/SASI_BITS_IN_BYTE) |
|
#define | CRYS_SRP_MAX_MODULUS_IN_WORDS (CRYS_SRP_MAX_MODULUS_IN_BITS/SASI_BITS_IN_32BIT_WORD) |
|
#define | CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_BITS (256) |
|
#define | CRYS_SRP_PRIV_NUM_MIN_SIZE (CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_BITS/SASI_BITS_IN_BYTE) |
|
#define | CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_WORDS (CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_BITS/SASI_BITS_IN_32BIT_WORD) |
|
#define | CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_BITS (CRYS_SRP_MAX_MODULUS_IN_BITS) |
|
#define | CRYS_SRP_PRIV_NUM_MAX_SIZE (CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_BITS/SASI_BITS_IN_BYTE) |
|
#define | CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_WORDS (CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_BITS/SASI_BITS_IN_32BIT_WORD) |
|
#define | CRYS_SRP_MAX_DIGEST_IN_WORDS CRYS_HASH_RESULT_SIZE_IN_WORDS |
|
#define | CRYS_SRP_MAX_DIGEST (CRYS_SRP_MAX_DIGEST_IN_WORDS*SASI_32BIT_WORD_SIZE) |
|
#define | CRYS_SRP_MIN_SALT_SIZE (8) |
|
#define | CRYS_SRP_MIN_SALT_SIZE_IN_WORDS (CRYS_SRP_MIN_SALT_SIZE/SASI_32BIT_WORD_SIZE) |
|
#define | CRYS_SRP_MAX_SALT_SIZE (64) |
|
#define | CRYS_SRP_MAX_SALT_SIZE_IN_WORDS (CRYS_SRP_MAX_SALT_SIZE/SASI_32BIT_WORD_SIZE) |
|
#define | CRYS_SRP_HK_INIT(srpType, srpModulus, srpGen, modSizeInBits, pUserName, userNameSize, pPwd, pwdSize, pRndCtx, pCtx) CRYS_SRP_Init(srpType, CRYS_SRP_VER_HK, srpModulus, srpGen, modSizeInBits, CRYS_HASH_SHA512_mode, pUserName, userNameSize, pPwd, pwdSize, pRndCtx, pCtx) |
|
|
CRYSError_t | CRYS_SRP_Init (CRYS_SRP_Entity_t srpType, CRYS_SRP_Version_t srpVer, CRYS_SRP_Modulus_t srpModulus, uint8_t srpGen, size_t modSizeInBits, CRYS_HASH_OperationMode_t hashMode, uint8_t *pUserName, size_t userNameSize, uint8_t *pPwd, size_t pwdSize, CRYS_RND_Context_t *pRndCtx, CRYS_SRP_Context_t *pCtx) |
| This function initiates the SRP context. More...
|
|
CRYSError_t | CRYS_SRP_PwdVerCreate (size_t saltSize, uint8_t *pSalt, CRYS_SRP_Modulus_t pwdVerifier, CRYS_SRP_Context_t *pCtx) |
| This function calculates pSalt & password verifier. More...
|
|
CRYSError_t | CRYS_SRP_Clear (CRYS_SRP_Context_t *pCtx) |
| Clears the SRP context. More...
|
|
CRYSError_t | CRYS_SRP_HostPubKeyCreate (size_t ephemPrivSize, CRYS_SRP_Modulus_t pwdVerifier, CRYS_SRP_Modulus_t hostPubKeyB, CRYS_SRP_Context_t *pCtx) |
| This function generates host public & private ephemeral key, known as B & b in RFC. More...
|
|
CRYSError_t | CRYS_SRP_HostProofVerifyAndCalc (size_t saltSize, uint8_t *pSalt, CRYS_SRP_Modulus_t pwdVerifier, CRYS_SRP_Modulus_t userPubKeyA, CRYS_SRP_Modulus_t hostPubKeyB, CRYS_SRP_Digest_t userProof, CRYS_SRP_Digest_t hostProof, CRYS_SRP_Secret_t sharedSecret, CRYS_SRP_Context_t *pCtx) |
| Verifies the user Proof and calculates the Host message proof. More...
|
|
CRYSError_t | CRYS_SRP_UserPubKeyCreate (size_t ephemPrivSize, CRYS_SRP_Modulus_t userPubKeyA, CRYS_SRP_Context_t *pCtx) |
| This function generates user public & private ephemeral key, known as A & a in RFC. More...
|
|
CRYSError_t | CRYS_SRP_UserProofCalc (size_t saltSize, uint8_t *pSalt, CRYS_SRP_Modulus_t userPubKeyA, CRYS_SRP_Modulus_t hostPubKeyB, CRYS_SRP_Digest_t userProof, CRYS_SRP_Secret_t sharedSecret, CRYS_SRP_Context_t *pCtx) |
| This function calculates the user proof. More...
|
|
CRYSError_t | CRYS_SRP_UserProofVerify (CRYS_SRP_Secret_t sharedSecret, CRYS_SRP_Modulus_t userPubKeyA, CRYS_SRP_Digest_t userProof, CRYS_SRP_Digest_t hostProof, CRYS_SRP_Context_t *pCtx) |
| This function verifies the host proof. More...
|
|
This file contains all of the enums and definitions that are used for the CRYS SRP APIs, as well as the APIs themselves.
#define CRYS_SRP_MAX_DIGEST_IN_WORDS CRYS_HASH_RESULT_SIZE_IN_WORDS |
The SRP HASH digest max size in bytes.
#define CRYS_SRP_MIN_SALT_SIZE (8) |
#define CRYS_SRP_MODULUS_SIZE_1024_BITS 1024 |
#define CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_BITS (256) |
The SRP private number size range.
typedef uint8_t CRYS_SRP_Digest_t[(16 *(sizeof(uint32_t)))] |
Defines the SRP digest sized buffer.
typedef uint8_t CRYS_SRP_Modulus_t[(3072/8)] |
Defines the SRP modulus sized buffer.
typedef uint8_t CRYS_SRP_Secret_t[2 *(16 *(sizeof(uint32_t)))] |
Defines the SRP secret sized buffer.
SRP entity type
Enumerator |
---|
CRYS_SRP_HOST |
Host entity, called also server, verifier, or Accessory in Home-Kit
|
CRYS_SRP_USER |
User entity, called also client, or Device in Home-Kit
|
SRP supported versions
Enumerator |
---|
CRYS_SRP_VER_3 |
VER 3
|
CRYS_SRP_VER_6 |
VER 6
|
CRYS_SRP_VER_6A |
VER 6A
|
CRYS_SRP_VER_HK |
VER 6A
|
Clears the SRP context.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in,out] | pCtx | A Pointer to the SRP context. |
Verifies the user Proof and calculates the Host message proof.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in] | saltSize | The size of the random salt, The range is between CRYS_SRP_MIN_SALT_SIZE to CRYS_SRP_MAX_SALT_SIZE. |
[in] | pSalt | A Pointer to the pSalt number. |
[in] | pwdVerifier | A Pointer to the password verifier (v). |
[in] | userPubKeyA | A Pointer to the user ephemeral public key (A). |
[in] | hostPubKeyB | A Pointer to the host ephemeral public key (B). |
[in] | userProof | A Pointer to the SRP user proof buffer (M1). |
[out] | hostProof | A Pointer to the SRP host proof buffer (M2). |
[out] | sharedSecret | A Pointer to the SRP shared secret (K). |
[in] | pCtx | A Pointer to the SRP context. |
This function generates host public & private ephemeral key, known as B & b in RFC.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in] | ephemPrivSize | The size of the generated ephemeral private key (b). The range is between CRYS_SRP_PRIV_NUM_MIN_SIZE to CRYS_SRP_PRIV_NUM_MAX_SIZE |
[in] | pwdVerifier | A Pointer to the verifier (v). |
[out] | hostPubKeyB | A Pointer to the host ephemeral public key (B). |
[in,out] | pCtx | A Pointer to the SRP context. |
CRYSError_t CRYS_SRP_Init |
( |
CRYS_SRP_Entity_t |
srpType, |
|
|
CRYS_SRP_Version_t |
srpVer, |
|
|
CRYS_SRP_Modulus_t |
srpModulus, |
|
|
uint8_t |
srpGen, |
|
|
size_t |
modSizeInBits, |
|
|
CRYS_HASH_OperationMode_t |
hashMode, |
|
|
uint8_t * |
pUserName, |
|
|
size_t |
userNameSize, |
|
|
uint8_t * |
pPwd, |
|
|
size_t |
pwdSize, |
|
|
CRYS_RND_Context_t * |
pRndCtx, |
|
|
CRYS_SRP_Context_t * |
pCtx |
|
) |
| |
This function initiates the SRP context.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in] | srpType | SRP entity type. |
[in] | srpVer | SRP version. |
[in] | srpModulus | A pointer to the SRP modulus, BE byte buffer. |
[in] | srpGen | The SRP generator param. |
[in] | modSizeInBits | The SRP modulus size in bits:1024, 1536, 2048 & 3072 |
[in] | hashMode | Enumerator defining the HASH mode. |
[in] | pUserName | A Pointer to user name. |
[in] | userNameSize | The user name buffer size > 0. |
[in] | pPwd | A Pointer to user password. |
[in] | pwdSize | The user password buffer size > 0 if pPwd is valid. |
[in] | pRndCtx | A Pointer to RND context. |
[out] | pCtx | A Pointer to the SRP host context. |
This function calculates pSalt & password verifier.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in] | saltSize | The size of the random salt to generate, The range is between CRYS_SRP_MIN_SALT_SIZE to CRYS_SRP_MAX_SALT_SIZE. |
[out] | pSalt | A Pointer to the pSalt number (s). |
[out] | pwdVerifier | A Pointer to the password verifier (v). |
[out] | pCtx | A Pointer to the SRP context. |
This function calculates the user proof.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in] | saltSize | The size of the random salt, The range is between CRYS_SRP_MIN_SALT_SIZE to CRYS_SRP_MAX_SALT_SIZE. |
[in] | pSalt | A Pointer to the pSalt number. |
[in] | userPubKeyA | A Pointer to the user public ephmeral key (A). |
[in] | hostPubKeyB | A Pointer to the host public ephmeral key (B). |
[out] | userProof | A Pointer to the SRP user proof buffer (M1). |
[out] | sharedSecret | A Pointer to the SRP shared secret (K). |
[out] | pCtx | A Pointer to the SRP context. |
This function verifies the host proof.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in] | sharedSecret | A Pointer to the SRP shared secret (K). |
[in] | userPubKeyA | A Pointer to the user public ephmeral key (A). |
[in] | userProof | A Pointer to the SRP user proof buffer (M1). |
[in] | hostProof | A Pointer to the SRP host proof buffer (M2). |
[out] | pCtx | A Pointer to the SRP user context. |
This function generates user public & private ephemeral key, known as A & a in RFC.
- Returns
- CRYS_OK on success.
-
A non-zero value on failure as defined crys_srp_error.h.
- Parameters
-
[in] | ephemPrivSize | The size of the generated ephemeral private key (a). The range is between CRYS_SRP_PRIV_NUM_MIN_SIZE to CRYS_SRP_PRIV_NUM_MAX_SIZE |
[out] | userPubKeyA | A Pointer to the user ephemeral public key (A). |
[in,out] | pCtx | A Pointer to the SRP context. |