25 #ifndef HAL_CRYPTO_LLD_H 26 #define HAL_CRYPTO_LLD_H 28 #if (HAL_USE_CRY == TRUE) || defined(__DOXYGEN__) 38 #define CRY_LLD_SUPPORTS_AES TRUE 39 #define CRY_LLD_SUPPORTS_AES_ECB TRUE 40 #define CRY_LLD_SUPPORTS_AES_CBC TRUE 41 #define CRY_LLD_SUPPORTS_AES_CFB TRUE 42 #define CRY_LLD_SUPPORTS_AES_CTR TRUE 43 #define CRY_LLD_SUPPORTS_AES_GCM TRUE 44 #define CRY_LLD_SUPPORTS_DES TRUE 45 #define CRY_LLD_SUPPORTS_DES_ECB TRUE 46 #define CRY_LLD_SUPPORTS_DES_CBC TRUE 47 #define CRY_LLD_SUPPORTS_SHA1 TRUE 48 #define CRY_LLD_SUPPORTS_SHA256 TRUE 49 #define CRY_LLD_SUPPORTS_SHA512 TRUE 50 #define CRY_LLD_SUPPORTS_TRNG TRUE 66 #if !defined(PLATFORM_CRY_USE_CRY1) || defined(__DOXYGEN__) 67 #define PLATFORM_CRY_USE_CRY1 FALSE 117 #if (HAL_CRY_USE_FALLBACK == TRUE) || defined(__DOXYGEN__) 123 #if defined(CRY_DRIVER_EXT_FIELDS) 124 CRY_DRIVER_EXT_FIELDS
129 #if (CRY_LLD_SUPPORTS_SHA1 == TRUE) || defined(__DOXYGEN__) 138 #if (CRY_LLD_SUPPORTS_SHA256 == TRUE) || defined(__DOXYGEN__) 147 #if (CRY_LLD_SUPPORTS_SHA512 == TRUE) || defined(__DOXYGEN__) 164 #if (PLATFORM_CRY_USE_CRY1 == TRUE) && !defined(__DOXYGEN__) 177 const uint8_t *keyp);
282 size_t size,
const uint8_t *in);
287 size_t size,
const uint8_t *in);
292 size_t size,
const uint8_t *in);
cryerror_t cry_lld_SHA1_init(CRYDriver *cryp, SHA1Context *sha1ctxp)
Hash initialization using SHA1.
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.
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_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_SHA1_final(CRYDriver *cryp, SHA1Context *sha1ctxp, uint8_t *out)
Hash finalization using SHA1.
cryerror_t cry_lld_SHA1_update(CRYDriver *cryp, SHA1Context *sha1ctxp, size_t size, const uint8_t *in)
Hash update using SHA1.
Type of a SHA512 context.
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_TRNG(CRYDriver *cryp, uint8_t *out)
True random numbers generator.
Structure representing an CRY driver.
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.
#define HAL_CRY_MAX_KEY_SIZE
Maximum size of a key for all supported algorithms.
void cry_lld_stop(CRYDriver *cryp)
Deactivates the crypto peripheral.
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
Driver error codes.
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.
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.
Driver configuration structure.
cryalgorithm_t key0_type
Algorithm type of transient key.
void cry_lld_start(CRYDriver *cryp)
Configures and activates the crypto peripheral.
uint32_t crykey_t
CRY key identifier type.
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_SHA512_init(CRYDriver *cryp, SHA512Context *sha512ctxp)
Hash initialization using SHA512.
void cry_lld_init(void)
Low level crypto driver initialization.
cryerror_t cry_lld_SHA512_final(CRYDriver *cryp, SHA512Context *sha512ctxp, uint8_t *out)
Hash finalization using SHA512.
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.
cryalgorithm_t
Type of an algorithm identifier.
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.
CRYDriver CRYD1
CRY1 driver identifier.
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_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(CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
Decryption of a single block using (T)DES.
size_t key0_size
Size of 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.
crystate_t
Driver state machine possible states.
cryerror_t cry_lld_SHA512_update(CRYDriver *cryp, SHA512Context *sha512ctxp, size_t size, const uint8_t *in)
Hash update using SHA512.
USBInEndpointState in
IN EP0 state.
cryerror_t cry_lld_SHA256_init(CRYDriver *cryp, SHA256Context *sha256ctxp)
Hash initialization using SHA256.
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.
crystate_t state
Driver state.
USBOutEndpointState out
OUT EP0 state.
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_loadkey(CRYDriver *cryp, cryalgorithm_t algorithm, size_t size, const uint8_t *keyp)
Initializes the transient key for a specific algorithm.
cryerror_t cry_lld_SHA256_update(CRYDriver *cryp, SHA256Context *sha256ctxp, size_t size, const uint8_t *in)
Hash update using SHA256.
Type of a SHA256 context.
cryerror_t cry_lld_SHA256_final(CRYDriver *cryp, SHA256Context *sha256ctxp, uint8_t *out)
Hash finalization using SHA256.
const CRYConfig * config
Current configuration data.
uint8_t key0_buffer[HAL_CRY_MAX_KEY_SIZE]
Key buffer for the fall-back implementation.
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.