2 Unix SMB/CIFS implementation.
5 Copyright (C) Stefan Metzmacher 2009
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _LIBCLI_SMB_SMB2_SIGNING_H_
22 #define _LIBCLI_SMB_SMB2_SIGNING_H_
26 struct smb2_signing_derivation
{
31 struct smb2_signing_derivations
{
32 struct smb2_signing_derivation __signing
;
33 const struct smb2_signing_derivation
*signing
;
34 struct smb2_signing_derivation __cipher_c2s
;
35 const struct smb2_signing_derivation
*cipher_c2s
;
36 struct smb2_signing_derivation __cipher_s2c
;
37 const struct smb2_signing_derivation
*cipher_s2c
;
38 struct smb2_signing_derivation __application
;
39 const struct smb2_signing_derivation
*application
;
42 void smb2_signing_derivations_fill_const_stack(struct smb2_signing_derivations
*ds
,
43 enum protocol_types protocol
,
44 const DATA_BLOB preauth_hash
);
46 struct smb2_signing_key
{
48 uint16_t sign_algo_id
;
50 #ifdef SMB2_SIGNING_KEY_GNUTLS_TYPES
51 gnutls_hmac_hd_t hmac_hnd
;
55 uint16_t cipher_algo_id
;
57 #ifdef SMB2_SIGNING_KEY_GNUTLS_TYPES
58 gnutls_aead_cipher_hd_t cipher_hnd
;
64 NTSTATUS
smb2_signing_key_copy(TALLOC_CTX
*mem_ctx
,
65 const struct smb2_signing_key
*src
,
66 struct smb2_signing_key
**_dst
);
67 NTSTATUS
smb2_signing_key_sign_create(TALLOC_CTX
*mem_ctx
,
68 uint16_t sign_algo_id
,
69 const DATA_BLOB
*master_key
,
70 const struct smb2_signing_derivation
*d
,
71 struct smb2_signing_key
**_key
);
72 NTSTATUS
smb2_signing_key_cipher_create(TALLOC_CTX
*mem_ctx
,
73 uint16_t cipher_algo_id
,
74 const DATA_BLOB
*master_key
,
75 const struct smb2_signing_derivation
*d
,
76 struct smb2_signing_key
**_key
);
78 bool smb2_signing_key_valid(const struct smb2_signing_key
*key
);
80 NTSTATUS
smb2_signing_sign_pdu(struct smb2_signing_key
*signing_key
,
84 NTSTATUS
smb2_signing_check_pdu(struct smb2_signing_key
*signing_key
,
85 const struct iovec
*vector
,
88 NTSTATUS
smb2_key_derivation(const uint8_t *KI
, size_t KI_len
,
89 const uint8_t *Label
, size_t Label_len
,
90 const uint8_t *Context
, size_t Context_len
,
91 uint8_t *KO
, size_t KO_len
);
93 NTSTATUS
smb2_signing_encrypt_pdu(struct smb2_signing_key
*encryption_key
,
96 NTSTATUS
smb2_signing_decrypt_pdu(struct smb2_signing_key
*decryption_key
,
100 #endif /* _LIBCLI_SMB_SMB2_SIGNING_H_ */