s5p_hash_prepare_sgs(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« 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 from sg. 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 🌈

  1. whether the buffers in sg have len-aligned data, and
  2. whether the sg table 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 in sgl, or
  • (2) allocate a new sg table and prepare the sg elements.

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:


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