drivers/crypto/ccp/ccp-crypto-rsa.c
Source file repositories/reference/linux-study-clean/drivers/crypto/ccp/ccp-crypto-rsa.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/ccp/ccp-crypto-rsa.c- Extension
.c- Size
- 6891 bytes
- Lines
- 294
- 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
linux/module.hlinux/sched.hlinux/scatterlist.hlinux/string.hlinux/crypto.hcrypto/algapi.hcrypto/internal/rsa.hcrypto/internal/akcipher.hcrypto/akcipher.hcrypto/scatterwalk.hccp-crypto.h
Detected Declarations
struct ccp_rsa_deffunction Coprocessorfunction ccp_copy_and_save_keypartfunction ccp_rsa_completefunction ccp_rsa_maxsizefunction ccp_rsa_cryptfunction ccp_rsa_encryptfunction ccp_rsa_decryptfunction ccp_check_key_lengthfunction ccp_rsa_free_key_bufsfunction ccp_rsa_setkeyfunction ccp_rsa_setprivkeyfunction ccp_rsa_setpubkeyfunction ccp_rsa_init_tfmfunction ccp_rsa_exit_tfmfunction ccp_register_rsa_algfunction ccp_register_rsa_algs
Annotated Snippet
struct ccp_rsa_def {
unsigned int version;
const char *name;
const char *driver_name;
unsigned int reqsize;
struct akcipher_alg *alg_defaults;
};
static struct ccp_rsa_def rsa_algs[] = {
{
.version = CCP_VERSION(3, 0),
.name = "rsa",
.driver_name = "rsa-ccp",
.reqsize = sizeof(struct ccp_rsa_req_ctx),
.alg_defaults = &ccp_rsa_defaults,
}
};
static int ccp_register_rsa_alg(struct list_head *head,
const struct ccp_rsa_def *def)
{
struct ccp_crypto_akcipher_alg *ccp_alg;
struct akcipher_alg *alg;
int ret;
ccp_alg = kzalloc_obj(*ccp_alg);
if (!ccp_alg)
return -ENOMEM;
INIT_LIST_HEAD(&ccp_alg->entry);
alg = &ccp_alg->alg;
*alg = *def->alg_defaults;
strscpy(alg->base.cra_name, def->name);
strscpy(alg->base.cra_driver_name, def->driver_name);
ret = crypto_register_akcipher(alg);
if (ret) {
pr_err("%s akcipher 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_rsa_algs(struct list_head *head)
{
int i, ret;
unsigned int ccpversion = ccp_version();
/* Register the RSA algorithm in standard mode
* This works for CCP v3 and later
*/
for (i = 0; i < ARRAY_SIZE(rsa_algs); i++) {
if (rsa_algs[i].version > ccpversion)
continue;
ret = ccp_register_rsa_alg(head, &rsa_algs[i]);
if (ret)
return ret;
}
return 0;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/sched.h`, `linux/scatterlist.h`, `linux/string.h`, `linux/crypto.h`, `crypto/algapi.h`, `crypto/internal/rsa.h`, `crypto/internal/akcipher.h`.
- Detected declarations: `struct ccp_rsa_def`, `function Coprocessor`, `function ccp_copy_and_save_keypart`, `function ccp_rsa_complete`, `function ccp_rsa_maxsize`, `function ccp_rsa_crypt`, `function ccp_rsa_encrypt`, `function ccp_rsa_decrypt`, `function ccp_check_key_length`, `function ccp_rsa_free_key_bufs`.
- 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.