drivers/crypto/ccp/ccp-crypto.h

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

File Facts

System
Linux kernel
Corpus path
drivers/crypto/ccp/ccp-crypto.h
Extension
.h
Size
5764 bytes
Lines
287
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 ccp_crypto_skcipher_alg {
	struct list_head entry;

	u32 mode;

	struct skcipher_alg alg;
};

struct ccp_crypto_aead {
	struct list_head entry;

	u32 mode;

	struct aead_alg alg;
};

struct ccp_crypto_ahash_alg {
	struct list_head entry;

	const __be32 *init;
	u32 type;
	u32 mode;

	/* Child algorithm used for HMAC, CMAC, etc */
	char child_alg[CRYPTO_MAX_ALG_NAME];

	struct ahash_alg alg;
};

struct ccp_crypto_akcipher_alg {
	struct list_head entry;

	struct akcipher_alg alg;
};

static inline struct ccp_crypto_skcipher_alg *
	ccp_crypto_skcipher_alg(struct crypto_skcipher *tfm)
{
	struct skcipher_alg *alg = crypto_skcipher_alg(tfm);

	return container_of(alg, struct ccp_crypto_skcipher_alg, alg);
}

static inline struct ccp_crypto_ahash_alg *
	ccp_crypto_ahash_alg(struct crypto_tfm *tfm)
{
	struct crypto_alg *alg = tfm->__crt_alg;
	struct ahash_alg *ahash_alg;

	ahash_alg = container_of(alg, struct ahash_alg, halg.base);

	return container_of(ahash_alg, struct ccp_crypto_ahash_alg, alg);
}

/***** AES related defines *****/
struct ccp_aes_ctx {
	/* Fallback cipher for XTS with unsupported unit sizes */
	struct crypto_skcipher *tfm_skcipher;

	enum ccp_engine engine;
	enum ccp_aes_type type;
	enum ccp_aes_mode mode;

	struct scatterlist key_sg;
	unsigned int key_len;
	u8 key[AES_MAX_KEY_SIZE * 2];

	u8 nonce[CTR_RFC3686_NONCE_SIZE];

	/* CMAC key structures */
	struct scatterlist k1_sg;
	struct scatterlist k2_sg;
	unsigned int kn_len;
	u8 k1[AES_BLOCK_SIZE];
	u8 k2[AES_BLOCK_SIZE];
};

struct ccp_aes_req_ctx {
	struct scatterlist iv_sg;
	u8 iv[AES_BLOCK_SIZE];

	struct scatterlist tag_sg;
	u8 tag[AES_BLOCK_SIZE];

	/* Fields used for RFC3686 requests */
	u8 *rfc3686_info;
	u8 rfc3686_iv[AES_BLOCK_SIZE];

	struct ccp_cmd cmd;

Annotation

Implementation Notes