restrict_li...y_or_keyring(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie so you're in the Kernel API Manual and this function is called restrict_link_by_key_or_keyring (yes the header abbreviates it as restrict_li...y_or_keyring(9), we're all doing our best πŸ’…). It's the one that decides whether a new key is allowed to join the keyring, using the restrict_key info that's already stored in the ring. slay.


✨ SYNOPSIS ✨

int restrict_link_by_key_or_keyring (struct key *dest_keyring , const
       struct key_type *type , const union key_payload *payload , struct key
       *trusted );

that's the whole signature, verbatim, no cap 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • dest_keyring β€” the keyring being linked to. the destination, the final boss, the place the new key wants to live πŸ’–
  • type β€” the type of key being added. like, what kind of key is this, bestie 🌸
  • payload β€” the payload of the new key. the actual contents, the inner self ✨
  • trusted β€” a key or ring of keys that can be used to vouch for the new cert. your key's references, basically πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe check πŸ”: it checks the new certificate only against the key or keys passed in the data parameter. literally only those. if one of those is the signing key and it validates the new certificate, then the new certificate gets marked as being ok to link β€” green flag, come on in πŸŽ‰πŸ’š

it's giving "you're either vouched for or you're not" and honestly? iconic.

what it returns (the moment of truth, the results, the ✨ grades ✨):

  • Returns 0 if the new certificate was accepted β€” ate and left no crumbs πŸ‘‘
  • -ENOKEY if we couldn't find a matching parent certificate in the trusted list β€” the vibe is missing 😭
  • -EKEYREJECTED if the signature check fails β€” rejected, blocked, unfollowed πŸ’€
  • -ENOPKG if the signature uses unsupported crypto β€” not our department bestie πŸ™ˆ
  • or some other error if there is a matching certificate but the signature check cannot be performed β€” close but no cigar, undefined vibes πŸŒ€
ngl, most of the time you'll see that 0 and everything's cute, but keep the error list in mind fr fr πŸ’…

🌈 SEE ALSO 🌈

all the sibling functions, the whole friend group, iykyk 🫢


okay that's the page!! πŸ“ it lives under ./crypto/asymmetric_keys and this edition dropped in October 2026 β€” so if you're reading it, hi from the future, hope your keyring is valid and your signatures check out. bye bestie, go slay some crypto πŸ’–πŸŽ€πŸŒŸ

πŸ“¦ where this page comes from