diff options
author | Marian Klymov <nekto1989@gmail.com> | 2018-06-02 23:52:56 +0300 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-06-11 11:14:48 +0200 |
commit | c45360d4633850839bb9c2d77dbf8a8285e9ad49 (patch) | |
tree | 20159c553a74ed98c2431fc8f2852067f79ac4e9 /lib/sha256.c | |
parent | 38203f1585da53e07e54e37c7d5da4d72f509a2e (diff) | |
download | curl-c45360d4633850839bb9c2d77dbf8a8285e9ad49.tar.gz |
cppcheck: fix warnings
- Get rid of variable that was generating false positive warning
(unitialized)
- Fix issues in tests
- Reduce scope of several variables all over
etc
Closes #2631
Diffstat (limited to 'lib/sha256.c')
-rw-r--r-- | lib/sha256.c | 12 |
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; |