diff options
| author | Dmitry Kasatkin <dmitry.kasatkin@huawei.com> | 2015-10-22 14:26:32 -0400 |
|---|---|---|
| committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2015-12-15 08:53:36 -0500 |
| commit | 7626676320f398980a6bb4490fd58e924c888f6a (patch) | |
| tree | bb852548419b70be34dc7f32765d70bd94cd8bbb /include/linux/evm.h | |
| parent | 26ddabfe96bb7468763c9c92791404d991b16250 (diff) | |
evm: provide a function to set the EVM key from the kernel
A crypto HW kernel module can possibly initialize the EVM key from the
kernel __init code to enable EVM before calling the 'init' process.
This patch provides a function evm_set_key() to set the EVM key
directly without using the KEY subsystem.
Changes in v4:
* kernel-doc style for evm_set_key
Changes in v3:
* error reporting moved to evm_set_key
* EVM_INIT_HMAC moved to evm_set_key
* added bitop to prevent key setting race
Changes in v2:
* use size_t for key size instead of signed int
* provide EVM_MAX_KEY_SIZE macro in <linux/evm.h>
* provide EVM_MIN_KEY_SIZE macro in <linux/evm.h>
Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/evm.h')
| -rw-r--r-- | include/linux/evm.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/evm.h b/include/linux/evm.h index 1fcb88ca88de..35ed9a8a403a 100644 --- a/include/linux/evm.h +++ b/include/linux/evm.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | struct integrity_iint_cache; | 14 | struct integrity_iint_cache; |
| 15 | 15 | ||
| 16 | #ifdef CONFIG_EVM | 16 | #ifdef CONFIG_EVM |
| 17 | extern int evm_set_key(void *key, size_t keylen); | ||
| 17 | extern enum integrity_status evm_verifyxattr(struct dentry *dentry, | 18 | extern enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 18 | const char *xattr_name, | 19 | const char *xattr_name, |
| 19 | void *xattr_value, | 20 | void *xattr_value, |
| @@ -42,6 +43,12 @@ static inline int posix_xattr_acl(const char *xattrname) | |||
| 42 | } | 43 | } |
| 43 | #endif | 44 | #endif |
| 44 | #else | 45 | #else |
| 46 | |||
| 47 | static inline int evm_set_key(void *key, size_t keylen) | ||
| 48 | { | ||
| 49 | return -EOPNOTSUPP; | ||
| 50 | } | ||
| 51 | |||
| 45 | #ifdef CONFIG_INTEGRITY | 52 | #ifdef CONFIG_INTEGRITY |
| 46 | static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, | 53 | static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 47 | const char *xattr_name, | 54 | const char *xattr_name, |
