aboutsummaryrefslogtreecommitdiff
path: root/security/security.c
diff options
context:
space:
mode:
authorGravatar Roberto Sassu <roberto.sassu@huawei.com> 2024-02-15 11:31:06 +0100
committerGravatar Paul Moore <paul@paul-moore.com> 2024-02-15 23:43:45 -0500
commitb8d997032a46fcf47d5bda011c0d1e87b20c08ba (patch)
tree7d98596e0338a1ae9dac887b611958d62cf25084 /security/security.c
parentsecurity: Introduce inode_post_remove_acl hook (diff)
downloadlinux-b8d997032a46fcf47d5bda011c0d1e87b20c08ba.tar.gz
linux-b8d997032a46fcf47d5bda011c0d1e87b20c08ba.tar.bz2
linux-b8d997032a46fcf47d5bda011c0d1e87b20c08ba.zip
security: Introduce key_post_create_or_update hook
In preparation for moving IMA and EVM to the LSM infrastructure, introduce the key_post_create_or_update hook. Depending on policy, IMA measures the key content after creation or update, so that remote verifiers are aware of the operation. Other LSMs could similarly take some action after successful key creation or update. The new hook cannot return an error and cannot cause the operation to be reverted. Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/security.c')
-rw-r--r--security/security.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c
index 3bed660fc950..6c23c620e3c1 100644
--- a/security/security.c
+++ b/security/security.c
@@ -5453,6 +5453,25 @@ int security_key_getsecurity(struct key *key, char **buffer)
*buffer = NULL;
return call_int_hook(key_getsecurity, 0, key, buffer);
}
+
+/**
+ * security_key_post_create_or_update() - Notification of key create or update
+ * @keyring: keyring to which the key is linked to
+ * @key: created or updated key
+ * @payload: data used to instantiate or update the key
+ * @payload_len: length of payload
+ * @flags: key flags
+ * @create: flag indicating whether the key was created or updated
+ *
+ * Notify the caller of a key creation or update.
+ */
+void security_key_post_create_or_update(struct key *keyring, struct key *key,
+ const void *payload, size_t payload_len,
+ unsigned long flags, bool create)
+{
+ call_void_hook(key_post_create_or_update, keyring, key, payload,
+ payload_len, flags, create);
+}
#endif /* CONFIG_KEYS */
#ifdef CONFIG_AUDIT