diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-22 13:07:41 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-22 13:07:41 +0000 |
commit | 9cbcbc183d7d620448a882ab66aa952a06452c22 (patch) | |
tree | 69ef5078e4762fbe63e9b7759309436147659443 /os/hal/ports | |
parent | dddff7b1f5fd6a56081b8f2af105e6eb05df904f (diff) | |
download | ChibiOS-9cbcbc183d7d620448a882ab66aa952a06452c22.tar.gz ChibiOS-9cbcbc183d7d620448a882ab66aa952a06452c22.tar.bz2 ChibiOS-9cbcbc183d7d620448a882ab66aa952a06452c22.zip |
Added capability for a fall-back crypto implementation.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10874 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports')
-rw-r--r-- | os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c | 18 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h | 25 |
2 files changed, 16 insertions, 27 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 9268e5398..f871ff4d4 100644 --- a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c +++ b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c @@ -35,7 +35,7 @@ /*===========================================================================*/
/** @brief CRY1 driver identifier.*/
-#if PLATFORM_CRY_USE_CRY1 || defined(__DOXYGEN__)
+#if STM32_CRY_USE_CRYP1 || defined(__DOXYGEN__)
CRYDriver CRYD1;
#endif
@@ -151,7 +151,7 @@ cryerror_t cry_lld_encrypt_AES_ECB(CRYDriver *cryp, (void)in;
(void)out;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
/**
@@ -187,7 +187,7 @@ cryerror_t cry_lld_decrypt_AES_ECB(CRYDriver *cryp, (void)in;
(void)out;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
/**
@@ -226,7 +226,7 @@ cryerror_t cry_lld_encrypt_AES_CBC(CRYDriver *cryp, (void)out;
(void)iv;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
/**
@@ -265,7 +265,7 @@ cryerror_t cry_lld_decrypt_AES_CBC(CRYDriver *cryp, (void)out;
(void)iv;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
/**
@@ -304,7 +304,7 @@ cryerror_t cry_lld_encrypt_AES_CFB(CRYDriver *cryp, (void)out;
(void)iv;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
/**
@@ -343,7 +343,7 @@ cryerror_t cry_lld_decrypt_AES_CFB(CRYDriver *cryp, (void)out;
(void)iv;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
/**
@@ -385,7 +385,7 @@ cryerror_t cry_lld_encrypt_AES_CTR(CRYDriver *cryp, (void)nonce;
(void)cnt;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
/**
@@ -427,7 +427,7 @@ cryerror_t cry_lld_decrypt_AES_CTR(CRYDriver *cryp, (void)nonce;
(void)cnt;
- return CRY_NOERROR;
+ return CRY_ERR_INV_ALGO;
}
#endif /* HAL_USE_CRY == TRUE */
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 2bc94b31d..4273340ad 100644 --- a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h +++ b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h @@ -37,7 +37,7 @@ */
#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_CFB FALSE
#define CRY_LLD_SUPPORTS_AES_CTR TRUE
/** @{ */
@@ -78,23 +78,6 @@ typedef uint32_t crykey_t; typedef struct CRYDriver CRYDriver;
/**
- * @brief CRY notification callback type.
- *
- * @param[in] cryp pointer to the @p CRYDriver object triggering the
- * callback
- */
-typedef void (*crycallback_t)(CRYDriver *cryp);
-
-/**
- * @brief CRY error callback type.
- *
- * @param[in] cryp pointer to the @p CRYDriver object triggering the
- * callback
- * @param[in] err CRY error code
- */
-typedef void (*cryerrorcallback_t)(CRYDriver *cryp, cryerror_t err);
-
-/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
*/
@@ -122,6 +105,12 @@ struct CRYDriver { * @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
|