18#ifndef ZEPHYR_INCLUDE_CRYPTO_CIPHER_H_
19#define ZEPHYR_INCLUDE_CRYPTO_CIPHER_H_
void(* cipher_completion_cb)(struct cipher_pkt *completed, int status)
Handle completion of an asynchronous cipher request.
Definition cipher.h:379
cipher_op
Cipher operation types.
Definition cipher.h:34
int(* ccm_op_t)(struct cipher_ctx *ctx, struct cipher_aead_pkt *pkt, uint8_t *nonce)
Perform a CCM authenticated cipher operation.
Definition cipher.h:110
int(* block_op_t)(struct cipher_ctx *ctx, struct cipher_pkt *pkt)
Perform an ECB block cipher operation.
Definition cipher.h:68
int(* ofb_op_t)(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv)
Perform an OFB cipher operation.
Definition cipher.h:151
cipher_algo
Cipher algorithms.
Definition cipher.h:29
int(* cbc_op_t)(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv)
Perform a CBC cipher operation.
Definition cipher.h:81
int(* cfb_op_t)(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv)
Perform a CFB cipher operation.
Definition cipher.h:138
int(* ctr_op_t)(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *ctr)
Perform a CTR cipher operation.
Definition cipher.h:95
int(* gcm_op_t)(struct cipher_ctx *ctx, struct cipher_aead_pkt *pkt, uint8_t *nonce)
Perform a GCM authenticated cipher operation.
Definition cipher.h:125
cipher_mode
Possible cipher mode options.
Definition cipher.h:44
@ CRYPTO_CIPHER_OP_DECRYPT
Decrypt input data.
Definition cipher.h:35
@ CRYPTO_CIPHER_OP_ENCRYPT
Encrypt input data.
Definition cipher.h:36
@ CRYPTO_CIPHER_ALGO_AES
Advanced Encryption Standard.
Definition cipher.h:30
@ CRYPTO_CIPHER_MODE_GCM
Galois/Counter mode.
Definition cipher.h:49
@ CRYPTO_CIPHER_MODE_ECB
Electronic Codebook mode.
Definition cipher.h:45
@ CRYPTO_CIPHER_MODE_CCM
Counter with CBC-MAC mode.
Definition cipher.h:48
@ CRYPTO_CIPHER_MODE_CTR
Counter mode.
Definition cipher.h:47
@ CRYPTO_CIPHER_MODE_CBC
Cipher Block Chaining mode.
Definition cipher.h:46
@ CRYPTO_CIPHER_MODE_OFB
Output Feedback mode.
Definition cipher.h:51
@ CRYPTO_CIPHER_MODE_CFB
Cipher Feedback mode.
Definition cipher.h:50
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
CCM mode session parameters.
Definition cipher.h:185
uint16_t tag_len
Authentication tag length, in bytes.
Definition cipher.h:187
uint16_t nonce_len
Nonce length, in bytes.
Definition cipher.h:189
Structure encoding IO parameters in AEAD (Authenticated Encryption with Associated Data) scenario lik...
Definition cipher.h:341
uint8_t * ad
Start address of associated data.
Definition cipher.h:352
uint32_t ad_len
Size of associated data, in bytes.
Definition cipher.h:355
uint8_t * tag
Start address of the authentication tag buffer.
Definition cipher.h:364
struct cipher_pkt * pkt
Packet containing input and output buffers.
Definition cipher.h:346
Structure encoding session parameters.
Definition cipher.h:217
void * app_sessn_state
Place for the user app to put info relevant stuff for resuming when completion callback happens for a...
Definition cipher.h:260
uint16_t keylen
Cryptographic keylength in bytes.
Definition cipher.h:278
struct ccm_params ccm_info
CCM parameters for CCM sessions.
Definition cipher.h:268
union cipher_ctx::@252266264254052346115200201223263334036213076237 key
Key material for the session.
const struct device * device
The device driver instance this crypto context relates to.
Definition cipher.h:245
uint16_t flags
How certain fields are to be interpreted for this session.
Definition cipher.h:286
void * drv_sessn_state
If the driver supports multiple simultaneously crypto sessions, this will identify the specific drive...
Definition cipher.h:254
void * handle
Driver-specific key handle for protected keys that are not directly available to the application.
Definition cipher.h:239
struct ctr_params ctr_info
CTR parameters for CTR sessions.
Definition cipher.h:270
struct gcm_params gcm_info
GCM parameters for GCM sessions.
Definition cipher.h:272
union cipher_ctx::@154152356303000122313150276277376275054131233366 mode_params
Cipher mode parameters, which remain constant for all ops in a session.
const uint8_t * bit_stream
Raw cryptographic key bytes.
Definition cipher.h:234
struct cipher_ops ops
Place for driver to return function pointers to be invoked per cipher operation.
Definition cipher.h:223
Cipher operation handlers selected for a session.
Definition cipher.h:160
block_op_t block_crypt_hndlr
Handler for ECB block operations.
Definition cipher.h:168
gcm_op_t gcm_crypt_hndlr
Handler for GCM authenticated operations.
Definition cipher.h:176
enum cipher_mode cipher_mode
Cipher mode associated with the active handler.
Definition cipher.h:163
cfb_op_t cfb_crypt_hndlr
Handler for CFB operations.
Definition cipher.h:178
cbc_op_t cbc_crypt_hndlr
Handler for CBC operations.
Definition cipher.h:170
ctr_op_t ctr_crypt_hndlr
Handler for CTR operations.
Definition cipher.h:172
ofb_op_t ofb_crypt_hndlr
Handler for OFB operations.
Definition cipher.h:180
ccm_op_t ccm_crypt_hndlr
Handler for CCM authenticated operations.
Definition cipher.h:174
Structure encoding IO parameters of one cryptographic operation like encrypt/decrypt.
Definition cipher.h:297
struct cipher_ctx * ctx
Context this packet relates to.
Definition cipher.h:332
uint8_t * in_buf
Start address of the input buffer.
Definition cipher.h:303
int out_buf_max
Size of the output buffer, in bytes.
Definition cipher.h:321
uint8_t * out_buf
Start address of the output buffer.
Definition cipher.h:315
int out_len
To be populated by driver on return from cipher_xxx_op() and holds the size of the actual result.
Definition cipher.h:326
int in_len
Number of input bytes to process.
Definition cipher.h:306
CTR mode session parameters.
Definition cipher.h:193
uint32_t ctr_len
Counter length, in bytes.
Definition cipher.h:200
GCM mode session parameters.
Definition cipher.h:204
uint16_t tag_len
Authentication tag length, in bytes.
Definition cipher.h:206
uint16_t nonce_len
Nonce length, in bytes.
Definition cipher.h:208