ChibiOS/HAL  6.1.0
Crypto Driver

Generic Crypto Driver. More...

Collaboration diagram for Crypto Driver:

Detailed Description

Generic Crypto Driver.

This module implements a generic Cryptography driver.

Precondition
In order to use the I2C driver the HAL_USE_CRY option must be enabled in halconf.h.

Macros

#define HAL_CRY_MAX_KEY_SIZE   32
 Maximum size of a key for all supported algorithms. More...
 
#define HAL_CRY_USE_FALLBACK   FALSE
 Enables the SW fall-back of the cryptographic driver. More...
 
#define HAL_CRY_USE_FALLBACK   TRUE
 Enables the SW fall-back of the cryptographic driver. More...
 
#define HAL_CRY_ENFORCE_FALLBACK   FALSE
 Makes the driver forcibly use the fall-back implementations. More...
 

Driver capability switches

#define CRY_LLD_SUPPORTS_AES   TRUE
 
#define CRY_LLD_SUPPORTS_AES_ECB   TRUE
 
#define CRY_LLD_SUPPORTS_AES_CBC   TRUE
 
#define CRY_LLD_SUPPORTS_AES_CFB   TRUE
 
#define CRY_LLD_SUPPORTS_AES_CTR   TRUE
 
#define CRY_LLD_SUPPORTS_AES_GCM   TRUE
 
#define CRY_LLD_SUPPORTS_DES   TRUE
 
#define CRY_LLD_SUPPORTS_DES_ECB   TRUE
 
#define CRY_LLD_SUPPORTS_DES_CBC   TRUE
 
#define CRY_LLD_SUPPORTS_SHA1   TRUE
 
#define CRY_LLD_SUPPORTS_SHA256   TRUE
 
#define CRY_LLD_SUPPORTS_SHA512   TRUE
 
#define CRY_LLD_SUPPORTS_TRNG   TRUE
 

PLATFORM configuration options

#define PLATFORM_CRY_USE_CRY1   FALSE
 CRY1 driver enable switch. More...
 

Typedefs

typedef size_t bitsize_t
 Size, in bits, of a crypto field or message. More...
 
typedef uint32_t crykey_t
 CRY key identifier type. More...
 
typedef struct CRYDriver CRYDriver
 Type of a structure representing an CRY driver. More...
 

Data Structures

struct  SHA1Context
 Type of a SHA1 context. More...
 
struct  SHA256Context
 Type of a SHA256 context. More...
 
struct  SHA512Context
 Type of a SHA512 context. More...
 
struct  CRYConfig
 Driver configuration structure. More...
 
struct  CRYDriver
 Structure representing an CRY driver. More...
 

Functions

void cryInit (void)
 Cryptographic Driver initialization. More...
 
void cryObjectInit (CRYDriver *cryp)
 Initializes the standard part of a CRYDriver structure. More...
 
void cryStart (CRYDriver *cryp, const CRYConfig *config)
 Configures and activates the cryptographic peripheral. More...
 
void cryStop (CRYDriver *cryp)
 Deactivates the cryptographic peripheral. More...
 
cryerror_t cryLoadTransientKey (CRYDriver *cryp, cryalgorithm_t algorithm, size_t size, const uint8_t *keyp)
 Initializes the transient key for a specific algorithm. More...
 
cryerror_t cryEncryptAES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Encryption of a single block using AES. More...
 
cryerror_t cryDecryptAES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Decryption of a single block using AES. More...
 
cryerror_t cryEncryptAES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Encryption operation using AES-ECB. More...
 
cryerror_t cryDecryptAES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Decryption operation using AES-ECB. More...
 
cryerror_t cryEncryptAES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using AES-CBC. More...
 
cryerror_t cryDecryptAES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using AES-CBC. More...
 
cryerror_t cryEncryptAES_CFB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using AES-CFB. More...
 
cryerror_t cryDecryptAES_CFB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using AES-CFB. More...
 
