Kenji Arai / TYBLE16_mbedlized_os5_several_examples_1st

Dependencies:   nRF51_Vdd TextLCD BME280

Embed: (wiki syntax)

« Back to documentation index

CryptoCell CHACHA APIs

CryptoCell CHACHA APIs

Data Structures

struct  CRYS_CHACHAUserContext_t

Modules

 CryptoCell CHACHA specific errors

Typedefs

typedef uint8_t CRYS_CHACHA_Nonce_t [CRYS_CHACHA_NONCE_MAX_SIZE_IN_BYTES]
typedef uint8_t CRYS_CHACHA_Key_t [CRYS_CHACHA_KEY_MAX_SIZE_IN_BYTES]
typedef struct
CRYS_CHACHAUserContext_t 
CRYS_CHACHAUserContext_t

Enumerations

enum  CRYS_CHACHA_EncryptMode_t { CRYS_CHACHA_Encrypt = 0, CRYS_CHACHA_Decrypt = 1, CRYS_CHACHA_EncryptNumOfOptions, CRYS_CHACHA_EncryptModeLast = 0x7FFFFFFF }
enum  CRYS_CHACHA_NonceSize_t { CRYS_CHACHA_Nonce64BitSize = 0, CRYS_CHACHA_Nonce96BitSize = 1, CRYS_CHACHA_NonceSizeNumOfOptions, CRYS_CHACHA_NonceSizeLast = 0x7FFFFFFF }

Functions

CIMPORT_C CRYSError_t CRYS_CHACHA_Init (CRYS_CHACHAUserContext_t *pContextID, CRYS_CHACHA_Nonce_t pNonce, CRYS_CHACHA_NonceSize_t nonceSize, CRYS_CHACHA_Key_t pKey, uint32_t initialCounter, CRYS_CHACHA_EncryptMode_t EncryptDecryptFlag)
 This function is used to initialize the context for CHACHA operations.
CIMPORT_C CRYSError_t CRYS_CHACHA_Block (CRYS_CHACHAUserContext_t *pContextID, uint8_t *pDataIn, uint32_t dataInSize, uint8_t *pDataOut)
 This function is used to process aligned blocks of CHACHA. The data in size should be a multiple of chacha block size.
CIMPORT_C CRYSError_t CRYS_CHACHA_Finish (CRYS_CHACHAUserContext_t *pContextID, uint8_t *pDataIn, uint32_t dataInSize, uint8_t *pDataOut)
 This function is used to process the remaining data of CHACHA. The data in size should be smaller than chacha block size.
CIMPORT_C CRYSError_t CRYS_CHACHA_Free (CRYS_CHACHAUserContext_t *pContextID)
 This function is used to free the context of CHACHA operations.
CIMPORT_C CRYSError_t CRYS_CHACHA (CRYS_CHACHA_Nonce_t pNonce, CRYS_CHACHA_NonceSize_t nonceSize, CRYS_CHACHA_Key_t pKey, uint32_t initialCounter, CRYS_CHACHA_EncryptMode_t encryptDecryptFlag, uint8_t *pDataIn, uint32_t dataInSize, uint8_t *pDataOut)
 This function is used to perform the CHACHA operation in one integrated process.

Typedef Documentation

typedef uint8_t CRYS_CHACHA_Key_t[CRYS_CHACHA_KEY_MAX_SIZE_IN_BYTES]

Defines the CHACHA key buffer.

Definition at line 111 of file crys_chacha.h.

typedef uint8_t CRYS_CHACHA_Nonce_t[CRYS_CHACHA_NONCE_MAX_SIZE_IN_BYTES]

Defines the Nonce buffer 12 bytes array.

Definition at line 108 of file crys_chacha.h.

The user's context prototype - the argument type that is passed by the user to the CHACHA API. The context saves the state of the operation and must be saved by the user till the end of the APIs flow (for example till CRYS_CHACHA_Free is called).


Enumeration Type Documentation

Enum defining the CHACHA Encrypt or Decrypt operation mode.

Enumerator:
CRYS_CHACHA_Encrypt 

CHACHA encrypt mode.

CRYS_CHACHA_Decrypt 

CHACHA decrypt mode.

CRYS_CHACHA_EncryptNumOfOptions 

CHACHA maximal number of operations (encrypt/decrypt).

CRYS_CHACHA_EncryptModeLast 

Reserved.

Definition at line 79 of file crys_chacha.h.

Enum defining the CHACHA Nonce size in bits.

Enumerator:
CRYS_CHACHA_Nonce64BitSize 

64 bit Nonce size.

CRYS_CHACHA_Nonce96BitSize 

96 bit Nonce size.

CRYS_CHACHA_NonceSizeNumOfOptions 

