s5p_hash_prepare_sgs(9)
π« s5p_hash_prepare_sgs β a Kernel API Manual moment π«
okay so bestie, welcome to the Kernel API Manual, and today's main character is s5p_hash_prepare_sgs(9). buckle up, we're doing scatterlist prep and honestly? it's giving "small function, big responsibilities" β¨
πΈ NAME πΈ
s5p_hash_prepare_sgs β prepare sg for processing π
π¦ SYNOPSIS π¦
int s5p_hash_prepare_sgs (struct s5p_hash_reqctx *ctx , struct
scatterlist *sg , unsigned int new_len , bool final );
π ARGUMENTS π
ctxβ the request context, aka everything this call needs to know about the request πsgβ the source scatterlist request, the actual data we're working with πnew_lenβ how many bytes to process fromsg. not vibes, actual bytes π’finalβ the final flag, literally just the "are we done here" boolean π
β¨ DESCRIPTION β¨
so what is she actually doing? two vibe checks, that's what π
- whether the buffers in
sghave len-aligned data, and - whether the
sgtable has good aligned elements (list_ok).
if one of these checks fails, then it's fix-it time, and there are two paths:
- (1) allocate a new buffer for the data with
s5p_hash_copy_sgs, copy the data into that buffer, and prepare the request insgl, or - (2) allocate a new
sgtable and prepare thesgelements.
and the cute part: for digest or finup, all the conditions can be good, so we may not need any fixes at all. no notes, we love a clean run π«Ά
ngl the whole point here is that this function exists so the rest of the pipeline doesn't have to be embarrassed about a badly aligned sg. iconic behavior, honestly.
π₯ SEE ALSO π₯
Kernel file ./drivers/crypto/s5p-sss.c, plus the whole friend group:
struct samsung_aes_variant(9)struct s5p_aes_dev(9)struct s5p_hash_reqctx(9)struct s5p_hash_ctx(9)s5p_set_dma_hashdata(9)s5p_hash_rx(9)s5p_hash_read_msg(9)s5p_hash_write_ctx_iv(9)s5p_hash_write_iv(9)s5p_hash_copy_result(9)s5p_hash_dma_flush(9)s5p_hash_dma_enable(9)s5p_hash_irq_disable(9)s5p_hash_irq_enable(9)s5p_hash_set_flow(9)s5p_ahash_dma_init(9)s5p_hash_write_ctrl(9)s5p_hash_xmit_dma(9)s5p_hash_copy_sgs(9)s5p_hash_copy_sg_lists(9)s5p_hash_prepare_request(9)s5p_hash_update_dma_stop(9)s5p_hash_finish(9)s5p_hash_finish_req(9)s5p_hash_handle_queue(9)s5p_hash_tasklet_cb(9)s5p_hash_enqueue(9)s5p_hash_update(9)s5p_hash_final(9)s5p_hash_finup(9)s5p_hash_init(9)s5p_hash_digest(9)s5p_hash_cra_init_alg(9)s5p_hash_cra_init(9)s5p_hash_cra_exit(9)s5p_hash_export(9)s5p_hash_import(9)
and that's the whole page, bestie π this one came to you straight out of ./drivers/crypto and it's dated October 2026 β go forth and align your scatterlists, periodt β¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms