svn commit: samba r7031 - in branches/SAMBA_3_0/source/libsmb: .
jra at samba.org
jra at samba.org
Fri May 27 16:16:07 GMT 2005
Author: jra
Date: 2005-05-27 16:15:56 +0000 (Fri, 27 May 2005)
New Revision: 7031
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7031
Log:
Added encrypt/decrypt function for LSA secrets and trusted
domain passwords on the wire.
Jeremy.
Modified:
branches/SAMBA_3_0/source/libsmb/smbdes.c
branches/SAMBA_3_0/source/libsmb/smbencrypt.c
Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/smbdes.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/smbdes.c 2005-05-27 16:15:39 UTC (rev 7030)
+++ branches/SAMBA_3_0/source/libsmb/smbdes.c 2005-05-27 16:15:56 UTC (rev 7031)
@@ -276,7 +276,7 @@
}
-static void smbhash(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw)
+void smbhash(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw)
{
int i;
char outb[64];
Modified: branches/SAMBA_3_0/source/libsmb/smbencrypt.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/smbencrypt.c 2005-05-27 16:15:39 UTC (rev 7030)
+++ branches/SAMBA_3_0/source/libsmb/smbencrypt.c 2005-05-27 16:15:56 UTC (rev 7031)
@@ -513,6 +513,7 @@
*new_pw_len is the length in bytes of the possibly mulitbyte
returned password including termination.
************************************************************/
+
BOOL decode_pw_buffer(uint8 in_buffer[516], char *new_pwrd,
int new_pwrd_size, uint32 *new_pw_len,
int string_flags)
@@ -554,3 +555,31 @@
return True;
}
+
+/***********************************************************
+ Encrypt/Decrypt used for LSA secrets and trusted domain
+ passwords.
+************************************************************/
+
+void sess_crypt_blob(DATA_BLOB *out, const DATA_BLOB *in, const DATA_BLOB *session_key, int forward)
+{
+ int i, k;
+
+ for (i=0,k=0;
+ i<in->length;
+ i += 8, k += 7) {
+ uint8_t bin[8], bout[8], key[7];
+
+ memset(bin, 0, 8);
+ memcpy(bin, &in->data[i], MIN(8, in->length-i));
+
+ if (k + 7 > session_key->length) {
+ k = (session_key->length - k);
+ }
+ memcpy(key, &session_key->data[k], 7);
+
+ smbhash(bout, bin, key, forward?1:0);
+
+ memcpy(&out->data[i], bout, MIN(8, in->length-i));
+ }
+}
More information about the samba-cvs
mailing list