Oops - now let's get that MD5 change _right_ :-)
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 4 Apr 2000 14:51:17 +0000 (14:51 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 4 Apr 2000 14:51:17 +0000 (14:51 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@438 cda61777-01e9-0310-a592-d414129be87e

ssh.h
sshmd5.c

diff --git a/ssh.h b/ssh.h
index 1e2291e..a9057e7 100644 (file)
--- a/ssh.h
+++ b/ssh.h
@@ -37,7 +37,7 @@ struct MD5Context {
     unsigned long hHash;
 #else
     MD5_Core_State core;
-    unsigned char block[BLKSIZE];
+    unsigned char block[64];
     int blkused;
     uint32 lenhi, lenlo;
 #endif
index 43c274c..f2ce2b3 100644 (file)
--- a/sshmd5.c
+++ b/sshmd5.c
 #define subround(f,w,x,y,z,k,s,ti) \
        w = x + rol(w + f(x,y,z) + block[k] + ti, s)
 
-typedef struct {
-    uint32 h[4];
-} MD5_Core_State;
-
 void MD5_Core_Init(MD5_Core_State *s) {
     s->h[0] = 0x67452301;
     s->h[1] = 0xefcdab89;
@@ -162,7 +158,7 @@ void MD5Update(struct MD5Context *s, unsigned char const *p,
 
 void MD5Final(unsigned char output[16], struct MD5Context *s) {
     int i;
-    int pad;
+    unsigned pad;
     unsigned char c[64];
     uint32 lenhi, lenlo;
 
@@ -176,7 +172,7 @@ void MD5Final(unsigned char output[16], struct MD5Context *s) {
 
     memset(c, 0, pad);
     c[0] = 0x80;
-    MD5_Bytes(s, &c, pad);
+    MD5Update(s, c, pad);
 
     c[7] = (lenhi >> 24) & 0xFF;
     c[6] = (lenhi >> 16) & 0xFF;
@@ -187,7 +183,7 @@ void MD5Final(unsigned char output[16], struct MD5Context *s) {
     c[1] = (lenlo >>  8) & 0xFF;
     c[0] = (lenlo >>  0) & 0xFF;
 
-    MD5_Bytes(s, &c, 8);
+    MD5Update(s, c, 8);
 
     for (i = 0; i < 4; i++) {
         output[4*i+3] = (s->core.h[i] >> 24) & 0xFF;