aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/hal_crypto.h
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-05-06 07:10:38 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-05-06 07:10:38 +0000
commitf2dfa96fda52c870ad0604a9da9a002fca241329 (patch)
treeef35d6e5989ed4bd0c3868670f5750f7a769e8a0 /os/hal/include/hal_crypto.h
parentd2f4209b79976c2059046b5a49baffd6aeb7afee (diff)
downloadChibiOS-f2dfa96fda52c870ad0604a9da9a002fca241329.tar.gz
ChibiOS-f2dfa96fda52c870ad0604a9da9a002fca241329.tar.bz2
ChibiOS-f2dfa96fda52c870ad0604a9da9a002fca241329.zip
HMAC templates added.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12004 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/include/hal_crypto.h')
-rw-r--r--os/hal/include/hal_crypto.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/os/hal/include/hal_crypto.h b/os/hal/include/hal_crypto.h
index f9a643f9a..060480d0c 100644
--- a/os/hal/include/hal_crypto.h
+++ b/os/hal/include/hal_crypto.h
@@ -33,6 +33,8 @@
/**
* @brief Maximum size of a key for all supported algorithms.
+ * @note It could be redefined by the LLD or the crypto fallback
+ * implementations.
*/
#define HAL_CRY_MAX_KEY_SIZE 32
@@ -106,7 +108,8 @@ typedef enum {
typedef enum {
cry_algo_none = 0,
cry_algo_aes, /**< AES 128, 192, 256 bits. */
- cry_algo_des /**< DES 56, TDES 112, 168 bits.*/
+ cry_algo_des, /**< DES 56, TDES 112, 168 bits.*/
+ cry_algo_hmac /**< HMAC variable size. */
} cryalgorithm_t;
#if HAL_CRY_ENFORCE_FALLBACK == FALSE
@@ -125,6 +128,8 @@ typedef enum {
!defined(CRY_LLD_SUPPORTS_SHA1) || \
!defined(CRY_LLD_SUPPORTS_SHA256) || \
!defined(CRY_LLD_SUPPORTS_SHA512) || \
+ !defined(CRY_LLD_SUPPORTS_HMAC_SHA256) || \
+ !defined(CRY_LLD_SUPPORTS_HMAC_SHA512) || \
!defined(CRY_LLD_SUPPORTS_TRNG)
#error "CRYPTO LLD does not export the required switches"
#endif
@@ -144,6 +149,8 @@ typedef enum {
#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
#define CRY_LLD_SUPPORTS_TRNG FALSE
typedef uint_fast8_t crykey_t;
@@ -334,6 +341,24 @@ extern "C" {
size_t size, const uint8_t *in);
cryerror_t crySHA512Final(CRYDriver *cryp, SHA512Context *sha512ctxp,
uint8_t *out);
+ cryerror_t cryHMACSHA256Init(CRYDriver *cryp,
+ HMACSHA256Context *hmacsha256ctxp);
+ cryerror_t cryHMACSHA256Update(CRYDriver *cryp,
+ HMACSHA256Context *hmacsha256ctxp,
+ size_t size,
+ const uint8_t *in);
+ cryerror_t cryHMACSHA256Final(CRYDriver *cryp,
+ HMACSHA256Context *hmacsha256ctxp,
+ uint8_t *out);
+ cryerror_t cryHMACSHA512Init(CRYDriver *cryp,
+ HMACSHA512Context *hmacsha512ctxp);
+ cryerror_t cryHMACSHA512Update(CRYDriver *cryp,
+ HMACSHA512Context *hmacsha512ctxp,
+ size_t size,
+ const uint8_t *in);
+ cryerror_t cryHMACSHA512Final(CRYDriver *cryp,
+ HMACSHA512Context *hmacsha512ctxp,
+ uint8_t *out);
cryerror_t cryTRNG(CRYDriver *cryp, uint8_t *out);
#ifdef __cplusplus
}