Lines Matching refs:key

19 	dst->key = kmemdup(src->key, src->len, GFP_NOFS);  in ceph_crypto_key_clone()
20 if (!dst->key) in ceph_crypto_key_clone()
25 int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end) in ceph_crypto_key_encode() argument
27 if (*p + sizeof(u16) + sizeof(key->created) + in ceph_crypto_key_encode()
28 sizeof(u16) + key->len > end) in ceph_crypto_key_encode()
30 ceph_encode_16(p, key->type); in ceph_crypto_key_encode()
31 ceph_encode_copy(p, &key->created, sizeof(key->created)); in ceph_crypto_key_encode()
32 ceph_encode_16(p, key->len); in ceph_crypto_key_encode()
33 ceph_encode_copy(p, key->key, key->len); in ceph_crypto_key_encode()
37 int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end) in ceph_crypto_key_decode() argument
39 ceph_decode_need(p, end, 2*sizeof(u16) + sizeof(key->created), bad); in ceph_crypto_key_decode()
40 key->type = ceph_decode_16(p); in ceph_crypto_key_decode()
41 ceph_decode_copy(p, &key->created, sizeof(key->created)); in ceph_crypto_key_decode()
42 key->len = ceph_decode_16(p); in ceph_crypto_key_decode()
43 ceph_decode_need(p, end, key->len, bad); in ceph_crypto_key_decode()
44 key->key = kmalloc(key->len, GFP_NOFS); in ceph_crypto_key_decode()
45 if (!key->key) in ceph_crypto_key_decode()
47 ceph_decode_copy(p, key->key, key->len); in ceph_crypto_key_decode()
55 int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *inkey) in ceph_crypto_key_unarmor() argument
73 ret = ceph_crypto_key_decode(key, &p, p + blen); in ceph_crypto_key_unarmor()
77 dout("crypto_key_unarmor key %p type %d len %d\n", key, in ceph_crypto_key_unarmor()
78 key->type, key->len); in ceph_crypto_key_unarmor()
159 static int ceph_aes_encrypt(const void *key, int key_len, in ceph_aes_encrypt() argument
187 crypto_blkcipher_setkey((void *)tfm, key, key_len); in ceph_aes_encrypt()
218 static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, in ceph_aes_encrypt2() argument
248 crypto_blkcipher_setkey((void *)tfm, key, key_len); in ceph_aes_encrypt2()
281 static int ceph_aes_decrypt(const void *key, int key_len, in ceph_aes_decrypt() argument
305 crypto_blkcipher_setkey((void *)tfm, key, key_len); in ceph_aes_decrypt()
345 static int ceph_aes_decrypt2(const void *key, int key_len, in ceph_aes_decrypt2() argument
371 crypto_blkcipher_setkey((void *)tfm, key, key_len); in ceph_aes_decrypt2()
435 return ceph_aes_decrypt(secret->key, secret->len, dst, in ceph_decrypt()
467 return ceph_aes_decrypt2(secret->key, secret->len, in ceph_decrypt2()
488 return ceph_aes_encrypt(secret->key, secret->len, dst, in ceph_encrypt()
510 return ceph_aes_encrypt2(secret->key, secret->len, dst, dst_len, in ceph_encrypt2()
557 static void ceph_key_destroy(struct key *key) in ceph_key_destroy() argument
559 struct ceph_crypto_key *ckey = key->payload.data[0]; in ceph_key_destroy()