summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/md4/md4_hasher.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:34:14 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:34:14 +0000
commited7d79f96177044949744da10f4431c1d6242241 (patch)
tree3aabaa55ed3b5291daef891cfee9befb5235e2b8 /src/libstrongswan/plugins/md4/md4_hasher.c
parent7410d3c6d6a9a1cd7aa55083c938946af6ff9498 (diff)
downloadvyos-strongswan-ed7d79f96177044949744da10f4431c1d6242241.tar.gz
vyos-strongswan-ed7d79f96177044949744da10f4431c1d6242241.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.3.6)
Diffstat (limited to 'src/libstrongswan/plugins/md4/md4_hasher.c')
-rw-r--r--src/libstrongswan/plugins/md4/md4_hasher.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libstrongswan/plugins/md4/md4_hasher.c b/src/libstrongswan/plugins/md4/md4_hasher.c
index 3801110dc..366d37328 100644
--- a/src/libstrongswan/plugins/md4/md4_hasher.c
+++ b/src/libstrongswan/plugins/md4/md4_hasher.c
@@ -2,9 +2,9 @@
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
- * Copyright (C) 1990-1992, RSA Data Security, Inc. Created 1990.
+ * Copyright (C) 1990-1992, RSA Data Security, Inc. Created 1990.
* All rights reserved.
- *
+ *
* Derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm.
* Ported to fulfill hasher_t interface.
*
@@ -83,7 +83,7 @@ struct private_md4_hasher_t {
* Public interface for this hasher.
*/
md4_hasher_t public;
-
+
/*
* State of the hasher.
*/
@@ -101,7 +101,7 @@ static void Encode (u_int8_t *output, u_int32_t *input, size_t len)
{
size_t i, j;
- for (i = 0, j = 0; j < len; i++, j += 4)
+ for (i = 0, j = 0; j < len; i++, j += 4)
{
output[j] = (u_int8_t)(input[i] & 0xff);
output[j+1] = (u_int8_t)((input[i] >> 8) & 0xff);
@@ -119,7 +119,7 @@ static void Decode(u_int32_t *output, u_int8_t *input, size_t len)
for (i = 0, j = 0; j < len; i++, j += 4)
{
- output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) |
+ output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) |
(((u_int32_t)input[j+2]) << 16) | (((u_int32_t)input[j+3]) << 24);
}
}
@@ -220,14 +220,14 @@ static void MD4Update(private_md4_hasher_t *this, u_int8_t *input, size_t inputL
partLen = 64 - index;
/* Transform as many times as possible. */
- if (inputLen >= partLen)
+ if (inputLen >= partLen)
{
memcpy(&this->buffer[index], input, partLen);
MD4Transform (this->state, this->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
{
- MD4Transform (this->state, &input[i]);
+ MD4Transform (this->state, &input[i]);
}
index = 0;
}
@@ -288,7 +288,7 @@ static void get_hash(private_md4_hasher_t *this, chunk_t chunk, u_int8_t *buffer
static void allocate_hash(private_md4_hasher_t *this, chunk_t chunk, chunk_t *hash)
{
chunk_t allocated_hash;
-
+
MD4Update(this, chunk.ptr, chunk.len);
if (hash != NULL)
{
@@ -297,11 +297,11 @@ static void allocate_hash(private_md4_hasher_t *this, chunk_t chunk, chunk_t *ha
MD4Final(this, allocated_hash.ptr);
this->public.hasher_interface.reset(&(this->public.hasher_interface));
-
+
*hash = allocated_hash;
}
}
-
+
/**
* Implementation of hasher_t.get_hash_size.
*/
@@ -337,21 +337,21 @@ static void destroy(private_md4_hasher_t *this)
md4_hasher_t *md4_hasher_create(hash_algorithm_t algo)
{
private_md4_hasher_t *this;
-
+
if (algo != HASH_MD4)
{
return NULL;
}
this = malloc_thing(private_md4_hasher_t);
-
+
this->public.hasher_interface.get_hash = (void (*) (hasher_t*, chunk_t, u_int8_t*))get_hash;
this->public.hasher_interface.allocate_hash = (void (*) (hasher_t*, chunk_t, chunk_t*))allocate_hash;
this->public.hasher_interface.get_hash_size = (size_t (*) (hasher_t*))get_hash_size;
this->public.hasher_interface.reset = (void (*) (hasher_t*))reset;
this->public.hasher_interface.destroy = (void (*) (hasher_t*))destroy;
-
+
/* initialize */
reset(this);
-
+
return &(this->public);
}