nRF5 SDK v17.1.0
Data Structures | Macros | Functions
CryptoCell EC Edwards APIs

Data Structures

struct  CRYS_ECEDW_TempBuff_t
 

Macros

#define CRYS_ECEDW_MOD_SIZE_IN_BITS   255U
 
#define CRYS_ECEDW_ORD_SIZE_IN_BITS   255U
 
#define CRYS_ECEDW_MOD_SIZE_IN_32BIT_WORDS   ((CRYS_ECEDW_MOD_SIZE_IN_BITS + SASI_BITS_IN_32BIT_WORD - 1) / SASI_BITS_IN_32BIT_WORD)
 
#define CRYS_ECEDW_MOD_SIZE_IN_BYTES   (CRYS_ECEDW_MOD_SIZE_IN_32BIT_WORDS * SASI_32BIT_WORD_SIZE)
 
#define CRYS_ECEDW_ORD_SIZE_IN_32BIT_WORDS   ((CRYS_ECEDW_ORD_SIZE_IN_BITS + SASI_BITS_IN_32BIT_WORD - 1) / SASI_BITS_IN_32BIT_WORD)
 
#define CRYS_ECEDW_ORD_SIZE_IN_BYTES   (CRYS_ECEDW_ORD_SIZE_IN_32BIT_WORDS * SASI_32BIT_WORD_SIZE)
 
#define CRYS_ECEDW_SEED_BYTES   CRYS_ECEDW_MOD_SIZE_IN_BYTES
 
#define CRYS_ECEDW_SECRET_KEY_BYTES   (2 * CRYS_ECEDW_MOD_SIZE_IN_BYTES)
 
#define CRYS_ECEDW_SIGNATURE_BYTES   (2 * CRYS_ECEDW_ORD_SIZE_IN_BYTES)
 
#define CRYS_ECEDW_SCALAR_BYTES   CRYS_ECEDW_ORD_SIZE_IN_BYTES
 
#define CRYS_ECEDW_SCALARMULT_BYTES   CRYS_ECEDW_MOD_SIZE_IN_BYTES
 
#define CRYS_ECEDW_TEMP_BUFF_SIZE_IN_32BIT_WORD   (10*CRYS_EC_MONT_EDW_MODULUS_MAX_SIZE_IN_WORDS + (sizeof(CRYS_HASHUserContext_t)+SASI_32BIT_WORD_SIZE-1)/SASI_32BIT_WORD_SIZE)
 

Functions

CRYSError_t CRYS_ECEDW_Sign (uint8_t *pSign, size_t *pSignSize, const uint8_t *pMsg, size_t msgSize, const uint8_t *pSignSecrKey, size_t secrKeySize, CRYS_ECEDW_TempBuff_t *pTempBuff)
 The function creates EC Edwards signature on the message. More...
 
CRYSError_t CRYS_ECEDW_Verify (const uint8_t *pSign, size_t signSize, const uint8_t *pSignPublKey, size_t publKeySize, uint8_t *pMsg, size_t msgSize, CRYS_ECEDW_TempBuff_t *pTempBuff)
 The function verifies the EC Edwards ed25519 signature on the message. More...
 
CRYSError_t CRYS_ECEDW_SeedKeyPair (const uint8_t *pSeed, size_t seedSize, uint8_t *pSecrKey, size_t *pSecrKeySize, uint8_t *pPublKey, size_t *pPublKeySize, CRYS_ECEDW_TempBuff_t *pTempBuff)
 The function randomly generates Ec ed25519 private and public keys using given seed. The generation is performed using EC Edwards ed25519 algorithm. More...
 
CRYSError_t CRYS_ECEDW_KeyPair (uint8_t *pSecrKey, size_t *pSecrKeySize, uint8_t *pPublKey, size_t *pPublKeySize, void *pRndState, SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, CRYS_ECEDW_TempBuff_t *pTempBuff)
 The function randomly generates the EC Edwards ed25519 private and public keys. The generation is performed using EC Edwards ed25519 algorithm. More...
 

