Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

CryptoCell EC Edwards APIs

Data Structures

struct  CRYS_ECEDW_TempBuff_t

Functions

CIMPORT_C 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.
CIMPORT_C 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.
CIMPORT_C 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.
CIMPORT_C 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.

Detailed Description

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

Function Documentation

CIMPORT_C 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.
CIMPORT_C 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.
CIMPORT_C 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.
CIMPORT_C 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.