nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
CryptoCell SRP APIs

Modules

 CryptoCell SRP specific errors
 

Data Structures

struct  CRYS_SRP_GroupParam_t
 
struct  CRYS_SRP_Context_t
 

Macros

#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, pRndState, rndGenerateVectFunc, pCtx)   CRYS_SRP_Init(srpType, CRYS_SRP_VER_HK, srpModulus, srpGen, modSizeInBits, CRYS_HASH_SHA512_mode, pUserName, userNameSize, pPwd, pwdSize, pRndState, rndGenerateVectFunc, pCtx)
 

Typedefs

typedef uint8_t CRYS_SRP_Modulus_t [(3072/8)]
 
typedef uint8_t CRYS_SRP_Digest_t [(16 *(sizeof(uint32_t)))]
 
typedef uint8_t CRYS_SRP_Secret_t [2 *(16 *(sizeof(uint32_t)))]
 
typedef struct
CRYS_SRP_GroupParam_t 
CRYS_SRP_GroupParam_t
 
typedef struct CRYS_SRP_Context_t CRYS_SRP_Context_t
 

Enumerations

enum  CRYS_SRP_Version_t {
  CRYS_SRP_VER_3 = 0,
  CRYS_SRP_VER_6 = 1,
  CRYS_SRP_VER_6A = 2,
  CRYS_SRP_VER_HK = 3,
  CRYS_SRP_NumOfVersions,
  CRYS_SRP_VersionLast = 0x7FFFFFFF
}
 
enum  CRYS_SRP_Entity_t {
  CRYS_SRP_HOST = 1,
  CRYS_SRP_USER = 2,
  CRYS_SRP_NumOfEntityType,
  CRYS_SRP_EntityLast = 0x7FFFFFFF
}
 

Functions

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, void *pRndState, SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, 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...
 

Detailed Description

Macro Definition Documentation

#define CRYS_SRP_HK_INIT (   srpType,
  srpModulus,
  srpGen,
  modSizeInBits,
  pUserName,
  userNameSize,
  pPwd,
  pwdSize,
  pRndState,
  rndGenerateVectFunc,
  pCtx 
)    CRYS_SRP_Init(srpType, CRYS_SRP_VER_HK, srpModulus, srpGen, modSizeInBits, CRYS_HASH_SHA512_mode, pUserName, userNameSize, pPwd, pwdSize, pRndState, rndGenerateVectFunc, pCtx)

MACRO definition for a specific SRP initialization function.

#define CRYS_SRP_MAX_DIGEST   (CRYS_SRP_MAX_DIGEST_IN_WORDS*SASI_32BIT_WORD_SIZE)

Maximal SRP HASH digest size in bytes.

#define CRYS_SRP_MAX_DIGEST_IN_WORDS   CRYS_HASH_RESULT_SIZE_IN_WORDS

Maximal SRP HASH digest size in words.

#define CRYS_SRP_MAX_MODULUS   (CRYS_SRP_MAX_MODULUS_IN_BITS/SASI_BITS_IN_BYTE)

Maximal modulus size in bytes.

#define CRYS_SRP_MAX_MODULUS_IN_BITS   CRYS_SRP_MODULUS_SIZE_3072_BITS

Maximal modulus size in bits.

#define CRYS_SRP_MAX_MODULUS_IN_WORDS   (CRYS_SRP_MAX_MODULUS_IN_BITS/SASI_BITS_IN_32BIT_WORD)

Maximal modulus size in words.

#define CRYS_SRP_MAX_SALT_SIZE   (64)

Maximal salt size in bytes.

#define CRYS_SRP_MAX_SALT_SIZE_IN_WORDS   (CRYS_SRP_MAX_SALT_SIZE/SASI_32BIT_WORD_SIZE)

Maximal salt size in words.

#define CRYS_SRP_MIN_SALT_SIZE   (8)

Minimal salt size in bytes.

#define CRYS_SRP_MIN_SALT_SIZE_IN_WORDS   (CRYS_SRP_MIN_SALT_SIZE/SASI_32BIT_WORD_SIZE)

Minimal salt size in words.

#define CRYS_SRP_MODULUS_SIZE_1024_BITS   1024

The SRP modulus sizes.

1024 bits modulus size.

#define CRYS_SRP_MODULUS_SIZE_1536_BITS   1536

1536 bits modulus size.

#define CRYS_SRP_MODULUS_SIZE_2048_BITS   2048

2048 bits modulus size.

#define CRYS_SRP_MODULUS_SIZE_3072_BITS   3072

3072 bits modulus size.

#define CRYS_SRP_PRIV_NUM_MAX_SIZE   (CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_BITS/SASI_BITS_IN_BYTE)

Maximal private number size in bytes.

#define CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_BITS   (CRYS_SRP_MAX_MODULUS_IN_BITS)

Maximal private number size in bits.

#define CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_WORDS   (CRYS_SRP_PRIV_NUM_MAX_SIZE_IN_BITS/SASI_BITS_IN_32BIT_WORD)

Maximal private number size in words.

#define CRYS_SRP_PRIV_NUM_MIN_SIZE   (CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_BITS/SASI_BITS_IN_BYTE)

Minimal private number size in bytes.

#define CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_BITS   (256)

The SRP private number size range.

Minimal private number size in bits.

