diff options
author | Luke Leighton <lkcl@samba.org> | 1998-10-09 19:05:19 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-10-09 19:05:19 +0000 |
commit | 755986764f5a6b0ec25c7f20fde0a80eb4d121ba (patch) | |
tree | 22ab05c952aab32a7fbd376943aa4cee3f5dd44f /source3/libsmb | |
parent | 00224e7d0875630e557922d093a264d755f36e3c (diff) | |
download | samba-755986764f5a6b0ec25c7f20fde0a80eb4d121ba.tar.gz samba-755986764f5a6b0ec25c7f20fde0a80eb4d121ba.tar.bz2 samba-755986764f5a6b0ec25c7f20fde0a80eb4d121ba.zip |
dce/rpc
(This used to be commit 32d0f5e4a564686ad6b270dd24423ee49a81f223)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/smbdes.c | 26 | ||||
-rw-r--r-- | source3/libsmb/smbencrypt.c | 6 |
2 files changed, 22 insertions, 10 deletions
diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c index 1d6c6bc0a6..c0f749ad3b 100644 --- a/source3/libsmb/smbdes.c +++ b/source3/libsmb/smbdes.c @@ -357,17 +357,17 @@ void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int for smbhash(out + 8, in + 8, key2, forw); } -void NTLMSSPhash( unsigned char hash[256], unsigned char const key[5]) +void NTLMSSPhash( unsigned char hash[258], unsigned char key[5]) { - unsigned char j = 0; - int ind; + unsigned char j = 0; + int ind; unsigned char k2[8]; - memcpy(k2, key, sizeof(key)); + memcpy(k2, key, 5); k2[5] = 0xe5; - k2[6] = 0xb8; - k2[6] = 0xb0; + k2[6] = 0x38; + k2[7] = 0xb0; for (ind = 0; ind < 256; ind++) { @@ -384,12 +384,15 @@ void NTLMSSPhash( unsigned char hash[256], unsigned char const key[5]) hash[ind] = hash[j]; hash[j] = tc; } + + hash[256] = 0; + hash[257] = 0; } -void NTLMSSPcalc( unsigned char hash[256], unsigned char *data, int len) +void NTLMSSPcalc( unsigned char hash[258], unsigned char *data, int len) { - unsigned char index_i = 0; - unsigned char index_j = 0; + unsigned char index_i = hash[256]; + unsigned char index_j = hash[257]; int ind; for( ind = 0; ind < len; ind++) @@ -405,8 +408,11 @@ void NTLMSSPcalc( unsigned char hash[256], unsigned char *data, int len) hash[index_j] = tc; t = hash[index_i] + hash[index_j]; - data[ind] ^= hash[t]; + data[ind] = data[ind] ^ hash[t]; } + + hash[256] = index_i; + hash[257] = index_j; } void SamOEMhash( unsigned char *data, unsigned char *key, int val) diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c index 44dcbd5e05..a9e680ccdd 100644 --- a/source3/libsmb/smbencrypt.c +++ b/source3/libsmb/smbencrypt.c @@ -162,6 +162,12 @@ void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]) memset(p21 + 8, 0xbd, 8); E_P24(p21, ntlmchalresp, p24); +#ifdef DEBUG_PASSWORD + DEBUG(100,("NTLMSSPOWFencrypt: p21, c8, p24\n")); + dump_data(100, p21, 21); + dump_data(100, ntlmchalresp, 8); + dump_data(100, p24, 24); +#endif } |