summaryrefslogtreecommitdiff
path: root/net/ceph/crypto.c
diff options
context:
space:
mode:
authorTommi Virtanen <tommi.virtanen@dreamhost.com>2011-03-25 16:32:57 -0700
committerSage Weil <sage@newdream.net>2011-03-29 12:11:16 -0700
commit8323c3aa74cd92465350294567142d12ffdcc963 (patch)
tree052e7374393994eea8d534f98ee1bc7acea4c2d9 /net/ceph/crypto.c
parentfbdb9190482fd83a3eb20cdeb0da454759f479d7 (diff)
ceph: Move secret key parsing earlier.
This makes the base64 logic be contained in mount option parsing, and prepares us for replacing the homebew key management with the kernel key retention service. Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph/crypto.c')
-rw-r--r--net/ceph/crypto.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index 7b505b0c983..75f0893fa11 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -9,6 +9,17 @@
#include <linux/ceph/decode.h>
#include "crypto.h"
+int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
+ const struct ceph_crypto_key *src)
+{
+ memcpy(dst, src, sizeof(struct ceph_crypto_key));
+ dst->key = kmalloc(src->len, GFP_NOFS);
+ if (!dst->key)
+ return -ENOMEM;
+ memcpy(dst->key, src->key, src->len);
+ return 0;
+}
+
int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end)
{
if (*p + sizeof(u16) + sizeof(key->created) +