drivers/crypto/tegra/tegra-se-aes.c
Source file repositories/reference/linux-study-clean/drivers/crypto/tegra/tegra-se-aes.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/tegra/tegra-se-aes.c- Extension
.c- Size
- 53395 bytes
- Lines
- 2078
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bottom_half.hlinux/clk.hlinux/dma-mapping.hlinux/module.hlinux/of_device.hlinux/platform_device.hcrypto/aead.hcrypto/aes.hcrypto/engine.hcrypto/gcm.hcrypto/scatterwalk.hcrypto/xts.hcrypto/internal/aead.hcrypto/internal/hash.hcrypto/internal/skcipher.htegra-se.h
Detected Declarations
struct tegra_aes_ctxstruct tegra_aes_reqctxstruct tegra_aead_ctxstruct tegra_aead_reqctxstruct tegra_cmac_ctxstruct tegra_cmac_reqctxfunction ctr_iv_incfunction tegra_cbc_iv_copybackfunction tegra_aes_update_ivfunction tegra234_aes_crypto_cfgfunction tegra234_aes_cfgfunction tegra_aes_prep_cmdfunction tegra_aes_do_one_reqfunction tegra_aes_cra_initfunction tegra_aes_cra_exitfunction tegra_aes_setkeyfunction tegra_xts_setkeyfunction tegra_aes_kac_manifestfunction tegra_aes_cryptfunction tegra_aes_encryptfunction tegra_aes_decryptfunction tegra_gmac_prep_cmdfunction tegra_gcm_crypt_prep_cmdfunction tegra_gcm_prep_final_cmdfunction tegra_gcm_do_gmacfunction tegra_gcm_do_cryptfunction tegra_gcm_do_finalfunction tegra_gcm_do_verifyfunction tegra_ccm_check_ivfunction tegra_cbcmac_prep_cmdfunction tegra_ctr_prep_cmdfunction tegra_ccm_do_cbcmacfunction tegra_ccm_set_msg_lenfunction tegra_ccm_format_noncefunction tegra_ccm_format_adatafunction tegra_ccm_add_paddingfunction tegra_ccm_format_blocksfunction tegra_ccm_mac_resultfunction tegra_ccm_ctr_resultfunction tegra_ccm_compute_authfunction tegra_ccm_do_ctrfunction tegra_ccm_crypt_initfunction tegra_ccm_do_one_reqfunction tegra_gcm_do_one_reqfunction tegra_aead_cra_initfunction tegra_ccm_setauthsizefunction tegra_gcm_setauthsizefunction tegra_aead_cra_exit
Annotated Snippet
struct tegra_aes_ctx {
struct tegra_se *se;
u32 alg;
u32 ivsize;
u32 key1_id;
u32 key2_id;
u32 keylen;
u8 key1[AES_MAX_KEY_SIZE];
u8 key2[AES_MAX_KEY_SIZE];
};
struct tegra_aes_reqctx {
struct tegra_se_datbuf datbuf;
bool encrypt;
u32 config;
u32 crypto_config;
u32 len;
u32 *iv;
};
struct tegra_aead_ctx {
struct tegra_se *se;
unsigned int authsize;
u32 alg;
u32 key_id;
u32 keylen;
u8 key[AES_MAX_KEY_SIZE];
};
struct tegra_aead_reqctx {
struct tegra_se_datbuf inbuf;
struct tegra_se_datbuf outbuf;
struct scatterlist *src_sg;
struct scatterlist *dst_sg;
unsigned int assoclen;
unsigned int cryptlen;
unsigned int authsize;
bool encrypt;
u32 crypto_config;
u32 config;
u32 key_id;
u32 iv[4];
u8 authdata[16];
};
struct tegra_cmac_ctx {
struct tegra_se *se;
unsigned int alg;
u32 key_id;
u32 keylen;
u8 key[AES_MAX_KEY_SIZE];
struct crypto_shash *fallback_tfm;
};
struct tegra_cmac_reqctx {
struct scatterlist *src_sg;
struct tegra_se_datbuf datbuf;
struct tegra_se_datbuf residue;
unsigned int total_len;
unsigned int blk_size;
unsigned int task;
u32 crypto_config;
u32 config;
u32 key_id;
u32 *iv;
u32 result[CMAC_RESULT_REG_COUNT];
};
/* increment counter (128-bit int) */
static void ctr_iv_inc(__u8 *counter, __u8 bits, __u32 nums)
{
do {
--bits;
nums += counter[bits];
counter[bits] = nums & 0xff;
nums >>= 8;
} while (bits && nums);
}
static void tegra_cbc_iv_copyback(struct skcipher_request *req, struct tegra_aes_ctx *ctx)
{
struct tegra_aes_reqctx *rctx = skcipher_request_ctx(req);
unsigned int offset;
offset = req->cryptlen - ctx->ivsize;
if (rctx->encrypt)
memcpy(req->iv, rctx->datbuf.buf + offset, ctx->ivsize);
else
scatterwalk_map_and_copy(req->iv, req->src, offset, ctx->ivsize, 0);
Annotation
- Immediate include surface: `linux/bottom_half.h`, `linux/clk.h`, `linux/dma-mapping.h`, `linux/module.h`, `linux/of_device.h`, `linux/platform_device.h`, `crypto/aead.h`, `crypto/aes.h`.
- Detected declarations: `struct tegra_aes_ctx`, `struct tegra_aes_reqctx`, `struct tegra_aead_ctx`, `struct tegra_aead_reqctx`, `struct tegra_cmac_ctx`, `struct tegra_cmac_reqctx`, `function ctr_iv_inc`, `function tegra_cbc_iv_copyback`, `function tegra_aes_update_iv`, `function tegra234_aes_crypto_cfg`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- 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.