aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-03-02 22:03:11 -0500
committerJeff Garzik <jgarzik@redhat.com>2011-03-02 22:03:11 -0500
commitef91bd59e2befdb4be7321593fe8dc8f1250080e (patch)
tree0fc601c99457a13ef3f2c77b4b4ab86891bfdb03
parenta27e69aec53806df3534ddb6e7e22165dbfb2f5b (diff)
sha256_4way: skip last 3 rounds.
Pointed out by several people, including Raulo.
-rw-r--r--sha256_4way.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sha256_4way.c b/sha256_4way.c
index 2c5afd8..742682f 100644
--- a/sha256_4way.c
+++ b/sha256_4way.c
@@ -452,12 +452,16 @@ static void DoubleBlockSHA256(const void* pin, void* pad, const void *pre, unsig
SHA256ROUND(f, g, h, a, b, c, d, e, 59, w11);
w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12);
SHA256ROUND(e, f, g, h, a, b, c, d, 60, w12);
+
+ /* Skip last 3-rounds; not necessary for H==0 */
+#if 0
w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
SHA256ROUND(d, e, f, g, h, a, b, c, 61, w13);
w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
SHA256ROUND(c, d, e, f, g, h, a, b, 62, w14);
w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
SHA256ROUND(b, c, d, e, f, g, h, a, 63, w15);
+#endif
/* store resulsts directly in thash */
#define store_2(x,i) \