summaryrefslogtreecommitdiffstats
path: root/crypto/sha/sha256.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2004-09-27 09:35:59 +0000
committerAndy Polyakov <appro@openssl.org>2004-09-27 09:35:59 +0000
commit968c31bd84943694e31b5b6ff8865d3179a3c1de (patch)
tree7a2168814edcfcb4baaf4a28d0c0cf696a57d5f2 /crypto/sha/sha256.c
parentc743966156500ccbbe5c713f2a8c63f981c0f55b (diff)
sha256_block advances the input pointer double as fast sometimes. Fix the
bug and test that it's actually gone. PR: 950
Diffstat (limited to 'crypto/sha/sha256.c')
-rw-r--r--crypto/sha/sha256.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/sha/sha256.c b/crypto/sha/sha256.c
index 618ba3bc10..5f3845f55c 100644
--- a/crypto/sha/sha256.c
+++ b/crypto/sha/sha256.c
@@ -179,6 +179,8 @@ static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
h = g; g = f; f = e; e = d + T1;
d = c; c = b; b = a; a = T1 + T2;
}
+
+ data += SHA256_CBLOCK;
}
else
{
@@ -209,7 +211,6 @@ static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d;
ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h;
- data += SHA256_CBLOCK;
}
}
@@ -258,6 +259,8 @@ static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
T1 = X[13] = W[13]; ROUND_00_15(13,d,e,f,g,h,a,b,c);
T1 = X[14] = W[14]; ROUND_00_15(14,c,d,e,f,g,h,a,b);
T1 = X[15] = W[15]; ROUND_00_15(15,b,c,d,e,f,g,h,a);
+
+ data += SHA256_CBLOCK;
}
else
{
@@ -296,7 +299,6 @@ static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d;
ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h;
- data += SHA256_CBLOCK;
}
}