restrict_li...y_or_keyring(9)
π restrict_link_by_key_or_keyring(9) β the Kernel API Manual page your group chat needed
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
0if the new certificate was accepted β ate and left no crumbs π -ENOKEYif we couldn't find a matching parent certificate in the trusted list β the vibe is missing π-EKEYREJECTEDif the signature check fails β rejected, blocked, unfollowed π-ENOPKGif 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 π
- Kernel file
./crypto/asymmetric_keys/restrict.cβ the source, the origin story π§ restrict_link_by_signature(9)restrict_link_by_ca(9)restrict_link_by_digsig(9)restrict_link_by_key_or_keyring_chain(9)
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
- 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