2014-09-23 06:09:16 +04:00
/*
Unix SMB / CIFS implementation .
Copyright ( C ) Stefan Metzmacher 2014
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_
# define _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_
struct smb2_negotiate_context {
uint16_t type ;
DATA_BLOB data ;
} ;
struct smb2_negotiate_contexts {
2021-05-09 22:16:00 +03:00
uint16_t num_contexts ;
2014-09-23 06:09:16 +04:00
struct smb2_negotiate_context * contexts ;
} ;
/*
parse a set of SMB2 negotiate contexts
*/
NTSTATUS smb2_negotiate_context_parse ( TALLOC_CTX * mem_ctx , const DATA_BLOB buffer ,
2021-05-09 22:16:00 +03:00
uint16_t expected_count ,
struct smb2_negotiate_contexts * contexts ) ;
2014-09-23 06:09:16 +04:00
/*
negotiate a buffer of a set of negotiate contexts
*/
NTSTATUS smb2_negotiate_context_push ( TALLOC_CTX * mem_ctx , DATA_BLOB * buffer ,
const struct smb2_negotiate_contexts contexts ) ;
2019-02-11 11:03:39 +03:00
NTSTATUS smb2_negotiate_context_add ( TALLOC_CTX * mem_ctx ,
struct smb2_negotiate_contexts * c ,
uint16_t type ,
const uint8_t * buf ,
size_t buflen ) ;
2014-09-23 06:09:16 +04:00
/*
* return the first context with the given tag
*/
struct smb2_negotiate_context * smb2_negotiate_context_find ( const struct smb2_negotiate_contexts * b ,
uint16_t type ) ;
2014-11-26 04:43:25 +03:00
# define WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK 31
2014-09-23 06:09:16 +04:00
2021-03-11 13:04:14 +03:00
struct smb3_signing_capabilities {
2020-11-11 16:10:01 +03:00
# define SMB3_SIGNING_CAPABILITIES_MAX_ALGOS 3
2021-03-11 13:04:14 +03:00
uint16_t num_algos ;
uint16_t algos [ SMB3_SIGNING_CAPABILITIES_MAX_ALGOS ] ;
} ;
2021-03-10 01:38:51 +03:00
struct smb3_encryption_capabilities {
2020-11-10 03:25:19 +03:00
# define SMB3_ENCRYTION_CAPABILITIES_MAX_ALGOS 4
2021-03-10 01:38:51 +03:00
uint16_t num_algos ;
uint16_t algos [ SMB3_ENCRYTION_CAPABILITIES_MAX_ALGOS ] ;
} ;
2021-03-10 01:38:51 +03:00
struct smb311_capabilities {
2021-03-11 13:04:14 +03:00
struct smb3_signing_capabilities signing ;
2021-03-10 01:38:51 +03:00
struct smb3_encryption_capabilities encryption ;
2021-03-10 01:38:51 +03:00
} ;
2021-03-11 13:04:14 +03:00
const char * smb3_signing_algorithm_name ( uint16_t algo ) ;
2021-07-13 19:00:59 +03:00
const char * smb3_encryption_algorithm_name ( uint16_t algo ) ;
struct smb311_capabilities smb311_capabilities_parse ( const char * role ,
2021-07-13 22:26:19 +03:00
const char * const * signing_algos ,
2021-07-13 19:00:59 +03:00
const char * const * encryption_algos ) ;
2021-07-14 13:13:49 +03:00
NTSTATUS smb311_capabilities_check ( const struct smb311_capabilities * c ,
const char * debug_prefix ,
int debug_lvl ,
NTSTATUS error_status ,
const char * role ,
enum protocol_types protocol ,
2021-07-13 22:26:19 +03:00
uint16_t sign_algo ,
2021-07-14 13:13:49 +03:00
uint16_t cipher_algo ) ;
2014-09-23 06:09:16 +04:00
# endif /* _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_ */