mchristi 8d5276
diff -Naurp open-iscsi/Makefile open-iscsi-5.0.5.595/Makefile
mchristi 8d5276
--- open-iscsi/Makefile	2006-05-30 01:51:42.000000000 -0500
mchristi 8d5276
+++ open-iscsi-5.0.5.595/Makefile	2006-05-30 02:29:46.000000000 -0500
mchristi 8d5276
@@ -26,6 +26,7 @@ ETCFILES = etc/iscsid.conf
mchristi 8d5276
 all:
mchristi 8d5276
 	$(MAKE) -C usr
mchristi 8d5276
 	$(MAKE) -C kernel
mchristi 8d5276
+	$(MAKE) -C utils
mchristi 8d5276
 	@echo
mchristi 8d5276
 	@echo "Compilation complete                Output file"
mchristi 8d5276
 	@echo "----------------------------------- ----------------"
mchristi 8d5276
@@ -38,6 +39,7 @@ all:
mchristi 8d5276
 	@echo Read README file for detailed information.
mchristi 8d5276
 
mchristi 8d5276
 clean:
mchristi 8d5276
+	$(MAKE) -C utils clean
mchristi 8d5276
 	$(MAKE) -C usr clean
mchristi 8d5276
 	$(MAKE) -C kernel clean
mchristi 8d5276
 
