[9/*] [CRYPTO] Remap when walk_out crosses page in crypt()

From: Herbert Xu
Date: Tue Mar 22 2005 - 06:34:03 EST


Hi:

This is needed so that we can keep the in_place assignment outside the
inner loop. Without this in pathalogical situations we can start out
having walk_out being different from walk_in, but when walk_out crosses
a page it may converge with walk_in.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
===== cipher.c 1.26 vs edited =====
--- 1.26/crypto/cipher.c 2005-03-22 21:56:21 +11:00
+++ edited/cipher.c 2005-03-22 21:59:53 +11:00
@@ -129,7 +129,9 @@
complete_dst(&walk_out, bsize, dst_p, in_place);

nbytes -= bsize;
- } while (nbytes && !scatterwalk_across_pages(&walk_in, bsize));
+ } while (nbytes &&
+ !scatterwalk_across_pages(&walk_in, bsize) &&
+ !scatterwalk_across_pages(&walk_out, bsize));

scatterwalk_done(&walk_in, 0, nbytes);
scatterwalk_done(&walk_out, 1, nbytes);