Detailed Description

Note
Algorithms of Montgomery and Edwards elliptic curves cryptography were developed by Daniel.J.Bernstein.

Macro Definition Documentation

#define CRYS_ECEDW_MOD_SIZE_IN_32BIT_WORDS   ((CRYS_ECEDW_MOD_SIZE_IN_BITS + SASI_BITS_IN_32BIT_WORD - 1) / SASI_BITS_IN_32BIT_WORD)

EC Edwards nodulus size in words.

#define CRYS_ECEDW_MOD_SIZE_IN_BITS   255U

EC Edwards ed25519 modulus and order sizes in bits, words and bytes.

EC Edwards modulus size in bits.

#define CRYS_ECEDW_MOD_SIZE_IN_BYTES   (CRYS_ECEDW_MOD_SIZE_IN_32BIT_WORDS * SASI_32BIT_WORD_SIZE)

EC Edwards modulus size in bytes.

#define CRYS_ECEDW_ORD_SIZE_IN_32BIT_WORDS   ((CRYS_ECEDW_ORD_SIZE_IN_BITS + SASI_BITS_IN_32BIT_WORD - 1) / SASI_BITS_IN_32BIT_WORD)

EC Edwards order size in words.

#define CRYS_ECEDW_ORD_SIZE_IN_BITS   255U

EC Edwards order size in bits.

#define CRYS_ECEDW_ORD_SIZE_IN_BYTES   (CRYS_ECEDW_ORD_SIZE_IN_32BIT_WORDS * SASI_32BIT_WORD_SIZE)

EC Edwards order size in bytes.

#define CRYS_ECEDW_SCALAR_BYTES   CRYS_ECEDW_ORD_SIZE_IN_BYTES

EC Edwards scalar size in bytes.

#define CRYS_ECEDW_SCALARMULT_BYTES   CRYS_ECEDW_MOD_SIZE_IN_BYTES

EC Edwards scalar multiplication size in bytes.

#define CRYS_ECEDW_SECRET_KEY_BYTES   (2 * CRYS_ECEDW_MOD_SIZE_IN_BYTES)

EC Edwards secret key size in bytes.

#define CRYS_ECEDW_SEED_BYTES   CRYS_ECEDW_MOD_SIZE_IN_BYTES

Constant sizes of special EC_MONT buffers and arrays

EC Edwards seed size in bytes.

#define CRYS_ECEDW_SIGNATURE_BYTES   (2 * CRYS_ECEDW_ORD_SIZE_IN_BYTES)

EC Edwards signatue size in bytes.

#define CRYS_ECEDW_TEMP_BUFF_SIZE_IN_32BIT_WORD   (10*CRYS_EC_MONT_EDW_MODULUS_MAX_SIZE_IN_WORDS + (sizeof(CRYS_HASHUserContext_t)+SASI_32BIT_WORD_SIZE-1)/SASI_32BIT_WORD_SIZE)

EC_EDW temp buffer size definition.

Function Documentation

CRYSError_t CRYS_ECEDW_KeyPair ( uint8_t *  pSecrKey,
size_t *  pSecrKeySize,
uint8_t *  pPublKey,
size_t *  pPublKeySize,
void *  pRndState,
SaSiRndGenerateVectWorkFunc_t  rndGenerateVectFunc,
CRYS_ECEDW_TempBuff_t pTempBuff 
)

The function randomly generates the EC Edwards ed25519 private and public keys. The generation is performed using EC Edwards ed25519 algorithm.

