drivers/crypto/stm32/stm32-cryp.c

Source file repositories/reference/linux-study-clean/drivers/crypto/stm32/stm32-cryp.c

File Facts

System
Linux kernel
Corpus path
drivers/crypto/stm32/stm32-cryp.c
Extension
.c
Size
69622 bytes
Lines
2779
Domain
Driver Families
Bucket
drivers/crypto
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct stm32_cryp_caps {
	bool			aeads_support;
	bool			linear_aes_key;
	bool			kp_mode;
	bool			iv_protection;
	bool			swap_final;
	bool			padding_wa;
	u32			cr;
	u32			sr;
	u32			din;
	u32			dout;
	u32			dmacr;
	u32			imsc;
	u32			mis;
	u32			k1l;
	u32			k1r;
	u32			k3r;
	u32			iv0l;
	u32			iv0r;
	u32			iv1l;
	u32			iv1r;
};

struct stm32_cryp_ctx {
	struct stm32_cryp       *cryp;
	int                     keylen;
	__be32                  key[AES_KEYSIZE_256 / sizeof(u32)];
	unsigned long           flags;
};

struct stm32_cryp_reqctx {
	unsigned long mode;
};

struct stm32_cryp {
	struct list_head        list;
	struct device           *dev;
	void __iomem            *regs;
	phys_addr_t             phys_base;
	struct clk              *clk;
	unsigned long           flags;
	u32                     irq_status;
	const struct stm32_cryp_caps *caps;
	struct stm32_cryp_ctx   *ctx;

	struct crypto_engine    *engine;

	struct skcipher_request *req;
	struct aead_request     *areq;

	size_t                  authsize;
	size_t                  hw_blocksize;

	size_t                  payload_in;
	size_t                  header_in;
	size_t                  payload_out;

	/* DMA process fields */
	struct scatterlist      *in_sg;
	struct scatterlist      *header_sg;
	struct scatterlist      *out_sg;
	size_t                  in_sg_len;
	size_t                  header_sg_len;
	size_t                  out_sg_len;
	struct completion	dma_completion;

	struct dma_chan         *dma_lch_in;
	struct dma_chan         *dma_lch_out;
	enum stm32_dma_mode     dma_mode;

	/* IT process fields */
	struct scatter_walk     in_walk;
	struct scatter_walk     out_walk;

	__be32                  last_ctr[4];
	u32                     gcm_ctr;
};

struct stm32_cryp_list {
	struct list_head        dev_list;
	spinlock_t              lock; /* protect dev_list */
};

static struct stm32_cryp_list cryp_list = {
	.dev_list = LIST_HEAD_INIT(cryp_list.dev_list),
	.lock     = __SPIN_LOCK_UNLOCKED(cryp_list.lock),
};

static inline bool is_aes(struct stm32_cryp *cryp)
{

Annotation

Implementation Notes