diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /net/ceph/crypto.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'net/ceph/crypto.c')
-rw-r--r-- | net/ceph/crypto.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index af14cb42516..85f3bc0a706 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c | |||
@@ -15,9 +15,10 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst, | |||
15 | const struct ceph_crypto_key *src) | 15 | const struct ceph_crypto_key *src) |
16 | { | 16 | { |
17 | memcpy(dst, src, sizeof(struct ceph_crypto_key)); | 17 | memcpy(dst, src, sizeof(struct ceph_crypto_key)); |
18 | dst->key = kmemdup(src->key, src->len, GFP_NOFS); | 18 | dst->key = kmalloc(src->len, GFP_NOFS); |
19 | if (!dst->key) | 19 | if (!dst->key) |
20 | return -ENOMEM; | 20 | return -ENOMEM; |
21 | memcpy(dst->key, src->key, src->len); | ||
21 | return 0; | 22 | return 0; |
22 | } | 23 | } |
23 | 24 | ||
@@ -423,15 +424,14 @@ int ceph_encrypt2(struct ceph_crypto_key *secret, void *dst, size_t *dst_len, | |||
423 | } | 424 | } |
424 | } | 425 | } |
425 | 426 | ||
426 | int ceph_key_instantiate(struct key *key, struct key_preparsed_payload *prep) | 427 | int ceph_key_instantiate(struct key *key, const void *data, size_t datalen) |
427 | { | 428 | { |
428 | struct ceph_crypto_key *ckey; | 429 | struct ceph_crypto_key *ckey; |
429 | size_t datalen = prep->datalen; | ||
430 | int ret; | 430 | int ret; |
431 | void *p; | 431 | void *p; |
432 | 432 | ||
433 | ret = -EINVAL; | 433 | ret = -EINVAL; |
434 | if (datalen <= 0 || datalen > 32767 || !prep->data) | 434 | if (datalen <= 0 || datalen > 32767 || !data) |
435 | goto err; | 435 | goto err; |
436 | 436 | ||
437 | ret = key_payload_reserve(key, datalen); | 437 | ret = key_payload_reserve(key, datalen); |
@@ -444,8 +444,8 @@ int ceph_key_instantiate(struct key *key, struct key_preparsed_payload *prep) | |||
444 | goto err; | 444 | goto err; |
445 | 445 | ||
446 | /* TODO ceph_crypto_key_decode should really take const input */ | 446 | /* TODO ceph_crypto_key_decode should really take const input */ |
447 | p = (void *)prep->data; | 447 | p = (void *)data; |
448 | ret = ceph_crypto_key_decode(ckey, &p, (char*)prep->data+datalen); | 448 | ret = ceph_crypto_key_decode(ckey, &p, (char*)data+datalen); |
449 | if (ret < 0) | 449 | if (ret < 0) |
450 | goto err_ckey; | 450 | goto err_ckey; |
451 | 451 | ||
@@ -467,7 +467,6 @@ void ceph_key_destroy(struct key *key) { | |||
467 | struct ceph_crypto_key *ckey = key->payload.data; | 467 | struct ceph_crypto_key *ckey = key->payload.data; |
468 | 468 | ||
469 | ceph_crypto_key_destroy(ckey); | 469 | ceph_crypto_key_destroy(ckey); |
470 | kfree(ckey); | ||
471 | } | 470 | } |
472 | 471 | ||
473 | struct key_type key_type_ceph = { | 472 | struct key_type key_type_ceph = { |