#define CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_WORDS   (CRYS_SRP_PRIV_NUM_MIN_SIZE_IN_BITS/SASI_BITS_IN_32BIT_WORD)

Minimal private number size in words.

Typedef Documentation

The SRP context prototype

typedef uint8_t CRYS_SRP_Digest_t[(16 *(sizeof(uint32_t)))]

SRP digest buffer definition.

Group parameters for the SRP - defines the modulus and the generator used

typedef uint8_t CRYS_SRP_Modulus_t[(3072/8)]

SRP modulus buffer definition.

typedef uint8_t CRYS_SRP_Secret_t[2 *(16 *(sizeof(uint32_t)))]

SRP secret buffer definition.

Enumeration Type Documentation

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

CRYS_SRP_NumOfEntityType 

Maximal number of entities types.

CRYS_SRP_EntityLast 

Reserved.

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.

CRYS_SRP_NumOfVersions 

Maximal number of supported versions.

CRYS_SRP_VersionLast 

Reserved.

Function Documentation

CRYSError_t CRYS_SRP_Clear ( CRYS_SRP_Context_t pCtx)

Clears the SRP context.

Returns
CRYS_OK on success.
A non-zero value on failure as defined crys_srp_error.h.
Parameters
[in,out]pCtxA Pointer to the SRP context.
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.

Returns
CRYS_OK on success.
A non-zero value on failure as defined crys_srp_error.h or crys_hash_error.h.
Parameters
[in]saltSizeThe size of the random salt, The range is between CRYS_SRP_MIN_SALT_SIZE to CRYS_SRP_MAX_SALT_SIZE.
[in]pSaltA Pointer to the pSalt number.
[in]pwdVerifierA Pointer to the password verifier (v).
[in]userPubKeyAA Pointer to the user ephemeral public key (A).
[in]hostPubKeyBA Pointer to the host ephemeral public key (B).
[in]userProofA Pointer to the SRP user proof buffer (M1).
[out]hostProofA Pointer to the SRP host proof buffer (M2).
[out]sharedSecretA Pointer to the SRP shared secret (K).
[in]pCtxA Pointer to the SRP context.
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.

Returns
CRYS_OK on success.
A non-zero value on failure as defined crys_srp_error.h or crys_rnd_error.h.
Parameters
[in]ephemPrivSizeThe 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]pwdVerifierA Pointer to the verifier (v).
[out]hostPubKeyBA Pointer to the host ephemeral public key (B).
[in,out]pCtxA 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,
void *  pRndState,
SaSiRndGenerateVectWorkFunc_t  rndGenerateVectFunc,
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 or crys_hash_error.h.
Parameters
[in]srpTypeSRP entity type.
[in]srpVerSRP version.
[in]srpModulusA pointer to the SRP modulus, BE byte buffer.
[in]srpGenThe SRP generator param.
[in]modSizeInBitsThe SRP modulus size in bits:1024, 1536, 2048 & 3072
[in]hashModeEnumerator defining the HASH mode.
[in]pUserNameA Pointer to user name.
[in]userNameSizeThe user name buffer size > 0.
[in]pPwdA Pointer to user password.
[in]pwdSizeThe user password buffer size > 0 if pPwd is valid.
[in]pRndStateA Pointer to RND context.
[in]rndGenerateVectFuncPointer to random vector generation function.
[out]pCtxA Pointer to the SRP host context.
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.

Returns
CRYS_OK on success.
A non-zero value on failure as defined crys_srp_error.h, crys_rnd_error.h or crys_hash_error.h.
Parameters
[in]saltSizeThe size of the random salt to generate, The range is between CRYS_SRP_MIN_SALT_SIZE to CRYS_SRP_MAX_SALT_SIZE.
[out]pSaltA Pointer to the pSalt number (s).
[out]pwdVerifierA Pointer to the password verifier (v).
[out]pCtxA Pointer to the SRP context.
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.

Returns
CRYS_OK on success.
A non-zero value on failure as defined crys_srp_error.h or crys_hash_error.h.
Parameters
[in]saltSizeThe size of the random salt, The range is between CRYS_SRP_MIN_SALT_SIZE to CRYS_SRP_MAX_SALT_SIZE.
[in]pSaltA Pointer to the pSalt number.
[in]userPubKeyAA Pointer to the user public ephmeral key (A).
[in]hostPubKeyBA Pointer to the host public ephmeral key (B).
[out]userProofA Pointer to the SRP user proof buffer (M1).
[out]sharedSecretA Pointer to the SRP shared secret (K).
[out]pCtxA Pointer to the SRP context.
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.

Returns
CRYS_OK on success.
A non-zero value on failure as defined crys_srp_error.h or crys_hash_error.h.
Parameters
[in]sharedSecretA Pointer to the SRP shared secret (K).
[in]userPubKeyAA Pointer to the user public ephmeral key (A).
[in]userProofA Pointer to the SRP user proof buffer (M1).
[in]hostProofA Pointer to the SRP host proof buffer (M2).
[out]pCtxA Pointer to the SRP user context.
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.

Returns
CRYS_OK on success.
A non-zero value on failure as defined crys_srp_error.h or crys_rnd_error.h.
Parameters
[in]ephemPrivSizeThe 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]userPubKeyAA Pointer to the user ephemeral public key (A).
[in,out]pCtxA Pointer to the SRP context.

Documentation feedback | Developer Zone | Subscribe | Updated