1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * Copyright (C) 2005-2010 IBM Corporation
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Authors:
6*4882a593Smuzhiyun * Mimi Zohar <zohar@us.ibm.com>
7*4882a593Smuzhiyun * Kylene Hall <kjhall@us.ibm.com>
8*4882a593Smuzhiyun *
9*4882a593Smuzhiyun * File: evm_crypto.c
10*4882a593Smuzhiyun * Using root's kernel master key (kmk), calculate the HMAC
11*4882a593Smuzhiyun */
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #include <linux/export.h>
14*4882a593Smuzhiyun #include <linux/crypto.h>
15*4882a593Smuzhiyun #include <linux/xattr.h>
16*4882a593Smuzhiyun #include <linux/evm.h>
17*4882a593Smuzhiyun #include <keys/encrypted-type.h>
18*4882a593Smuzhiyun #include <crypto/hash.h>
19*4882a593Smuzhiyun #include <crypto/hash_info.h>
20*4882a593Smuzhiyun #include "evm.h"
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun #define EVMKEY "evm-key"
23*4882a593Smuzhiyun #define MAX_KEY_SIZE 128
24*4882a593Smuzhiyun static unsigned char evmkey[MAX_KEY_SIZE];
25*4882a593Smuzhiyun static const int evmkey_len = MAX_KEY_SIZE;
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun struct crypto_shash *hmac_tfm;
28*4882a593Smuzhiyun static struct crypto_shash *evm_tfm[HASH_ALGO__LAST];
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun static DEFINE_MUTEX(mutex);
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun #define EVM_SET_KEY_BUSY 0
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun static unsigned long evm_set_key_flags;
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun static const char evm_hmac[] = "hmac(sha1)";
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun /**
39*4882a593Smuzhiyun * evm_set_key() - set EVM HMAC key from the kernel
40*4882a593Smuzhiyun * @key: pointer to a buffer with the key data
41*4882a593Smuzhiyun * @size: length of the key data
42*4882a593Smuzhiyun *
43*4882a593Smuzhiyun * This function allows setting the EVM HMAC key from the kernel
44*4882a593Smuzhiyun * without using the "encrypted" key subsystem keys. It can be used
45*4882a593Smuzhiyun * by the crypto HW kernel module which has its own way of managing
46*4882a593Smuzhiyun * keys.
47*4882a593Smuzhiyun *
48*4882a593Smuzhiyun * key length should be between 32 and 128 bytes long
49*4882a593Smuzhiyun */
evm_set_key(void * key,size_t keylen)50*4882a593Smuzhiyun int evm_set_key(void *key, size_t keylen)
51*4882a593Smuzhiyun {
52*4882a593Smuzhiyun int rc;
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun rc = -EBUSY;
55*4882a593Smuzhiyun if (test_and_set_bit(EVM_SET_KEY_BUSY, &evm_set_key_flags))
56*4882a593Smuzhiyun goto busy;
57*4882a593Smuzhiyun rc = -EINVAL;
58*4882a593Smuzhiyun if (keylen > MAX_KEY_SIZE)
59*4882a593Smuzhiyun goto inval;
60*4882a593Smuzhiyun memcpy(evmkey, key, keylen);
61*4882a593Smuzhiyun evm_initialized |= EVM_INIT_HMAC;
62*4882a593Smuzhiyun pr_info("key initialized\n");
63*4882a593Smuzhiyun return 0;
64*4882a593Smuzhiyun inval:
65*4882a593Smuzhiyun clear_bit(EVM_SET_KEY_BUSY, &evm_set_key_flags);
66*4882a593Smuzhiyun busy:
67*4882a593Smuzhiyun pr_err("key initialization failed\n");
68*4882a593Smuzhiyun return rc;
69*4882a593Smuzhiyun }
70*4882a593Smuzhiyun EXPORT_SYMBOL_GPL(evm_set_key);
71*4882a593Smuzhiyun
init_desc(char type,uint8_t hash_algo)72*4882a593Smuzhiyun static struct shash_desc *init_desc(char type, uint8_t hash_algo)
73*4882a593Smuzhiyun {
74*4882a593Smuzhiyun long rc;
75*4882a593Smuzhiyun const char *algo;
76*4882a593Smuzhiyun struct crypto_shash **tfm, *tmp_tfm;
77*4882a593Smuzhiyun struct shash_desc *desc;
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun if (type == EVM_XATTR_HMAC) {
80*4882a593Smuzhiyun if (!(evm_initialized & EVM_INIT_HMAC)) {
81*4882a593Smuzhiyun pr_err_once("HMAC key is not set\n");
82*4882a593Smuzhiyun return ERR_PTR(-ENOKEY);
83*4882a593Smuzhiyun }
84*4882a593Smuzhiyun tfm = &hmac_tfm;
85*4882a593Smuzhiyun algo = evm_hmac;
86*4882a593Smuzhiyun } else {
87*4882a593Smuzhiyun if (hash_algo >= HASH_ALGO__LAST)
88*4882a593Smuzhiyun return ERR_PTR(-EINVAL);
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun tfm = &evm_tfm[hash_algo];
91*4882a593Smuzhiyun algo = hash_algo_name[hash_algo];
92*4882a593Smuzhiyun }
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun if (*tfm)
95*4882a593Smuzhiyun goto alloc;
96*4882a593Smuzhiyun mutex_lock(&mutex);
97*4882a593Smuzhiyun if (*tfm)
98*4882a593Smuzhiyun goto unlock;
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun tmp_tfm = crypto_alloc_shash(algo, 0, CRYPTO_NOLOAD);
101*4882a593Smuzhiyun if (IS_ERR(tmp_tfm)) {
102*4882a593Smuzhiyun pr_err("Can not allocate %s (reason: %ld)\n", algo,
103*4882a593Smuzhiyun PTR_ERR(tmp_tfm));
104*4882a593Smuzhiyun mutex_unlock(&mutex);
105*4882a593Smuzhiyun return ERR_CAST(tmp_tfm);
106*4882a593Smuzhiyun }
107*4882a593Smuzhiyun if (type == EVM_XATTR_HMAC) {
108*4882a593Smuzhiyun rc = crypto_shash_setkey(tmp_tfm, evmkey, evmkey_len);
109*4882a593Smuzhiyun if (rc) {
110*4882a593Smuzhiyun crypto_free_shash(tmp_tfm);
111*4882a593Smuzhiyun mutex_unlock(&mutex);
112*4882a593Smuzhiyun return ERR_PTR(rc);
113*4882a593Smuzhiyun }
114*4882a593Smuzhiyun }
115*4882a593Smuzhiyun *tfm = tmp_tfm;
116*4882a593Smuzhiyun unlock:
117*4882a593Smuzhiyun mutex_unlock(&mutex);
118*4882a593Smuzhiyun alloc:
119*4882a593Smuzhiyun desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(*tfm),
120*4882a593Smuzhiyun GFP_KERNEL);
121*4882a593Smuzhiyun if (!desc)
122*4882a593Smuzhiyun return ERR_PTR(-ENOMEM);
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun desc->tfm = *tfm;
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun rc = crypto_shash_init(desc);
127*4882a593Smuzhiyun if (rc) {
128*4882a593Smuzhiyun kfree(desc);
129*4882a593Smuzhiyun return ERR_PTR(rc);
130*4882a593Smuzhiyun }
131*4882a593Smuzhiyun return desc;
132*4882a593Smuzhiyun }
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun /* Protect against 'cutting & pasting' security.evm xattr, include inode
135*4882a593Smuzhiyun * specific info.
136*4882a593Smuzhiyun *
137*4882a593Smuzhiyun * (Additional directory/file metadata needs to be added for more complete
138*4882a593Smuzhiyun * protection.)
139*4882a593Smuzhiyun */
hmac_add_misc(struct shash_desc * desc,struct inode * inode,char type,char * digest)140*4882a593Smuzhiyun static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
141*4882a593Smuzhiyun char type, char *digest)
142*4882a593Smuzhiyun {
143*4882a593Smuzhiyun struct h_misc {
144*4882a593Smuzhiyun unsigned long ino;
145*4882a593Smuzhiyun __u32 generation;
146*4882a593Smuzhiyun uid_t uid;
147*4882a593Smuzhiyun gid_t gid;
148*4882a593Smuzhiyun umode_t mode;
149*4882a593Smuzhiyun } hmac_misc;
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun memset(&hmac_misc, 0, sizeof(hmac_misc));
152*4882a593Smuzhiyun /* Don't include the inode or generation number in portable
153*4882a593Smuzhiyun * signatures
154*4882a593Smuzhiyun */
155*4882a593Smuzhiyun if (type != EVM_XATTR_PORTABLE_DIGSIG) {
156*4882a593Smuzhiyun hmac_misc.ino = inode->i_ino;
157*4882a593Smuzhiyun hmac_misc.generation = inode->i_generation;
158*4882a593Smuzhiyun }
159*4882a593Smuzhiyun /* The hmac uid and gid must be encoded in the initial user
160*4882a593Smuzhiyun * namespace (not the filesystems user namespace) as encoding
161*4882a593Smuzhiyun * them in the filesystems user namespace allows an attack
162*4882a593Smuzhiyun * where first they are written in an unprivileged fuse mount
163*4882a593Smuzhiyun * of a filesystem and then the system is tricked to mount the
164*4882a593Smuzhiyun * filesystem for real on next boot and trust it because
165*4882a593Smuzhiyun * everything is signed.
166*4882a593Smuzhiyun */
167*4882a593Smuzhiyun hmac_misc.uid = from_kuid(&init_user_ns, inode->i_uid);
168*4882a593Smuzhiyun hmac_misc.gid = from_kgid(&init_user_ns, inode->i_gid);
169*4882a593Smuzhiyun hmac_misc.mode = inode->i_mode;
170*4882a593Smuzhiyun crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
171*4882a593Smuzhiyun if ((evm_hmac_attrs & EVM_ATTR_FSUUID) &&
172*4882a593Smuzhiyun type != EVM_XATTR_PORTABLE_DIGSIG)
173*4882a593Smuzhiyun crypto_shash_update(desc, (u8 *)&inode->i_sb->s_uuid, UUID_SIZE);
174*4882a593Smuzhiyun crypto_shash_final(desc, digest);
175*4882a593Smuzhiyun }
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun /*
178*4882a593Smuzhiyun * Calculate the HMAC value across the set of protected security xattrs.
179*4882a593Smuzhiyun *
180*4882a593Smuzhiyun * Instead of retrieving the requested xattr, for performance, calculate
181*4882a593Smuzhiyun * the hmac using the requested xattr value. Don't alloc/free memory for
182*4882a593Smuzhiyun * each xattr, but attempt to re-use the previously allocated memory.
183*4882a593Smuzhiyun */
evm_calc_hmac_or_hash(struct dentry * dentry,const char * req_xattr_name,const char * req_xattr_value,size_t req_xattr_value_len,uint8_t type,struct evm_digest * data)184*4882a593Smuzhiyun static int evm_calc_hmac_or_hash(struct dentry *dentry,
185*4882a593Smuzhiyun const char *req_xattr_name,
186*4882a593Smuzhiyun const char *req_xattr_value,
187*4882a593Smuzhiyun size_t req_xattr_value_len,
188*4882a593Smuzhiyun uint8_t type, struct evm_digest *data)
189*4882a593Smuzhiyun {
190*4882a593Smuzhiyun struct inode *inode = d_backing_inode(dentry);
191*4882a593Smuzhiyun struct xattr_list *xattr;
192*4882a593Smuzhiyun struct shash_desc *desc;
193*4882a593Smuzhiyun size_t xattr_size = 0;
194*4882a593Smuzhiyun char *xattr_value = NULL;
195*4882a593Smuzhiyun int error;
196*4882a593Smuzhiyun int size;
197*4882a593Smuzhiyun bool ima_present = false;
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun if (!(inode->i_opflags & IOP_XATTR) ||
200*4882a593Smuzhiyun inode->i_sb->s_user_ns != &init_user_ns)
201*4882a593Smuzhiyun return -EOPNOTSUPP;
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun desc = init_desc(type, data->hdr.algo);
204*4882a593Smuzhiyun if (IS_ERR(desc))
205*4882a593Smuzhiyun return PTR_ERR(desc);
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun data->hdr.length = crypto_shash_digestsize(desc->tfm);
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun error = -ENODATA;
210*4882a593Smuzhiyun list_for_each_entry_lockless(xattr, &evm_config_xattrnames, list) {
211*4882a593Smuzhiyun bool is_ima = false;
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun if (strcmp(xattr->name, XATTR_NAME_IMA) == 0)
214*4882a593Smuzhiyun is_ima = true;
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun if ((req_xattr_name && req_xattr_value)
217*4882a593Smuzhiyun && !strcmp(xattr->name, req_xattr_name)) {
218*4882a593Smuzhiyun error = 0;
219*4882a593Smuzhiyun crypto_shash_update(desc, (const u8 *)req_xattr_value,
220*4882a593Smuzhiyun req_xattr_value_len);
221*4882a593Smuzhiyun if (is_ima)
222*4882a593Smuzhiyun ima_present = true;
223*4882a593Smuzhiyun continue;
224*4882a593Smuzhiyun }
225*4882a593Smuzhiyun size = vfs_getxattr_alloc(dentry, xattr->name,
226*4882a593Smuzhiyun &xattr_value, xattr_size, GFP_NOFS);
227*4882a593Smuzhiyun if (size == -ENOMEM) {
228*4882a593Smuzhiyun error = -ENOMEM;
229*4882a593Smuzhiyun goto out;
230*4882a593Smuzhiyun }
231*4882a593Smuzhiyun if (size < 0)
232*4882a593Smuzhiyun continue;
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun error = 0;
235*4882a593Smuzhiyun xattr_size = size;
236*4882a593Smuzhiyun crypto_shash_update(desc, (const u8 *)xattr_value, xattr_size);
237*4882a593Smuzhiyun if (is_ima)
238*4882a593Smuzhiyun ima_present = true;
239*4882a593Smuzhiyun }
240*4882a593Smuzhiyun hmac_add_misc(desc, inode, type, data->digest);
241*4882a593Smuzhiyun
242*4882a593Smuzhiyun /* Portable EVM signatures must include an IMA hash */
243*4882a593Smuzhiyun if (type == EVM_XATTR_PORTABLE_DIGSIG && !ima_present)
244*4882a593Smuzhiyun error = -EPERM;
245*4882a593Smuzhiyun out:
246*4882a593Smuzhiyun kfree(xattr_value);
247*4882a593Smuzhiyun kfree(desc);
248*4882a593Smuzhiyun return error;
249*4882a593Smuzhiyun }
250*4882a593Smuzhiyun
evm_calc_hmac(struct dentry * dentry,const char * req_xattr_name,const char * req_xattr_value,size_t req_xattr_value_len,struct evm_digest * data)251*4882a593Smuzhiyun int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name,
252*4882a593Smuzhiyun const char *req_xattr_value, size_t req_xattr_value_len,
253*4882a593Smuzhiyun struct evm_digest *data)
254*4882a593Smuzhiyun {
255*4882a593Smuzhiyun return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value,
256*4882a593Smuzhiyun req_xattr_value_len, EVM_XATTR_HMAC, data);
257*4882a593Smuzhiyun }
258*4882a593Smuzhiyun
evm_calc_hash(struct dentry * dentry,const char * req_xattr_name,const char * req_xattr_value,size_t req_xattr_value_len,char type,struct evm_digest * data)259*4882a593Smuzhiyun int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
260*4882a593Smuzhiyun const char *req_xattr_value, size_t req_xattr_value_len,
261*4882a593Smuzhiyun char type, struct evm_digest *data)
262*4882a593Smuzhiyun {
263*4882a593Smuzhiyun return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value,
264*4882a593Smuzhiyun req_xattr_value_len, type, data);
265*4882a593Smuzhiyun }
266*4882a593Smuzhiyun
evm_is_immutable(struct dentry * dentry,struct inode * inode)267*4882a593Smuzhiyun static int evm_is_immutable(struct dentry *dentry, struct inode *inode)
268*4882a593Smuzhiyun {
269*4882a593Smuzhiyun const struct evm_ima_xattr_data *xattr_data = NULL;
270*4882a593Smuzhiyun struct integrity_iint_cache *iint;
271*4882a593Smuzhiyun int rc = 0;
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun iint = integrity_iint_find(inode);
274*4882a593Smuzhiyun if (iint && (iint->flags & EVM_IMMUTABLE_DIGSIG))
275*4882a593Smuzhiyun return 1;
276*4882a593Smuzhiyun
277*4882a593Smuzhiyun /* Do this the hard way */
278*4882a593Smuzhiyun rc = vfs_getxattr_alloc(dentry, XATTR_NAME_EVM, (char **)&xattr_data, 0,
279*4882a593Smuzhiyun GFP_NOFS);
280*4882a593Smuzhiyun if (rc <= 0) {
281*4882a593Smuzhiyun if (rc == -ENODATA)
282*4882a593Smuzhiyun return 0;
283*4882a593Smuzhiyun return rc;
284*4882a593Smuzhiyun }
285*4882a593Smuzhiyun if (xattr_data->type == EVM_XATTR_PORTABLE_DIGSIG)
286*4882a593Smuzhiyun rc = 1;
287*4882a593Smuzhiyun else
288*4882a593Smuzhiyun rc = 0;
289*4882a593Smuzhiyun
290*4882a593Smuzhiyun kfree(xattr_data);
291*4882a593Smuzhiyun return rc;
292*4882a593Smuzhiyun }
293*4882a593Smuzhiyun
294*4882a593Smuzhiyun
295*4882a593Smuzhiyun /*
296*4882a593Smuzhiyun * Calculate the hmac and update security.evm xattr
297*4882a593Smuzhiyun *
298*4882a593Smuzhiyun * Expects to be called with i_mutex locked.
299*4882a593Smuzhiyun */
evm_update_evmxattr(struct dentry * dentry,const char * xattr_name,const char * xattr_value,size_t xattr_value_len)300*4882a593Smuzhiyun int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name,
301*4882a593Smuzhiyun const char *xattr_value, size_t xattr_value_len)
302*4882a593Smuzhiyun {
303*4882a593Smuzhiyun struct inode *inode = d_backing_inode(dentry);
304*4882a593Smuzhiyun struct evm_digest data;
305*4882a593Smuzhiyun int rc = 0;
306*4882a593Smuzhiyun
307*4882a593Smuzhiyun /*
308*4882a593Smuzhiyun * Don't permit any transformation of the EVM xattr if the signature
309*4882a593Smuzhiyun * is of an immutable type
310*4882a593Smuzhiyun */
311*4882a593Smuzhiyun rc = evm_is_immutable(dentry, inode);
312*4882a593Smuzhiyun if (rc < 0)
313*4882a593Smuzhiyun return rc;
314*4882a593Smuzhiyun if (rc)
315*4882a593Smuzhiyun return -EPERM;
316*4882a593Smuzhiyun
317*4882a593Smuzhiyun data.hdr.algo = HASH_ALGO_SHA1;
318*4882a593Smuzhiyun rc = evm_calc_hmac(dentry, xattr_name, xattr_value,
319*4882a593Smuzhiyun xattr_value_len, &data);
320*4882a593Smuzhiyun if (rc == 0) {
321*4882a593Smuzhiyun data.hdr.xattr.sha1.type = EVM_XATTR_HMAC;
322*4882a593Smuzhiyun rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM,
323*4882a593Smuzhiyun &data.hdr.xattr.data[1],
324*4882a593Smuzhiyun SHA1_DIGEST_SIZE + 1, 0);
325*4882a593Smuzhiyun } else if (rc == -ENODATA && (inode->i_opflags & IOP_XATTR)) {
326*4882a593Smuzhiyun rc = __vfs_removexattr(dentry, XATTR_NAME_EVM);
327*4882a593Smuzhiyun }
328*4882a593Smuzhiyun return rc;
329*4882a593Smuzhiyun }
330*4882a593Smuzhiyun
evm_init_hmac(struct inode * inode,const struct xattr * lsm_xattr,char * hmac_val)331*4882a593Smuzhiyun int evm_init_hmac(struct inode *inode, const struct xattr *lsm_xattr,
332*4882a593Smuzhiyun char *hmac_val)
333*4882a593Smuzhiyun {
334*4882a593Smuzhiyun struct shash_desc *desc;
335*4882a593Smuzhiyun
336*4882a593Smuzhiyun desc = init_desc(EVM_XATTR_HMAC, HASH_ALGO_SHA1);
337*4882a593Smuzhiyun if (IS_ERR(desc)) {
338*4882a593Smuzhiyun pr_info("init_desc failed\n");
339*4882a593Smuzhiyun return PTR_ERR(desc);
340*4882a593Smuzhiyun }
341*4882a593Smuzhiyun
342*4882a593Smuzhiyun crypto_shash_update(desc, lsm_xattr->value, lsm_xattr->value_len);
343*4882a593Smuzhiyun hmac_add_misc(desc, inode, EVM_XATTR_HMAC, hmac_val);
344*4882a593Smuzhiyun kfree(desc);
345*4882a593Smuzhiyun return 0;
346*4882a593Smuzhiyun }
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun /*
349*4882a593Smuzhiyun * Get the key from the TPM for the SHA1-HMAC
350*4882a593Smuzhiyun */
evm_init_key(void)351*4882a593Smuzhiyun int evm_init_key(void)
352*4882a593Smuzhiyun {
353*4882a593Smuzhiyun struct key *evm_key;
354*4882a593Smuzhiyun struct encrypted_key_payload *ekp;
355*4882a593Smuzhiyun int rc;
356*4882a593Smuzhiyun
357*4882a593Smuzhiyun evm_key = request_key(&key_type_encrypted, EVMKEY, NULL);
358*4882a593Smuzhiyun if (IS_ERR(evm_key))
359*4882a593Smuzhiyun return -ENOENT;
360*4882a593Smuzhiyun
361*4882a593Smuzhiyun down_read(&evm_key->sem);
362*4882a593Smuzhiyun ekp = evm_key->payload.data[0];
363*4882a593Smuzhiyun
364*4882a593Smuzhiyun rc = evm_set_key(ekp->decrypted_data, ekp->decrypted_datalen);
365*4882a593Smuzhiyun
366*4882a593Smuzhiyun /* burn the original key contents */
367*4882a593Smuzhiyun memset(ekp->decrypted_data, 0, ekp->decrypted_datalen);
368*4882a593Smuzhiyun up_read(&evm_key->sem);
369*4882a593Smuzhiyun key_put(evm_key);
370*4882a593Smuzhiyun return rc;
371*4882a593Smuzhiyun }
372