drivers/crypto/hisilicon/sec/sec_algs.c
Source file repositories/reference/linux-study-clean/drivers/crypto/hisilicon/sec/sec_algs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/hisilicon/sec/sec_algs.c- Extension
.c- Size
- 30059 bytes
- Lines
- 1123
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/crypto.hlinux/dma-mapping.hlinux/dmapool.hlinux/module.hlinux/mutex.hlinux/slab.hcrypto/aes.hcrypto/algapi.hcrypto/internal/des.hcrypto/skcipher.hcrypto/xts.hcrypto/internal/skcipher.hsec_drv.h
Detected Declarations
struct sec_c_alg_cfgfunction sec_alg_skcipher_init_templatefunction sec_alg_skcipher_init_contextfunction sec_free_hw_sglfunction sec_alloc_and_fill_hw_sglfunction for_each_sgfunction sec_alg_skcipher_setkeyfunction sec_alg_skcipher_setkey_aes_ecbfunction sec_alg_skcipher_setkey_aes_cbcfunction sec_alg_skcipher_setkey_aes_ctrfunction sec_alg_skcipher_setkey_aes_xtsfunction sec_alg_skcipher_setkey_des_ecbfunction sec_alg_skcipher_setkey_des_cbcfunction sec_alg_skcipher_setkey_3des_ecbfunction sec_alg_skcipher_setkey_3des_cbcfunction sec_alg_free_elfunction sec_send_requestfunction sec_skcipher_alg_callbackfunction sec_alg_callbackfunction sec_alg_alloc_and_calc_split_sizesfunction sec_map_and_split_sgfunction sec_unmap_sg_on_errfunction sec_alg_skcipher_cryptofunction kfifo_availfunction sec_alg_skcipher_encryptfunction sec_alg_skcipher_decryptfunction sec_alg_skcipher_initfunction sec_alg_skcipher_exitfunction sec_alg_skcipher_init_with_queuefunction sec_alg_skcipher_exit_with_queuefunction sec_algs_registerfunction sec_algs_unregister
Annotated Snippet
struct sec_c_alg_cfg {
unsigned c_alg : 3;
unsigned c_mode : 3;
unsigned key_len : 2;
unsigned c_width : 2;
};
static const struct sec_c_alg_cfg sec_c_alg_cfgs[] = {
[SEC_C_DES_ECB_64] = {
.c_alg = SEC_C_ALG_DES,
.c_mode = SEC_C_MODE_ECB,
.key_len = SEC_KEY_LEN_DES,
},
[SEC_C_DES_CBC_64] = {
.c_alg = SEC_C_ALG_DES,
.c_mode = SEC_C_MODE_CBC,
.key_len = SEC_KEY_LEN_DES,
},
[SEC_C_3DES_ECB_192_3KEY] = {
.c_alg = SEC_C_ALG_3DES,
.c_mode = SEC_C_MODE_ECB,
.key_len = SEC_KEY_LEN_3DES_3_KEY,
},
[SEC_C_3DES_ECB_192_2KEY] = {
.c_alg = SEC_C_ALG_3DES,
.c_mode = SEC_C_MODE_ECB,
.key_len = SEC_KEY_LEN_3DES_2_KEY,
},
[SEC_C_3DES_CBC_192_3KEY] = {
.c_alg = SEC_C_ALG_3DES,
.c_mode = SEC_C_MODE_CBC,
.key_len = SEC_KEY_LEN_3DES_3_KEY,
},
[SEC_C_3DES_CBC_192_2KEY] = {
.c_alg = SEC_C_ALG_3DES,
.c_mode = SEC_C_MODE_CBC,
.key_len = SEC_KEY_LEN_3DES_2_KEY,
},
[SEC_C_AES_ECB_128] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_ECB,
.key_len = SEC_KEY_LEN_AES_128,
},
[SEC_C_AES_ECB_192] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_ECB,
.key_len = SEC_KEY_LEN_AES_192,
},
[SEC_C_AES_ECB_256] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_ECB,
.key_len = SEC_KEY_LEN_AES_256,
},
[SEC_C_AES_CBC_128] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_CBC,
.key_len = SEC_KEY_LEN_AES_128,
},
[SEC_C_AES_CBC_192] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_CBC,
.key_len = SEC_KEY_LEN_AES_192,
},
[SEC_C_AES_CBC_256] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_CBC,
.key_len = SEC_KEY_LEN_AES_256,
},
[SEC_C_AES_CTR_128] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_CTR,
.key_len = SEC_KEY_LEN_AES_128,
},
[SEC_C_AES_CTR_192] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_CTR,
.key_len = SEC_KEY_LEN_AES_192,
},
[SEC_C_AES_CTR_256] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_CTR,
.key_len = SEC_KEY_LEN_AES_256,
},
[SEC_C_AES_XTS_128] = {
.c_alg = SEC_C_ALG_AES,
.c_mode = SEC_C_MODE_XTS,
.key_len = SEC_KEY_LEN_AES_128,
},
[SEC_C_AES_XTS_256] = {
.c_alg = SEC_C_ALG_AES,
Annotation
- Immediate include surface: `linux/crypto.h`, `linux/dma-mapping.h`, `linux/dmapool.h`, `linux/module.h`, `linux/mutex.h`, `linux/slab.h`, `crypto/aes.h`, `crypto/algapi.h`.
- Detected declarations: `struct sec_c_alg_cfg`, `function sec_alg_skcipher_init_template`, `function sec_alg_skcipher_init_context`, `function sec_free_hw_sgl`, `function sec_alloc_and_fill_hw_sgl`, `function for_each_sg`, `function sec_alg_skcipher_setkey`, `function sec_alg_skcipher_setkey_aes_ecb`, `function sec_alg_skcipher_setkey_aes_cbc`, `function sec_alg_skcipher_setkey_aes_ctr`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.