(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c) |
| |
| 124 | | | static void sha256_transf(struct sha256_ctx *ctx, const unsigned char *data, |
| 125 | | | size_t block_nb) |
| 126 | | | { |
| 127 | | | uint32_t w[64]; |
| 128 | | | uint32_t wv[8]; |
| 129 | | | uint32_t t1, t2; |
| 130 | | | const unsigned char *sub_block; |
| 131 | | | int i,j; |
| 132 | | | |
| 133 | | | |
| 134 | | | for (i = 0; i < (int) block_nb; i++) { |
| 135 | | | sub_block = data + (i << 6); |
| 136 | | | |
| 137 | | | for (j = 0; j < 16; j++) { |
| 138 | | | PACK32(&sub_block[j << 2], &w[j]);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
56 | #define PACK32(str, x) \ |
57 | { \ |
58 | *(x) = ((uint32_t) *((str) + 3) ) \ |
59 | | ((uint32_t) *((str) + 2) << 8) \ |
60 | | ((uint32_t) *((str) + 1) << 16) \ |
61 | | ((uint32_t) *((str) + 0) << 24); \ |
62 | } |
| |
|
| 139 | | | } |
| 140 | | | |
| 141 | | | for (j = 16; j < 64; j++) { |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 142 | | | SHA256_SCR(j);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
90 | #define SHA256_SCR(i) \ |
91 | { \ |
92 | w[i] = SHA256_F4(w[i - 2]) + w[i - 7] \ |
93 | + SHA256_F3(w[i - 15]) + w[i - 16]; \ |
94 | } |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
46 | #define SHA256_F4(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHFR(x, 10)) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
45 | #define SHA256_F3(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHFR(x, 3)) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
|
| 143 | | | } |
| 144 | | | |
| 145 | | | for (j = 0; j < 8; j++) { |
| 146 | | | wv[j] = ctx->h[j]; |
| 147 | | | } |
| 148 | | | |
| 149 | | | for (j = 0; j < 64; j++) { |
| 150 | | | t1 = wv[7] + SHA256_F2(wv[4]) + CH(wv[4], wv[5], wv[6])
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
44 | #define SHA256_F2(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
|
| 151 | | | + sha256_k[j] + w[j]; |
| 152 | | | t2 = SHA256_F1(wv[0]) + MAJ(wv[0], wv[1], wv[2]);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
43 | #define SHA256_F1(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/sha2.c |
| |
38 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) |
| |
|
| 153 | | | wv[7] = wv[6]; |
| 154 | | | wv[6] = wv[5]; |
| 155 | | | wv[5] = wv[4]; |
| 156 | | | wv[4] = wv[3] + t1; |
| 157 | | | wv[3] = wv[2]; |
| 158 | | | wv[2] = wv[1]; |
| 159 | | | wv[1] = wv[0]; |
| 160 | | | wv[0] = t1 + t2; |
| 161 | | | } |
| 162 | | | |
| 163 | | | for (j = 0; j < 8; j++) { |
| 164 | | | ctx->h[j] += wv[j]; |
| 165 | | | } |
| 166 | | | } |
| 167 | | | } |
| |