summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Crowley <paulcrowley@google.com>2015-07-06 16:54:28 +0100
committerPaul Crowley <paulcrowley@google.com>2015-07-09 18:09:17 +0100
commit31654044064d5bac0dd57c495ad43afb7573c393 (patch)
tree7ac0d3d72d13102b4a184e60488adb857b0ea36f
parente92c682fb37a21a38406281f3038c5168fd26b3e (diff)
downloadextras-31654044064d5bac0dd57c495ad43afb7573c393.tar.gz
Add keyctl_revoke
Change-Id: If63f439d831aa384acd45fde98312923f9c2e561
-rw-r--r--ext4_utils/key_control.cpp7
-rw-r--r--ext4_utils/key_control.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/ext4_utils/key_control.cpp b/ext4_utils/key_control.cpp
index 3d775b7f..39bd1401 100644
--- a/ext4_utils/key_control.cpp
+++ b/ext4_utils/key_control.cpp
@@ -5,8 +5,8 @@
#include <sys/syscall.h>
/* keyring keyctl commands */
+#define KEYCTL_REVOKE 3 /* revoke a key */
#define KEYCTL_SETPERM 5 /* set permissions for a key in a keyring */
-#define KEYCTL_UNLINK 9 /* unlink a key from a keyring */
#define KEYCTL_SEARCH 10 /* search for a key in a keyring */
static long keyctl(int cmd, ...)
@@ -32,6 +32,11 @@ key_serial_t add_key(const char *type,
return syscall(__NR_add_key, type, description, payload, plen, ringid);
}
+long keyctl_revoke(key_serial_t id)
+{
+ return keyctl(KEYCTL_REVOKE, id);
+}
+
long keyctl_setperm(key_serial_t id, int permissions)
{
return keyctl(KEYCTL_SETPERM, id, permissions);
diff --git a/ext4_utils/key_control.h b/ext4_utils/key_control.h
index 8e6e32ba..bbf0acec 100644
--- a/ext4_utils/key_control.h
+++ b/ext4_utils/key_control.h
@@ -21,6 +21,8 @@ key_serial_t add_key(const char *type,
size_t plen,
key_serial_t ringid);
+long keyctl_revoke(key_serial_t id);
+
long keyctl_setperm(key_serial_t id, int permissions);
long keyctl_search(key_serial_t ringid, const char *type,