aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/authenc.c3
-rw-r--r--crypto/blkcipher.c2
-rw-r--r--crypto/digest.c3
-rw-r--r--crypto/gcm.c3
-rw-r--r--crypto/internal.h29
-rw-r--r--crypto/scatterwalk.c5
-rw-r--r--crypto/xcbc.c2
-rw-r--r--include/crypto/scatterwalk.h (renamed from crypto/scatterwalk.h)36
8 files changed, 42 insertions, 41 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
25struct authenc_instance_ctx { 24struct 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
30enum { 30enum {
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
25static int init(struct hash_desc *desc) 24static 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
21struct gcm_instance_ctx { 22struct 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. */
31enum { 30enum {
@@ -50,34 +49,6 @@ extern struct list_head crypto_alg_list;
50extern struct rw_semaphore crypto_alg_sem; 49extern struct rw_semaphore crypto_alg_sem;
51extern struct blocking_notifier_head crypto_chain; 50extern struct blocking_notifier_head crypto_chain;
52 51
53static 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
65static inline void *crypto_kmap(struct page *page, int out)
66{
67 return kmap_atomic(page, crypto_kmap_type(out));
68}
69
70static inline void crypto_kunmap(void *vaddr, int out)
71{
72 kunmap_atomic(vaddr, crypto_kmap_type(out));
73}
74
75static 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
82void __init crypto_init_proc(void); 53void __init crypto_init_proc(void);
83void __exit crypto_exit_proc(void); 54void __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
26static inline void memcpy_dir(void *buf, void *sgdata, size_t nbytes, int out) 25static 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/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
32static u_int32_t ks[12] = {0x01010101, 0x01010101, 0x01010101, 0x01010101, 32static u_int32_t ks[12] = {0x01010101, 0x01010101, 0x01010101, 0x01010101,
33 0x02020202, 0x02020202, 0x02020202, 0x02020202, 33 0x02020202, 0x02020202, 0x02020202, 0x02020202,
diff --git a/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index fd5517d2a7a9..07b6f17122d2 100644
--- a/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -1,9 +1,10 @@
1/* 1/*
2 * Cryptographic API. 2 * Cryptographic scatter and gather helpers.
3 * 3 *
4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> 4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
5 * Copyright (c) 2002 Adam J. Richter <adam@yggdrasil.com> 5 * Copyright (c) 2002 Adam J. Richter <adam@yggdrasil.com>
6 * Copyright (c) 2004 Jean-Luc Cooke <jlcooke@certainkey.com> 6 * Copyright (c) 2004 Jean-Luc Cooke <jlcooke@certainkey.com>
7 * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify it 9 * 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 * under the terms of the GNU General Public License as published by the Free
@@ -15,10 +16,41 @@
15#ifndef _CRYPTO_SCATTERWALK_H 16#ifndef _CRYPTO_SCATTERWALK_H
16#define _CRYPTO_SCATTERWALK_H 17#define _CRYPTO_SCATTERWALK_H
17 18
19#include <asm/kmap_types.h>
20#include <crypto/algapi.h>
21#include <linux/hardirq.h>
22#include <linux/highmem.h>
23#include <linux/kernel.h>
18#include <linux/mm.h> 24#include <linux/mm.h>
19#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
20 26
21#include "internal.h" 27static inline enum km_type crypto_kmap_type(int out)
28{
29 enum km_type type;
30
31 if (in_softirq())
32 type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0;
33 else
34 type = out * (KM_USER1 - KM_USER0) + KM_USER0;
35
36 return type;
37}
38
39static inline void *crypto_kmap(struct page *page, int out)
40{
41 return kmap_atomic(page, crypto_kmap_type(out));
42}
43
44static inline void crypto_kunmap(void *vaddr, int out)
45{
46 kunmap_atomic(vaddr, crypto_kmap_type(out));
47}
48
49static inline void crypto_yield(u32 flags)
50{
51 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
52 cond_resched();
53}
22 54
23static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in, 55static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in,
24 struct scatter_walk *walk_out) 56 struct scatter_walk *walk_out)