aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/sha-2
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-17 10:07:59 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-17 10:07:59 +0100
commit4d25fa871e9960d6e01dd4b63acdf367fee5431b (patch)
tree9ba781bbbc40b90ccb638e0c417846bd8ceb8933 /test/monniaux/sha-2
parentb2fd964630a1e4964d97bfe84a550a701bb936b7 (diff)
downloadcompcert-kvx-4d25fa871e9960d6e01dd4b63acdf367fee5431b.tar.gz
compcert-kvx-4d25fa871e9960d6e01dd4b63acdf367fee5431b.zip
stats on chunks etc.
Diffstat (limited to 'test/monniaux/sha-2')
-rw-r--r--test/monniaux/sha-2/sha-256.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/monniaux/sha-2/sha-256.c b/test/monniaux/sha-2/sha-256.c
index 3bd48c44..9306b7f1 100644
--- a/test/monniaux/sha-2/sha-256.c
+++ b/test/monniaux/sha-2/sha-256.c
@@ -282,6 +282,7 @@ void calc_sha_256(uint8_t hash[32], const void * input, size_t len)
const uint8_t *p = chunk;
memset(w, 0x00, sizeof w);
+#ifndef SKIP_SLOW_PARTS
for (i = 0; i < 16; i++) {
w[i] = (uint32_t) p[0] << 24 | (uint32_t) p[1] << 16 |
(uint32_t) p[2] << 8 | (uint32_t) p[3];
@@ -289,13 +290,13 @@ void calc_sha_256(uint8_t hash[32], const void * input, size_t len)
}
/* Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: */
- /* DM this is a SLOW part with ccomp */
+ /* DM this is a SLOW part with ccomp; awkward address computations. */
for (i = 16; i < 64; i++) {
const uint32_t s0 = right_rot7(w[i - 15]) ^ right_rot18(w[i - 15]) ^ (w[i - 15] >> 3);
const uint32_t s1 = right_rot17(w[i - 2]) ^ right_rot19(w[i - 2]) ^ (w[i - 2] >> 10);
w[i] = w[i - 16] + s0 + w[i - 7] + s1;
}
-
+#endif
/* Initialize working variables to current hash value: */
ah0 = h0;
ah1 = h1;
@@ -308,7 +309,7 @@ void calc_sha_256(uint8_t hash[32], const void * input, size_t len)
/* Compression function main loop: */
#if AUTOINCREMENT
- uint32_t *ki=k, *wi=w;
+ const uint32_t *ki=k, *wi=w;
#define KI *ki
#define WI *wi
#define STEP i++; ki++; wi++;
@@ -338,6 +339,7 @@ void calc_sha_256(uint8_t hash[32], const void * input, size_t len)
STEP \
}
CHUNK
+ CHUNK
}
/* Add the compressed chunk to the current hash value: */