diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-08-08 09:32:22 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-08-09 09:59:02 +0200 |
commit | 0d7b17f4db9d271ae41ade7c7b003b8d264cf6bf (patch) | |
tree | 8fcdf8be7d9e095cbbeafa4a27393e6eb316cd0c | |
parent | 0cb11efa873d6e70ef54454240df7fbdd54fd3f2 (diff) | |
download | samba-0d7b17f4db9d271ae41ade7c7b003b8d264cf6bf.tar.gz samba-0d7b17f4db9d271ae41ade7c7b003b8d264cf6bf.tar.bz2 samba-0d7b17f4db9d271ae41ade7c7b003b8d264cf6bf.zip |
s3:smb2_sesssetup: setup global->[en|de]cryption_key
metze
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug 9 09:59:02 CEST 2012 on sn-devel-104
-rw-r--r-- | source3/smbd/smb2_sesssetup.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c index 6135efcd54..12a9d22f16 100644 --- a/source3/smbd/smb2_sesssetup.c +++ b/source3/smbd/smb2_sesssetup.c @@ -243,6 +243,42 @@ static NTSTATUS smbd_smb2_auth_generic_return(struct smbXsrv_session *session, x->global->signing_key.data); } + if (conn->protocol >= PROTOCOL_SMB2_24) { + const DATA_BLOB label = data_blob_string_const_null("SMB2AESCCM"); + const DATA_BLOB context = data_blob_string_const_null("ServerIn "); + + x->global->decryption_key = data_blob_talloc(x->global, + session_key, + sizeof(session_key)); + if (x->global->decryption_key.data == NULL) { + ZERO_STRUCT(session_key); + return NT_STATUS_NO_MEMORY; + } + + smb2_key_derivation(session_key, sizeof(session_key), + label.data, label.length, + context.data, context.length, + x->global->decryption_key.data); + } + + if (conn->protocol >= PROTOCOL_SMB2_24) { + const DATA_BLOB label = data_blob_string_const_null("SMB2AESCCM"); + const DATA_BLOB context = data_blob_string_const_null("ServerOut"); + + x->global->encryption_key = data_blob_talloc(x->global, + session_key, + sizeof(session_key)); + if (x->global->encryption_key.data == NULL) { + ZERO_STRUCT(session_key); + return NT_STATUS_NO_MEMORY; + } + + smb2_key_derivation(session_key, sizeof(session_key), + label.data, label.length, + context.data, context.length, + x->global->encryption_key.data); + } + x->global->application_key = data_blob_dup_talloc(x->global, x->global->signing_key); if (x->global->application_key.data == NULL) { |