[libsoup] Bug 732087 - fix MD4 padding (for NTLM passwords of 28 chars)



commit b0918d0a5165ba7f33564acc35e1ee6b9850c77a
Author: David Woodhouse <David Woodhouse intel com>
Date:   Tue Jun 24 17:35:37 2014 +0100

    Bug 732087 - fix MD4 padding (for NTLM passwords of 28 chars)

 libsoup/soup-auth-ntlm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-auth-ntlm.c b/libsoup/soup-auth-ntlm.c
index 0554197..ca0e4e1 100644
--- a/libsoup/soup-auth-ntlm.c
+++ b/libsoup/soup-auth-ntlm.c
@@ -835,7 +835,8 @@ md4sum (const unsigned char *in, int nbytes, unsigned char digest[16])
        guint32 A, B, C, D, AA, BB, CC, DD, X[16];
        int pbytes, nbits = nbytes * 8, i, j;
 
-       pbytes = (120 - (nbytes % 64)) % 64;
+       /* There is *always* padding of at least one bit. */
+       pbytes = ((119 - (nbytes % 64)) % 64) + 1;
        M = alloca (nbytes + pbytes + 8);
        memcpy (M, in, nbytes);
        memset (M + nbytes, 0, pbytes + 8);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]