ChibiOS 21.11.4
|
Generic Crypto Driver. More...
Generic Crypto Driver.
This module implements a generic Cryptography driver.
HAL_USE_CRY
option must be enabled in halconf.h
.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_HMAC_SHA256 TRUE |
#define | CRY_LLD_SUPPORTS_HMAC_SHA512 TRUE |
PLATFORM configuration options | |
#define | PLATFORM_CRY_USE_CRY1 FALSE |
CRY1 driver enable switch. |
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 | HMACSHA256Context |
Type of a HMAC_SHA256 context. More... | |
struct | HMACSHA512Context |
Type of a HMAC_SHA512 context. More... | |
struct | CRYConfig |
Driver configuration structure. More... | |
struct | CRYDriver |
Structure representing an CRY driver. More... |
Macros | |
#define | HAL_CRY_USE_FALLBACK FALSE |
Enables the SW fall-back of the cryptographic driver. | |
#define | HAL_CRY_USE_FALLBACK TRUE |
Enables the SW fall-back of the cryptographic driver. | |
#define | HAL_CRY_ENFORCE_FALLBACK FALSE |
Makes the driver forcibly use the fall-back implementations. |
Typedefs | |
typedef size_t | bitsize_t |
Size, in bits, of a crypto field or message. | |
typedef uint32_t | crykey_t |
CRY key identifier type. | |
typedef struct CRYDriver | CRYDriver |
Type of a structure representing an CRY driver. |
Enumerations | |
enum | crystate_t { CRY_UNINIT = 0 , CRY_STOP = 1 , CRY_READY = 2 } |
Driver state machine possible states. More... | |
enum | cryerror_t { CRY_NOERROR = 0 , CRY_ERR_INV_ALGO = 1 , CRY_ERR_INV_KEY_SIZE = 2 , CRY_ERR_INV_KEY_TYPE = 3 , CRY_ERR_INV_KEY_ID = 4 , CRY_ERR_AUTH_FAILED = 5 , CRY_ERR_OP_FAILURE = 6 } |
Driver error codes. More... | |
enum | cryalgorithm_t { cry_algo_none = 0 , cry_algo_aes , cry_algo_des , cry_algo_hmac } |
Type of an algorithm identifier. More... |
Functions | |
void | cryInit (void) |
Cryptographic Driver initialization. | |
void | cryObjectInit (CRYDriver *cryp) |
Initializes the standard part of a CRYDriver structure. | |
msg_t | cryStart (CRYDriver *cryp, const CRYConfig *config) |
Configures and activates the cryptographic peripheral. | |
void | cryStop (CRYDriver *cryp) |
Deactivates the cryptographic peripheral. | |
cryerror_t | cryLoadAESTransientKey (CRYDriver *cryp, size_t size, const uint8_t *keyp) |
Initializes the AES transient key. | |
cryerror_t | cryEncryptAES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out) |
Encryption of a single block using AES. | |
cryerror_t | cryDecryptAES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out) |
Decryption of a single block using AES. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
cryerror_t | cryEncryptAES_GCM (CRYDriver *cryp, crykey_t key_id, size_t auth_size, const uint8_t *auth_in, size_t text_size, const uint8_t *text_in, uint8_t *text_out, const uint8_t *iv, size_t tag_size, uint8_t *tag_out) |
Encryption operation using AES-GCM. | |
cryerror_t | cryDecryptAES_GCM (CRYDriver *cryp, crykey_t key_id, size_t auth_size, const uint8_t *auth_in, size_t text_size, const uint8_t *text_in, uint8_t *text_out, const uint8_t *iv, size_t tag_size, const uint8_t *tag_in) |
Decryption operation using AES-GCM. | |
cryerror_t | cryLoadDESTransientKey (CRYDriver *cryp, size_t size, const uint8_t *keyp) |
Initializes the DES transient key. | |
cryerror_t | cryEncryptDES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out) |
Encryption of a single block using (T)DES. | |
cryerror_t | cryDecryptDES (CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out) |
Decryption of a single block using (T)DES. | |
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. | |
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. | |
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. | |
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. | |
cryerror_t | crySHA1Init (CRYDriver *cryp, SHA1Context *sha1ctxp) |
Hash initialization using SHA1. | |
cryerror_t | crySHA1Update (CRYDriver *cryp, SHA1Context *sha1ctxp, size_t size, const uint8_t *in) |
Hash update using SHA1. | |
cryerror_t | crySHA1Final (CRYDriver *cryp, SHA1Context *sha1ctxp, uint8_t *out) |
Hash finalization using SHA1. | |
cryerror_t | crySHA256Init (CRYDriver *cryp, SHA256Context *sha256ctxp) |
Hash initialization using SHA256. | |
cryerror_t | crySHA256Update (CRYDriver *cryp, SHA256Context *sha256ctxp, size_t size, const uint8_t *in) |
Hash update using SHA256. | |
cryerror_t | crySHA256Final (CRYDriver *cryp, SHA256Context *sha256ctxp, uint8_t *out) |
Hash finalization using SHA256. | |
cryerror_t | crySHA512Init (CRYDriver *cryp, SHA512Context *sha512ctxp) |
Hash initialization using SHA512. | |
cryerror_t | crySHA512Update (CRYDriver *cryp, SHA512Context *sha512ctxp, size_t size, const uint8_t *in) |
Hash update using SHA512. | |
cryerror_t | crySHA512Final (CRYDriver *cryp, SHA512Context *sha512ctxp, uint8_t *out) |
Hash finalization using SHA512. | |
cryerror_t | cryLoadHMACTransientKey (CRYDriver *cryp, size_t size, const uint8_t *keyp) |
Initializes the HMAC transient key. | |
cryerror_t | cryHMACSHA256Init (CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp) |
Hash initialization using HMAC_SHA256. | |
cryerror_t | cryHMACSHA256Update (CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp, size_t size, const uint8_t *in) |
Hash update using HMAC. | |
cryerror_t | cryHMACSHA256Final (CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp, uint8_t *out) |
Hash finalization using HMAC. | |
cryerror_t | cryHMACSHA512Init (CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp) |
Hash initialization using HMAC_SHA512. | |
cryerror_t | cryHMACSHA512Update (CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp, size_t size, const uint8_t *in) |
Hash update using HMAC. | |
cryerror_t | cryHMACSHA512Final (CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp, uint8_t *out) |
Hash finalization using HMAC. | |
void | cry_lld_init (void) |
Low level crypto driver initialization. | |
void | cry_lld_start (CRYDriver *cryp) |
Configures and activates the crypto peripheral. | |
void | cry_lld_stop (CRYDriver *cryp) |
Deactivates the crypto peripheral. | |
cryerror_t | cry_lld_aes_loadkey (CRYDriver *cryp, size_t size, const uint8_t *keyp) |
Initializes the AES transient key. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
cryerror_t | cry_lld_encrypt_AES_GCM (CRYDriver *cryp, crykey_t key_id, size_t auth_size, const uint8_t *auth_in, size_t text_size, const uint8_t *text_in, uint8_t *text_out, const uint8_t *iv, size_t tag_size, uint8_t *tag_out) |
Encryption operation using AES-GCM. | |
cryerror_t | cry_lld_decrypt_AES_GCM (CRYDriver *cryp, crykey_t key_id, size_t auth_size, const uint8_t *auth_in, size_t text_size, const uint8_t *text_in, uint8_t *text_out, const uint8_t *iv, size_t tag_size, const uint8_t *tag_in) |
Decryption operation using AES-GCM. | |
cryerror_t | cry_lld_des_loadkey (CRYDriver *cryp, size_t size, const uint8_t *keyp) |
Initializes the DES transient key. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
cryerror_t | cry_lld_SHA1_init (CRYDriver *cryp, SHA1Context *sha1ctxp) |
Hash initialization using SHA1. | |
cryerror_t | cry_lld_SHA1_update (CRYDriver *cryp, SHA1Context *sha1ctxp, size_t size, const uint8_t *in) |
Hash update using SHA1. | |
cryerror_t | cry_lld_SHA1_final (CRYDriver *cryp, SHA1Context *sha1ctxp, uint8_t *out) |
Hash finalization using SHA1. | |
cryerror_t | cry_lld_SHA256_init (CRYDriver *cryp, SHA256Context *sha256ctxp) |
Hash initialization using SHA256. | |
cryerror_t | cry_lld_SHA256_update (CRYDriver *cryp, SHA256Context *sha256ctxp, size_t size, const uint8_t *in) |
Hash update using SHA256. | |
cryerror_t | cry_lld_SHA256_final (CRYDriver *cryp, SHA256Context *sha256ctxp, uint8_t *out) |
Hash finalization using SHA256. | |
cryerror_t | cry_lld_SHA512_init (CRYDriver *cryp, SHA512Context *sha512ctxp) |
Hash initialization using SHA512. | |
cryerror_t | cry_lld_SHA512_update (CRYDriver *cryp, SHA512Context *sha512ctxp, size_t size, const uint8_t *in) |
Hash update using SHA512. | |
cryerror_t | cry_lld_SHA512_final (CRYDriver *cryp, SHA512Context *sha512ctxp, uint8_t *out) |
Hash finalization using SHA512. | |
cryerror_t | cry_lld_hmac_loadkey (CRYDriver *cryp, size_t size, const uint8_t *keyp) |
Initializes the HMAC transient key. | |
cryerror_t | cry_lld_HMACSHA256_init (CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp) |
Hash initialization using HMAC_SHA256. | |
cryerror_t | cry_lld_HMACSHA256_update (CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp, size_t size, const uint8_t *in) |
Hash update using HMAC. | |
cryerror_t | cry_lld_HMACSHA256_final (CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp, uint8_t *out) |
Hash finalization using HMAC. | |
cryerror_t | cry_lld_HMACSHA512_init (CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp) |
Hash initialization using HMAC_SHA512. | |
cryerror_t | cry_lld_HMACSHA512_update (CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp, size_t size, const uint8_t *in) |
Hash update using HMAC. | |
cryerror_t | cry_lld_HMACSHA512_final (CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp, uint8_t *out) |
Hash finalization using HMAC. |
Variables | |
CRYDriver | CRYD1 |
CRY1 driver identifier. |
#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 46 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 46 of file hal_crypto.h.
#define HAL_CRY_ENFORCE_FALLBACK FALSE |
Makes the driver forcibly use the fall-back implementations.
Definition at line 54 of file hal_crypto.h.
#define CRY_LLD_SUPPORTS_AES TRUE |
Definition at line 38 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_AES_ECB TRUE |
Definition at line 39 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_AES_CBC TRUE |
Definition at line 40 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_AES_CFB TRUE |
Definition at line 41 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_AES_CTR TRUE |
Definition at line 42 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_AES_GCM TRUE |
Definition at line 43 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_DES TRUE |
Definition at line 44 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_DES_ECB TRUE |
Definition at line 45 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_DES_CBC TRUE |
Definition at line 46 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_SHA1 TRUE |
Definition at line 47 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_SHA256 TRUE |
Definition at line 48 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_SHA512 TRUE |
Definition at line 49 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_HMAC_SHA256 TRUE |
Definition at line 50 of file hal_crypto_lld.h.
#define CRY_LLD_SUPPORTS_HMAC_SHA512 TRUE |
Definition at line 51 of file hal_crypto_lld.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 68 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 75 of file hal_crypto.h.
typedef uint32_t crykey_t |
CRY key identifier type.
Definition at line 83 of file hal_crypto_lld.h.
typedef struct CRYDriver CRYDriver |
Type of a structure representing an CRY driver.
Definition at line 88 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 80 of file hal_crypto.h.
enum cryerror_t |
Driver error codes.
Definition at line 89 of file hal_crypto.h.
enum cryalgorithm_t |
Type of an algorithm identifier.
Enumerator | |
---|---|
cry_algo_none | |
cry_algo_aes | AES 128, 192, 256 bits. |
cry_algo_des | DES 56, TDES 112, 168 bits. |
cry_algo_hmac | HMAC variable size. |
Definition at line 103 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 89 of file hal_crypto.c.
References CRYDriver::config, cry_lld_start(), CRY_READY, CRY_STOP, HAL_RET_SUCCESS, 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 129 of file hal_crypto.c.
References CRYDriver::config, cry_lld_stop(), CRY_READY, CRY_STOP, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), and CRYDriver::state.
cryerror_t cryLoadAESTransientKey | ( | CRYDriver * | cryp, |
size_t | size, | ||
const uint8_t * | keyp ) |
Initializes the AES transient key.
[in] | cryp | pointer to the CRYDriver object |
[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 algorithm is unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid for the specified algorithm. |
Definition at line 163 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_aes_loadkey(), 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 ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 205 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 251 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 300 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_ECB(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 352 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_ECB(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 405 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_CBC(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 460 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_CBC(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 512 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_CFB(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 |
[in] | in | buffer containing the input ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 564 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_CFB(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 617 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_AES_CTR(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 |
[in] | in | buffer containing the input ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 670 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_CTR(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, and CRYDriver::state.
cryerror_t cryEncryptAES_GCM | ( | CRYDriver * | cryp, |
crykey_t | key_id, | ||
size_t | auth_size, | ||
const uint8_t * | auth_in, | ||
size_t | text_size, | ||
const uint8_t * | text_in, | ||
uint8_t * | text_out, | ||
const uint8_t * | iv, | ||
size_t | tag_size, | ||
uint8_t * | tag_out ) |
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] | auth_size | size of the data buffer to be authenticated |
[in] | auth_in | buffer containing the data to be authenticated |
[in] | text_size | size of the text buffer |
[in] | text_in | buffer containing the input plaintext |
[out] | text_out | buffer for the output ciphertext |
[in] | iv | 128 bits input vector |
[in] | tag_size | size of the authentication tag, this number must be between 1 and 16 |
[out] | tag_out | 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 727 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 | auth_size, | ||
const uint8_t * | auth_in, | ||
size_t | text_size, | ||
const uint8_t * | text_in, | ||
uint8_t * | text_out, | ||
const uint8_t * | iv, | ||
size_t | tag_size, | ||
const uint8_t * | tag_in ) |
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] | auth_size | size of the data buffer to be authenticated |
[in] | auth_in | buffer containing the data to be authenticated |
[in] | text_size | size of the text buffer |
[in] | text_in | buffer containing the input plaintext |
[out] | text_out | buffer for the output ciphertext |
[in] | iv | 128 bits input vector |
[in] | tag_size | size of the authentication tag, this number must be between 1 and 16 |
[in] | tag_in | 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. |
CRY_ERR_AUTH_FAILED | authentication failed |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 800 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_AES_GCM(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.
cryerror_t cryLoadDESTransientKey | ( | CRYDriver * | cryp, |
size_t | size, | ||
const uint8_t * | keyp ) |
Initializes the DES transient key.
[in] | cryp | pointer to the CRYDriver object |
[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 algorithm is unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid for the specified algorithm. |
Definition at line 859 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_des_loadkey(), and osalDbgCheck.
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 ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 901 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_DES(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 948 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_DES(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 997 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_DES_ECB(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1049 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_DES_ECB(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1102 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_encrypt_DES_CBC(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1157 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_decrypt_DES_CBC(), CRY_READY, in, osalDbgAssert, osalDbgCheck, out, 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1200 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1235 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_SHA1_update(), CRY_READY, in, 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1272 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_SHA1_final(), CRY_READY, osalDbgAssert, osalDbgCheck, out, 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1305 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1339 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_SHA256_update(), CRY_READY, in, 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1375 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_SHA256_final(), CRY_READY, osalDbgAssert, osalDbgCheck, out, 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1409 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1443 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_SHA512_update(), CRY_READY, in, 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1479 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_SHA512_final(), CRY_READY, osalDbgAssert, osalDbgCheck, out, and CRYDriver::state.
cryerror_t cryLoadHMACTransientKey | ( | CRYDriver * | cryp, |
size_t | size, | ||
const uint8_t * | keyp ) |
Initializes the HMAC transient key.
[in] | cryp | pointer to the CRYDriver object |
[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 algorithm is unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid for the specified algorithm. |
Definition at line 1515 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_hmac_loadkey(), and osalDbgCheck.
cryerror_t cryHMACSHA256Init | ( | CRYDriver * | cryp, |
HMACSHA256Context * | hmacsha256ctxp ) |
Hash initialization using HMAC_SHA256.
[in] | cryp | pointer to the CRYDriver object |
[out] | hmacsha256ctxp | pointer to a HMAC_SHA256 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1550 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_HMACSHA256_init(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.
cryerror_t cryHMACSHA256Update | ( | CRYDriver * | cryp, |
HMACSHA256Context * | hmacsha256ctxp, | ||
size_t | size, | ||
const uint8_t * | in ) |
Hash update using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha256ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1585 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_HMACSHA256_update(), CRY_READY, in, osalDbgAssert, osalDbgCheck, and CRYDriver::state.
cryerror_t cryHMACSHA256Final | ( | CRYDriver * | cryp, |
HMACSHA256Context * | hmacsha256ctxp, | ||
uint8_t * | out ) |
Hash finalization using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha256ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1623 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_HMACSHA256_final(), CRY_READY, osalDbgAssert, osalDbgCheck, out, and CRYDriver::state.
cryerror_t cryHMACSHA512Init | ( | CRYDriver * | cryp, |
HMACSHA512Context * | hmacsha512ctxp ) |
Hash initialization using HMAC_SHA512.
[in] | cryp | pointer to the CRYDriver object |
[out] | hmacsha512ctxp | pointer to a HMAC_SHA512 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1659 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_HMACSHA512_init(), CRY_READY, osalDbgAssert, osalDbgCheck, and CRYDriver::state.
cryerror_t cryHMACSHA512Update | ( | CRYDriver * | cryp, |
HMACSHA512Context * | hmacsha512ctxp, | ||
size_t | size, | ||
const uint8_t * | in ) |
Hash update using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha512ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1694 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_HMACSHA512_update(), CRY_READY, in, osalDbgAssert, osalDbgCheck, and CRYDriver::state.
cryerror_t cryHMACSHA512Final | ( | CRYDriver * | cryp, |
HMACSHA512Context * | hmacsha512ctxp, | ||
uint8_t * | out ) |
Hash finalization using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha512ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1732 of file hal_crypto.c.
References CRY_ERR_INV_ALGO, cry_lld_HMACSHA512_final(), CRY_READY, osalDbgAssert, osalDbgCheck, out, 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_aes_loadkey | ( | CRYDriver * | cryp, |
size_t | size, | ||
const uint8_t * | keyp ) |
Initializes the AES transient key.
[in] | cryp | pointer to the CRYDriver object |
[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 algorithm is unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid for the specified algorithm. |
Definition at line 112 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO.
Referenced by cryLoadAESTransientKey().
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 ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 146 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 182 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 223 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 264 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 308 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers, this number must be a multiple of 16 |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 352 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 395 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 436 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers |
[in] | in | buffer containing the input plaintext |
[out] | out | buffer for the output ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 480 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 both buffers |
[in] | in | buffer containing the input ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 522 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
Referenced by cryDecryptAES_CTR().
cryerror_t cry_lld_encrypt_AES_GCM | ( | CRYDriver * | cryp, |
crykey_t | key_id, | ||
size_t | auth_size, | ||
const uint8_t * | auth_in, | ||
size_t | text_size, | ||
const uint8_t * | text_in, | ||
uint8_t * | text_out, | ||
const uint8_t * | iv, | ||
size_t | tag_size, | ||
uint8_t * | tag_out ) |
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] | auth_size | size of the data buffer to be authenticated |
[in] | auth_in | buffer containing the data to be authenticated |
[in] | text_size | size of the text buffer |
[in] | text_in | buffer containing the input plaintext |
[out] | text_out | buffer for the output ciphertext |
[in] | iv | 128 bits input vector |
[in] | tag_size | size of the authentication tag, this number must be between 1 and 16 |
[out] | tag_out | 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 570 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 | auth_size, | ||
const uint8_t * | auth_in, | ||
size_t | text_size, | ||
const uint8_t * | text_in, | ||
uint8_t * | text_out, | ||
const uint8_t * | iv, | ||
size_t | tag_size, | ||
const uint8_t * | tag_in ) |
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] | auth_size | size of the data buffer to be authenticated |
[in] | auth_in | buffer containing the data to be authenticated |
[in] | text_size | size of the text buffer |
[in] | text_in | buffer containing the input plaintext |
[out] | text_out | buffer for the output ciphertext |
[in] | iv | 128 bits input vector |
[in] | tag_size | size of the authentication tag, this number must be between 1 and 16 |
[in] | tag_in | 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. |
CRY_ERR_AUTH_FAILED | authentication failed |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 625 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO.
Referenced by cryDecryptAES_GCM().
cryerror_t cry_lld_des_loadkey | ( | CRYDriver * | cryp, |
size_t | size, | ||
const uint8_t * | keyp ) |
Initializes the DES transient key.
[in] | cryp | pointer to the CRYDriver object |
[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 algorithm is unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid for the specified algorithm. |
Definition at line 668 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO.
Referenced by cryLoadDESTransientKey().
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 ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 702 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 739 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 ciphertext |
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 780 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 821 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 865 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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 ciphertext |
[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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 909 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, in, and out.
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 942 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 967 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and in.
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 994 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and out.
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1019 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1043 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and in.
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1069 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and out.
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1094 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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1118 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and in.
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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1144 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and out.
Referenced by crySHA512Final().
cryerror_t cry_lld_hmac_loadkey | ( | CRYDriver * | cryp, |
size_t | size, | ||
const uint8_t * | keyp ) |
Initializes the HMAC transient key.
[in] | cryp | pointer to the CRYDriver object |
[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 algorithm is unsupported. |
CRY_ERR_INV_KEY_SIZE | if the specified key size is invalid for the specified algorithm. |
Definition at line 1172 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO.
Referenced by cryLoadHMACTransientKey().
cryerror_t cry_lld_HMACSHA256_init | ( | CRYDriver * | cryp, |
HMACSHA256Context * | hmacsha256ctxp ) |
Hash initialization using HMAC_SHA256.
[in] | cryp | pointer to the CRYDriver object |
[out] | hmacsha256ctxp | pointer to a HMAC_SHA256 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1198 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO.
Referenced by cryHMACSHA256Init().
cryerror_t cry_lld_HMACSHA256_update | ( | CRYDriver * | cryp, |
HMACSHA256Context * | hmacsha256ctxp, | ||
size_t | size, | ||
const uint8_t * | in ) |
Hash update using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha256ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1223 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and in.
Referenced by cryHMACSHA256Update().
cryerror_t cry_lld_HMACSHA256_final | ( | CRYDriver * | cryp, |
HMACSHA256Context * | hmacsha256ctxp, | ||
uint8_t * | out ) |
Hash finalization using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha256ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1251 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and out.
Referenced by cryHMACSHA256Final().
cryerror_t cry_lld_HMACSHA512_init | ( | CRYDriver * | cryp, |
HMACSHA512Context * | hmacsha512ctxp ) |
Hash initialization using HMAC_SHA512.
[in] | cryp | pointer to the CRYDriver object |
[out] | hmacsha512ctxp | pointer to a HMAC_SHA512 context to be initialized |
CRY_NOERROR | if the operation succeeded. |
CRY_ERR_INV_ALGO | if the operation is unsupported on this device instance. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1279 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO.
Referenced by cryHMACSHA512Init().
cryerror_t cry_lld_HMACSHA512_update | ( | CRYDriver * | cryp, |
HMACSHA512Context * | hmacsha512ctxp, | ||
size_t | size, | ||
const uint8_t * | in ) |
Hash update using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha512ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1304 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and in.
Referenced by cryHMACSHA512Update().
cryerror_t cry_lld_HMACSHA512_final | ( | CRYDriver * | cryp, |
HMACSHA512Context * | hmacsha512ctxp, | ||
uint8_t * | out ) |
Hash finalization using HMAC.
[in] | cryp | pointer to the CRYDriver object |
[in] | hmacsha512ctxp | pointer to a HMAC_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. |
CRY_ERR_OP_FAILURE | if the operation failed, implementation dependent. |
Definition at line 1332 of file hal_crypto_lld.c.
References CRY_ERR_INV_ALGO, and out.
Referenced by cryHMACSHA512Final().
CRYDriver CRYD1 |
CRY1 driver identifier.
Definition at line 39 of file hal_crypto_lld.c.