Preparation work for STM32 crypto driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12250 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
parent
1804d1f008
commit
bbcb55cfc5
|
@ -1328,6 +1328,7 @@ cryerror_t cry_lld_HMACSHA512_final(CRYDriver *cryp,
|
|||
cryerror_t cry_lld_TRNG(CRYDriver *cryp, size_t size, uint8_t *out) {
|
||||
|
||||
(void)cryp;
|
||||
(void)size;
|
||||
(void)out;
|
||||
|
||||
return CRY_ERR_INV_ALGO;
|
||||
|
|
|
@ -31,27 +31,6 @@
|
|||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name 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
|
||||
#define CRY_LLD_SUPPORTS_TRNG TRUE
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
@ -74,6 +53,64 @@
|
|||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/* Handling cleanly incomplete registry files.*/
|
||||
#if !defined (STM32_HAS_CRYP)
|
||||
#define STM32_HAS_CRYP FALSE
|
||||
#endif
|
||||
|
||||
#if !defined (STM32_HAS_HASH)
|
||||
#define STM32_HAS_HASH FALSE
|
||||
#endif
|
||||
|
||||
#if !defined (STM32_HAS_RNG)
|
||||
#define STM32_HAS_RNG FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Driver capability switches
|
||||
* @{
|
||||
*/
|
||||
#if STM32_HAS_CRYP || defined (__DOXYGEN__)
|
||||
#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
|
||||
#else
|
||||
#define CRY_LLD_SUPPORTS_AES FALSE
|
||||
#define CRY_LLD_SUPPORTS_AES_ECB FALSE
|
||||
#define CRY_LLD_SUPPORTS_AES_CBC FALSE
|
||||
#define CRY_LLD_SUPPORTS_AES_CFB FALSE
|
||||
#define CRY_LLD_SUPPORTS_AES_CTR FALSE
|
||||
#define CRY_LLD_SUPPORTS_AES_GCM FALSE
|
||||
#define CRY_LLD_SUPPORTS_DES FALSE
|
||||
#define CRY_LLD_SUPPORTS_DES_ECB FALSE
|
||||
#define CRY_LLD_SUPPORTS_DES_CBC FALSE
|
||||
#endif
|
||||
#if STM32_HAS_HASH || defined (__DOXYGEN__)
|
||||
#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
|
||||
#else
|
||||
#define CRY_LLD_SUPPORTS_SHA1 FALSE
|
||||
#define CRY_LLD_SUPPORTS_SHA256 FALSE
|
||||
#define CRY_LLD_SUPPORTS_SHA512 FALSE
|
||||
#define CRY_LLD_SUPPORTS_HMAC_SHA256 FALSE
|
||||
#define CRY_LLD_SUPPORTS_HMAC_SHA512 FALSE
|
||||
#endif
|
||||
#if STM32_HAS_RNG || defined (__DOXYGEN__)
|
||||
#define CRY_LLD_SUPPORTS_TRNG TRUE
|
||||
#else
|
||||
#define CRY_LLD_SUPPORTS_TRNG FALSE
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
@ -126,6 +163,24 @@ struct CRYDriver {
|
|||
CRY_DRIVER_EXT_FIELDS
|
||||
#endif
|
||||
/* End of the mandatory fields.*/
|
||||
#if STM32_HAS_CRYP || defined (__DOXYGEN__)
|
||||
/**
|
||||
* @brief Pointer to the CRYP registers block.
|
||||
*/
|
||||
CRYP_TypeDef *cryp;
|
||||
#endif
|
||||
#if STM32_HAS_HASH || defined (__DOXYGEN__)
|
||||
/**
|
||||
* @brief Pointer to the HASH registers block.
|
||||
*/
|
||||
HASH_TypeDef *hash;
|
||||
#endif
|
||||
#if STM32_HAS_RNG || defined (__DOXYGEN__)
|
||||
/**
|
||||
* @brief Pointer to the RNG registers block.
|
||||
*/
|
||||
RNG_TypeDef *rng;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if (CRY_LLD_SUPPORTS_SHA1 == TRUE) || defined(__DOXYGEN__)
|
||||
|
|
Loading…
Reference in New Issue