drivers/crypto/caam/caampkc.h

Source file repositories/reference/linux-study-clean/drivers/crypto/caam/caampkc.h

File Facts

System
Linux kernel
Corpus path
drivers/crypto/caam/caampkc.h
Extension
.h
Size
5109 bytes
Lines
156
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 caam_rsa_key {
	u8 *n;
	u8 *e;
	u8 *d;
	u8 *p;
	u8 *q;
	u8 *dp;
	u8 *dq;
	u8 *qinv;
	u8 *tmp1;
	u8 *tmp2;
	size_t n_sz;
	size_t e_sz;
	size_t d_sz;
	size_t p_sz;
	size_t q_sz;
	enum caam_priv_key_form priv_form;
};

/**
 * caam_rsa_ctx - per session context.
 * @key         : RSA key in DMA zone
 * @dev         : device structure
 * @padding_dma : dma address of padding, for adding it to the input
 */
struct caam_rsa_ctx {
	struct caam_rsa_key key;
	struct device *dev;
	dma_addr_t padding_dma;

};

/**
 * caam_rsa_req_ctx - per request context.
 * @src           : input scatterlist (stripped of leading zeros)
 * @fixup_src     : input scatterlist (that might be stripped of leading zeros)
 * @fixup_src_len : length of the fixup_src input scatterlist
 * @edesc         : s/w-extended rsa descriptor
 * @akcipher_op_done : callback used when operation is done
 */
struct caam_rsa_req_ctx {
	struct scatterlist src[2];
	struct scatterlist *fixup_src;
	unsigned int fixup_src_len;
	struct rsa_edesc *edesc;
	void (*akcipher_op_done)(struct device *jrdev, u32 *desc, u32 err,
				 void *context);
};

/**
 * rsa_edesc - s/w-extended rsa descriptor
 * @src_nents     : number of segments in input s/w scatterlist
 * @dst_nents     : number of segments in output s/w scatterlist
 * @mapped_src_nents: number of segments in input h/w link table
 * @mapped_dst_nents: number of segments in output h/w link table
 * @sec4_sg_bytes : length of h/w link table
 * @bklog         : stored to determine if the request needs backlog
 * @sec4_sg_dma   : dma address of h/w link table
 * @sec4_sg       : pointer to h/w link table
 * @pdb           : specific RSA Protocol Data Block (PDB)
 * @hw_desc       : descriptor followed by link tables if any
 */
struct rsa_edesc {
	int src_nents;
	int dst_nents;
	int mapped_src_nents;
	int mapped_dst_nents;
	int sec4_sg_bytes;
	bool bklog;
	dma_addr_t sec4_sg_dma;
	struct sec4_sg_entry *sec4_sg;
	union {
		struct rsa_pub_pdb pub;
		struct rsa_priv_f1_pdb priv_f1;
		struct rsa_priv_f2_pdb priv_f2;
		struct rsa_priv_f3_pdb priv_f3;
	} pdb;
	u32 hw_desc[];
};

/* Descriptor construction primitives. */
void init_rsa_pub_desc(u32 *desc, struct rsa_pub_pdb *pdb);
void init_rsa_priv_f1_desc(u32 *desc, struct rsa_priv_f1_pdb *pdb);
void init_rsa_priv_f2_desc(u32 *desc, struct rsa_priv_f2_pdb *pdb);
void init_rsa_priv_f3_desc(u32 *desc, struct rsa_priv_f3_pdb *pdb);

#endif

Annotation

Implementation Notes