mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
KEYS: Add KEYCTL_RESTRICT_KEYRING
Keyrings recently gained restrict_link capabilities that allow individual keys to be validated prior to linking. This functionality was only available using internal kernel APIs. With the KEYCTL_RESTRICT_KEYRING command existing keyrings can be configured to check the content of keys before they are linked, and then allow or disallow linkage of that key to the keyring. To restrict a keyring, call: keyctl(KEYCTL_RESTRICT_KEYRING, key_serial_t keyring, const char *type, const char *restriction) where 'type' is the name of a registered key type and 'restriction' is a string describing how key linkage is to be restricted. The restriction option syntax is specific to each key type. Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
This commit is contained in:
parent
4a420896f1
commit
6563c91fd6
7 changed files with 201 additions and 1 deletions
|
@ -219,7 +219,8 @@ struct key {
|
|||
/* This is set on a keyring to restrict the addition of a link to a key
|
||||
* to it. If this structure isn't provided then it is assumed that the
|
||||
* keyring is open to any addition. It is ignored for non-keyring
|
||||
* keys.
|
||||
* keys. Only set this value using keyring_restrict(), keyring_alloc(),
|
||||
* or key_alloc().
|
||||
*
|
||||
* This is intended for use with rings of trusted keys whereby addition
|
||||
* to the keyring needs to be controlled. KEY_ALLOC_BYPASS_RESTRICTION
|
||||
|
@ -328,6 +329,9 @@ extern key_ref_t keyring_search(key_ref_t keyring,
|
|||
extern int keyring_add_key(struct key *keyring,
|
||||
struct key *key);
|
||||
|
||||
extern int keyring_restrict(key_ref_t keyring, const char *type,
|
||||
const char *restriction);
|
||||
|
||||
extern struct key *key_lookup(key_serial_t id);
|
||||
|
||||
static inline key_serial_t key_serial(const struct key *key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue