mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r3295: Fix for SMB signing with 56-bit DES session keys. From Nalin Dahyabhai <nalin@redhat.com>.
Jeremy.
(This used to be commit afed78f359
)
This commit is contained in:
parent
157dc5e7ea
commit
971754c0ed
@ -102,6 +102,8 @@ void sign_outgoing_message(struct request_buffer *out, DATA_BLOB *mac_key, uint_
|
||||
{
|
||||
uint8_t calc_md5_mac[16];
|
||||
struct MD5Context md5_ctx;
|
||||
unsigned char key_buf[16];
|
||||
|
||||
/*
|
||||
* Firstly put the sequence number into the first 4 bytes.
|
||||
* and zero out the next 4 bytes.
|
||||
@ -114,8 +116,15 @@ void sign_outgoing_message(struct request_buffer *out, DATA_BLOB *mac_key, uint_
|
||||
|
||||
/* Calculate the 16 byte MAC and place first 8 bytes into the field. */
|
||||
MD5Init(&md5_ctx);
|
||||
MD5Update(&md5_ctx, mac_key->data,
|
||||
mac_key->length);
|
||||
|
||||
/* NB. When making and verifying SMB signatures, Windows apparently
|
||||
zero-pads the key to 128 bits if it isn't long enough.
|
||||
From Nalin Dahyabhai <nalin@redhat.com> */
|
||||
MD5Update(&md5_ctx, mac_key->data, mac_key->length);
|
||||
if (mac_key->length < sizeof(key_buf)) {
|
||||
memset(key_buf, 0, sizeof(key_buf));
|
||||
MD5Update(&md5_ctx, key_buf, sizeof(key_buf) - mac_key->length);
|
||||
}
|
||||
MD5Update(&md5_ctx,
|
||||
out->buffer + NBT_HDR_SIZE,
|
||||
out->size - NBT_HDR_SIZE);
|
||||
|
Loading…
Reference in New Issue
Block a user