diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/authenc.c | 3 | ||||
-rw-r--r-- | crypto/blkcipher.c | 2 | ||||
-rw-r--r-- | crypto/digest.c | 3 | ||||
-rw-r--r-- | crypto/gcm.c | 3 | ||||
-rw-r--r-- | crypto/internal.h | 29 | ||||
-rw-r--r-- | crypto/scatterwalk.c | 5 | ||||
-rw-r--r-- | crypto/scatterwalk.h | 75 | ||||
-rw-r--r-- | crypto/xcbc.c | 2 |
8 files changed, 8 insertions, 114 deletions
diff --git a/crypto/authenc.c b/crypto/authenc.c index 6c9104ebf2f4..fbbc2b505a21 100644 --- a/crypto/authenc.c +++ b/crypto/authenc.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <crypto/algapi.h> | 13 | #include <crypto/algapi.h> |
14 | #include <crypto/authenc.h> | 14 | #include <crypto/authenc.h> |
15 | #include <crypto/scatterwalk.h> | ||
15 | #include <linux/err.h> | 16 | #include <linux/err.h> |
16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
@@ -20,8 +21,6 @@ | |||
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
21 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
22 | 23 | ||
23 | #include "scatterwalk.h" | ||
24 | |||
25 | struct authenc_instance_ctx { | 24 | struct authenc_instance_ctx { |
26 | struct crypto_spawn auth; | 25 | struct crypto_spawn auth; |
27 | struct crypto_spawn enc; | 26 | struct crypto_spawn enc; |
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 180d91451476..7939504dfd8b 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <crypto/scatterwalk.h> | ||
17 | #include <linux/crypto.h> | 18 | #include <linux/crypto.h> |
18 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
19 | #include <linux/hardirq.h> | 20 | #include <linux/hardirq.h> |
@@ -25,7 +26,6 @@ | |||
25 | #include <linux/string.h> | 26 | #include <linux/string.h> |
26 | 27 | ||
27 | #include "internal.h" | 28 | #include "internal.h" |
28 | #include "scatterwalk.h" | ||
29 | 29 | ||
30 | enum { | 30 | enum { |
31 | BLKCIPHER_WALK_PHYS = 1 << 0, | 31 | BLKCIPHER_WALK_PHYS = 1 << 0, |
diff --git a/crypto/digest.c b/crypto/digest.c index d3e827a141f1..52845f53f8e1 100644 --- a/crypto/digest.c +++ b/crypto/digest.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <crypto/scatterwalk.h> | ||
15 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
16 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
17 | #include <linux/hardirq.h> | 18 | #include <linux/hardirq.h> |
@@ -20,8 +21,6 @@ | |||
20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
21 | #include <linux/scatterlist.h> | 22 | #include <linux/scatterlist.h> |
22 | 23 | ||
23 | #include "internal.h" | ||
24 | |||
25 | static int init(struct hash_desc *desc) | 24 | static int init(struct hash_desc *desc) |
26 | { | 25 | { |
27 | struct crypto_tfm *tfm = crypto_hash_tfm(desc->tfm); | 26 | struct crypto_tfm *tfm = crypto_hash_tfm(desc->tfm); |
diff --git a/crypto/gcm.c b/crypto/gcm.c index d60c340b0b9d..27483f361e80 100644 --- a/crypto/gcm.c +++ b/crypto/gcm.c | |||
@@ -10,13 +10,14 @@ | |||
10 | 10 | ||
11 | #include <crypto/algapi.h> | 11 | #include <crypto/algapi.h> |
12 | #include <crypto/gf128mul.h> | 12 | #include <crypto/gf128mul.h> |
13 | #include <crypto/scatterwalk.h> | ||
13 | #include <linux/err.h> | 14 | #include <linux/err.h> |
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
18 | 19 | ||
19 | #include "scatterwalk.h" | 20 | #include "internal.h" |
20 | 21 | ||
21 | struct gcm_instance_ctx { | 22 | struct gcm_instance_ctx { |
22 | struct crypto_spawn ctr; | 23 | struct crypto_spawn ctr; |
diff --git a/crypto/internal.h b/crypto/internal.h index abb01f71f817..cb13952f82bf 100644 --- a/crypto/internal.h +++ b/crypto/internal.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/notifier.h> | 25 | #include <linux/notifier.h> |
26 | #include <linux/rwsem.h> | 26 | #include <linux/rwsem.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <asm/kmap_types.h> | ||
29 | 28 | ||
30 | /* Crypto notification events. */ | 29 | /* Crypto notification events. */ |
31 | enum { | 30 | enum { |
@@ -50,34 +49,6 @@ extern struct list_head crypto_alg_list; | |||
50 | extern struct rw_semaphore crypto_alg_sem; | 49 | extern struct rw_semaphore crypto_alg_sem; |
51 | extern struct blocking_notifier_head crypto_chain; | 50 | extern struct blocking_notifier_head crypto_chain; |
52 | 51 | ||
53 | static inline enum km_type crypto_kmap_type(int out) | ||
54 | { | ||
55 | enum km_type type; | ||
56 | |||
57 | if (in_softirq()) | ||
58 | type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0; | ||
59 | else | ||
60 | type = out * (KM_USER1 - KM_USER0) + KM_USER0; | ||
61 | |||
62 | return type; | ||
63 | } | ||
64 | |||
65 | static inline void *crypto_kmap(struct page *page, int out) | ||
66 | { | ||
67 | return kmap_atomic(page, crypto_kmap_type(out)); | ||
68 | } | ||
69 | |||
70 | static inline void crypto_kunmap(void *vaddr, int out) | ||
71 | { | ||
72 | kunmap_atomic(vaddr, crypto_kmap_type(out)); | ||
73 | } | ||
74 | |||
75 | static inline void crypto_yield(u32 flags) | ||
76 | { | ||
77 | if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) | ||
78 | cond_resched(); | ||
79 | } | ||
80 | |||
81 | #ifdef CONFIG_PROC_FS | 52 | #ifdef CONFIG_PROC_FS |
82 | void __init crypto_init_proc(void); | 53 | void __init crypto_init_proc(void); |
83 | void __exit crypto_exit_proc(void); | 54 | void __exit crypto_exit_proc(void); |
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index 206c39a97e57..12d19019e178 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | |||
17 | #include <crypto/scatterwalk.h> | ||
16 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
17 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -20,9 +22,6 @@ | |||
20 | #include <linux/highmem.h> | 22 | #include <linux/highmem.h> |
21 | #include <linux/scatterlist.h> | 23 | #include <linux/scatterlist.h> |
22 | 24 | ||
23 | #include "internal.h" | ||
24 | #include "scatterwalk.h" | ||
25 | |||
26 | static inline void memcpy_dir(void *buf, void *sgdata, size_t nbytes, int out) | 25 | static inline void memcpy_dir(void *buf, void *sgdata, size_t nbytes, int out) |
27 | { | 26 | { |
28 | void *src = out ? buf : sgdata; | 27 | void *src = out ? buf : sgdata; |
diff --git a/crypto/scatterwalk.h b/crypto/scatterwalk.h deleted file mode 100644 index fd5517d2a7a9..000000000000 --- a/crypto/scatterwalk.h +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* | ||
2 | * Cryptographic API. | ||
3 | * | ||
4 | * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> | ||
5 | * Copyright (c) 2002 Adam J. Richter <adam@yggdrasil.com> | ||
6 | * Copyright (c) 2004 Jean-Luc Cooke <jlcooke@certainkey.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation; either version 2 of the License, or (at your option) | ||
11 | * any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef _CRYPTO_SCATTERWALK_H | ||
16 | #define _CRYPTO_SCATTERWALK_H | ||
17 | |||
18 | #include <linux/mm.h> | ||
19 | #include <linux/scatterlist.h> | ||
20 | |||
21 | #include "internal.h" | ||
22 | |||
23 | static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in, | ||
24 | struct scatter_walk *walk_out) | ||
25 | { | ||
26 | return !(((sg_page(walk_in->sg) - sg_page(walk_out->sg)) << PAGE_SHIFT) + | ||
27 | (int)(walk_in->offset - walk_out->offset)); | ||
28 | } | ||
29 | |||
30 | static inline unsigned int scatterwalk_pagelen(struct scatter_walk *walk) | ||
31 | { | ||
32 | unsigned int len = walk->sg->offset + walk->sg->length - walk->offset; | ||
33 | unsigned int len_this_page = offset_in_page(~walk->offset) + 1; | ||
34 | return len_this_page > len ? len : len_this_page; | ||
35 | } | ||
36 | |||
37 | static inline unsigned int scatterwalk_clamp(struct scatter_walk *walk, | ||
38 | unsigned int nbytes) | ||
39 | { | ||
40 | unsigned int len_this_page = scatterwalk_pagelen(walk); | ||
41 | return nbytes > len_this_page ? len_this_page : nbytes; | ||
42 | } | ||
43 | |||
44 | static inline void scatterwalk_advance(struct scatter_walk *walk, | ||
45 | unsigned int nbytes) | ||
46 | { | ||
47 | walk->offset += nbytes; | ||
48 | } | ||
49 | |||
50 | static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk, | ||
51 | unsigned int alignmask) | ||
52 | { | ||
53 | return !(walk->offset & alignmask); | ||
54 | } | ||
55 | |||
56 | static inline struct page *scatterwalk_page(struct scatter_walk *walk) | ||
57 | { | ||
58 | return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); | ||
59 | } | ||
60 | |||
61 | static inline void scatterwalk_unmap(void *vaddr, int out) | ||
62 | { | ||
63 | crypto_kunmap(vaddr, out); | ||
64 | } | ||
65 | |||
66 | void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); | ||
67 | void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, | ||
68 | size_t nbytes, int out); | ||
69 | void *scatterwalk_map(struct scatter_walk *walk, int out); | ||
70 | void scatterwalk_done(struct scatter_walk *walk, int out, int more); | ||
71 | |||
72 | void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, | ||
73 | unsigned int start, unsigned int nbytes, int out); | ||
74 | |||
75 | #endif /* _CRYPTO_SCATTERWALK_H */ | ||
diff --git a/crypto/xcbc.c b/crypto/xcbc.c index ac68f3b62fde..789cdeee6b7d 100644 --- a/crypto/xcbc.c +++ b/crypto/xcbc.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * Kazunori Miyazawa <miyazawa@linux-ipv6.org> | 19 | * Kazunori Miyazawa <miyazawa@linux-ipv6.org> |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <crypto/scatterwalk.h> | ||
22 | #include <linux/crypto.h> | 23 | #include <linux/crypto.h> |
23 | #include <linux/err.h> | 24 | #include <linux/err.h> |
24 | #include <linux/hardirq.h> | 25 | #include <linux/hardirq.h> |
@@ -27,7 +28,6 @@ | |||
27 | #include <linux/rtnetlink.h> | 28 | #include <linux/rtnetlink.h> |
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | #include <linux/scatterlist.h> | 30 | #include <linux/scatterlist.h> |
30 | #include "internal.h" | ||
31 | 31 | ||
32 | static u_int32_t ks[12] = {0x01010101, 0x01010101, 0x01010101, 0x01010101, | 32 | static u_int32_t ks[12] = {0x01010101, 0x01010101, 0x01010101, 0x01010101, |
33 | 0x02020202, 0x02020202, 0x02020202, 0x02020202, | 33 | 0x02020202, 0x02020202, 0x02020202, 0x02020202, |