Portability fix for broken compilers.
authormdw <mdw>
Sat, 17 Jun 2000 11:31:43 +0000 (11:31 +0000)
committermdw <mdw>
Sat, 17 Jun 2000 11:31:43 +0000 (11:31 +0000)
md4.c
md5.c
rmd160.c
sha.c

diff --git a/md4.c b/md4.c
index 19c74d2..fe0c788 100644 (file)
--- a/md4.c
+++ b/md4.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: md4.c,v 1.2 1999/12/10 23:20:03 mdw Exp $
+ * $Id: md4.c,v 1.3 2000/06/17 11:31:43 mdw Exp $
  *
  * The MD4 message digest function
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: md4.c,v $
+ * Revision 1.3  2000/06/17 11:31:43  mdw
+ * Portability fix for broken compilers.
+ *
  * Revision 1.2  1999/12/10 23:20:03  mdw
  * New hash interface requirements.
  *
@@ -198,7 +201,7 @@ void md4_set(md4_ctx *ctx, const void *buf, unsigned long count)
   ctx->d = LOAD32_L(p + 12);
   ctx->off = 0;
   ctx->nl = U32(count);
-  ctx->nh = U32((count >> 16) >> 16);
+  ctx->nh = U32(((count & ~MASK32) >> 16) >> 16);
 }
 
 /* --- @md4_hash@ --- *
diff --git a/md5.c b/md5.c
index 55a0aaa..fa078e9 100644 (file)
--- a/md5.c
+++ b/md5.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: md5.c,v 1.2 1999/12/10 23:20:03 mdw Exp $
+ * $Id: md5.c,v 1.3 2000/06/17 11:31:43 mdw Exp $
  *
  * The MD5 message digest function
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: md5.c,v $
+ * Revision 1.3  2000/06/17 11:31:43  mdw
+ * Portability fix for broken compilers.
+ *
  * Revision 1.2  1999/12/10 23:20:03  mdw
  * New hash interface requirements.
  *
@@ -217,7 +220,7 @@ void md5_set(md5_ctx *ctx, const void *buf, unsigned long count)
   ctx->d = LOAD32_L(p + 12);
   ctx->off = 0;
   ctx->nl = U32(count);
-  ctx->nh = U32((count >> 16) >> 16);
+  ctx->nh = U32(((count & ~MASK32) >> 16) >> 16);
 }
 
 /* --- @md5_hash@ --- *
index 60b67a7..3d56e0d 100644 (file)
--- a/rmd160.c
+++ b/rmd160.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: rmd160.c,v 1.2 1999/12/10 23:20:03 mdw Exp $
+ * $Id: rmd160.c,v 1.3 2000/06/17 11:31:43 mdw Exp $
  *
  * The RIPEMD-160 message digest function
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: rmd160.c,v $
+ * Revision 1.3  2000/06/17 11:31:43  mdw
+ * Portability fix for broken compilers.
+ *
  * Revision 1.2  1999/12/10 23:20:03  mdw
  * New hash interface requirements.
  *
@@ -338,7 +341,7 @@ void rmd160_set(rmd160_ctx *ctx, const void *buf, unsigned long count)
   ctx->e = LOAD32_L(p + 16);
   ctx->off = 0;
   ctx->nl = U32(count);
-  ctx->nh = U32((count >> 16) >> 16);
+  ctx->nh = U32(((count & ~MASK32) >> 16) >> 16);
 }
 
 /* --- @rmd160_hash@ --- *
diff --git a/sha.c b/sha.c
index 2fe1846..918e6d3 100644 (file)
--- a/sha.c
+++ b/sha.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: sha.c,v 1.2 1999/12/10 23:20:03 mdw Exp $
+ * $Id: sha.c,v 1.3 2000/06/17 11:31:43 mdw Exp $
  *
  * Implementation of the SHA-1 hash function
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: sha.c,v $
+ * Revision 1.3  2000/06/17 11:31:43  mdw
+ * Portability fix for broken compilers.
+ *
  * Revision 1.2  1999/12/10 23:20:03  mdw
  * New hash interface requirements.
  *
@@ -240,7 +243,7 @@ void sha_set(sha_ctx *ctx, const void *buf, unsigned long count)
   ctx->e = LOAD32(p + 16);
   ctx->off = 0;
   ctx->nl = U32(count);
-  ctx->nh = U32((count >> 16) >> 16);
+  ctx->nh = U32(((count & ~MASK32) >> 16) >> 16);
 }
 
 /* --- @sha_hash@ --- *