drivers/crypto/tegra/tegra-se-hash.c
Source file repositories/reference/linux-study-clean/drivers/crypto/tegra/tegra-se-hash.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/tegra/tegra-se-hash.c- Extension
.c- Size
- 32576 bytes
- Lines
- 1159
- 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/aes.hcrypto/sha1.hcrypto/sha2.hcrypto/sha3.hcrypto/internal/des.hcrypto/engine.hcrypto/scatterwalk.hcrypto/internal/hash.htegra-se.h
Detected Declarations
struct tegra_sha_ctxstruct tegra_sha_reqctxfunction tegra_sha_get_configfunction tegra_sha_fallback_initfunction tegra_sha_fallback_updatefunction tegra_sha_fallback_finalfunction tegra_sha_fallback_finupfunction tegra_sha_fallback_digestfunction tegra_sha_fallback_importfunction tegra_sha_fallback_exportfunction tegra_se_insert_hash_resultfunction tegra_sha_prep_cmdfunction tegra_sha_do_initfunction tegra_sha_do_updatefunction finalfunction tegra_sha_do_finalfunction tegra_sha_do_one_reqfunction tegra_sha_init_fallbackfunction tegra_sha_cra_initfunction tegra_sha_cra_exitfunction tegra_hmac_fallback_setkeyfunction tegra_hmac_setkeyfunction tegra_sha_initfunction tegra_sha_updatefunction tegra_sha_finalfunction tegra_sha_finupfunction tegra_sha_digestfunction tegra_sha_exportfunction tegra_sha_importfunction tegra_hash_kac_manifestfunction tegra_init_hashfunction tegra_deinit_hash
Annotated Snippet
struct tegra_sha_ctx {
struct tegra_se *se;
unsigned int alg;
bool fallback;
u32 key_id;
struct crypto_ahash *fallback_tfm;
};
struct tegra_sha_reqctx {
struct scatterlist *src_sg;
struct tegra_se_datbuf datbuf;
struct tegra_se_datbuf residue;
struct tegra_se_datbuf digest;
struct tegra_se_datbuf intr_res;
unsigned int alg;
unsigned int config;
unsigned int total_len;
unsigned int blk_size;
unsigned int task;
u32 key_id;
u32 result[HASH_RESULT_REG_COUNT];
struct ahash_request fallback_req;
};
static int tegra_sha_get_config(u32 alg)
{
int cfg = 0;
switch (alg) {
case SE_ALG_SHA1:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA1;
break;
case SE_ALG_HMAC_SHA224:
cfg |= SE_SHA_ENC_ALG_HMAC;
fallthrough;
case SE_ALG_SHA224:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA224;
break;
case SE_ALG_HMAC_SHA256:
cfg |= SE_SHA_ENC_ALG_HMAC;
fallthrough;
case SE_ALG_SHA256:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA256;
break;
case SE_ALG_HMAC_SHA384:
cfg |= SE_SHA_ENC_ALG_HMAC;
fallthrough;
case SE_ALG_SHA384:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA384;
break;
case SE_ALG_HMAC_SHA512:
cfg |= SE_SHA_ENC_ALG_HMAC;
fallthrough;
case SE_ALG_SHA512:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA512;
break;
case SE_ALG_SHA3_224:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA3_224;
break;
case SE_ALG_SHA3_256:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA3_256;
break;
case SE_ALG_SHA3_384:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA3_384;
break;
case SE_ALG_SHA3_512:
cfg |= SE_SHA_ENC_ALG_SHA;
cfg |= SE_SHA_ENC_MODE_SHA3_512;
break;
default:
return -EINVAL;
}
return cfg;
}
static int tegra_sha_fallback_init(struct ahash_request *req)
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/aes.h`, `crypto/sha1.h`.
- Detected declarations: `struct tegra_sha_ctx`, `struct tegra_sha_reqctx`, `function tegra_sha_get_config`, `function tegra_sha_fallback_init`, `function tegra_sha_fallback_update`, `function tegra_sha_fallback_final`, `function tegra_sha_fallback_finup`, `function tegra_sha_fallback_digest`, `function tegra_sha_fallback_import`, `function tegra_sha_fallback_export`.
- 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.