/* $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:
*/
#include "portable.h"
+#include <ac/param.h>
#include <ac/string.h>
-
-/* include socket.h to get sys/types.h and/or winsock2.h */
#include <ac/socket.h>
-
-#include <ac/param.h>
+#include <ac/bytes.h>
#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))))
#ifdef SHA1HANDSOFF
uint32 block[16];
- (void)memcpy(block, buffer, 64);
+ (void)AC_MEMCPY(block, buffer, 64);
#else
uint32 *block = (u_int32 *) buffer;
#endif
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]);
} else {
i = 0;
}
- (void)memcpy(&context->buffer[j], &data[i], len - i);
+ (void)AC_MEMCPY(&context->buffer[j], &data[i], len - i);
}
lutil_SHA1Update(&ctx, data, len);
return(lutil_SHA1End(&ctx, buf));
}
+
+#endif