浏览代码

crypto: lrw - fix rebase error after out of bounds fix

Due to an unfortunate interaction between commit fbe1a850b3b1
("crypto: lrw - Fix out-of bounds access on counter overflow") and
commit c778f96bf347 ("crypto: lrw - Optimize tweak computation"),
we ended up with a version of next_index() that always returns 127.

Fixes: c778f96bf347 ("crypto: lrw - Optimize tweak computation")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Ard Biesheuvel 6 年之前
父节点
当前提交
fd27b571c9
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      crypto/lrw.c

+ 3 - 4
crypto/lrw.c

@@ -122,10 +122,9 @@ static int next_index(u32 *counter)
 	int i, res = 0;
 
 	for (i = 0; i < 4; i++) {
-		if (counter[i] + 1 != 0) {
-			res += ffz(counter[i]++);
-			break;
-		}
+		if (counter[i] + 1 != 0)
+			return res + ffz(counter[i]++);
+
 		counter[i] = 0;
 		res += 32;
 	}