drivers/crypto/sa2ul.c
Source file repositories/reference/linux-study-clean/drivers/crypto/sa2ul.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/sa2ul.c- Extension
.c- Size
- 67694 bytes
- Lines
- 2470
- 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/bitfield.hlinux/clk.hlinux/dma-mapping.hlinux/dmaengine.hlinux/dmapool.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hcrypto/aes.hcrypto/authenc.hcrypto/des.hcrypto/internal/aead.hcrypto/internal/hash.hcrypto/internal/skcipher.hcrypto/scatterwalk.hcrypto/sha1.hcrypto/sha2.hsa2ul.h
Detected Declarations
struct sa_match_datastruct sa_cmdl_cfgstruct algo_datastruct sa_alg_tmplstruct sa_mapped_sgstruct sa_rx_datastruct sa_reqenum sa_algo_idfunction sa_swiz_128function prepare_kipadfunction prepare_kopadfunction sa_export_shashfunction sa_prepare_iopadsfunction sa_aes_inv_keyfunction sa_set_sc_encfunction sa_set_sc_authfunction sa_copy_ivfunction sa_format_cmdl_genfunction sa_update_cmdlfunction sa_set_swinfofunction sa_dump_scfunction sa_init_scfunction sa_free_ctx_infofunction sa_init_ctx_infofunction sa_cipher_cra_exitfunction sa_cipher_cra_initfunction sa_cipher_setkeyfunction sa_aes_cbc_setkeyfunction sa_aes_ecb_setkeyfunction sa_3des_cbc_setkeyfunction sa_3des_ecb_setkeyfunction sa_sync_from_devicefunction sa_free_sa_rx_datafunction sa_aes_dma_in_callbackfunction sa_prepare_tx_descfunction sa_runfunction sa_cipher_runfunction sa_encryptfunction sa_decryptfunction sa_sha_dma_in_callbackfunction zero_message_processfunction sa_sha_runfunction sa_sha_setupfunction sa_sha_cra_init_algfunction sa_sha_digestfunction sa_sha_initfunction sa_sha_updatefunction sa_sha_final
Annotated Snippet
struct sa_match_data {
u8 priv;
u8 priv_id;
u32 supported_algos;
};
static struct device *sa_k3_dev;
/**
* struct sa_cmdl_cfg - Command label configuration descriptor
* @aalg: authentication algorithm ID
* @enc_eng_id: Encryption Engine ID supported by the SA hardware
* @auth_eng_id: Authentication Engine ID
* @iv_size: Initialization Vector size
* @akey: Authentication key
* @akey_len: Authentication key length
* @enc: True, if this is an encode request
*/
struct sa_cmdl_cfg {
int aalg;
u8 enc_eng_id;
u8 auth_eng_id;
u8 iv_size;
const u8 *akey;
u16 akey_len;
bool enc;
};
/**
* struct algo_data - Crypto algorithm specific data
* @enc_eng: Encryption engine info structure
* @auth_eng: Authentication engine info structure
* @auth_ctrl: Authentication control word
* @hash_size: Size of digest
* @iv_idx: iv index in psdata
* @iv_out_size: iv out size
* @ealg_id: Encryption Algorithm ID
* @aalg_id: Authentication algorithm ID
* @mci_enc: Mode Control Instruction for Encryption algorithm
* @mci_dec: Mode Control Instruction for Decryption
* @inv_key: Whether the encryption algorithm demands key inversion
* @ctx: Pointer to the algorithm context
* @keyed_mac: Whether the authentication algorithm has key
* @prep_iopad: Function pointer to generate intermediate ipad/opad
*/
struct algo_data {
struct sa_eng_info enc_eng;
struct sa_eng_info auth_eng;
u8 auth_ctrl;
u8 hash_size;
u8 iv_idx;
u8 iv_out_size;
u8 ealg_id;
u8 aalg_id;
u8 *mci_enc;
u8 *mci_dec;
bool inv_key;
struct sa_tfm_ctx *ctx;
bool keyed_mac;
void (*prep_iopad)(struct algo_data *algo, const u8 *key,
u16 key_sz, __be32 *ipad, __be32 *opad);
};
/**
* struct sa_alg_tmpl: A generic template encompassing crypto/aead algorithms
* @type: Type of the crypto algorithm.
* @alg: Union of crypto algorithm definitions.
* @registered: Flag indicating if the crypto algorithm is already registered
*/
struct sa_alg_tmpl {
u32 type; /* CRYPTO_ALG_TYPE from <linux/crypto.h> */
union {
struct skcipher_alg skcipher;
struct ahash_alg ahash;
struct aead_alg aead;
} alg;
bool registered;
};
/**
* struct sa_mapped_sg: scatterlist information for tx and rx
* @mapped: Set to true if the @sgt is mapped
* @dir: mapping direction used for @sgt
* @split_sg: Set if the sg is split and needs to be freed up
* @static_sg: Static scatterlist entry for overriding data
* @sgt: scatterlist table for DMA API use
*/
struct sa_mapped_sg {
bool mapped;
enum dma_data_direction dir;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/dmapool.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct sa_match_data`, `struct sa_cmdl_cfg`, `struct algo_data`, `struct sa_alg_tmpl`, `struct sa_mapped_sg`, `struct sa_rx_data`, `struct sa_req`, `enum sa_algo_id`, `function sa_swiz_128`, `function prepare_kipad`.
- 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.