git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10885 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
824682a00c
commit
94a1f758d8
|
@ -55,7 +55,7 @@
|
||||||
* @brief Enables the cryptographic subsystem.
|
* @brief Enables the cryptographic subsystem.
|
||||||
*/
|
*/
|
||||||
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
|
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
|
||||||
#define HAL_USE_CRY FALSE
|
#define HAL_USE_CRY TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
* @note Fall-back implementations may not be present for all algorithms.
|
* @note Fall-back implementations may not be present for all algorithms.
|
||||||
*/
|
*/
|
||||||
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
|
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
|
||||||
#define HAL_CRY_USE_FALLBACK FALSE
|
#define HAL_CRY_USE_FALLBACK TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,6 +71,13 @@
|
||||||
/* Driver data structures and types. */
|
/* Driver data structures and types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.
|
* @brief Driver state machine possible states.
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +95,8 @@ typedef enum {
|
||||||
CRY_ERR_INV_ALGO = 1, /**< Invalid cypher/mode. */
|
CRY_ERR_INV_ALGO = 1, /**< Invalid cypher/mode. */
|
||||||
CRY_ERR_INV_KEY_SIZE = 2, /**< Invalid key size. */
|
CRY_ERR_INV_KEY_SIZE = 2, /**< Invalid key size. */
|
||||||
CRY_ERR_INV_KEY_TYPE = 3, /**< Invalid key type. */
|
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;
|
} cryerror_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,6 +218,24 @@ extern "C" {
|
||||||
uint8_t *out,
|
uint8_t *out,
|
||||||
const uint8_t *nonce,
|
const uint8_t *nonce,
|
||||||
uint8_t *cnt);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
#if (HAL_USE_CRY == TRUE) || defined(__DOXYGEN__)
|
#if (HAL_USE_CRY == TRUE) || defined(__DOXYGEN__)
|
||||||
|
|
Loading…
Reference in New Issue