drivers/crypto/omap-aes-gcm.c
Source file repositories/reference/linux-study-clean/drivers/crypto/omap-aes-gcm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/omap-aes-gcm.c- Extension
.c- Size
- 9398 bytes
- Lines
- 388
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/aes.hcrypto/engine.hcrypto/gcm.hcrypto/internal/aead.hcrypto/scatterwalk.hcrypto/skcipher.hlinux/errno.hlinux/dma-mapping.hlinux/dmaengine.hlinux/interrupt.hlinux/kernel.hlinux/omap-dma.hlinux/pm_runtime.hlinux/scatterlist.hlinux/string.homap-crypto.homap-aes.h
Detected Declarations
function omap_aes_gcm_finish_reqfunction omap_aes_gcm_done_taskfunction omap_aes_gcm_copy_buffersfunction do_encrypt_ivfunction omap_aes_gcm_dma_out_callbackfunction omap_aes_gcm_handle_queuefunction omap_aes_gcm_prepare_reqfunction omap_aes_gcm_cryptfunction omap_aes_gcm_encryptfunction omap_aes_gcm_decryptfunction omap_aes_4106gcm_encryptfunction omap_aes_4106gcm_decryptfunction omap_aes_gcm_setkeyfunction omap_aes_4106gcm_setkeyfunction omap_aes_gcm_setauthsizefunction omap_aes_4106gcm_setauthsizefunction omap_aes_gcm_crypt_reqfunction omap_aes_gcm_cra_init
Annotated Snippet
if (tag[i]) {
ret = -EBADMSG;
}
}
}
omap_aes_gcm_finish_req(dd, ret);
}
static int omap_aes_gcm_copy_buffers(struct omap_aes_dev *dd,
struct aead_request *req)
{
int alen, clen, cryptlen, assoclen, ret;
struct crypto_aead *aead = crypto_aead_reqtfm(req);
unsigned int authlen = crypto_aead_authsize(aead);
struct scatterlist *tmp, sg_arr[2];
int nsg;
u16 flags;
assoclen = req->assoclen;
cryptlen = req->cryptlen;
if (dd->flags & FLAGS_RFC4106_GCM)
assoclen -= 8;
if (!(dd->flags & FLAGS_ENCRYPT))
cryptlen -= authlen;
alen = ALIGN(assoclen, AES_BLOCK_SIZE);
clen = ALIGN(cryptlen, AES_BLOCK_SIZE);
nsg = !!(assoclen && cryptlen);
omap_aes_clear_copy_flags(dd);
sg_init_table(dd->in_sgl, nsg + 1);
if (assoclen) {
tmp = req->src;
ret = omap_crypto_align_sg(&tmp, assoclen,
AES_BLOCK_SIZE, dd->in_sgl,
OMAP_CRYPTO_COPY_DATA |
OMAP_CRYPTO_ZERO_BUF |
OMAP_CRYPTO_FORCE_SINGLE_ENTRY,
FLAGS_ASSOC_DATA_ST_SHIFT,
&dd->flags);
if (ret)
return ret;
}
if (cryptlen) {
tmp = scatterwalk_ffwd(sg_arr, req->src, req->assoclen);
if (nsg)
sg_unmark_end(dd->in_sgl);
ret = omap_crypto_align_sg(&tmp, cryptlen,
AES_BLOCK_SIZE, &dd->in_sgl[nsg],
OMAP_CRYPTO_COPY_DATA |
OMAP_CRYPTO_ZERO_BUF |
OMAP_CRYPTO_FORCE_SINGLE_ENTRY,
FLAGS_IN_DATA_ST_SHIFT,
&dd->flags);
if (ret)
return ret;
}
dd->in_sg = dd->in_sgl;
dd->total = cryptlen;
dd->assoc_len = assoclen;
dd->authsize = authlen;
dd->out_sg = req->dst;
dd->orig_out = req->dst;
dd->out_sg = scatterwalk_ffwd(sg_arr, req->dst, req->assoclen);
flags = 0;
if (req->src == req->dst || dd->out_sg == sg_arr)
flags |= OMAP_CRYPTO_FORCE_COPY;
if (cryptlen) {
ret = omap_crypto_align_sg(&dd->out_sg, cryptlen,
AES_BLOCK_SIZE, &dd->out_sgl,
flags,
FLAGS_OUT_DATA_ST_SHIFT, &dd->flags);
if (ret)
return ret;
}
dd->in_sg_len = sg_nents_for_len(dd->in_sg, alen + clen);
Annotation
- Immediate include surface: `crypto/aes.h`, `crypto/engine.h`, `crypto/gcm.h`, `crypto/internal/aead.h`, `crypto/scatterwalk.h`, `crypto/skcipher.h`, `linux/errno.h`, `linux/dma-mapping.h`.
- Detected declarations: `function omap_aes_gcm_finish_req`, `function omap_aes_gcm_done_task`, `function omap_aes_gcm_copy_buffers`, `function do_encrypt_iv`, `function omap_aes_gcm_dma_out_callback`, `function omap_aes_gcm_handle_queue`, `function omap_aes_gcm_prepare_req`, `function omap_aes_gcm_crypt`, `function omap_aes_gcm_encrypt`, `function omap_aes_gcm_decrypt`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
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.