drivers/crypto/qce/aead.c

Source file repositories/reference/linux-study-clean/drivers/crypto/qce/aead.c

File Facts

System
Linux kernel
Corpus path
drivers/crypto/qce/aead.c
Extension
.c
Size
23709 bytes
Lines
842
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 qce_aead_def {
	unsigned long flags;
	const char *name;
	const char *drv_name;
	unsigned int blocksize;
	unsigned int chunksize;
	unsigned int ivsize;
	unsigned int maxauthsize;
};

static const struct qce_aead_def aead_def[] = {
	{
		.flags          = QCE_ALG_DES | QCE_MODE_CBC | QCE_HASH_SHA1_HMAC,
		.name           = "authenc(hmac(sha1),cbc(des))",
		.drv_name       = "authenc-hmac-sha1-cbc-des-qce",
		.blocksize      = DES_BLOCK_SIZE,
		.ivsize         = DES_BLOCK_SIZE,
		.maxauthsize	= SHA1_DIGEST_SIZE,
	},
	{
		.flags          = QCE_ALG_3DES | QCE_MODE_CBC | QCE_HASH_SHA1_HMAC,
		.name           = "authenc(hmac(sha1),cbc(des3_ede))",
		.drv_name       = "authenc-hmac-sha1-cbc-3des-qce",
		.blocksize      = DES3_EDE_BLOCK_SIZE,
		.ivsize         = DES3_EDE_BLOCK_SIZE,
		.maxauthsize	= SHA1_DIGEST_SIZE,
	},
	{
		.flags          = QCE_ALG_DES | QCE_MODE_CBC | QCE_HASH_SHA256_HMAC,
		.name           = "authenc(hmac(sha256),cbc(des))",
		.drv_name       = "authenc-hmac-sha256-cbc-des-qce",
		.blocksize      = DES_BLOCK_SIZE,
		.ivsize         = DES_BLOCK_SIZE,
		.maxauthsize	= SHA256_DIGEST_SIZE,
	},
	{
		.flags          = QCE_ALG_3DES | QCE_MODE_CBC | QCE_HASH_SHA256_HMAC,
		.name           = "authenc(hmac(sha256),cbc(des3_ede))",
		.drv_name       = "authenc-hmac-sha256-cbc-3des-qce",
		.blocksize      = DES3_EDE_BLOCK_SIZE,
		.ivsize         = DES3_EDE_BLOCK_SIZE,
		.maxauthsize	= SHA256_DIGEST_SIZE,
	},
	{
		.flags          =  QCE_ALG_AES | QCE_MODE_CBC | QCE_HASH_SHA256_HMAC,
		.name           = "authenc(hmac(sha256),cbc(aes))",
		.drv_name       = "authenc-hmac-sha256-cbc-aes-qce",
		.blocksize      = AES_BLOCK_SIZE,
		.ivsize         = AES_BLOCK_SIZE,
		.maxauthsize	= SHA256_DIGEST_SIZE,
	},
	{
		.flags          =  QCE_ALG_AES | QCE_MODE_CCM,
		.name           = "ccm(aes)",
		.drv_name       = "ccm-aes-qce",
		.blocksize	= 1,
		.ivsize         = AES_BLOCK_SIZE,
		.maxauthsize	= AES_BLOCK_SIZE,
	},
	{
		.flags          =  QCE_ALG_AES | QCE_MODE_CCM | QCE_MODE_CCM_RFC4309,
		.name           = "rfc4309(ccm(aes))",
		.drv_name       = "rfc4309-ccm-aes-qce",
		.blocksize	= 1,
		.ivsize         = 8,
		.maxauthsize	= AES_BLOCK_SIZE,
	},
};

static int qce_aead_register_one(const struct qce_aead_def *def, struct qce_device *qce)
{
	struct qce_alg_template *tmpl;
	struct aead_alg *alg;
	int ret;

	tmpl = kzalloc_obj(*tmpl);
	if (!tmpl)
		return -ENOMEM;

	alg = &tmpl->alg.aead;

	strscpy(alg->base.cra_name, def->name);
	strscpy(alg->base.cra_driver_name, def->drv_name);

	alg->base.cra_blocksize		= def->blocksize;
	alg->chunksize			= def->chunksize;
	alg->ivsize			= def->ivsize;
	alg->maxauthsize		= def->maxauthsize;
	if (IS_CCM(def->flags))
		alg->setkey		= qce_aead_ccm_setkey;

Annotation

Implementation Notes