aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-10-23 10:06:15 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-10-23 10:06:15 +0000
commit94a1f758d8fd03c828108b585af4c360b2899bb9 (patch)
treeb64947827498c1688b7fe8724366c3e4a93cd8ce /os/hal
parent824682a00cc38ab733df49516046b26e363ab5fd (diff)
downloadChibiOS-94a1f758d8fd03c828108b585af4c360b2899bb9.tar.gz
ChibiOS-94a1f758d8fd03c828108b585af4c360b2899bb9.tar.bz2
ChibiOS-94a1f758d8fd03c828108b585af4c360b2899bb9.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10885 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/include/hal_crypto.h28
-rw-r--r--os/hal/src/hal_crypto.c2
2 files changed, 27 insertions, 3 deletions
diff --git a/os/hal/include/hal_crypto.h b/os/hal/include/hal_crypto.h
index cc2ca5fdf..433953e45 100644
--- a/os/hal/include/hal_crypto.h
+++ b/os/hal/include/hal_crypto.h
@@ -72,6 +72,13 @@
/*===========================================================================*/
/**
+ * @brief Size, in bits, of a crypto field or message.
+ * @note It is assumed, for simplicity, that this type is equivalent to
+ * a @p size_t.
+ */
+typedef size_t bitsize_t;
+
+/**
* @brief Driver state machine possible states.
*/
typedef enum {
@@ -88,7 +95,8 @@ typedef enum {
CRY_ERR_INV_ALGO = 1, /**< Invalid cypher/mode. */
CRY_ERR_INV_KEY_SIZE = 2, /**< Invalid key size. */
CRY_ERR_INV_KEY_TYPE = 3, /**< Invalid key type. */
- CRY_ERR_INV_KEY_ID = 4 /**< Invalid key type. */
+ CRY_ERR_INV_KEY_ID = 4, /**< Invalid key type. */
+ CRY_ERR_AUTH_FAILED = 5 /**< Authentication failed. */
} cryerror_t;
/**
@@ -210,6 +218,24 @@ extern "C" {
uint8_t *out,
const uint8_t *nonce,
uint8_t *cnt);
+ cryerror_t cryEncryptAES_GCM(CRYDriver *cryp,
+ crykey_t key_id,
+ bitsize_t size,
+ const uint8_t *in,
+ uint8_t *out,
+ bitsize_t ivsize,
+ const uint8_t *iv,
+ bitsize_t authsize,
+ uint8_t *authout);
+ cryerror_t cryDecryptAES_GCM(CRYDriver *cryp,
+ crykey_t key_id,
+ bitsize_t size,
+ const uint8_t *in,
+ uint8_t *out,
+ bitsize_t ivsize,
+ const uint8_t *iv,
+ bitsize_t authsize,
+ const uint8_t *authin);
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/src/hal_crypto.c b/os/hal/src/hal_crypto.c
index de516dc72..710495343 100644
--- a/os/hal/src/hal_crypto.c
+++ b/os/hal/src/hal_crypto.c
@@ -22,8 +22,6 @@
* @{
*/
-#include <string.h>
-
#include "hal.h"
#if (HAL_USE_CRY == TRUE) || defined(__DOXYGEN__)