diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 11:38:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 11:38:25 -0500 |
commit | eba0e319c12fb098d66316a8eafbaaa9174a07c3 (patch) | |
tree | b2703117db9e36bb3510654efd55361f61c54742 /crypto/scatterwalk.c | |
parent | df8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (diff) | |
parent | 15e7b4452b72ae890f2fcb027b4c4fa63a1c9a7a (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (125 commits)
[CRYPTO] twofish: Merge common glue code
[CRYPTO] hifn_795x: Fixup container_of() usage
[CRYPTO] cast6: inline bloat--
[CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long
[CRYPTO] tcrypt: Make xcbc available as a standalone test
[CRYPTO] xcbc: Remove bogus hash/cipher test
[CRYPTO] xcbc: Fix algorithm leak when block size check fails
[CRYPTO] tcrypt: Zero axbuf in the right function
[CRYPTO] padlock: Only reset the key once for each CBC and ECB operation
[CRYPTO] api: Include sched.h for cond_resched in scatterwalk.h
[CRYPTO] salsa20-asm: Remove unnecessary dependency on CRYPTO_SALSA20
[CRYPTO] tcrypt: Add select of AEAD
[CRYPTO] salsa20: Add x86-64 assembly version
[CRYPTO] salsa20_i586: Salsa20 stream cipher algorithm (i586 version)
[CRYPTO] gcm: Introduce rfc4106
[CRYPTO] api: Show async type
[CRYPTO] chainiv: Avoid lock spinning where possible
[CRYPTO] seqiv: Add select AEAD in Kconfig
[CRYPTO] scatterwalk: Handle zero nbytes in scatterwalk_map_and_copy
[CRYPTO] null: Allow setkey on digest_null
...
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r-- | crypto/scatterwalk.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index b9bbda0bb9f9..9aeeb52004a5 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; |
@@ -106,6 +105,9 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, | |||
106 | struct scatter_walk walk; | 105 | struct scatter_walk walk; |
107 | unsigned int offset = 0; | 106 | unsigned int offset = 0; |
108 | 107 | ||
108 | if (!nbytes) | ||
109 | return; | ||
110 | |||
109 | for (;;) { | 111 | for (;;) { |
110 | scatterwalk_start(&walk, sg); | 112 | scatterwalk_start(&walk, sg); |
111 | 113 | ||
@@ -113,7 +115,7 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, | |||
113 | break; | 115 | break; |
114 | 116 | ||
115 | offset += sg->length; | 117 | offset += sg->length; |
116 | sg = sg_next(sg); | 118 | sg = scatterwalk_sg_next(sg); |
117 | } | 119 | } |
118 | 120 | ||
119 | scatterwalk_advance(&walk, start - offset); | 121 | scatterwalk_advance(&walk, start - offset); |