X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblutil%2Fsha1.c;h=a5c026384e6c7271879308066bb9f46e2dcc7f7d;hb=6456e5f5593c09bf6a446e82e690181beed3d077;hp=a7670f93d84d06072fdb94e52909a172c0234a75;hpb=ebc4a8f1497781cf87a7895f0cdcee1a071c05c8;p=openldap diff --git a/libraries/liblutil/sha1.c b/libraries/liblutil/sha1.c index a7670f93d8..a5c026384e 100644 --- a/libraries/liblutil/sha1.c +++ b/libraries/liblutil/sha1.c @@ -1,6 +1,6 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ /* Acquired from: @@ -25,17 +25,16 @@ */ #include "portable.h" +#include #include - -/* include socket.h to get sys/types.h and/or winsock2.h */ #include - -#if defined(HAVE_SYS_PARAM_H) -#include -#endif +#include #include "lutil_sha1.h" +#ifdef LUTIL_SHA1_BYTES + +/* undefining this will cause pointer alignment errors */ #define SHA1HANDSOFF /* Copies data before messing with it. */ #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) @@ -72,7 +71,7 @@ lutil_SHA1Transform( uint32 *state, const unsigned char *buffer ) #ifdef SHA1HANDSOFF uint32 block[16]; - (void)memcpy(block, buffer, 64); + (void)AC_MEMCPY(block, buffer, 64); #else uint32 *block = (u_int32 *) buffer; #endif @@ -152,7 +151,7 @@ lutil_SHA1Update( context->count[1] += (len>>29)+1; j = (j >> 3) & 63; if ((j + len) > 63) { - (void)memcpy(&context->buffer[j], data, (i = 64-j)); + (void)AC_MEMCPY(&context->buffer[j], data, (i = 64-j)); lutil_SHA1Transform(context->state, context->buffer); for ( ; i + 63 < len; i += 64) lutil_SHA1Transform(context->state, &data[i]); @@ -160,7 +159,7 @@ lutil_SHA1Update( } else { i = 0; } - (void)memcpy(&context->buffer[j], &data[i], len - i); + (void)AC_MEMCPY(&context->buffer[j], &data[i], len - i); } @@ -276,3 +275,5 @@ lutil_SHA1Data( const unsigned char *data, size_t len, char *buf ) lutil_SHA1Update(&ctx, data, len); return(lutil_SHA1End(&ctx, buf)); } + +#endif