aboutsummaryrefslogtreecommitdiff
path: root/lib/sha256.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sha256.c')
-rw-r--r--lib/sha256.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sha256.c b/lib/sha256.c
index 55716c63b..3ac129612 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -130,8 +130,7 @@ static const unsigned long K[64] = {
static int sha256_compress(struct sha256_state *md,
unsigned char *buf)
{
- unsigned long S[8], W[64], t0, t1;
- unsigned long t;
+ unsigned long S[8], W[64];
int i;
/* copy state into S */
for(i = 0; i < 8; i++) {
@@ -146,12 +145,13 @@ static int sha256_compress(struct sha256_state *md,
W[i - 16];
}
/* Compress */
-#define RND(a,b,c,d,e,f,g,h,i) \
- t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
- t1 = Sigma0(a) + Maj(a, b, c); \
- d += t0; \
+#define RND(a,b,c,d,e,f,g,h,i) \
+ unsigned long t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
+ unsigned long t1 = Sigma0(a) + Maj(a, b, c); \
+ d += t0; \
h = t0 + t1;
for(i = 0; i < 64; ++i) {
+ unsigned long t;
RND(S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7], i);
t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4];
S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t;