summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-12-31 18:05:03 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-12-31 18:05:03 +0100
commitb02e2db0712f943ad794d98a6e9c01378860960a (patch)
treebbeccab1fa8c5d0be7ce739ffc81caad8a01f798
parent0c85e6f1f43d2b432a024d7da88ddfc429f0bba1 (diff)
downloadeurephia-b02e2db0712f943ad794d98a6e9c01378860960a.tar.gz
eurephia-b02e2db0712f943ad794d98a6e9c01378860960a.tar.xz
eurephia-b02e2db0712f943ad794d98a6e9c01378860960a.zip
Make use of more cross-platform friendly libc functions
The initial implementation of the SHA512 hashing functions was tightly connected to glibc. This patch changes those few functions which is glibc to more portable functions. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
-rw-r--r--common/passwd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/passwd.c b/common/passwd.c
index 4408e02..217fa0c 100644
--- a/common/passwd.c
+++ b/common/passwd.c
@@ -327,7 +327,8 @@ inline char *sha512_crypt_r(const char *key, const char *salt, size_t maxrounds_
/* Create byte sequence P. */
cp = p_bytes = alloca (key_len);
for (cnt = key_len; cnt >= 64; cnt -= 64) {
- cp = mempcpy (cp, temp_result, 64);
+ cp = memcpy (cp, temp_result, 64);
+ cp += 64;
}
memcpy (cp, temp_result, cnt);
@@ -345,7 +346,8 @@ inline char *sha512_crypt_r(const char *key, const char *salt, size_t maxrounds_
/* Create byte sequence S. */
cp = s_bytes = alloca (salt_len);
for (cnt = salt_len; cnt >= 64; cnt -= 64) {
- cp = mempcpy (cp, temp_result, 64);
+ cp = memcpy (cp, temp_result, 64);
+ cp += 64;
}
memcpy (cp, temp_result, cnt);
@@ -386,7 +388,7 @@ inline char *sha512_crypt_r(const char *key, const char *salt, size_t maxrounds_
/* Now we can construct the result string. It consists of three
parts. */
- cp = __stpncpy (buffer, salt, MIN ((size_t) MAX (0, buflen), salt_len));
+ cp = stpncpy (buffer, salt, MIN ((size_t) MAX (0, buflen), salt_len));
buflen -= MIN ((size_t) MAX (0, buflen), salt_len);
b64_from_24bit (alt_result[0], alt_result[21], alt_result[42], 4);