Returns
CRYS_OK on success,
A non-zero value on failure as defined crys_ec_mont_edw_error.h, crys_hash_error.h or crys_rnd_error.
Parameters
[out]pSecrKeyPointer to the secret key (including seed and public key).
[in,out]pSecrKeySizePointer to the size of the secret key in bytes, (must be at least 2*EC order size).
[out]pPublKeyPointer to the public key.
[in,out]pPublKeySize- Pointer to the size of the public key in bytes. In - the size of buffer must be at least EC modulus size; Out - the actual size.
[in,out]pRndStatePointer to the RND state structure.
[in]rndGenerateVectFuncPointer to the random vector generation function.
[in]pTempBuffPointer to the temp buffer.
CRYSError_t CRYS_ECEDW_SeedKeyPair ( const uint8_t *  pSeed,
size_t  seedSize,
uint8_t *  pSecrKey,
size_t *  pSecrKeySize,
uint8_t *  pPublKey,
size_t *  pPublKeySize,
CRYS_ECEDW_TempBuff_t pTempBuff 
)

The function randomly generates Ec ed25519 private and public keys using given seed. The generation is performed using EC Edwards ed25519 algorithm.

Returns
CRYS_OK on success,
A non-zero value on failure as defined crys_ec_mont_edw_error.h or crys_hash_error.h.
Parameters
[in]pSeedPointer to the given seed.
[in]seedSizeSize of the seed in bytes, must be equal the EC order size in bytes.
[out]pSecrKeyPointer to the secret key, including the seed, concatenated with the public key.
[in,out]pSecrKeySizePointer to the size of the secret key buffer in bytes (must be at least 2*EC order size).
[out]pPublKeyPointer to the public key.
[in,out]pPublKeySizePointer to the size of the public key in bytes. In - the size of buffer must be at least EC modulus size; Out - the actual size.
[in]pTempBuffPointer to the temp buffer, for internal use.
CRYSError_t CRYS_ECEDW_Sign ( uint8_t *  pSign,
size_t *  pSignSize,
const uint8_t *  pMsg,
size_t  msgSize,
const uint8_t *  pSignSecrKey,
size_t  secrKeySize,
CRYS_ECEDW_TempBuff_t pTempBuff 
)

The function creates EC Edwards signature on the message.

Note
Used detached form of signature, separated from the message. Implemented algorithm of Bernstein D. etc. sign ed25519.
Returns
CRYS_OK on success,
A non-zero value on failure as defined crys_ec_mont_edw_error.h or crys_hash_error.h.
Parameters
[out]pSignPointer to the detached signature.
[in,out]pSignSizePointer to the total size of the signature ; In - the buffer size, which (must be at least 2*EC order size); Out - the actual size of output data.
[in]pMsgPointer to the message.
[in]msgSizeMessage size in bytes: must be less, than (CRYS_HASH_UPDATE_DATA_MAX_SIZE_IN_BYTES - 2*(EC_EDW modulus size)).
[in]pSignSecrKeyPointer to the signer secret key (seed || pulKey)
[in]secrKeySizeSize of signer secret key in bytes: (must be 2*EC order size).
[in]pTempBuffPointer to the temp buffer.
CRYSError_t CRYS_ECEDW_Verify ( const uint8_t *  pSign,
size_t  signSize,
const uint8_t *  pSignPublKey,
size_t  publKeySize,
uint8_t *  pMsg,
size_t  msgSize,
CRYS_ECEDW_TempBuff_t pTempBuff 
)

The function verifies the EC Edwards ed25519 signature on the message.

Note
The input signature is in detached form, i.e. separated from the message.
Returns
CRYS_OK on success,
A non-zero value on failure as defined crys_ec_mont_edw_error.h or crys_hash_error.h.
Parameters
[in]pSignPointer to detached signature, i.e. the signature is separated from the message.
[in]signSizeSize of the signature in bytes, it must be equal to two EC Order size in bytes.
[in]pSignPublKeyPointer to signer public key.
[in]publKeySizeSize of the signer public key in bytes; must be equal to EC modulus size.
[in]pMsgPointer to the message.
[in]msgSizePointer to the message size in bytes. Must be less than (CRYS_HASH_UPDATE_DATA_MAX_SIZE_IN_BYTES - 2*(EC_EDW modulus size)).
[in]pTempBuffPointer to the temp buffer, for internal use.

Documentation feedback | Developer Zone | Subscribe | Updated