drivers/crypto/inside-secure/eip93/eip93-common.c
Source file repositories/reference/linux-study-clean/drivers/crypto/inside-secure/eip93/eip93-common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/inside-secure/eip93/eip93-common.c- Extension
.c- Size
- 19863 bytes
- Lines
- 823
- 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.
- 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
crypto/aes.hcrypto/ctr.hcrypto/hmac.hcrypto/sha1.hcrypto/sha2.hlinux/kernel.hlinux/delay.hlinux/dma-mapping.hlinux/scatterlist.heip93-cipher.heip93-hash.heip93-common.heip93-main.heip93-regs.h
Detected Declarations
function Copyrightfunction eip93_put_descriptorfunction eip93_free_sg_copyfunction eip93_make_sg_copyfunction eip93_is_sg_alignedfunction check_valid_requestfunction eip93_set_sa_recordfunction eip93_scatter_combinefunction eip93_send_reqfunction eip93_unmap_dmafunction eip93_handle_resultfunction eip93_hmac_setkey
Annotated Snippet
if (len <= sg->length) {
if (!IS_ALIGNED(len, blksize))
return false;
return true;
}
if (!IS_ALIGNED(sg->length, blksize))
return false;
len -= sg->length;
}
return false;
}
int check_valid_request(struct eip93_cipher_reqctx *rctx)
{
struct scatterlist *src = rctx->sg_src;
struct scatterlist *dst = rctx->sg_dst;
u32 textsize = rctx->textsize;
u32 authsize = rctx->authsize;
u32 blksize = rctx->blksize;
u32 totlen_src = rctx->assoclen + rctx->textsize;
u32 totlen_dst = rctx->assoclen + rctx->textsize;
u32 copy_len;
bool src_align, dst_align;
int src_nents, dst_nents;
int err = -EINVAL;
if (!IS_CTR(rctx->flags)) {
if (!IS_ALIGNED(textsize, blksize))
return err;
}
if (authsize) {
if (IS_ENCRYPT(rctx->flags))
totlen_dst += authsize;
else
totlen_src += authsize;
}
src_nents = sg_nents_for_len(src, totlen_src);
if (src_nents < 0)
return src_nents;
dst_nents = sg_nents_for_len(dst, totlen_dst);
if (dst_nents < 0)
return dst_nents;
if (src == dst) {
src_nents = max(src_nents, dst_nents);
dst_nents = src_nents;
if (unlikely((totlen_src || totlen_dst) && !src_nents))
return err;
} else {
if (unlikely(totlen_src && !src_nents))
return err;
if (unlikely(totlen_dst && !dst_nents))
return err;
}
if (authsize) {
if (dst_nents == 1 && src_nents == 1) {
src_align = eip93_is_sg_aligned(src, totlen_src, blksize);
if (src == dst)
dst_align = src_align;
else
dst_align = eip93_is_sg_aligned(dst, totlen_dst, blksize);
} else {
src_align = false;
dst_align = false;
}
} else {
src_align = eip93_is_sg_aligned(src, totlen_src, blksize);
if (src == dst)
dst_align = src_align;
else
dst_align = eip93_is_sg_aligned(dst, totlen_dst, blksize);
}
copy_len = max(totlen_src, totlen_dst);
if (!src_align) {
err = eip93_make_sg_copy(src, &rctx->sg_src, copy_len, true);
if (err)
return err;
}
if (!dst_align) {
Annotation
- Immediate include surface: `crypto/aes.h`, `crypto/ctr.h`, `crypto/hmac.h`, `crypto/sha1.h`, `crypto/sha2.h`, `linux/kernel.h`, `linux/delay.h`, `linux/dma-mapping.h`.
- Detected declarations: `function Copyright`, `function eip93_put_descriptor`, `function eip93_free_sg_copy`, `function eip93_make_sg_copy`, `function eip93_is_sg_aligned`, `function check_valid_request`, `function eip93_set_sa_record`, `function eip93_scatter_combine`, `function eip93_send_req`, `function eip93_unmap_dma`.
- 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.