CHACHA maximal number of nonce sizes.

CRYS_CHACHA_NonceSizeLast 

Reserved.

Definition at line 93 of file crys_chacha.h.


Function Documentation

CIMPORT_C CRYSError_t CRYS_CHACHA ( CRYS_CHACHA_Nonce_t  pNonce,
CRYS_CHACHA_NonceSize_t  nonceSize,
CRYS_CHACHA_Key_t  pKey,
uint32_t  initialCounter,
CRYS_CHACHA_EncryptMode_t  encryptDecryptFlag,
uint8_t *  pDataIn,
uint32_t  dataInSize,
uint8_t *  pDataOut 
)

This function is used to perform the CHACHA operation in one integrated process.

Returns:
CRYS_OK on success.
A non-zero value on failure as defined crys_chacha_error.h.
Parameters:
[in]pNonceA buffer containing an nonce.
[in]nonceSizeEnumerator defining the nonce size (only 64 and 96 bit are valid).
[in]pKeyA pointer to the user's key buffer.
[in]initialCounterAn initial counter.
[in]encryptDecryptFlagA flag specifying whether the CHACHA should perform an Encrypt operation or a Decrypt operation.
[in]pDataInA pointer to the buffer of the input data to the CHACHA. The pointer does not need to be aligned. must not be null.
[in]dataInSizeThe size of the input data. must not be 0.
[out]pDataOutA pointer to the buffer of the output data from the CHACHA. The pointer does not need to be aligned. must not be null.
CIMPORT_C CRYSError_t CRYS_CHACHA_Block ( CRYS_CHACHAUserContext_t pContextID,
uint8_t *  pDataIn,
uint32_t  dataInSize,
uint8_t *  pDataOut 
)

This function is used to process aligned blocks of CHACHA. The data in size should be a multiple of chacha block size.

Returns:
CRYS_OK on success.
A non-zero value on failure as defined crys_chacha_error.h.
Parameters:
[in]pContextIDPointer to the context buffer.
[in]pDataInA pointer to the buffer of the input data to the CHACHA. The pointer does not need to be aligned. must not be null.
[in]dataInSizeThe size of the input data. Must be a multiple of CRYS_CHACHA_BLOCK_SIZE_IN_BYTES bytes and must not be 0.
[out]pDataOutA pointer to the buffer of the output data from the CHACHA. The pointer does not need to be aligned. must not be null.
CIMPORT_C CRYSError_t CRYS_CHACHA_Finish ( CRYS_CHACHAUserContext_t pContextID,
uint8_t *  pDataIn,
uint32_t  dataInSize,
uint8_t *  pDataOut 
)

This function is used to process the remaining data of CHACHA. The data in size should be smaller than chacha block size.

Returns:
CRYS_OK on success.
A non-zero value on failure as defined crys_chacha_error.h.
Parameters:
[in]pContextIDPointer to the context buffer.
[in]pDataInA pointer to the buffer of the input data to the CHACHA. The pointer does not need to be aligned. If dataInSize = 0, input buffer is not required.
[in]dataInSizeThe size of the input data. zero and non multiple of CRYS_CHACHA_BLOCK_SIZE_IN_BYTES are valid.
[out]pDataOutA pointer to the buffer of the output data from the CHACHA. The pointer does not need to be aligned. If dataInSize = 0, output buffer is not required.
CIMPORT_C CRYSError_t CRYS_CHACHA_Free ( CRYS_CHACHAUserContext_t pContextID )

This function is used to free the context of CHACHA operations.

Returns:
CRYS_OK on success.
A non-zero value on failure as defined crys_chacha_error.h.
Parameters:
[in]pContextIDPointer to the context buffer.
CIMPORT_C CRYSError_t CRYS_CHACHA_Init ( CRYS_CHACHAUserContext_t pContextID,
CRYS_CHACHA_Nonce_t  pNonce,
CRYS_CHACHA_NonceSize_t  nonceSize,
CRYS_CHACHA_Key_t  pKey,
uint32_t  initialCounter,
CRYS_CHACHA_EncryptMode_t  EncryptDecryptFlag 
)

This function is used to initialize the context for CHACHA operations.

Returns:
CRYS_OK on success.
A non-zero value on failure as defined crys_chacha_error.h.
Parameters:
[in]pContextIDPointer to the CHACHA context buffer that is allocated by the user and is used for the CHACHA operation.
[in]pNonceA buffer containing an nonce.
[in]nonceSizeEnumerator defining the nonce size (only 64 and 96 bit are valid).
[in]pKeyA pointer to the user's key buffer.
[in]initialCounterAn initial counter.
[in]EncryptDecryptFlagA flag specifying whether the CHACHA should perform an Encrypt operation or a Decrypt operation.