crypto_check_attr_type(9)
π 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 tocrypto_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 β
0on success π-errnoon 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
- 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