ChibiOS/HAL
6.1.0
|
Generic Crypto Driver. More...
Generic Crypto Driver.
This module implements a generic Cryptography driver.
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... | |
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... | |
#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.
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.
Definition at line 68 of file hal_crypto.h.
#define HAL_CRY_ENFORCE_FALLBACK FALSE |
Makes the driver forcibly use the fall-back implementations.
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.
FALSE
. Definition at line 67 of file hal_crypto_lld.h.
typedef size_t bitsize_t |
Size, in bits, of a crypto field or message.
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.
Type of a structure representing an CRY driver.
Definition at line 87 of file hal_crypto_lld.h.
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.
enum cryalgorithm_t |
Type of an algorithm identifier.
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.
void cryInit | ( | void | ) |
Cryptographic Driver initialization.
halInit()
, there is no need to explicitly initialize the driver.Definition at line 56 of file hal_crypto.c.
References cry_lld_init().
Referenced by halInit().
void cryObjectInit | ( | CRYDriver * | cryp | ) |
Initializes the standard part of a CRYDriver
structure.
[out] | cryp | pointer to the CRYDriver object |
Definition at line 70 of file hal_crypto.c.
References CRYDriver::config, CRY_STOP, and CRYDriver::state.
Configures and activates the cryptographic peripheral.
[in] | cryp | pointer to the CRYDriver object |
[in] | config | pointer to the CRYConfig object. Depending on the implementation the value can be NULL . |
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.
void cryStop | ( | CRYDriver * | cryp | ) |
Deactivates the cryptographic peripheral.
[in] | cryp | pointer to the CRYDriver object |
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.
cryerror_t cryLoadTransientKey | ( | CRYDriver * | cryp, |
cryalgorithm_t | algorithm, | ||
size_t | size, | ||
const uint8_t * | keyp | ||
) |
Initializes the transient key for a specific algorithm.
[in] | cryp | pointer to the CRYDriver object |
[in] | algorithm | the algorithm identifier |
[in] | size | key size in bytes |
[in] | keyp | pointer to the key data |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the specified algorithm is unknown or unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid for the specified algorithm. |
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.
cryerror_t cryEncryptAES | ( | CRYDriver * | cryp, |
crykey_t | key_id, | ||
const uint8_t * | in, | ||
uint8_t * | out | ||
) |
Encryption of a single block using AES.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
cryerror_t cryDecryptAES | ( | CRYDriver * | cryp, |
crykey_t | key_id, | ||
const uint8_t * | in, | ||
uint8_t * | out | ||
) |
Decryption of a single block using AES.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
[in] | iv | 128 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
[in] | iv | 128 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
[in] | iv | 128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the text buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter |
[in] | aadsize | size of the authentication data, this number must be a multiple of 16 |
[in] | aad | buffer containing the authentication data |
[in] | authtag | 128 bits buffer for the generated authentication tag |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the text buffers, this number must be a multiple of 16 |
[in] | in | buffer for the output cyphertext |
[out] | out | buffer containing the input plaintext |
[in] | iv | 128 bits input vector + counter, it contains a 96 bits IV and a 32 bits counter |
[in] | aadsize | size of the authentication data, this number must be a multiple of 16 |
[in] | aad | buffer containing the authentication data |
[in] | authtag | 128 bits buffer for the generated authentication tag |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
cryerror_t cryEncryptDES | ( | CRYDriver * | cryp, |
crykey_t | key_id, | ||
const uint8_t * | in, | ||
uint8_t * | out | ||
) |
Encryption of a single block using (T)DES.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
cryerror_t cryDecryptDES | ( | CRYDriver * | cryp, |
crykey_t | key_id, | ||
const uint8_t * | in, | ||
uint8_t * | out | ||
) |
Decryption of a single block using (T)DES.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 8 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 8 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 8 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 64 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of both buffers, this number must be a multiple of 8 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
[in] | iv | 64 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
cryerror_t crySHA1Init | ( | CRYDriver * | cryp, |
SHA1Context * | sha1ctxp | ||
) |
Hash initialization using SHA1.
[in] | cryp | pointer to the CRYDriver object |
[out] | sha1ctxp | pointer to a SHA1 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA1Update | ( | CRYDriver * | cryp, |
SHA1Context * | sha1ctxp, | ||
size_t | size, | ||
const uint8_t * | in | ||
) |
Hash update using SHA1.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha1ctxp | pointer to a SHA1 context |
[in] | size | size of input buffer |
[in] | in | buffer containing the input text |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA1Final | ( | CRYDriver * | cryp, |
SHA1Context * | sha1ctxp, | ||
uint8_t * | out | ||
) |
Hash finalization using SHA1.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha1ctxp | pointer to a SHA1 context |
[out] | out | 160 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA256Init | ( | CRYDriver * | cryp, |
SHA256Context * | sha256ctxp | ||
) |
Hash initialization using SHA256.
[in] | cryp | pointer to the CRYDriver object |
[out] | sha256ctxp | pointer to a SHA256 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA256Update | ( | CRYDriver * | cryp, |
SHA256Context * | sha256ctxp, | ||
size_t | size, | ||
const uint8_t * | in | ||
) |
Hash update using SHA256.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha256ctxp | pointer to a SHA256 context |
[in] | size | size of input buffer |
[in] | in | buffer containing the input text |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA256Final | ( | CRYDriver * | cryp, |
SHA256Context * | sha256ctxp, | ||
uint8_t * | out | ||
) |
Hash finalization using SHA256.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha256ctxp | pointer to a SHA256 context |
[out] | out | 256 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA512Init | ( | CRYDriver * | cryp, |
SHA512Context * | sha512ctxp | ||
) |
Hash initialization using SHA512.
[in] | cryp | pointer to the CRYDriver object |
[out] | sha512ctxp | pointer to a SHA512 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA512Update | ( | CRYDriver * | cryp, |
SHA512Context * | sha512ctxp, | ||
size_t | size, | ||
const uint8_t * | in | ||
) |
Hash update using SHA512.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha512ctxp | pointer to a SHA512 context |
[in] | size | size of input buffer |
[in] | in | buffer containing the input text |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t crySHA512Final | ( | CRYDriver * | cryp, |
SHA512Context * | sha512ctxp, | ||
uint8_t * | out | ||
) |
Hash finalization using SHA512.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha512ctxp | pointer to a SHA512 context |
[out] | out | 512 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
cryerror_t cryTRNG | ( | CRYDriver * | cryp, |
uint8_t * | out | ||
) |
True random numbers generator.
[in] | cryp | pointer to the CRYDriver object |
[out] | out | 128 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
Definition at line 1435 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_TRNG(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.
void cry_lld_init | ( | void | ) |
Low level crypto driver initialization.
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.
[in] | cryp | pointer to the CRYDriver object |
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.
[in] | cryp | pointer to the CRYDriver object |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | algorithm | the algorithm identifier |
[in] | size | key size in bytes |
[in] | keyp | pointer to the key data |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the specified algorithm is unknown or unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of the selected key size |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of the selected key size |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of the selected key size |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits initial vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of the selected key size |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits initial vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of the selected key size |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits initial vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of the selected key size |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits initial vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of 16 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
[in] | iv | 128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the text buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter |
[in] | aadsize | size of the authentication data, this number must be a multiple of 16 |
[in] | aad | buffer containing the authentication data |
[in] | authtag | 128 bits buffer for the generated authentication tag |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the text buffers, this number must be a multiple of 16 |
[in] | in | buffer for the output cyphertext |
[out] | out | buffer containing the input plaintext |
[in] | iv | 128 bits initial vector + counter, it contains a 96 bits IV and a 32 bits counter |
[in] | aadsize | size of the authentication data, this number must be a multiple of 16 |
[in] | aad | buffer containing the authentication data |
[in] | authtag | 128 bits buffer for the generated authentication tag |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of 8 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of 8 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of 8 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output cyphertext |
[in] | iv | 64 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | key_id | the key to be used for the operation, zero is the transient key, other values are keys stored in an unspecified way |
[in] | size | size of the plaintext buffer, this number must be a multiple of 8 |
[in] | in | buffer containing the input cyphertext |
[out] | out | buffer for the output plaintext |
[in] | iv | 64 bits input vector |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_INV_KEY_TYPE | the selected key is invalid for this operation. |
CRY_ERR_INV_KEY_ID | if the specified key identifier is invalid or refers to an empty key slot. |
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.
[in] | cryp | pointer to the CRYDriver object |
[out] | sha1ctxp | pointer to a SHA1 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha1ctxp | pointer to a SHA1 context |
[in] | size | size of input buffer |
[in] | in | buffer containing the input text |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha1ctxp | pointer to a SHA1 context |
[out] | out | 160 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[out] | sha256ctxp | pointer to a SHA256 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha256ctxp | pointer to a SHA256 context |
[in] | size | size of input buffer |
[in] | in | buffer containing the input text |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha256ctxp | pointer to a SHA256 context |
[out] | out | 256 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[out] | sha512ctxp | pointer to a SHA512 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha512ctxp | pointer to a SHA512 context |
[in] | size | size of input buffer |
[in] | in | buffer containing the input text |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[in] | sha512ctxp | pointer to a SHA512 context |
[out] | out | 512 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
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.
[in] | cryp | pointer to the CRYDriver object |
[out] | out | 128 bits output buffer |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
Definition at line 1078 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO.
Referenced by cryTRNG().
CRYDriver CRYD1 |
CRY1 driver identifier.
Definition at line 39 of file hal_crypto_lld.c.