drivers/crypto/ccp/ccp-crypto-aes.c
Source file repositories/reference/linux-study-clean/drivers/crypto/ccp/ccp-crypto-aes.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/ccp/ccp-crypto-aes.c- Extension
.c- Size
- 8761 bytes
- Lines
- 344
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/aes.hcrypto/ctr.hcrypto/internal/skcipher.hlinux/err.hlinux/kernel.hlinux/list.hlinux/module.hlinux/scatterlist.hlinux/slab.hlinux/string.hccp-crypto.h
Detected Declarations
struct ccp_aes_deffunction Coprocessorfunction ccp_aes_setkeyfunction ccp_aes_cryptfunction ccp_aes_encryptfunction ccp_aes_decryptfunction ccp_aes_init_tfmfunction ccp_aes_rfc3686_completefunction ccp_aes_rfc3686_setkeyfunction ccp_aes_rfc3686_cryptfunction ccp_aes_rfc3686_encryptfunction ccp_aes_rfc3686_decryptfunction ccp_aes_rfc3686_init_tfmfunction ccp_register_aes_algfunction ccp_register_aes_algs
Annotated Snippet
struct ccp_aes_def {
enum ccp_aes_mode mode;
unsigned int version;
const char *name;
const char *driver_name;
unsigned int blocksize;
unsigned int ivsize;
const struct skcipher_alg *alg_defaults;
};
static struct ccp_aes_def aes_algs[] = {
{
.mode = CCP_AES_MODE_ECB,
.version = CCP_VERSION(3, 0),
.name = "ecb(aes)",
.driver_name = "ecb-aes-ccp",
.blocksize = AES_BLOCK_SIZE,
.ivsize = 0,
.alg_defaults = &ccp_aes_defaults,
},
{
.mode = CCP_AES_MODE_CBC,
.version = CCP_VERSION(3, 0),
.name = "cbc(aes)",
.driver_name = "cbc-aes-ccp",
.blocksize = AES_BLOCK_SIZE,
.ivsize = AES_BLOCK_SIZE,
.alg_defaults = &ccp_aes_defaults,
},
{
.mode = CCP_AES_MODE_CTR,
.version = CCP_VERSION(3, 0),
.name = "ctr(aes)",
.driver_name = "ctr-aes-ccp",
.blocksize = 1,
.ivsize = AES_BLOCK_SIZE,
.alg_defaults = &ccp_aes_defaults,
},
{
.mode = CCP_AES_MODE_CTR,
.version = CCP_VERSION(3, 0),
.name = "rfc3686(ctr(aes))",
.driver_name = "rfc3686-ctr-aes-ccp",
.blocksize = 1,
.ivsize = CTR_RFC3686_IV_SIZE,
.alg_defaults = &ccp_aes_rfc3686_defaults,
},
};
static int ccp_register_aes_alg(struct list_head *head,
const struct ccp_aes_def *def)
{
struct ccp_crypto_skcipher_alg *ccp_alg;
struct skcipher_alg *alg;
int ret;
ccp_alg = kzalloc_obj(*ccp_alg);
if (!ccp_alg)
return -ENOMEM;
INIT_LIST_HEAD(&ccp_alg->entry);
ccp_alg->mode = def->mode;
/* Copy the defaults and override as necessary */
alg = &ccp_alg->alg;
*alg = *def->alg_defaults;
strscpy(alg->base.cra_name, def->name);
strscpy(alg->base.cra_driver_name, def->driver_name);
alg->base.cra_blocksize = def->blocksize;
alg->ivsize = def->ivsize;
ret = crypto_register_skcipher(alg);
if (ret) {
pr_err("%s skcipher algorithm registration error (%d)\n",
alg->base.cra_name, ret);
kfree(ccp_alg);
return ret;
}
list_add(&ccp_alg->entry, head);
return 0;
}
int ccp_register_aes_algs(struct list_head *head)
{
int i, ret;
unsigned int ccpversion = ccp_version();
Annotation
- Immediate include surface: `crypto/aes.h`, `crypto/ctr.h`, `crypto/internal/skcipher.h`, `linux/err.h`, `linux/kernel.h`, `linux/list.h`, `linux/module.h`, `linux/scatterlist.h`.
- Detected declarations: `struct ccp_aes_def`, `function Coprocessor`, `function ccp_aes_setkey`, `function ccp_aes_crypt`, `function ccp_aes_encrypt`, `function ccp_aes_decrypt`, `function ccp_aes_init_tfm`, `function ccp_aes_rfc3686_complete`, `function ccp_aes_rfc3686_setkey`, `function ccp_aes_rfc3686_crypt`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.