crypto_check_attr_type(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… crypto_check_attr_type β€” check algorithm type and compute inherited mask

okay bestie, welcome to crypto_check_attr_type(9) from the Kernel API Manual β€” section 9, kernelspace, no gatekeeping πŸ’– This one's a little vibe-checker for crypto templates: it makes sure the algorithm type you asked for is actually the type you're gonna get, and it hands back a mask while it's at it. Slay.


✨ SYNOPSIS ✨

int crypto_check_attr_type (struct rtattr **tb , u32 type , u32 *mask_ret );
not me writing a whole function signature in one line 😭 but yes, that's the whole thing, character for character, no cap.

πŸŽ€ ARGUMENTS πŸŽ€

  • tb β€” the template parameters. the receipts, basically 🧾
  • type β€” the algorithm type the template would be instantiated as. like, what it's actually gonna turn into πŸ‘‘
  • mask_ret β€” (output) the mask that should be passed to crypto_grab_*() to restrict the flags of any inner algorithms. she's an output param, so she gets filled in, not read 🫢

🌸 DESCRIPTION 🌸

so the whole ~purpose~ here is validating that the algorithm type the user requested is compatible with the one the template would actually be instantiated as. vibe check: passed or failed, no in-between πŸ’€

like, picture this: if the user is doing crypto_alloc_shash("cbc(aes)", ...), this would return an error β€” because the "cbc" template creates an "skcipher" algorithm, not an "shash" algorithm. it's giving "sir this is a Wendy's" πŸ“ the request just doesn't match what the template grows up to be, and this function is the one to call it out.

it also computes the mask to use to restrict the flags of any inner algorithms. two jobs, one function, main character energy honestly ✨


⭐ RETURN ⭐

  • 0 on success πŸŽ‰
  • -errno on failure 😭 (the classic)

πŸ¦‹ SEE ALSO πŸ¦‹

  • Kernel file ./crypto/algapi.c β€” go read the source, iykyk πŸ“–

and that's the tea, bestie 🧚 this page came from ./crypto and it's dated October 2026 β€” periodt πŸ’…πŸŒˆ

πŸ“¦ where this page comes from