request_key_and_link(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, this is from the Kernel API Manual and it's literally the glow-up guide for requesting a key and caching it in a keyring β€” no cap, it's giving main character energy for kernel key management πŸ—οΈβœ¨


✨ SYNOPSIS ✨

struct key * request_key_and_link (struct key_type *type , const char
*description , struct key_tag *domain_tag , const void *callout_info ,
size_t callout_len , void *aux , struct key *dest_keyring , unsigned
long flags );

πŸŽ€ ARGUMENTS πŸŽ€

  • type β€” the type of key we want, like the vibe check for what kind of key this is πŸ’…
  • description β€” the searchable description of the key β€” this is how we find it later, periodt
  • domain_tag β€” the domain in which the key operates, iykyk πŸ¦‹
  • callout_info β€” the data to pass to the instantiation upcall (or NULL), lowkey the instructions for the upcall 🫢
  • callout_len β€” the length of callout_info, fr fr gotta know how much data we're passing
  • aux β€” auxiliary data for the upcall, extra sprinkle on top ✨
  • dest_keyring β€” where to cache the key, like its home base 🏠
  • flags β€” flags to key_alloc, the little settings that matter πŸ’–

🌸 DESCRIPTION 🌸

okay so here's the tea: a key matching the specified criteria (type, description, domain_tag) is searched for in the process's keyrings. if it's found, it's returned with its usage count incremented β€” slay! πŸ”₯

otherwise, if callout_info is not NULL, a key will be allocated and some service (probably in userspace) will be asked to instantiate it. like, "hey bestie, can you make this key for me?" 😭

if successfully found or created, the key will be linked to the destination keyring if one is provided. iconic behavior tbh πŸ’…

Returns a pointer to the key if successful. but bestie, there are so many ways this can go sideways:

  • -EACCES, -ENOKEY, -EKEYREVOKED or -EKEYEXPIRED β€” if an inaccessible, negative, revoked or expired key was found 😬
  • -ENOKEY β€” if no key was found and no callout_info was given, literally nothing to work with
  • -EDQUOT β€” if insufficient key quota was available to create a new key, the quota said no πŸ’€
  • -ENOMEM β€” if insufficient memory was available, out of brain space
🫢 important note bestie: if the returned key was created, then it may still be under construction, and wait_for_key_construction should be used to wait for that to complete. don't skip this step, fr fr πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯


and that's the whole vibe, bestie! this page is from ./security/keys and it's dated October 2026 β€” so go forth and request those keys like the icon you are πŸ‘‘πŸ’œπŸ’–

πŸ“¦ where this page comes from