summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>1997-10-28 21:40:10 +0000
committerTom Yu <tlyu@mit.edu>1997-10-28 21:40:10 +0000
commitd9a2c66ab5c2b6a446bb2fe07ed4875a39e162f2 (patch)
tree0dea0555f027b15f6d3bf95c8971caba2cc0f89d /src
parent052d558202badc4e9e81641058c89d17f656e2f5 (diff)
downloadkrb5-d9a2c66ab5c2b6a446bb2fe07ed4875a39e162f2.tar.gz
krb5-d9a2c66ab5c2b6a446bb2fe07ed4875a39e162f2.tar.xz
krb5-d9a2c66ab5c2b6a446bb2fe07ed4875a39e162f2.zip
* md5.c: Fix to deal with types longer than 32 bits
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10259 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/crypto/md4/ChangeLog4
-rw-r--r--src/lib/crypto/md4/md4.c5
-rw-r--r--src/lib/crypto/md5/ChangeLog4
-rw-r--r--src/lib/crypto/md5/md5.c10
4 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/crypto/md4/ChangeLog b/src/lib/crypto/md4/ChangeLog
index 3653c4509..bcac6ed4b 100644
--- a/src/lib/crypto/md4/ChangeLog
+++ b/src/lib/crypto/md4/ChangeLog
@@ -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
diff --git a/src/lib/crypto/md4/md4.c b/src/lib/crypto/md4/md4.c
index 8714f4a0b..fbfd25625 100644
--- a/src/lib/crypto/md4/md4.c
+++ b/src/lib/crypto/md4/md4.c
@@ -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
diff --git a/src/lib/crypto/md5/ChangeLog b/src/lib/crypto/md5/ChangeLog
index 6cbaa4ab8..130adc451 100644
--- a/src/lib/crypto/md5/ChangeLog
+++ b/src/lib/crypto/md5/ChangeLog
@@ -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
diff --git a/src/lib/crypto/md5/md5.c b/src/lib/crypto/md5/md5.c
index a636968d5..95efb77e4 100644
--- a/src/lib/crypto/md5/md5.c
+++ b/src/lib/crypto/md5/md5.c
@@ -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