aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h')
-rw-r--r--os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h70
1 files changed, 55 insertions, 15 deletions
diff --git a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h
index 607ac8cb3..b66be5e29 100644
--- a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h
+++ b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h
@@ -40,37 +40,77 @@
* @{
*/
/**
- * @brief CRY1 driver enable switch.
+ * @brief CRYP1 driver enable switch.
* @details If set to @p TRUE the support for CRYP1 is included.
* @note The default is @p FALSE.
*/
#if !defined(STM32_CRY_USE_CRYP1) || defined(__DOXYGEN__)
#define STM32_CRY_USE_CRYP1 FALSE
#endif
+
+/**
+ * @brief HASH1 driver enable switch.
+ * @details If set to @p TRUE the support for CRYP1 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(STM32_CRY_USE_HASH1) || defined(__DOXYGEN__)
+#define STM32_CRY_USE_HASH1 FALSE
+#endif
+
+/**
+ * @brief RNG1 driver enable switch.
+ * @details If set to @p TRUE the support for CRYP1 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(STM32_CRY_USE_RNG1) || defined(__DOXYGEN__)
+#define STM32_CRY_USE_RNG1 FALSE
+#endif
/** @} */
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
-/* Handling cleanly incomplete registry files.*/
-#if !defined (STM32_HAS_CRYP)
-#define STM32_HAS_CRYP FALSE
+#if (STM32_CRY_USE_CRYP1 == TRUE) || (STM32_CRY_USE_HASH1 == TRUE) || \
+ (STM32_CRY_USE_RNG1 == TRUE) || defined (__DOXYGEN__)
+#define STM32_CRY_ENABLED1 TRUE
+#else
+#define STM32_CRY_ENABLED1 FALSE
+#endif
+
+#if !defined (STM32_HAS_CRYP1)
+#define STM32_HAS_CRYP1 FALSE
+#endif
+
+#if !defined (STM32_HAS_HASH1)
+#define STM32_HAS_HASH1 FALSE
+#endif
+
+#if !defined (STM32_HAS_RNG1)
+#define STM32_HAS_RNG1 FALSE
+#endif
+
+#if STM32_CRY_USE_CRYP1 && !STM32_HAS_CRYP1
+#error "CRYP1 not present in the selected device"
+#endif
+
+#if STM32_CRY_USE_HASH1 && !STM32_HAS_HASH1
+#error "HASH1 not present in the selected device"
#endif
-#if !defined (STM32_HAS_HASH)
-#define STM32_HAS_HASH FALSE
+#if STM32_CRY_USE_RNG1 && !STM32_HAS_RNG1
+#error "RNG1 not present in the selected device"
#endif
-#if !defined (STM32_HAS_RNG)
-#define STM32_HAS_RNG FALSE
+#if !STM32_CRY_ENABLED1
+#error "CRY driver activated but no CRYP or HASH or RNG peripheral assigned"
#endif
/**
* @name Driver capability switches
* @{
*/
-#if STM32_HAS_CRYP || defined (__DOXYGEN__)
+#if STM32_CRY_USE_CRYP1 || defined (__DOXYGEN__)
#define CRY_LLD_SUPPORTS_AES TRUE
#define CRY_LLD_SUPPORTS_AES_ECB TRUE
#define CRY_LLD_SUPPORTS_AES_CBC TRUE
@@ -91,7 +131,7 @@
#define CRY_LLD_SUPPORTS_DES_ECB FALSE
#define CRY_LLD_SUPPORTS_DES_CBC FALSE
#endif
-#if STM32_HAS_HASH || defined (__DOXYGEN__)
+#if STM32_CRY_USE_HASH1 || defined (__DOXYGEN__)
#define CRY_LLD_SUPPORTS_SHA1 TRUE
#define CRY_LLD_SUPPORTS_SHA256 TRUE
#define CRY_LLD_SUPPORTS_SHA512 TRUE
@@ -104,7 +144,7 @@
#define CRY_LLD_SUPPORTS_HMAC_SHA256 FALSE
#define CRY_LLD_SUPPORTS_HMAC_SHA512 FALSE
#endif
-#if STM32_HAS_RNG || defined (__DOXYGEN__)
+#if STM32_CRY_USE_RNG1 || defined (__DOXYGEN__)
#define CRY_LLD_SUPPORTS_TRNG TRUE
#else
#define CRY_LLD_SUPPORTS_TRNG FALSE
@@ -163,19 +203,19 @@ struct CRYDriver {
CRY_DRIVER_EXT_FIELDS
#endif
/* End of the mandatory fields.*/
-#if STM32_HAS_CRYP || defined (__DOXYGEN__)
+#if STM32_CRY_USE_CRYP1 || defined (__DOXYGEN__)
/**
* @brief Pointer to the CRYP registers block.
*/
CRYP_TypeDef *cryp;
#endif
-#if STM32_HAS_HASH || defined (__DOXYGEN__)
+#if STM32_CRY_USE_HASH1 || defined (__DOXYGEN__)
/**
* @brief Pointer to the HASH registers block.
*/
HASH_TypeDef *hash;
#endif
-#if STM32_HAS_RNG || defined (__DOXYGEN__)
+#if STM32_CRY_USE_RNG1 || defined (__DOXYGEN__)
/**
* @brief Pointer to the RNG registers block.
*/
@@ -236,7 +276,7 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
-#if (STM32_CRY_USE_CRYP1 == TRUE) && !defined(__DOXYGEN__)
+#if (STM32_CRY_ENABLED1 == TRUE) && !defined(__DOXYGEN__)
extern CRYDriver CRYD1;
#endif