Skip to contentSkip to conversation

Fixes for parallel XTS/LRW patch series

PATCH New Jussi Kivilinna 1 participant 3 messages Oct 23, 2011 Crypto API

lore
Share & tools
lore
#0 lore raw

cover Fixes for parallel XTS/LRW patch series

These patches fix bug in xts_crypt()/lrw_crypt() where nblocks is not updated in the block walk loop.

This causes nblocks to be left at 0, after blkcipher_walk_done() call. This leads 'do { ... } while (nblocks > 0)' loop to be run one extra time with nblocks == 0 and at end of do-while loop nblocks gets updated correctly.

---

Jussi Kivilinna (2):
crypto: xts: fix nblocks not being updated in walk loop
crypto: lrw: fix nblocks not being updated in walk loop

 crypto/lrw.c |    1 +
 crypto/xts.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
#1 lore raw

PATCH 1/2 crypto: xts: fix nblocks not being updated in walk loop

In xts_crypt() function, nblocks should be updated after blkcipher_walk_done call.

---
 crypto/xts.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
crypto/xts.c +1 -0
index 5681d66..ca1608f 100644
@@ -229,6 +229,7 @@ first:
 		if (!nbytes)
 			break;
 
+		nblocks = min(nbytes / bsize, max_blks);
 		src = (be128 *)walk.src.virt.addr;
 		dst = (be128 *)walk.dst.virt.addr;
 	}
#2 lore raw

PATCH 2/2 crypto: lrw: fix nblocks not being updated in walk loop

In reply to Jussi Kivilinna

In lrw_crypt() function, nblocks should be updated after blkcipher_walk_done call.

---
 crypto/lrw.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
crypto/lrw.c +1 -0
index 66c4d22..ba42acc 100644
@@ -284,6 +284,7 @@ first:
 		if (!nbytes)
 			break;
 
+		nblocks = min(nbytes / bsize, max_blks);
 		src = (be128 *)walk.src.virt.addr;
 		dst = (be128 *)walk.dst.virt.addr;
 	}