aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/CRYPv1
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-09-08 12:54:58 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-09-08 12:54:58 +0000
commitab8cbd8f7c824a3311c1878157e8b6d7721e470d (patch)
treed82a10430b547335fda2e94799e08207d247c170 /os/hal/ports/STM32/LLD/CRYPv1
parent2dbd855684b925c7a57982d883abcc9e0ecec10c (diff)
downloadChibiOS-ab8cbd8f7c824a3311c1878157e8b6d7721e470d.tar.gz
ChibiOS-ab8cbd8f7c824a3311c1878157e8b6d7721e470d.tar.bz2
ChibiOS-ab8cbd8f7c824a3311c1878157e8b6d7721e470d.zip
Some changes to the crypto infrastructure.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12252 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/LLD/CRYPv1')
-rw-r--r--os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c59
-rw-r--r--os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h14
2 files changed, 58 insertions, 15 deletions
diff --git a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c
index c9ca9858b..5c02434e3 100644
--- a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c
+++ b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c
@@ -62,6 +62,18 @@ CRYDriver CRYD1;
*/
void cry_lld_init(void) {
+#if STM32_CRY_ENABLED1
+ cryObjectInit(&CRYD1);
+#if STM32_CRY_USE_CRYP1
+ CRYD1.cryp = CRYP;
+#endif
+#if STM32_CRY_USE_HASH1
+ CRYD1.hash = HASH;
+#endif
+#if STM32_CRY_USE_RNG1
+ CRYD1.rng = RNG;
+#endif
+#endif
}
/**
@@ -74,8 +86,30 @@ void cry_lld_init(void) {
void cry_lld_start(CRYDriver *cryp) {
if (cryp->state == CRY_STOP) {
-
+#if STM32_CRY_ENABLED1
+ if (&CRYD1 == cryp) {
+#if STM32_CRY_USE_CRYP1
+ rccEnableCRYP(true);
+#endif
+#if STM32_CRY_USE_HASH1
+ rccEnableHASH(true);
+#endif
+#if STM32_CRY_USE_RNG1
+ rccEnableRNG(true);
+#endif
+ }
+#endif
}
+
+#if STM32_CRY_USE_CRYP1
+ /* CRYP setup and enable.*/
+#endif
+#if STM32_CRY_USE_HASH1
+ /* HASH setup and enable.*/
+#endif
+#if STM32_CRY_USE_RNG1
+ /* RNG setup and enable.*/
+#endif
}
/**
@@ -89,6 +123,29 @@ void cry_lld_stop(CRYDriver *cryp) {
if (cryp->state == CRY_READY) {
+#if STM32_CRY_USE_CRYP1
+ /* CRYP disable.*/
+#endif
+#if STM32_CRY_USE_HASH1
+ /* HASH disable.*/
+#endif
+#if STM32_CRY_USE_RNG1
+ /* RNG disable.*/
+#endif
+
+#if STM32_CRY_ENABLED1
+ if (&CRYD1 == cryp) {
+#if STM32_CRY_USE_CRYP1
+ rccDisableCRYP();
+#endif
+#if STM32_CRY_USE_HASH1
+ rccDisableHASH();
+#endif
+#if STM32_CRY_USE_RNG1
+ rccDisableRNG();
+#endif
+ }
+#endif
}
}
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 b66be5e29..60c50e03c 100644
--- a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h
+++ b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h
@@ -185,20 +185,6 @@ struct CRYDriver {
* @brief Current configuration data.
*/
const CRYConfig *config;
- /**
- * @brief Algorithm type of transient key.
- */
- cryalgorithm_t key0_type;
- /**
- * @brief Size of transient key.
- */
- size_t key0_size;
-#if (HAL_CRY_USE_FALLBACK == TRUE) || defined(__DOXYGEN__)
- /**
- * @brief Key buffer for the fall-back implementation.
- */
- uint8_t key0_buffer[HAL_CRY_MAX_KEY_SIZE];
-#endif
#if defined(CRY_DRIVER_EXT_FIELDS)
CRY_DRIVER_EXT_FIELDS
#endif