bpf_crypto_ctx_create(9)
π bpf_crypto_ctx_create(9)
okay so this is a page from the Kernel API Manual β yes, the kernel has manpages too, we stay educated π β and it's all about bpf_crypto_ctx_create, the little function that spawns a mutable BPF crypto context for you. mutable!! crypto!! bestie we are SO back π₯
β¨ NAME β¨
bpf_crypto_ctx_create β creates a mutable BPF crypto context. that's it, that's the whole name, and honestly it ate π
π SYNOPSIS π
__bpf_kfunc struct bpf_crypto_ctx * bpf_crypto_ctx_create (const struct
bpf_crypto_params *params , u32 params__sz , int *err );
it's giving "long signature, tiny name" energy. she's a __bpf_kfunc, she returns a struct bpf_crypto_ctx *, and she takes three things. let's get into it π¦
πΈ ARGUMENTS πΈ
paramsβ pointer tostruct bpf_crypto_params, which holds literally all the details you need to initialise the crypto context. the whole blueprint. the vibe check for your cipher πparams__szβ the size ofstruct bpf_crypto_paramsas used by the BPF program. (ngl the original page spells it "steuct" and "usef" β iconic typo moment, we keep it real π«Ά, but it'sstructandused, iykyk)errβ an integer where the error code gets stored wheneverNULLcomes back. so like, if it flops, this is where the receipts live π
π DESCRIPTION π
so what does she do? she allocates a crypto context that a BPF program can use, acquire, and release. main character energy honestly π
the context she returns has exactly two acceptable fates, no third option, periodt:
- it gets embedded in a map as a kptr, or
- it gets freed with
bpf_crypto_ctx_releaseπ
β fr fr do not just leave it lying around β those are the options.
and because crypto API functions use GFP_KERNEL allocations, this function can only be used in sleepable BPF programs. no cap, that's a hard requirement, not a suggestion π§
bpf_crypto_ctx_create allocates memory for the crypto context, and it may return NULL if no memory is available. lowkey devastating but that's what err is for π
π SEE ALSO π
- Kernel file
./kernel/bpf/crypto.c struct bpf_crypto_params(9)struct bpf_crypto_ctx(9)bpf_crypto_ctx_acquire(9)bpf_crypto_ctx_release(9)bpf_crypto_decrypt(9)bpf_crypto_encrypt(9)
go read the whole friend group, they're all connected π
and that's the page!! this one lives at ./kernel/bpf (the directory, not a person, sadly), it's dated October 2026 β β yes, the future, we're ahead of schedule β and it's page bpf_crypto_ctx_create(9) of the Kernel API Manual. slay, go create some contexts responsibly π
β¨π
π¦ 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