Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
crypto.h File Reference

Crypto Cipher APIs. More...

#include <zephyr/device.h>
#include <errno.h>
#include <zephyr/sys/util.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/crypto/hash.h>
#include "cipher.h"

Go to the source code of this file.

Data Structures

struct  crypto_driver_api
 Crypto driver API definition. More...
 

Macros

#define CAP_OPAQUE_KEY_HNDL   BIT(0)
 
#define CAP_RAW_KEY   BIT(1)
 
#define CAP_KEY_LOADING_API   BIT(2)
 
#define CAP_INPLACE_OPS   BIT(3)
 Whether the output is placed in separate buffer or not.
 
#define CAP_SEPARATE_IO_BUFS   BIT(4)
 
#define CAP_SYNC_OPS   BIT(5)
 These denotes if the output (completion of a cipher_xxx_op) is conveyed by the op function returning, or it is conveyed by an async notification.
 
#define CAP_ASYNC_OPS   BIT(6)
 
#define CAP_AUTONONCE   BIT(7)
 Whether the hardware/driver supports autononce feature.
 
#define CAP_NO_IV_PREFIX   BIT(8)
 Don't prefix IV to cipher blocks.
 

Functions

static int crypto_query_hwcaps (const struct device *dev)
 Query the crypto hardware capabilities.
 
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.
 
static int cipher_free_session (const struct device *dev, struct cipher_ctx *ctx)
 Cleanup a crypto session.
 
static int cipher_callback_set (const struct device *dev, cipher_completion_cb cb)
 Registers an async crypto op completion callback with the driver.
 
static int cipher_block_op (struct cipher_ctx *ctx, struct cipher_pkt *pkt)
 Perform single-block crypto operation (ECB cipher mode).
 
static int cipher_cbc_op (struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv)
 Perform Cipher Block Chaining (CBC) crypto operation.
 
static int cipher_ctr_op (struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv)
 Perform Counter (CTR) mode crypto operation.
 
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.
 
static int cipher_gcm_op (struct cipher_ctx *ctx, struct cipher_aead_pkt *pkt, uint8_t *nonce)
 Perform Galois/Counter Mode (GCM) crypto operation.
 
static int hash_begin_session (const struct device *dev, struct hash_ctx *ctx, enum hash_algo algo)
 Setup a hash session.
 
static int hash_free_session (const struct device *dev, struct hash_ctx *ctx)
 Cleanup a hash session.
 
static int hash_callback_set (const struct device *dev, hash_completion_cb cb)
 Registers an async hash completion callback with the driver.
 
static int hash_compute (struct hash_ctx *ctx, struct hash_pkt *pkt)
 Perform a cryptographic hash function.
 
static int hash_update (struct hash_ctx *ctx, struct hash_pkt *pkt)
 Perform a cryptographic multipart hash operation.
 

Detailed Description

Crypto Cipher APIs.

This file contains the Crypto Abstraction layer APIs.

[Experimental] Users should note that the APIs can change as a part of ongoing development.