drivers/crypto/omap-sham.c

Source file repositories/reference/linux-study-clean/drivers/crypto/omap-sham.c

File Facts

System
Linux kernel
Corpus path
drivers/crypto/omap-sham.c
Extension
.c
Size
54833 bytes
Lines
2227
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 omap_sham_reqctx {
	struct omap_sham_dev	*dd;
	unsigned long		flags;
	u8			op;

	u8			digest[SHA512_DIGEST_SIZE] OMAP_ALIGNED;
	size_t			digcnt;
	size_t			bufcnt;

	/* walk state */
	struct scatterlist	*sg;
	struct scatterlist	sgl[2];
	int			offset;	/* offset in current sg */
	int			sg_len;
	unsigned int		total;	/* total request */

	u8			buffer[BUFLEN] OMAP_ALIGNED;
};

struct omap_sham_hmac_ctx {
	struct crypto_shash	*shash;
	u8			ipad[SHA512_BLOCK_SIZE] OMAP_ALIGNED;
	u8			opad[SHA512_BLOCK_SIZE] OMAP_ALIGNED;
};

struct omap_sham_ctx {
	unsigned long		flags;

	/* fallback stuff */
	struct crypto_shash	*fallback;

	struct omap_sham_hmac_ctx base[];
};

#define OMAP_SHAM_QUEUE_LENGTH	10

struct omap_sham_algs_info {
	struct ahash_engine_alg	*algs_list;
	unsigned int		size;
	unsigned int		registered;
};

struct omap_sham_pdata {
	struct omap_sham_algs_info	*algs_info;
	unsigned int	algs_info_size;
	unsigned long	flags;
	int		digest_size;

	void		(*copy_hash)(struct ahash_request *req, int out);
	void		(*write_ctrl)(struct omap_sham_dev *dd, size_t length,
				      int final, int dma);
	void		(*trigger)(struct omap_sham_dev *dd, size_t length);
	int		(*poll_irq)(struct omap_sham_dev *dd);
	irqreturn_t	(*intr_hdlr)(int irq, void *dev_id);

	u32		odigest_ofs;
	u32		idigest_ofs;
	u32		din_ofs;
	u32		digcnt_ofs;
	u32		rev_ofs;
	u32		mask_ofs;
	u32		sysstatus_ofs;
	u32		mode_ofs;
	u32		length_ofs;

	u32		major_mask;
	u32		major_shift;
	u32		minor_mask;
	u32		minor_shift;
};

struct omap_sham_dev {
	struct list_head	list;
	unsigned long		phys_base;
	struct device		*dev;
	void __iomem		*io_base;
	int			irq;
	int			err;
	struct dma_chan		*dma_lch;
	struct work_struct	done_task;
	u8			polling_mode;
	u8			xmit_buf[BUFLEN] OMAP_ALIGNED;

	unsigned long		flags;
	int			fallback_sz;
	struct crypto_queue	queue;
	struct ahash_request	*req;
	struct crypto_engine	*engine;

	const struct omap_sham_pdata	*pdata;

Annotation

Implementation Notes