Module Name:    src
Committed By:   mlelstv
Date:           Mon Jun 25 20:34:26 UTC 2012

Modified Files:
        src/sys/dev/iscsi: iscsi_utils.c

Log Message:
Make digests work also on big endian machines.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/iscsi/iscsi_utils.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/iscsi/iscsi_utils.c
diff -u src/sys/dev/iscsi/iscsi_utils.c:1.3 src/sys/dev/iscsi/iscsi_utils.c:1.4
--- src/sys/dev/iscsi/iscsi_utils.c:1.3	Sun Jun 24 17:01:35 2012
+++ src/sys/dev/iscsi/iscsi_utils.c	Mon Jun 25 20:34:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_utils.c,v 1.3 2012/06/24 17:01:35 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_utils.c,v 1.4 2012/06/25 20:34:26 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2008 The NetBSD Foundation, Inc.
@@ -33,6 +33,7 @@
 #include <sys/systm.h>
 #include <sys/buf.h>
 #include <sys/socketvar.h>
+#include <sys/bswap.h>
 
 
 #ifdef ISCSI_DEBUG
@@ -166,7 +167,7 @@ gen_digest(void *buff, int len)
 	while (len--) {
 		crc = ((crc >> 8) & 0x00ffffff) ^ crc_table[(crc ^ *bp++) & 0xff];
 	}
-	return crc ^ 0xffffffff;
+	return htonl(bswap32(crc ^ 0xffffffff));
 }
 
 
@@ -195,7 +196,7 @@ gen_digest_2(void *buf1, int len1, void 
 	while (len2--) {
 		crc = ((crc >> 8) & 0x00ffffff) ^ crc_table[(crc ^ *bp++) & 0xff];
 	}
-	return crc ^ 0xffffffff;
+	return htonl(bswap32(crc ^ 0xffffffff));
 }
 
 /*****************************************************************************

Reply via email to