summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-09-15 02:49:38 +0000
committerAndrew Tridgell <tridge@samba.org>1997-09-15 02:49:38 +0000
commitddb2ce9d8100bd2c0475032b99869624db36304c (patch)
tree65f00b30f58a3007be8dcdb64b91512e341ae580 /source3/libsmb
parent5137b860723437f0befaec9bc3f6a157b8efe507 (diff)
downloadsamba-ddb2ce9d8100bd2c0475032b99869624db36304c.tar.gz
samba-ddb2ce9d8100bd2c0475032b99869624db36304c.tar.bz2
samba-ddb2ce9d8100bd2c0475032b99869624db36304c.zip
rewrote md4.c from scratch. This implementation should be portable and
doesn't have any worries about RSA copyright. (This used to be commit a1569971663f01c245c145b18290d9dba965dc36)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/smbencrypt.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index b2ae363952..2738103692 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -21,7 +21,6 @@
*/
#include "includes.h"
-#include "md4.h"
extern int DEBUGLEVEL;
@@ -105,28 +104,20 @@ static int _my_mbstowcs(int16 *dst, uchar *src, int len)
void E_md4hash(uchar *passwd, uchar *p16)
{
- int i, len;
+ int len;
int16 wpwd[129];
- MDstruct MD;
-
+
/* Password cannot be longer than 128 characters */
len = strlen((char *)passwd);
if(len > 128)
len = 128;
/* Password must be converted to NT unicode */
- _my_mbstowcs( wpwd, passwd, len);
+ _my_mbstowcs(wpwd, passwd, len);
wpwd[len] = 0; /* Ensure string is null terminated */
/* Calculate length in bytes */
len = _my_wcslen(wpwd) * sizeof(int16);
-
- MDbegin(&MD);
- for(i = 0; i + 64 <= len; i += 64)
- MDupdate(&MD,wpwd + (i/2), 512);
- MDupdate(&MD,wpwd + (i/2),(len-i)*8);
- SIVAL(p16,0,MD.buffer[0]);
- SIVAL(p16,4,MD.buffer[1]);
- SIVAL(p16,8,MD.buffer[2]);
- SIVAL(p16,12,MD.buffer[3]);
+
+ mdfour(p16, (unsigned char *)wpwd, len);
}
/* Does the NT MD4 hash then des encryption. */