summaryrefslogtreecommitdiff
path: root/ext/hash/hash_gost.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-01-03 01:22:58 -0800
committerStanislav Malyshev <stas@php.net>2015-01-10 15:07:38 -0800
commitb7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc (patch)
tree0e09490075ee4f9a75a77ef4168d8ee254c52e5b /ext/hash/hash_gost.c
parent773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff)
downloadphp-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz
trailing whitespace removal
Diffstat (limited to 'ext/hash/hash_gost.c')
-rw-r--r--ext/hash/hash_gost.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index 9fb8f2a5fb..482a881afe 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -84,7 +84,7 @@
key[6] = ((w[1] & 0x00ff0000) >> 16) | ((w[3] & 0x00ff0000) >> 8) | \
(w[5] & 0x00ff0000) | ((w[7] & 0x00ff0000) << 8); \
key[7] = ((w[1] & 0xff000000) >> 24) | ((w[3] & 0xff000000) >> 16) | \
- ((w[5] & 0xff000000) >> 8) | (w[7] & 0xff000000);
+ ((w[5] & 0xff000000) >> 8) | (w[7] & 0xff000000);
#define A(x, l, r) \
l = x[0] ^ x[2]; \
@@ -211,10 +211,10 @@ static inline void Gost(PHP_GOST_CTX *context, php_hash_uint32 data[8])
{
int i;
php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = context->state, *m = data;
-
+
memcpy(u, context->state, sizeof(u));
memcpy(v, data, sizeof(v));
-
+
for (i = 0; i < 8; i += 2) {
PASS(*context->tables);
}
@@ -228,15 +228,15 @@ static inline void GostTransform(PHP_GOST_CTX *context, const unsigned char inpu
{
int i, j;
php_hash_uint32 data[8], temp = 0, save = 0;
-
+
for (i = 0, j = 0; i < 8; ++i, j += 4) {
- data[i] = ((php_hash_uint32) input[j]) | (((php_hash_uint32) input[j + 1]) << 8) |
+ data[i] = ((php_hash_uint32) input[j]) | (((php_hash_uint32) input[j + 1]) << 8) |
(((php_hash_uint32) input[j + 2]) << 16) | (((php_hash_uint32) input[j + 3]) << 24);
save = context->state[i + 8];
context->state[i + 8] += data[i] + temp;
- temp = ((context->state[i + 8] < data[i]) || (context->state[i + 8] < save)) ? 1 : 0;
+ temp = ((context->state[i + 8] < data[i]) || (context->state[i + 8] < save)) ? 1 : 0;
}
-
+
Gost(context, data);
}
@@ -263,23 +263,23 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp
} else {
context->count[0] += len * 8;
}
-
+
if (context->length + len < 32) {
memcpy(&context->buffer[context->length], input, len);
context->length += len;
} else {
size_t i = 0, r = (context->length + len) % 32;
-
+
if (context->length) {
i = 32 - context->length;
memcpy(&context->buffer[context->length], input, i);
GostTransform(context, context->buffer);
}
-
+
for (; i + 32 <= len; i += 32) {
GostTransform(context, input + i);
}
-
+
memcpy(context->buffer, input + i, r);
ZEND_SECURE_ZERO(&context->buffer[r], 32 - r);
context->length = r;
@@ -289,23 +289,23 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp
PHP_HASH_API void PHP_GOSTFinal(unsigned char digest[32], PHP_GOST_CTX *context)
{
php_hash_uint32 i, j, l[8] = {0};
-
+
if (context->length) {
GostTransform(context, context->buffer);
}
-
+
memcpy(l, context->count, sizeof(context->count));
Gost(context, l);
memcpy(l, &context->state[8], sizeof(l));
Gost(context, l);
-
+
for (i = 0, j = 0; j < 32; i++, j += 4) {
digest[j] = (unsigned char) (context->state[i] & 0xff);
digest[j + 1] = (unsigned char) ((context->state[i] >> 8) & 0xff);
digest[j + 2] = (unsigned char) ((context->state[i] >> 16) & 0xff);
digest[j + 3] = (unsigned char) ((context->state[i] >> 24) & 0xff);
}
-
+
ZEND_SECURE_ZERO(context, sizeof(*context));
}