summaryrefslogtreecommitdiff
path: root/libcrypt/sha256.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-03-29 04:50:56 -0500
committerWaldemar Brodkorb <wbx@openadk.org>2015-03-29 04:50:56 -0500
commitcd5f92704e1e17bbc0c15d197f3bc236c7dc9bf2 (patch)
tree1400302b543e4528aedea5d72731983559cfcf36 /libcrypt/sha256.c
parentad2bffbf1926051ef333f9899344f6bddf2c03cf (diff)
parent24946289317ea23bb0d1814cca0a499a905f7d6f (diff)
merge uClibc git master
Diffstat (limited to 'libcrypt/sha256.c')
-rw-r--r--libcrypt/sha256.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libcrypt/sha256.c b/libcrypt/sha256.c
index 6bc2d8b2b..3e12b5ce4 100644
--- a/libcrypt/sha256.c
+++ b/libcrypt/sha256.c
@@ -108,12 +108,12 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
uint32_t h_save = h;
/* Operators defined in FIPS 180-2:4.1.2. */
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
-#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
-#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
-#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
+#define _Ch(x, y, z) ((x & y) ^ (~x & z))
+#define _Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
+#define _S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
+#define _S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
+#define _R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
+#define _R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
@@ -126,13 +126,13 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
++words;
}
for (unsigned int t = 16; t < 64; ++t)
- W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];
+ W[t] = _R1 (W[t - 2]) + W[t - 7] + _R0 (W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.2.2 step 3. */
for (unsigned int t = 0; t < 64; ++t)
{
- uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];
- uint32_t T2 = S0 (a) + Maj (a, b, c);
+ uint32_t T1 = h + _S1 (e) + _Ch (e, f, g) + K[t] + W[t];
+ uint32_t T2 = _S0 (a) + _Maj (a, b, c);
h = g;
g = f;
f = e;