* md5.c: Fix to deal with types longer than 32 bits
authorTom Yu <tlyu@mit.edu>
Tue, 28 Oct 1997 21:40:10 +0000 (21:40 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 28 Oct 1997 21:40:10 +0000 (21:40 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10259 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/md4/ChangeLog
src/lib/crypto/md4/md4.c
src/lib/crypto/md5/ChangeLog
src/lib/crypto/md5/md5.c

index 3653c4509d5604af3460734853836c313c27c29d..bcac6ed4bd838da798d823b177bbce1d9982ea5a 100644 (file)
@@ -1,3 +1,7 @@
+Tue Oct 28 16:36:15 1997  Tom Yu  <tlyu@voltage-multiplier.mit.edu>
+
+       * md4.c: Fix to deal with types longer than 32 bits.
+
 Sat Feb 22 18:53:00 1997  Richard Basch  <basch@lehman.com>
 
        * Makefile.in: Use some of the new library list build rules in
index 8714f4a0b8758cc59ab1929ff7cb9e62e32c66a9..fbfd256258e940a7b98f54a115e39d027deac9de 100644 (file)
@@ -68,18 +68,21 @@ static unsigned char PADDING[64] = {
 #define H(x, y, z) ((x) ^ (y) ^ (z))
 
 /* ROTATE_LEFT rotates x left n bits */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+#define ROTATE_LEFT(x, n) (((x) << (n)) & 0xffffffff | ((x) >> (32-(n))))
 
 /* FF, GG and HH are MD4 transformations for rounds 1, 2 and 3 */
 /* Rotation is separate from addition to prevent recomputation */
 #define FF(a, b, c, d, x, s) \
   {(a) += F ((b), (c), (d)) + (x); \
+   (a) &= 0xffffffff; \
    (a) = ROTATE_LEFT ((a), (s));}
 #define GG(a, b, c, d, x, s) \
   {(a) += G ((b), (c), (d)) + (x) + UL(013240474631); \
+   (a) &= 0xffffffff; \
    (a) = ROTATE_LEFT ((a), (s));}
 #define HH(a, b, c, d, x, s) \
   {(a) += H ((b), (c), (d)) + (x) + UL(015666365641); \
+   (a) &= 0xffffffff; \
    (a) = ROTATE_LEFT ((a), (s));}
 
 void
index 6cbaa4ab833e1da7c277115fac850d8c75f32b70..130adc451bcebddb4550b6002a85a9ea5bc94500 100644 (file)
@@ -1,3 +1,7 @@
+Tue Oct 28 16:36:30 1997  Tom Yu  <tlyu@voltage-multiplier.mit.edu>
+
+       * md5.c: Fix to deal with types longer than 32 bits.
+
 Sat Feb 22 18:54:09 1997  Richard Basch  <basch@lehman.com>
 
        * Makefile.in: Use some of the new library list build rules in
index a636968d568e57220ab3729cbac99482f943bf14..95efb77e49844f91597edf5ea25577e08b9c8292 100644 (file)
@@ -76,29 +76,37 @@ static unsigned char PADDING[64] = {
 #define I(x, y, z) ((y) ^ ((x) | (~z)))
 
 /* ROTATE_LEFT rotates x left n bits */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+#define ROTATE_LEFT(x, n) (((x) << (n)) & 0xffffffff | ((x) >> (32-(n))))
 
 /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
 /* Rotation is separate from addition to prevent recomputation */
 #define FF(a, b, c, d, x, s, ac) \
   {(a) += F ((b), (c), (d)) + (x) + (krb5_ui_4)(ac); \
+   (a) &= 0xffffffff; \
    (a) = ROTATE_LEFT ((a), (s)); \
    (a) += (b); \
+   (a) &= 0xffffffff; \
   }
 #define GG(a, b, c, d, x, s, ac) \
   {(a) += G ((b), (c), (d)) + (x) + (krb5_ui_4)(ac); \
+   (a) &= 0xffffffff; \
    (a) = ROTATE_LEFT ((a), (s)); \
    (a) += (b); \
+   (a) &= 0xffffffff; \
   }
 #define HH(a, b, c, d, x, s, ac) \
   {(a) += H ((b), (c), (d)) + (x) + (krb5_ui_4)(ac); \
+   (a) &= 0xffffffff; \
    (a) = ROTATE_LEFT ((a), (s)); \
    (a) += (b); \
+   (a) &= 0xffffffff; \
   }
 #define II(a, b, c, d, x, s, ac) \
   {(a) += I ((b), (c), (d)) + (x) + (krb5_ui_4)(ac); \
+   (a) &= 0xffffffff; \
    (a) = ROTATE_LEFT ((a), (s)); \
    (a) += (b); \
+   (a) &= 0xffffffff; \
   }
 
 /* The routine krb5_MD5Init initializes the message-digest context