mchristi 8d5276
diff -Naurp open-iscsi/utils/iscsi-iname.c open-iscsi-5.0.5.595/utils/iscsi-iname.c
mchristi 8d5276
--- open-iscsi/utils/iscsi-iname.c	1969-12-31 18:00:00.000000000 -0600
mchristi 8d5276
+++ open-iscsi-5.0.5.595/utils/iscsi-iname.c	2006-05-30 02:28:34.000000000 -0500
mchristi 8d5276
@@ -0,0 +1,140 @@
mchristi 8d5276
+/*
mchristi 8d5276
+ * iSCSI InitiatorName creation utility
mchristi 8d5276
+ * Copyright (C) 2001 Cisco Systems, Inc.
mchristi 8d5276
+ * maintained by linux-iscsi-devel@lists.sourceforge.net
mchristi 8d5276
+ *
mchristi 8d5276
+ * This program is free software; you can redistribute it and/or modify
mchristi 8d5276
+ * it under the terms of the GNU General Public License as published
mchristi 8d5276
+ * by the Free Software Foundation; either version 2 of the License, or
mchristi 8d5276
+ * (at your option) any later version.
mchristi 8d5276
+ *
mchristi 8d5276
+ * This program is distributed in the hope that it will be useful, but
mchristi 8d5276
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
mchristi 8d5276
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
mchristi 8d5276
+ * General Public License for more details.
mchristi 8d5276
+ *
mchristi 8d5276
+ * See the file COPYING included with this distribution for more details.
mchristi 8d5276
+ *
mchristi 8d5276
+ * $Id: iscsi-initiator-utils-add-iscsi-iname.patch,v 1.1 2007/03/20 19:39:20 mchristi Exp $
mchristi 8d5276
+ *
mchristi 8d5276
+ * iscsi-iname.c - Compute an iSCSI InitiatorName for this host.
mchristi 8d5276
+ * Note that to ensure uniqueness, the system time is
mchristi 8d5276
+ * a factor.  This name must be cached and only regenerated
mchristi 8d5276
+ * if there is no cached value.
mchristi 8d5276
+ */
mchristi 8d5276
+
mchristi 8d5276
+#include <stdint.h>
mchristi 8d5276
+#include <fcntl.h>
mchristi 8d5276
+#include <unistd.h>
mchristi 8d5276
+#include <stdlib.h>
mchristi 8d5276
+#include <stdio.h>
mchristi 8d5276
+#include <string.h>
mchristi 8d5276
+#include <sys utsname.h="">
mchristi 8d5276
+#include <sys time.h="">
mchristi 8d5276
+
mchristi 8d5276
+#include "md5.h"
mchristi 8d5276
+
mchristi 8d5276
+#define RANDOM_NUM_GENERATOR	"/dev/urandom"
mchristi 8d5276
+
mchristi 8d5276
+int
mchristi 8d5276
+main(int argc, char *argv[])
mchristi 8d5276
+{
mchristi 8d5276
+	char iname[256];
mchristi 8d5276
+	struct timeval time;
mchristi 8d5276
+	struct utsname system_info;
mchristi 8d5276
+	long hostid;
mchristi 8d5276
+	struct MD5Context context;
mchristi 8d5276
+	unsigned char digest[16];
mchristi 8d5276
+	unsigned char *bytes = digest;
mchristi 8d5276
+	unsigned char entropy[16];
mchristi 8d5276
+	int e;
mchristi 8d5276
+	int fd;
mchristi 8d5276
+	char *prefix;
mchristi 8d5276
+
mchristi 8d5276
+	/* initialize */
mchristi 8d5276
+	memset(iname, 0, sizeof (iname));
mchristi 8d5276
+	memset(digest, 0, sizeof (digest));
mchristi 8d5276
+	memset(&context, 0, sizeof (context));
mchristi 8d5276
+	MD5Init(&context);
mchristi 8d5276
+
mchristi 8d5276
+	/* take a prefix if given, otherwise use a default. */
mchristi 8d5276
+	if (argc > 1 && argv[1]) {
mchristi 8d5276
+		prefix = argv[1];
mchristi 8d5276
+		if (( strcmp(prefix, "-h") == 0 ) ||
mchristi 8d5276
+		    ( strcmp(prefix, "--help") == 0 )) {
mchristi 8d5276
+			printf("\nDisplays the iSCSI initiator name\n");
mchristi 8d5276
+			exit(0);
mchristi 8d5276
+		} else if ( strcmp(prefix, "-p") == 0 ) {
mchristi 8d5276
+			prefix = argv[2];
mchristi 8d5276
+		} else {
mchristi 8d5276
+			printf("\nUsage: iscsi-iname [-h | --help | "
mchristi 8d5276
+			       "-p <prefix>]\n");
mchristi 8d5276
+			exit(0);
mchristi 8d5276
+		}
mchristi 8d5276
+	} else {
mchristi 8d5276
+		prefix = "iqn.2005-03.com.redhat:01";
mchristi 8d5276
+	}
mchristi 8d5276
+
mchristi 8d5276
+	/* try to feed some entropy from the pool to MD5 in order to get
mchristi 8d5276
+	 * uniqueness properties
mchristi 8d5276
+	 */
mchristi 8d5276
+
mchristi 8d5276
+	if ((fd = open(RANDOM_NUM_GENERATOR, O_RDONLY))) {
mchristi 8d5276
+		e = read(fd, &entropy, 16);
mchristi 8d5276
+		if (e >= 1)
mchristi 8d5276
+			MD5Update(&context, (md5byte *)entropy, e);
mchristi 8d5276
+		close(fd);
mchristi 8d5276
+	}
mchristi 8d5276
+
mchristi 8d5276
+	/* time the name is created is a factor in order to get
mchristi 8d5276
+	 * uniqueness properties
mchristi 8d5276
+	 */
mchristi 8d5276
+	if (gettimeofday(&time, NULL) < 0) {
mchristi 8d5276
+		perror("error: gettimeofday failed");
mchristi 8d5276
+		return 1;
mchristi 8d5276
+	}
mchristi 8d5276
+	MD5Update(&context, (md5byte *) & time.tv_sec, sizeof (time.tv_sec));
mchristi 8d5276
+	MD5Update(&context, (md5byte *) & time.tv_usec, sizeof (time.tv_usec));
mchristi 8d5276
+
mchristi 8d5276
+	/* hostid */
mchristi 8d5276
+	hostid = gethostid();
mchristi 8d5276
+	MD5Update(&context, (md5byte *) & hostid, sizeof (hostid));
mchristi 8d5276
+
mchristi 8d5276
+	/* get the hostname and system name */
mchristi 8d5276
+	if (uname(&system_info) < 0) {
mchristi 8d5276
+		perror("error: uname failed");
mchristi 8d5276
+		return 1;
mchristi 8d5276
+	}
mchristi 8d5276
+	MD5Update(&context, (md5byte *) system_info.sysname,
mchristi 8d5276
+		  sizeof (system_info.sysname));
mchristi 8d5276
+	MD5Update(&context, (md5byte *) system_info.nodename,
mchristi 8d5276
+		  sizeof (system_info.nodename));
mchristi 8d5276
+	MD5Update(&context, (md5byte *) system_info.release,
mchristi 8d5276
+		  sizeof (system_info.release));
mchristi 8d5276
+	MD5Update(&context, (md5byte *) system_info.version,
mchristi 8d5276
+		  sizeof (system_info.version));
mchristi 8d5276
+	MD5Update(&context, (md5byte *) system_info.machine,
mchristi 8d5276
+		  sizeof (system_info.machine));
mchristi 8d5276
+
mchristi 8d5276
+	/* compute the md5 hash of all the bits we just collected */
mchristi 8d5276
+	MD5Final(digest, &context);
mchristi 8d5276
+
mchristi 8d5276
+	/* vary which md5 bytes we pick (though we probably don't need to do
mchristi 8d5276
+	 * this, since hopefully MD5 produces results such that each byte is as
mchristi 8d5276
+	 * good as any other).
mchristi 8d5276
+	 */
mchristi 8d5276
+
mchristi 8d5276
+	if ((fd = open(RANDOM_NUM_GENERATOR, O_RDONLY))) {
mchristi 8d5276
+		if (read(fd, entropy, 1) == 1)
mchristi 8d5276
+			bytes = &digest[(entropy[0] % (sizeof(digest) - 6))];
mchristi 8d5276
+		close(fd);
mchristi 8d5276
+	}
mchristi 8d5276
+
mchristi 8d5276
+	/* print the prefix followed by 6 bytes of the MD5 hash */
mchristi 8d5276
+	sprintf(iname, "%s.%x%x%x%x%x%x", prefix,
mchristi 8d5276
+		bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]);
mchristi 8d5276
+
mchristi 8d5276
+	iname[sizeof (iname) - 1] = '\0';
mchristi 8d5276
+	printf("%s\n", iname);
mchristi 8d5276
+	return 0;
mchristi 8d5276
+}
mchristi 8d5276
diff -Naurp open-iscsi/utils/Makefile open-iscsi-5.0.5.595/utils/Makefile
mchristi 8d5276
--- open-iscsi/utils/Makefile	1969-12-31 18:00:00.000000000 -0600
mchristi 8d5276
+++ open-iscsi-5.0.5.595/utils/Makefile	2006-05-30 02:28:34.000000000 -0500
mchristi 8d5276
@@ -0,0 +1,12 @@
mchristi 8d5276
+# This Makefile will work only with GNU make.
mchristi 8d5276
+
mchristi 8d5276
+CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g
mchristi 8d5276
+PROGRAMS = iscsi-iname
mchristi 8d5276
+
mchristi 8d5276
+all: $(PROGRAMS)
mchristi 8d5276
+
mchristi 8d5276
+iscsi-iname: md5.o iscsi-iname.o
mchristi 8d5276
+	$(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
mchristi 8d5276
+
mchristi 8d5276
+clean:
mchristi 8d5276
+	rm -f *.o $(PROGRAMS)
mchristi 8d5276
diff -Naurp open-iscsi/utils/md5.c open-iscsi-5.0.5.595/utils/md5.c
mchristi 8d5276
--- open-iscsi/utils/md5.c	1969-12-31 18:00:00.000000000 -0600
mchristi 8d5276
+++ open-iscsi-5.0.5.595/utils/md5.c	2006-05-30 02:28:34.000000000 -0500
mchristi 8d5276
@@ -0,0 +1,242 @@
mchristi 8d5276
+/*
mchristi 8d5276
+ * This code implements the MD5 message-digest algorithm.
mchristi 8d5276
+ * The algorithm is due to Ron Rivest.  This code was
mchristi 8d5276
+ * written by Colin Plumb in 1993, no copyright is claimed.
mchristi 8d5276
+ * This code is in the public domain; do with it what you wish.
mchristi 8d5276
+ *
mchristi 8d5276
+ * Equivalent code is available from RSA Data Security, Inc.
mchristi 8d5276
+ * This code has been tested against that, and is equivalent,
mchristi 8d5276
+ * except that you don't need to include two pages of legalese
mchristi 8d5276
+ * with every copy.
mchristi 8d5276
+ *
mchristi 8d5276
+ * To compute the message digest of a chunk of bytes, declare an
mchristi 8d5276
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
mchristi 8d5276
+ * needed on buffers full of bytes, and then call MD5Final, which
mchristi 8d5276
+ * will fill a supplied 16-byte array with the digest.
mchristi 8d5276
+ *
mchristi 8d5276
+ * Changed so as no longer to depend on Colin Plumb's `usual.h' header
mchristi 8d5276
+ * definitions; now uses stuff from dpkg's config.h.
mchristi 8d5276
+ *  - Ian Jackson <ijackson@nyx.cs.du.edu>.
mchristi 8d5276
+ * Still in the public domain.
mchristi 8d5276
+ */
mchristi 8d5276
+
mchristi 8d5276
+#include <string.h>
mchristi 8d5276
+
mchristi 8d5276
+#include "md5.h"
mchristi 8d5276
+
mchristi 8d5276
+#if (__BYTE_ORDER == __BIG_ENDIAN)
mchristi 8d5276
+/*
mchristi 8d5276
+ * we can compile this away for little endian since
mchristi 8d5276
+ * it does not do anything on those archs
mchristi 8d5276
+ */
mchristi 8d5276
+void
mchristi 8d5276
+byteSwap(uint32_t * buf, unsigned words)
mchristi 8d5276
+{
mchristi 8d5276
+	md5byte *p = (md5byte *) buf;
mchristi 8d5276
+
mchristi 8d5276
+	do {
mchristi 8d5276
+		*buf++ = (uint32_t) ((unsigned) p[3] << 8 | p[2]) << 16 |
mchristi 8d5276
+		    ((unsigned) p[1] << 8 | p[0]);
mchristi 8d5276
+		p += 4;
mchristi 8d5276
+	} while (--words);
mchristi 8d5276
+}
mchristi 8d5276
+#else
mchristi 8d5276
+#define byteSwap(buf,words)
mchristi 8d5276
+#endif
mchristi 8d5276
+
mchristi 8d5276
+/*
mchristi 8d5276
+ * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
mchristi 8d5276
+ * initialization constants.
mchristi 8d5276
+ */
mchristi 8d5276
+void
mchristi 8d5276
+MD5Init(struct MD5Context *ctx)
mchristi 8d5276
+{
mchristi 8d5276
+	ctx->buf[0] = 0x67452301;
mchristi 8d5276
+	ctx->buf[1] = 0xefcdab89;
mchristi 8d5276
+	ctx->buf[2] = 0x98badcfe;
mchristi 8d5276
+	ctx->buf[3] = 0x10325476;
mchristi 8d5276
+
mchristi 8d5276
+	ctx->bytes[0] = 0;
mchristi 8d5276
+	ctx->bytes[1] = 0;
mchristi 8d5276
+}
mchristi 8d5276
+
mchristi 8d5276
+/*
mchristi 8d5276
+ * Update context to reflect the concatenation of another buffer full
mchristi 8d5276
+ * of bytes.
mchristi 8d5276
+ */
mchristi 8d5276
+void
mchristi 8d5276
+MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
mchristi 8d5276
+{
mchristi 8d5276
+	uint32_t t;
mchristi 8d5276
+
mchristi 8d5276
+	/* Update byte count */
mchristi 8d5276
+
mchristi 8d5276
+	t = ctx->bytes[0];
mchristi 8d5276
+	if ((ctx->bytes[0] = t + len) < t)
mchristi 8d5276
+		ctx->bytes[1]++;	/* Carry from low to high */
mchristi 8d5276
+
mchristi 8d5276
+	t = 64 - (t & 0x3f);	/* Space available in ctx->in (at least 1) */
mchristi 8d5276
+	if (t > len) {
mchristi 8d5276
+		memcpy((md5byte *) ctx->in + 64 - t, buf, len);
mchristi 8d5276
+		return;
mchristi 8d5276
+	}
mchristi 8d5276
+	/* First chunk is an odd size */
mchristi 8d5276
+	memcpy((md5byte *) ctx->in + 64 - t, buf, t);
mchristi 8d5276
+	byteSwap(ctx->in, 16);
mchristi 8d5276
+	MD5Transform(ctx->buf, ctx->in);
mchristi 8d5276
+	buf += t;
mchristi 8d5276
+	len -= t;
mchristi 8d5276
+
mchristi 8d5276
+	/* Process data in 64-byte chunks */
mchristi 8d5276
+	while (len >= 64) {
mchristi 8d5276
+		memcpy(ctx->in, buf, 64);
mchristi 8d5276
+		byteSwap(ctx->in, 16);
mchristi 8d5276
+		MD5Transform(ctx->buf, ctx->in);
mchristi 8d5276
+		buf += 64;
mchristi 8d5276
+		len -= 64;
mchristi 8d5276
+	}
mchristi 8d5276
+
mchristi 8d5276
+	/* Handle any remaining bytes of data. */
mchristi 8d5276
+	memcpy(ctx->in, buf, len);
mchristi 8d5276
+}
mchristi 8d5276
+
mchristi 8d5276
+/*
mchristi 8d5276
+ * Final wrapup - pad to 64-byte boundary with the bit pattern 
mchristi 8d5276
+ * 1 0* (64-bit count of bits processed, MSB-first)
mchristi 8d5276
+ */
mchristi 8d5276
+void
mchristi 8d5276
+MD5Final(md5byte digest[16], struct MD5Context *ctx)
mchristi 8d5276
+{
mchristi 8d5276
+	int count = ctx->bytes[0] & 0x3f;	/* Number of bytes in ctx->in */
mchristi 8d5276
+	md5byte *p = (md5byte *) ctx->in + count;
mchristi 8d5276
+
mchristi 8d5276
+	/* Set the first char of padding to 0x80.  There is always room. */
mchristi 8d5276
+	*p++ = 0x80;
mchristi 8d5276
+
mchristi 8d5276
+	/* Bytes of padding needed to make 56 bytes (-8..55) */
mchristi 8d5276
+	count = 56 - 1 - count;
mchristi 8d5276
+
mchristi 8d5276
+	if (count < 0) {	/* Padding forces an extra block */
mchristi 8d5276
+		memset(p, 0, count + 8);
mchristi 8d5276
+		byteSwap(ctx->in, 16);
mchristi 8d5276
+		MD5Transform(ctx->buf, ctx->in);
mchristi 8d5276
+		p = (md5byte *) ctx->in;
mchristi 8d5276
+		count = 56;
mchristi 8d5276
+	}
mchristi 8d5276
+	memset(p, 0, count);
mchristi 8d5276
+	byteSwap(ctx->in, 14);
mchristi 8d5276
+
mchristi 8d5276
+	/* Append length in bits and transform */
mchristi 8d5276
+	ctx->in[14] = ctx->bytes[0] << 3;
mchristi 8d5276
+	ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
mchristi 8d5276
+	MD5Transform(ctx->buf, ctx->in);
mchristi 8d5276
+
mchristi 8d5276
+	byteSwap(ctx->buf, 4);
mchristi 8d5276
+	memcpy(digest, ctx->buf, 16);
mchristi 8d5276
+	memset(ctx, 0, sizeof (ctx));	/* In case it's sensitive */
mchristi 8d5276
+}
mchristi 8d5276
+
mchristi 8d5276
+#ifndef ASM_MD5
mchristi 8d5276
+
mchristi 8d5276
+/* The four core functions - F1 is optimized somewhat */
mchristi 8d5276
+
mchristi 8d5276
+/* #define F1(x, y, z) (x & y | ~x & z) */
mchristi 8d5276
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
mchristi 8d5276
+#define F2(x, y, z) F1(z, x, y)
mchristi 8d5276
+#define F3(x, y, z) (x ^ y ^ z)
mchristi 8d5276
+#define F4(x, y, z) (y ^ (x | ~z))
mchristi 8d5276
+
mchristi 8d5276
+/* This is the central step in the MD5 algorithm. */
mchristi 8d5276
+#define MD5STEP(f,w,x,y,z,in,s) \
mchristi 8d5276
+	 (w += f(x,y,z) + in, w = (w<<s |="" w="">>(32-s)) + x)
mchristi 8d5276
+
mchristi 8d5276
+/*
mchristi 8d5276
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
mchristi 8d5276
+ * reflect the addition of 16 longwords of new data.  MD5Update blocks
mchristi 8d5276
+ * the data and converts bytes into longwords for this routine.
mchristi 8d5276
+ */
mchristi 8d5276
+void
mchristi 8d5276
+MD5Transform(uint32_t buf[4], uint32_t const in[16])
mchristi 8d5276
+{
mchristi 8d5276
+	register uint32_t a, b, c, d;
mchristi 8d5276
+
mchristi 8d5276
+	a = buf[0];
mchristi 8d5276
+	b = buf[1];
mchristi 8d5276
+	c = buf[2];
mchristi 8d5276
+	d = buf[3];
mchristi 8d5276
+
mchristi 8d5276
+	MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
mchristi 8d5276
+	MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
mchristi 8d5276
+	MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
mchristi 8d5276
+	MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
mchristi 8d5276
+	MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
mchristi 8d5276
+	MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
mchristi 8d5276
+	MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
mchristi 8d5276
+	MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
mchristi 8d5276
+	MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
mchristi 8d5276
+	MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
mchristi 8d5276
+	MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
mchristi 8d5276
+	MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
mchristi 8d5276
+	MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
mchristi 8d5276
+	MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
mchristi 8d5276
+	MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
mchristi 8d5276
+	MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
mchristi 8d5276
+
mchristi 8d5276
+	MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
mchristi 8d5276
+	MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
mchristi 8d5276
+	MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
mchristi 8d5276
+	MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
mchristi 8d5276
+	MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
mchristi 8d5276
+	MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
mchristi 8d5276
+	MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
mchristi 8d5276
+	MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
mchristi 8d5276
+	MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
mchristi 8d5276
+	MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
mchristi 8d5276
+	MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
mchristi 8d5276
+	MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
mchristi 8d5276
+	MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
mchristi 8d5276
+	MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
mchristi 8d5276
+	MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
mchristi 8d5276
+	MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
mchristi 8d5276
+
mchristi 8d5276
+	MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
mchristi 8d5276
+	MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
mchristi 8d5276
+	MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
mchristi 8d5276
+	MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
mchristi 8d5276
+	MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
mchristi 8d5276
+	MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
mchristi 8d5276
+	MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
mchristi 8d5276
+	MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
mchristi 8d5276
+	MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
mchristi 8d5276
+	MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
mchristi 8d5276
+	MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
mchristi 8d5276
+	MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
mchristi 8d5276
+	MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
mchristi 8d5276
+	MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
mchristi 8d5276
+	MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
mchristi 8d5276
+	MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
mchristi 8d5276
+
mchristi 8d5276
+	MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
mchristi 8d5276
+	MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
mchristi 8d5276
+	MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
mchristi 8d5276
+	MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
mchristi 8d5276
+	MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
mchristi 8d5276
+	MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
mchristi 8d5276
+	MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
mchristi 8d5276
+	MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
mchristi 8d5276
+	MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
mchristi 8d5276
+	MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
mchristi 8d5276
+	MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
mchristi 8d5276
+	MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
mchristi 8d5276
+	MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
mchristi 8d5276
+	MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
mchristi 8d5276
+	MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
mchristi 8d5276
+	MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
mchristi 8d5276
+
mchristi 8d5276
+	buf[0] += a;
mchristi 8d5276
+	buf[1] += b;
mchristi 8d5276
+	buf[2] += c;
mchristi 8d5276
+	buf[3] += d;
mchristi 8d5276
+}
mchristi 8d5276
+
mchristi 8d5276
+#endif
mchristi 8d5276
diff -Naurp open-iscsi/utils/md5.h open-iscsi-5.0.5.595/utils/md5.h
mchristi 8d5276
--- open-iscsi/utils/md5.h	1969-12-31 18:00:00.000000000 -0600
mchristi 8d5276
+++ open-iscsi-5.0.5.595/utils/md5.h	2006-05-30 02:28:34.000000000 -0500
mchristi 8d5276
@@ -0,0 +1,41 @@
mchristi 8d5276
+/*
mchristi 8d5276
+ * This is the header file for the MD5 message-digest algorithm.
mchristi 8d5276
+ * The algorithm is due to Ron Rivest.  This code was
mchristi 8d5276
+ * written by Colin Plumb in 1993, no copyright is claimed.
mchristi 8d5276
+ * This code is in the public domain; do with it what you wish.
mchristi 8d5276
+ *
mchristi 8d5276
+ * Equivalent code is available from RSA Data Security, Inc.
mchristi 8d5276
+ * This code has been tested against that, and is equivalent,
mchristi 8d5276
+ * except that you don't need to include two pages of legalese
mchristi 8d5276
+ * with every copy.
mchristi 8d5276
+ *
mchristi 8d5276
+ * To compute the message digest of a chunk of bytes, declare an
mchristi 8d5276
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
mchristi 8d5276
+ * needed on buffers full of bytes, and then call MD5Final, which
mchristi 8d5276
+ * will fill a supplied 16-byte array with the digest.
mchristi 8d5276
+ *
mchristi 8d5276
+ * Changed so as no longer to depend on Colin Plumb's `usual.h'
mchristi 8d5276
+ * header definitions; now uses stuff from dpkg's config.h
mchristi 8d5276
+ *  - Ian Jackson <ijackson@nyx.cs.du.edu>.
mchristi 8d5276
+ * Still in the public domain.
mchristi 8d5276
+ */
mchristi 8d5276
+
mchristi 8d5276
+#ifndef MD5_H
mchristi 8d5276
+#define MD5_H
mchristi 8d5276
+
mchristi 8d5276
+#include <stdint.h>
mchristi 8d5276
+
mchristi 8d5276
+#define md5byte unsigned char
mchristi 8d5276
+
mchristi 8d5276
+struct MD5Context {
mchristi 8d5276
+	uint32_t buf[4];
mchristi 8d5276
+	uint32_t bytes[2];
mchristi 8d5276
+	uint32_t in[16];
mchristi 8d5276
+};
mchristi 8d5276
+
mchristi 8d5276
+void MD5Init(struct MD5Context *context);
mchristi 8d5276
+void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
mchristi 8d5276
+void MD5Final(unsigned char digest[16], struct MD5Context *context);
mchristi 8d5276
+void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
mchristi 8d5276
+
mchristi 8d5276
+#endif				/* !MD5_H */