cryerror_t cryEncryptAES_CTR (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using AES-CTR. More...
 
cryerror_t cryDecryptAES_CTR (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using AES-CTR. More...
 
cryerror_t cryEncryptAES_GCM (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv, size_t aadsize, const uint8_t *aad, uint8_t *authtag)
 Encryption operation using AES-GCM. More...
 
cryerror_t cryDecryptAES_GCM (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv, size_t aadsize, const uint8_t *aad, uint8_t *authtag)
 Decryption operation using AES-GCM. More...
 
cryerror_t cryEncryptDES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Encryption of a single block using (T)DES. More...
 
cryerror_t cryDecryptDES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Decryption of a single block using (T)DES. More...
 
cryerror_t cryEncryptDES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Encryption operation using (T)DES-ECB. More...
 
cryerror_t cryDecryptDES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Decryption operation using (T)DES-ECB. More...
 
cryerror_t cryEncryptDES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using (T)DES-CBC. More...
 
cryerror_t cryDecryptDES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using (T)DES-CBC. More...
 
cryerror_t crySHA1Init (CRYDriver *cryp, SHA1Context *sha1ctxp)
 Hash initialization using SHA1. More...
 
cryerror_t crySHA1Update (CRYDriver *cryp, SHA1Context *sha1ctxp, size_t size, const uint8_t *in)
 Hash update using SHA1. More...
 
cryerror_t crySHA1Final (CRYDriver *cryp, SHA1Context *sha1ctxp, uint8_t *out)
 Hash finalization using SHA1. More...
 
cryerror_t crySHA256Init (CRYDriver *cryp, SHA256Context *sha256ctxp)
 Hash initialization using SHA256. More...
 
cryerror_t crySHA256Update (CRYDriver *cryp, SHA256Context *sha256ctxp, size_t size, const uint8_t *in)
 Hash update using SHA256. More...
 
cryerror_t crySHA256Final (CRYDriver *cryp, SHA256Context *sha256ctxp, uint8_t *out)
 Hash finalization using SHA256. More...
 
cryerror_t crySHA512Init (CRYDriver *cryp, SHA512Context *sha512ctxp)
 Hash initialization using SHA512. More...
 
cryerror_t crySHA512Update (CRYDriver *cryp, SHA512Context *sha512ctxp, size_t size, const uint8_t *in)
 Hash update using SHA512. More...
 
cryerror_t crySHA512Final (CRYDriver *cryp, SHA512Context *sha512ctxp, uint8_t *out)
 Hash finalization using SHA512. More...
 
cryerror_t cryTRNG (CRYDriver *cryp, uint8_t *out)
 True random numbers generator. More...
 
void cry_lld_init (void)
 Low level crypto driver initialization. More...
 
void cry_lld_start (CRYDriver *cryp)
 Configures and activates the crypto peripheral. More...
 
void cry_lld_stop (CRYDriver *cryp)
 Deactivates the crypto peripheral. More...
 
cryerror_t cry_lld_loadkey (CRYDriver *cryp, cryalgorithm_t algorithm, size_t size, const uint8_t *keyp)
 Initializes the transient key for a specific algorithm. More...
 
cryerror_t cry_lld_encrypt_AES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Encryption of a single block using AES. More...
 
cryerror_t cry_lld_decrypt_AES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Decryption of a single block using AES. More...
 
cryerror_t cry_lld_encrypt_AES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Encryption operation using AES-ECB. More...
 
cryerror_t cry_lld_decrypt_AES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Decryption operation using AES-ECB. More...
 
cryerror_t cry_lld_encrypt_AES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using AES-CBC. More...
 
cryerror_t cry_lld_decrypt_AES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using AES-CBC. More...
 
cryerror_t cry_lld_encrypt_AES_CFB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using AES-CFB. More...
 
cryerror_t cry_lld_decrypt_AES_CFB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using AES-CFB. More...
 
cryerror_t cry_lld_encrypt_AES_CTR (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using AES-CTR. More...
 
cryerror_t cry_lld_decrypt_AES_CTR (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using AES-CTR. More...
 
cryerror_t cry_lld_encrypt_AES_GCM (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv, size_t aadsize, const uint8_t *aad, uint8_t *authtag)
 Encryption operation using AES-GCM. More...
 
cryerror_t cry_lld_decrypt_AES_GCM (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv, size_t aadsize, const uint8_t *aad, uint8_t *authtag)
 Decryption operation using AES-GCM. More...
 
cryerror_t cry_lld_encrypt_DES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Encryption of a single block using (T)DES. More...
 
cryerror_t cry_lld_decrypt_DES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
 Decryption of a single block using (T)DES. More...
 
cryerror_t cry_lld_encrypt_DES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Encryption operation using (T)DES-ECB. More...
 
cryerror_t cry_lld_decrypt_DES_ECB (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
 Decryption operation using (T)DES-ECB. More...
 
cryerror_t cry_lld_encrypt_DES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Encryption operation using (T)DES-CBC. More...
 
cryerror_t cry_lld_decrypt_DES_CBC (CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
 Decryption operation using (T)DES-CBC. More...
 
cryerror_t cry_lld_SHA1_init (CRYDriver *cryp, SHA1Context *sha1ctxp)
 Hash initialization using SHA1. More...
 
cryerror_t cry_lld_SHA1_update (CRYDriver *cryp, SHA1Context *sha1ctxp, size_t size, const uint8_t *in)
 Hash update using SHA1. More...
 
cryerror_t cry_lld_SHA1_final (CRYDriver *cryp, SHA1Context *sha1ctxp, uint8_t *out)
 Hash finalization using SHA1. More...
 
cryerror_t cry_lld_SHA256_init (CRYDriver *cryp, SHA256Context *sha256ctxp)
 Hash initialization using SHA256. More...
 
cryerror_t cry_lld_SHA256_update (CRYDriver *cryp, SHA256Context *sha256ctxp, size_t size, const uint8_t *in)
 Hash update using SHA256. More...
 
cryerror_t cry_lld_SHA256_final (CRYDriver *cryp, SHA256Context *sha256ctxp, uint8_t *out)
 Hash finalization using SHA256. More...
 
cryerror_t cry_lld_SHA512_init (CRYDriver *cryp, SHA512Context *sha512ctxp)
 Hash initialization using SHA512. More...
 
cryerror_t cry_lld_SHA512_update (CRYDriver *cryp, SHA512Context *sha512ctxp, size_t size, const uint8_t *in)
 Hash update using SHA512. More...
 
cryerror_t cry_lld_SHA512_final (CRYDriver *cryp, SHA512Context *sha512ctxp, uint8_t *out)
 Hash finalization using SHA512. More...
 
cryerror_t cry_lld_TRNG (CRYDriver *cryp, uint8_t *out)
 True random numbers generator. More...
 

Enumerations

Variables

CRYDriver CRYD1
 CRY1 driver identifier. More...
 

Macro Definition Documentation

#define HAL_CRY_MAX_KEY_SIZE   32

Maximum size of a key for all supported algorithms.

Definition at line 37 of file hal_crypto.h.

Referenced by cryLoadTransientKey().

#define HAL_CRY_USE_FALLBACK   FALSE

Enables the SW fall-back of the cryptographic driver.

When enabled, this option, activates a fall-back software implementation for algorithms not supported by the underlying hardware.

Note
Fall-back implementations may not be present for all algorithms.

Definition at line 68 of file hal_crypto.h.

#define HAL_CRY_USE_FALLBACK   TRUE

Enables the SW fall-back of the cryptographic driver.

When enabled, this option, activates a fall-back software implementation for algorithms not supported by the underlying hardware.

Note
Fall-back implementations may not be present for all algorithms.

Definition at line 68 of file hal_crypto.h.

#define HAL_CRY_ENFORCE_FALLBACK   FALSE

Makes the driver forcibly use the fall-back implementations.

Note
If enabled then the LLD driver is not included at all.

Definition at line 59 of file hal_crypto.h.

#define PLATFORM_CRY_USE_CRY1   FALSE

CRY1 driver enable switch.

If set to TRUE the support for CRY1 is included.

Note
The default is FALSE.

Definition at line 67 of file hal_crypto_lld.h.

Typedef Documentation

typedef size_t bitsize_t

Size, in bits, of a crypto field or message.

Note
It is assumed, for simplicity, that this type is equivalent to a size_t.

Definition at line 80 of file hal_crypto.h.

typedef uint32_t crykey_t

CRY key identifier type.

Definition at line 82 of file hal_crypto_lld.h.

typedef struct CRYDriver CRYDriver

Type of a structure representing an CRY driver.

Definition at line 87 of file hal_crypto_lld.h.

Enumeration Type Documentation

enum crystate_t

Driver state machine possible states.

Enumerator
CRY_UNINIT 

Not initialized.

CRY_STOP 

Stopped.

CRY_READY 

Ready.

Definition at line 85 of file hal_crypto.h.

enum cryerror_t

Driver error codes.

Enumerator
CRY_NOERROR 

No error.

CRY_ERR_INV_ALGO 

Invalid cypher/mode.

CRY_ERR_INV_KEY_SIZE 

Invalid key size.

CRY_ERR_INV_KEY_TYPE 

Invalid key type.

CRY_ERR_INV_KEY_ID 

Invalid key type.

Definition at line 94 of file hal_crypto.h.

Type of an algorithm identifier.

Note
It is only used to determine the key required for operations.
Enumerator
cry_algo_aes 

AES 128, 192, 256 bits.

cry_algo_des 

DES 56, TDES 112, 168 bits.

Definition at line 106 of file hal_crypto.h.

Function Documentation

void cryInit ( void  )

Cryptographic Driver initialization.

Note
This function is implicitly invoked by halInit(), there is no need to explicitly initialize the driver.
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 56 of file hal_crypto.c.

References cry_lld_init().

Referenced by halInit().

Here is the call graph for this function:

void cryObjectInit ( CRYDriver cryp)

Initializes the standard part of a CRYDriver structure.

Parameters
[out]cryppointer to the CRYDriver object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 70 of file hal_crypto.c.

References CRYDriver::config, CRY_STOP, and CRYDriver::state.

void cryStart ( CRYDriver cryp,
const CRYConfig config 
)

Configures and activates the cryptographic peripheral.

Parameters
[in]cryppointer to the CRYDriver object
[in]configpointer to the CRYConfig object. Depending on the implementation the value can be NULL.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 88 of file hal_crypto.c.

References CRYDriver::config, cry_lld_start(), CRY_READY, CRY_STOP, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), and CRYDriver::state.

Here is the call graph for this function:

void cryStop ( CRYDriver cryp)

Deactivates the cryptographic peripheral.

Parameters
[in]cryppointer to the CRYDriver object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 110 of file hal_crypto.c.

References CRYDriver::config, cry_lld_stop(), CRY_READY, CRY_STOP, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryLoadTransientKey ( CRYDriver cryp,
cryalgorithm_t  algorithm,
size_t  size,
const uint8_t *  keyp 
)

Initializes the transient key for a specific algorithm.

Note
It is the underlying implementation to decide which combinations of algorithm and key size are allowable.
Parameters
[in]cryppointer to the CRYDriver object
[in]algorithmthe algorithm identifier
[in]sizekey size in bytes
[in]keyppointer to the key data
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the specified algorithm is unknown or unsupported.
CRY_ERR_INV_KEY_SIZEif the specified key size is invalid for the specified algorithm.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 146 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_loadkey(), CRY_NOERROR, HAL_CRY_MAX_KEY_SIZE, CRYDriver::key0_size, CRYDriver::key0_type, and osalDbgCheck.

Here is the call graph for this function:

cryerror_t cryEncryptAES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Encryption of a single block using AES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 199 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptAES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Decryption of a single block using AES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 243 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptAES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Encryption operation using AES-ECB.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 290 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_ECB(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptAES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Decryption operation using AES-ECB.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 340 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_ECB(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptAES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using AES-CBC.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 391 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_CBC(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptAES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using AES-CBC.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
[in]iv128 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 444 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_CBC(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptAES_CFB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using AES-CFB.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 497 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_CFB(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptAES_CFB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using AES-CFB.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
[in]iv128 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 550 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_CFB(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptAES_CTR ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using AES-CTR.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 604 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_CTR(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptAES_CTR ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using AES-CTR.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 16
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
[in]iv128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 659 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_CTR(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptAES_GCM ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv,
size_t  aadsize,
const uint8_t *  aad,
uint8_t *  authtag 
)

Encryption operation using AES-GCM.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the text buffers, this number must be a multiple of 16
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter
[in]aadsizesize of the authentication data, this number must be a multiple of 16
[in]aadbuffer containing the authentication data
[in]authtag128 bits buffer for the generated authentication tag
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 719 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_GCM(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptAES_GCM ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv,
size_t  aadsize,
const uint8_t *  aad,
uint8_t *  authtag 
)

Decryption operation using AES-GCM.

Note
The function operates on data buffers whose length is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the text buffers, this number must be a multiple of 16
[in]inbuffer for the output cyphertext
[out]outbuffer containing the input plaintext
[in]iv128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter
[in]aadsizesize of the authentication data, this number must be a multiple of 16
[in]aadbuffer containing the authentication data
[in]authtag128 bits buffer for the generated authentication tag
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 788 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_GCM(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptDES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Encryption of a single block using (T)DES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 847 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_DES(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptDES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Decryption of a single block using (T)DES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 892 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_DES(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptDES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Encryption operation using (T)DES-ECB.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 8
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 939 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_DES_ECB(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptDES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Decryption operation using (T)DES-ECB.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 8
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 989 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_DES_ECB(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryEncryptDES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using (T)DES-CBC.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 8
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv64 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1040 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_encrypt_DES_CBC(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryDecryptDES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using (T)DES-CBC.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of both buffers, this number must be a multiple of 8
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
[in]iv64 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1093 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_decrypt_DES_CBC(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA1Init ( CRYDriver cryp,
SHA1Context sha1ctxp 
)

Hash initialization using SHA1.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[out]sha1ctxppointer to a SHA1 context to be initialized
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1134 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA1_init(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA1Update ( CRYDriver cryp,
SHA1Context sha1ctxp,
size_t  size,
const uint8_t *  in 
)

Hash update using SHA1.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha1ctxppointer to a SHA1 context
[in]sizesize of input buffer
[in]inbuffer containing the input text
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1167 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA1_update(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA1Final ( CRYDriver cryp,
SHA1Context sha1ctxp,
uint8_t *  out 
)

Hash finalization using SHA1.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha1ctxppointer to a SHA1 context
[out]out160 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1202 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA1_final(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA256Init ( CRYDriver cryp,
SHA256Context sha256ctxp 
)

Hash initialization using SHA256.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[out]sha256ctxppointer to a SHA256 context to be initialized
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1234 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA256_init(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA256Update ( CRYDriver cryp,
SHA256Context sha256ctxp,
size_t  size,
const uint8_t *  in 
)

Hash update using SHA256.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha256ctxppointer to a SHA256 context
[in]sizesize of input buffer
[in]inbuffer containing the input text
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1267 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA256_update(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA256Final ( CRYDriver cryp,
SHA256Context sha256ctxp,
uint8_t *  out 
)

Hash finalization using SHA256.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha256ctxppointer to a SHA256 context
[out]out256 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1302 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA256_final(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA512Init ( CRYDriver cryp,
SHA512Context sha512ctxp 
)

Hash initialization using SHA512.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[out]sha512ctxppointer to a SHA512 context to be initialized
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1335 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA512_init(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA512Update ( CRYDriver cryp,
SHA512Context sha512ctxp,
size_t  size,
const uint8_t *  in 
)

Hash update using SHA512.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha512ctxppointer to a SHA512 context
[in]sizesize of input buffer
[in]inbuffer containing the input text
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1368 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA512_update(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t crySHA512Final ( CRYDriver cryp,
SHA512Context sha512ctxp,
uint8_t *  out 
)

Hash finalization using SHA512.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha512ctxppointer to a SHA512 context
[out]out512 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1403 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_SHA512_final(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

cryerror_t cryTRNG ( CRYDriver cryp,
uint8_t *  out 
)

True random numbers generator.

Parameters
[in]cryppointer to the CRYDriver object
[out]out128 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1435 of file hal_crypto.c.

References CRY_ERR_INV_ALGO, cry_lld_TRNG(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.

Here is the call graph for this function:

void cry_lld_init ( void  )

Low level crypto driver initialization.

Function Class:Not an API, this function is for internal use only.

Definition at line 63 of file hal_crypto_lld.c.

Referenced by cryInit().

void cry_lld_start ( CRYDriver cryp)

Configures and activates the crypto peripheral.

Parameters
[in]cryppointer to the CRYDriver object
Function Class:Not an API, this function is for internal use only.

Definition at line 74 of file hal_crypto_lld.c.

References CRY_STOP, and CRYDriver::state.

Referenced by cryStart().

void cry_lld_stop ( CRYDriver cryp)

Deactivates the crypto peripheral.

Parameters
[in]cryppointer to the CRYDriver object
Function Class:Not an API, this function is for internal use only.

Definition at line 88 of file hal_crypto_lld.c.

References CRY_READY, and CRYDriver::state.

Referenced by cryStop().

cryerror_t cry_lld_loadkey ( CRYDriver cryp,
cryalgorithm_t  algorithm,
size_t  size,
const uint8_t *  keyp 
)

Initializes the transient key for a specific algorithm.

Parameters
[in]cryppointer to the CRYDriver object
[in]algorithmthe algorithm identifier
[in]sizekey size in bytes
[in]keyppointer to the key data
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the specified algorithm is unknown or unsupported.
CRY_ERR_INV_KEY_SIZEif the specified key size is invalid.
Function Class:Not an API, this function is for internal use only.

Definition at line 110 of file hal_crypto_lld.c.

References CRY_NOERROR.

Referenced by cryLoadTransientKey().

cryerror_t cry_lld_encrypt_AES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Encryption of a single block using AES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 144 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptAES().

cryerror_t cry_lld_decrypt_AES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Decryption of a single block using AES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 178 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptAES().

cryerror_t cry_lld_encrypt_AES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Encryption operation using AES-ECB.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of the selected key size
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 215 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptAES_ECB().

cryerror_t cry_lld_decrypt_AES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Decryption operation using AES-ECB.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of the selected key size
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 254 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptAES_ECB().

cryerror_t cry_lld_encrypt_AES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using AES-CBC.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of the selected key size
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits initial vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 294 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptAES_CBC().

cryerror_t cry_lld_decrypt_AES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using AES-CBC.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of the selected key size
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits initial vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 336 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptAES_CBC().

cryerror_t cry_lld_encrypt_AES_CFB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using AES-CFB.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of the selected key size
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits initial vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 378 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptAES_CFB().

cryerror_t cry_lld_decrypt_AES_CFB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using AES-CFB.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of the selected key size
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits initial vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 420 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptAES_CFB().

cryerror_t cry_lld_encrypt_AES_CTR ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using AES-CTR.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of 16
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 463 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptAES_CTR().

cryerror_t cry_lld_decrypt_AES_CTR ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using AES-CTR.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of 16
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
[in]iv128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 506 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptAES_CTR().

cryerror_t cry_lld_encrypt_AES_GCM ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv,
size_t  aadsize,
const uint8_t *  aad,
uint8_t *  authtag 
)

Encryption operation using AES-GCM.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the text buffers, this number must be a multiple of 16
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter
[in]aadsizesize of the authentication data, this number must be a multiple of 16
[in]aadbuffer containing the authentication data
[in]authtag128 bits buffer for the generated authentication tag
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 554 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptAES_GCM().

cryerror_t cry_lld_decrypt_AES_GCM ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv,
size_t  aadsize,
const uint8_t *  aad,
uint8_t *  authtag 
)

Decryption operation using AES-GCM.

Note
The function operates on data buffers whose lenght is a multiple of an AES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the text buffers, this number must be a multiple of 16
[in]inbuffer for the output cyphertext
[out]outbuffer containing the input plaintext
[in]iv128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter
[in]aadsizesize of the authentication data, this number must be a multiple of 16
[in]aadbuffer containing the authentication data
[in]authtag128 bits buffer for the generated authentication tag
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 608 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptAES_GCM().

cryerror_t cry_lld_encrypt_DES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Encryption of a single block using (T)DES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 652 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptDES().

cryerror_t cry_lld_decrypt_DES ( CRYDriver cryp,
crykey_t  key_id,
const uint8_t *  in,
uint8_t *  out 
)

Decryption of a single block using (T)DES.

Note
The implementation of this function must guarantee that it can be called from any context.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 687 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptDES().

cryerror_t cry_lld_encrypt_DES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Encryption operation using (T)DES-ECB.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of 8
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 724 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptDES_ECB().

cryerror_t cry_lld_decrypt_DES_ECB ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out 
)

Decryption operation using (T)DES-ECB.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of 8
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
Returns
T he operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 763 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptDES_ECB().

cryerror_t cry_lld_encrypt_DES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Encryption operation using (T)DES-CBC.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of 8
[in]inbuffer containing the input plaintext
[out]outbuffer for the output cyphertext
[in]iv64 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 803 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryEncryptDES_CBC().

cryerror_t cry_lld_decrypt_DES_CBC ( CRYDriver cryp,
crykey_t  key_id,
size_t  size,
const uint8_t *  in,
uint8_t *  out,
const uint8_t *  iv 
)

Decryption operation using (T)DES-CBC.

Note
The function operates on data buffers whose length is a multiple of an DES block, this means that padding must be done by the caller.
Parameters
[in]cryppointer to the CRYDriver object
[in]key_idthe key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way
[in]sizesize of the plaintext buffer, this number must be a multiple of 8
[in]inbuffer containing the input cyphertext
[out]outbuffer for the output plaintext
[in]iv64 bits input vector
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
CRY_ERR_INV_KEY_TYPEthe selected key is invalid for this operation.
CRY_ERR_INV_KEY_IDif the specified key identifier is invalid or refers to an empty key slot.
Function Class:Not an API, this function is for internal use only.

Definition at line 845 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryDecryptDES_CBC().

cryerror_t cry_lld_SHA1_init ( CRYDriver cryp,
SHA1Context sha1ctxp 
)

Hash initialization using SHA1.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[out]sha1ctxppointer to a SHA1 context to be initialized
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 874 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA1Init().

cryerror_t cry_lld_SHA1_update ( CRYDriver cryp,
SHA1Context sha1ctxp,
size_t  size,
const uint8_t *  in 
)

Hash update using SHA1.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha1ctxppointer to a SHA1 context
[in]sizesize of input buffer
[in]inbuffer containing the input text
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 897 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA1Update().

cryerror_t cry_lld_SHA1_final ( CRYDriver cryp,
SHA1Context sha1ctxp,
uint8_t *  out 
)

Hash finalization using SHA1.

Note
Use of this algorithm is not recommended because proven weak.
Parameters
[in]cryppointer to the CRYDriver object
[in]sha1ctxppointer to a SHA1 context
[out]out160 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 922 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA1Final().

cryerror_t cry_lld_SHA256_init ( CRYDriver cryp,
SHA256Context sha256ctxp 
)

Hash initialization using SHA256.

Parameters
[in]cryppointer to the CRYDriver object
[out]sha256ctxppointer to a SHA256 context to be initialized
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 943 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA256Init().

cryerror_t cry_lld_SHA256_update ( CRYDriver cryp,
SHA256Context sha256ctxp,
size_t  size,
const uint8_t *  in 
)

Hash update using SHA256.

Parameters
[in]cryppointer to the CRYDriver object
[in]sha256ctxppointer to a SHA256 context
[in]sizesize of input buffer
[in]inbuffer containing the input text
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 965 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA256Update().

cryerror_t cry_lld_SHA256_final ( CRYDriver cryp,
SHA256Context sha256ctxp,
uint8_t *  out 
)

Hash finalization using SHA256.

Parameters
[in]cryppointer to the CRYDriver object
[in]sha256ctxppointer to a SHA256 context
[out]out256 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 989 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA256Final().

cryerror_t cry_lld_SHA512_init ( CRYDriver cryp,
SHA512Context sha512ctxp 
)

Hash initialization using SHA512.

Parameters
[in]cryppointer to the CRYDriver object
[out]sha512ctxppointer to a SHA512 context to be initialized
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 1010 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA512Init().

cryerror_t cry_lld_SHA512_update ( CRYDriver cryp,
SHA512Context sha512ctxp,
size_t  size,
const uint8_t *  in 
)

Hash update using SHA512.

Parameters
[in]cryppointer to the CRYDriver object
[in]sha512ctxppointer to a SHA512 context
[in]sizesize of input buffer
[in]inbuffer containing the input text
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 1032 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA512Update().

cryerror_t cry_lld_SHA512_final ( CRYDriver cryp,
SHA512Context sha512ctxp,
uint8_t *  out 
)

Hash finalization using SHA512.

Parameters
[in]cryppointer to the CRYDriver object
[in]sha512ctxppointer to a SHA512 context
[out]out512 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 1056 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by crySHA512Final().

cryerror_t cry_lld_TRNG ( CRYDriver cryp,
uint8_t *  out 
)

True random numbers generator.

Parameters
[in]cryppointer to the CRYDriver object
[out]out128 bits output buffer
Returns
The operation status.
Return values
CRY_NOERRORif the operation succeeded.
CRY_ERR_INV_ALGOif the operation is unsupported on this device instance.
Function Class:Not an API, this function is for internal use only.

Definition at line 1078 of file hal_crypto_lld.c.

References CRY_ERR_INV_ALGO.

Referenced by cryTRNG().

Variable Documentation

CRYDriver CRYD1

CRY1 driver identifier.

Definition at line 39 of file hal_crypto_lld.c.