aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-10-13 09:43:54 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-10-13 09:43:54 -0400
commitb160292cc216a50fd0cd386b0bda2cd48352c73b (patch)
treeef07cf98f91353ee4c9ec1e1ca7a2a5d9d4b538a /crypto
parentb37bde147890c8fea8369a5a4e230dabdea4ebfb (diff)
parentbbf25010f1a6b761914430f5fca081ec8c7accd1 (diff)
Merge Linux 2.6.23
Diffstat (limited to 'crypto')
-rw-r--r--crypto/async_tx/async_tx.c12
-rw-r--r--crypto/blkcipher.c11
2 files changed, 17 insertions, 6 deletions
diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c
index 035007145e78..bc18cbb8ea79 100644
--- a/crypto/async_tx/async_tx.c
+++ b/crypto/async_tx/async_tx.c
@@ -80,6 +80,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
80{ 80{
81 enum dma_status status; 81 enum dma_status status;
82 struct dma_async_tx_descriptor *iter; 82 struct dma_async_tx_descriptor *iter;
83 struct dma_async_tx_descriptor *parent;
83 84
84 if (!tx) 85 if (!tx)
85 return DMA_SUCCESS; 86 return DMA_SUCCESS;
@@ -87,8 +88,15 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
87 /* poll through the dependency chain, return when tx is complete */ 88 /* poll through the dependency chain, return when tx is complete */
88 do { 89 do {
89 iter = tx; 90 iter = tx;
90 while (iter->cookie == -EBUSY) 91
91 iter = iter->parent; 92 /* find the root of the unsubmitted dependency chain */
93 while (iter->cookie == -EBUSY) {
94 parent = iter->parent;
95 if (parent && parent->cookie == -EBUSY)
96 iter = iter->parent;
97 else
98 break;
99 }
92 100
93 status = dma_sync_wait(iter->chan, iter->cookie); 101 status = dma_sync_wait(iter->chan, iter->cookie);
94 } while (status == DMA_IN_PROGRESS || (iter != tx)); 102 } while (status == DMA_IN_PROGRESS || (iter != tx));
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index 7755834b8846..d8f8ec320213 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -59,11 +59,13 @@ static inline void blkcipher_unmap_dst(struct blkcipher_walk *walk)
59 scatterwalk_unmap(walk->dst.virt.addr, 1); 59 scatterwalk_unmap(walk->dst.virt.addr, 1);
60} 60}
61 61
62/* Get a spot of the specified length that does not straddle a page.
63 * The caller needs to ensure that there is enough space for this operation.
64 */
62static inline u8 *blkcipher_get_spot(u8 *start, unsigned int len) 65static inline u8 *blkcipher_get_spot(u8 *start, unsigned int len)
63{ 66{
64 if (offset_in_page(start + len) < len) 67 u8 *end_page = (u8 *)(((unsigned long)(start + len - 1)) & PAGE_MASK);
65 return (u8 *)((unsigned long)(start + len) & PAGE_MASK); 68 return start > end_page ? start : end_page;
66 return start;
67} 69}
68 70
69static inline unsigned int blkcipher_done_slow(struct crypto_blkcipher *tfm, 71static inline unsigned int blkcipher_done_slow(struct crypto_blkcipher *tfm,
@@ -155,7 +157,8 @@ static inline int blkcipher_next_slow(struct blkcipher_desc *desc,
155 if (walk->buffer) 157 if (walk->buffer)
156 goto ok; 158 goto ok;
157 159
158 n = bsize * 2 + (alignmask & ~(crypto_tfm_ctx_alignment() - 1)); 160 n = bsize * 3 - (alignmask + 1) +
161 (alignmask & ~(crypto_tfm_ctx_alignment() - 1));
159 walk->buffer = kmalloc(n, GFP_ATOMIC); 162 walk->buffer = kmalloc(n, GFP_ATOMIC);
160 if (!walk->buffer) 163 if (!walk->buffer)
161 return blkcipher_walk_done(desc, walk, -ENOMEM); 164 return blkcipher_walk_done(desc, walk, -ENOMEM);