32#ifndef ZEPHYR_INCLUDE_CRYPTO_CIPHER_H_
33#define ZEPHYR_INCLUDE_CRYPTO_CIPHER_H_
86 "Driver should support at least one key type: RAW/Opaque");
89 "Driver should support at least one IO buf type: Inplace/separate");
92 "Driver should support at least one op-type: sync/async");
130 __ASSERT(
flags != 0U,
"Keytype missing: RAW Key or OPAQUE handle");
132 "conflicting options for keytype");
135 __ASSERT(
flags != 0U,
"IO buffer type missing");
137 "conflicting options for IO buffer type");
140 __ASSERT(
flags != 0U,
"sync/async type missing");
142 "conflicting options for sync/async");
210 "session invoking a different mode handler");
231 "session invoking a different mode handler");
258 "session invoking a different mode handler");
280 "session invoking a different mode handler");
302 "session invoking a different mode handler");
Crypto Cipher structure definitions.
static int cipher_block_op(struct cipher_ctx *ctx, struct cipher_pkt *pkt)
Perform single-block crypto operation (ECB cipher mode). This should not be overloaded to operate on ...
Definition: cipher.h:206
static int cipher_begin_session(const struct device *dev, struct cipher_ctx *ctx, enum cipher_algo algo, enum cipher_mode mode, enum cipher_op optype)
Setup a crypto session.
Definition: cipher.h:116
cipher_op
Definition: cipher_structs.h:34
static int cipher_callback_set(const struct device *dev, crypto_completion_cb cb)
Registers an async crypto op completion callback with the driver.
Definition: cipher.h:182
static int cipher_cbc_op(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv)
Perform Cipher Block Chaining (CBC) crypto operation.
Definition: cipher.h:227
static int cipher_gcm_op(struct cipher_ctx *ctx, struct cipher_aead_pkt *pkt, uint8_t *nonce)
Perform Galois/Counter Mode (GCM) crypto operation.
Definition: cipher.h:298
#define CAP_SYNC_OPS
Definition: cipher_structs.h:191
static int cipher_ccm_op(struct cipher_ctx *ctx, struct cipher_aead_pkt *pkt, uint8_t *nonce)
Perform Counter with CBC-MAC (CCM) mode crypto operation.
Definition: cipher.h:276
#define CAP_INPLACE_OPS
Definition: cipher_structs.h:184
void(* crypto_completion_cb)(struct cipher_pkt *completed, int status)
Definition: cipher_structs.h:273
#define CAP_ASYNC_OPS
Definition: cipher_structs.h:192
static int cipher_query_hwcaps(const struct device *dev)
Query the crypto hardware capabilities.
Definition: cipher.h:76
#define CAP_OPAQUE_KEY_HNDL
Definition: cipher_structs.h:177
#define CAP_SEPARATE_IO_BUFS
Definition: cipher_structs.h:185
#define CAP_RAW_KEY
Definition: cipher_structs.h:178
cipher_algo
Definition: cipher_structs.h:29
static int cipher_free_session(const struct device *dev, struct cipher_ctx *ctx)
Cleanup a crypto session.
Definition: cipher.h:158
cipher_mode
Definition: cipher_structs.h:44
static int cipher_ctr_op(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv)
Perform Counter (CTR) mode crypto operation.
Definition: cipher.h:254
@ CRYPTO_CIPHER_MODE_GCM
Definition: cipher_structs.h:49
@ CRYPTO_CIPHER_MODE_ECB
Definition: cipher_structs.h:45
@ CRYPTO_CIPHER_MODE_CCM
Definition: cipher_structs.h:48
@ CRYPTO_CIPHER_MODE_CTR
Definition: cipher_structs.h:47
@ CRYPTO_CIPHER_MODE_CBC
Definition: cipher_structs.h:46
#define ENOTSUP
Definition: errno.h:115
flags
Definition: http_parser.h:131
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Definition: cipher_structs.h:248
struct cipher_pkt * pkt
Definition: cipher_structs.h:250
Definition: cipher_structs.h:110
const struct device * device
Definition: cipher_structs.h:131
uint16_t flags
Definition: cipher_structs.h:169
struct cipher_ops ops
Definition: cipher_structs.h:116
block_op_t block_crypt_hndlr
Definition: cipher_structs.h:79
gcm_op_t gcm_crypt_hndlr
Definition: cipher_structs.h:83
enum cipher_mode cipher_mode
Definition: cipher_structs.h:76
cbc_op_t cbc_crypt_hndlr
Definition: cipher_structs.h:80
ctr_op_t ctr_crypt_hndlr
Definition: cipher_structs.h:81
ccm_op_t ccm_crypt_hndlr
Definition: cipher_structs.h:82
Definition: cipher_structs.h:211
struct cipher_ctx * ctx
Definition: cipher_structs.h:239
int(* free_session)(const struct device *dev, struct cipher_ctx *ctx)
Definition: cipher.h:51
int(* query_hw_caps)(const struct device *dev)
Definition: cipher.h:43
int(* begin_session)(const struct device *dev, struct cipher_ctx *ctx, enum cipher_algo algo, enum cipher_mode mode, enum cipher_op op_type)
Definition: cipher.h:46
int(* crypto_async_callback_set)(const struct device *dev, crypto_completion_cb cb)
Definition: cipher.h:54
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373