42
42
/* SMB2 Max Credits */
43
43
#define SMB2_MAX_CREDITS 8192
44
44
45
- #define SMB2_CLIENT_GUID_SIZE 16
46
- #define SMB2_CREATE_GUID_SIZE 16
47
-
48
45
/* Maximum buffer size value we can send with 1 credit */
49
46
#define SMB2_MAX_BUFFER_SIZE 65536
50
47
@@ -80,48 +77,11 @@ struct smb2_err_rsp {
80
77
__u8 ErrorData [1 ]; /* variable length */
81
78
} __packed ;
82
79
83
- struct smb2_negotiate_req {
84
- struct smb2_hdr hdr ;
85
- __le16 StructureSize ; /* Must be 36 */
86
- __le16 DialectCount ;
87
- __le16 SecurityMode ;
88
- __le16 Reserved ; /* MBZ */
89
- __le32 Capabilities ;
90
- __u8 ClientGUID [SMB2_CLIENT_GUID_SIZE ];
91
- /* In SMB3.02 and earlier next three were MBZ le64 ClientStartTime */
92
- __le32 NegotiateContextOffset ; /* SMB3.1.1 only. MBZ earlier */
93
- __le16 NegotiateContextCount ; /* SMB3.1.1 only. MBZ earlier */
94
- __le16 Reserved2 ;
95
- __le16 Dialects [1 ]; /* One dialect (vers=) at a time for now */
96
- } __packed ;
97
-
98
- /* SecurityMode flags */
99
- #define SMB2_NEGOTIATE_SIGNING_ENABLED_LE cpu_to_le16(0x0001)
100
- #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002
101
- #define SMB2_NEGOTIATE_SIGNING_REQUIRED_LE cpu_to_le16(0x0002)
102
- /* Capabilities flags */
103
- #define SMB2_GLOBAL_CAP_DFS 0x00000001
104
- #define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */
105
- #define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */
106
- #define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */
107
- #define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */
108
- #define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */
109
- #define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */
110
- /* Internal types */
111
- #define SMB2_NT_FIND 0x00100000
112
- #define SMB2_LARGE_FILES 0x00200000
113
-
114
- #define SMB311_SALT_SIZE 32
115
- /* Hash Algorithm Types */
116
- #define SMB2_PREAUTH_INTEGRITY_SHA512 cpu_to_le16(0x0001)
117
-
118
- #define PREAUTH_HASHVALUE_SIZE 64
119
-
120
80
struct preauth_integrity_info {
121
81
/* PreAuth integrity Hash ID */
122
82
__le16 Preauth_HashId ;
123
83
/* PreAuth integrity Hash Value */
124
- __u8 Preauth_HashValue [PREAUTH_HASHVALUE_SIZE ];
84
+ __u8 Preauth_HashValue [SMB2_PREAUTH_HASH_SIZE ];
125
85
};
126
86
127
87
/* offset is sizeof smb2_negotiate_rsp but rounded up to 8 bytes. */
@@ -137,107 +97,6 @@ struct preauth_integrity_info {
137
97
#define OFFSET_OF_NEG_CONTEXT 0xd0
138
98
#endif
139
99
140
- #define SMB2_PREAUTH_INTEGRITY_CAPABILITIES cpu_to_le16(1)
141
- #define SMB2_ENCRYPTION_CAPABILITIES cpu_to_le16(2)
142
- #define SMB2_COMPRESSION_CAPABILITIES cpu_to_le16(3)
143
- #define SMB2_NETNAME_NEGOTIATE_CONTEXT_ID cpu_to_le16(5)
144
- #define SMB2_SIGNING_CAPABILITIES cpu_to_le16(8)
145
- #define SMB2_POSIX_EXTENSIONS_AVAILABLE cpu_to_le16(0x100)
146
-
147
- struct smb2_neg_context {
148
- __le16 ContextType ;
149
- __le16 DataLength ;
150
- __le32 Reserved ;
151
- /* Followed by array of data */
152
- } __packed ;
153
-
154
- struct smb2_preauth_neg_context {
155
- __le16 ContextType ; /* 1 */
156
- __le16 DataLength ;
157
- __le32 Reserved ;
158
- __le16 HashAlgorithmCount ; /* 1 */
159
- __le16 SaltLength ;
160
- __le16 HashAlgorithms ; /* HashAlgorithms[0] since only one defined */
161
- __u8 Salt [SMB311_SALT_SIZE ];
162
- } __packed ;
163
-
164
- /* Encryption Algorithms Ciphers */
165
- #define SMB2_ENCRYPTION_AES128_CCM cpu_to_le16(0x0001)
166
- #define SMB2_ENCRYPTION_AES128_GCM cpu_to_le16(0x0002)
167
- #define SMB2_ENCRYPTION_AES256_CCM cpu_to_le16(0x0003)
168
- #define SMB2_ENCRYPTION_AES256_GCM cpu_to_le16(0x0004)
169
-
170
- struct smb2_encryption_neg_context {
171
- __le16 ContextType ; /* 2 */
172
- __le16 DataLength ;
173
- __le32 Reserved ;
174
- /* CipherCount usally 2, but can be 3 when AES256-GCM enabled */
175
- __le16 CipherCount ; /* AES-128-GCM and AES-128-CCM by default */
176
- __le16 Ciphers [];
177
- } __packed ;
178
-
179
- #define SMB3_COMPRESS_NONE cpu_to_le16(0x0000)
180
- #define SMB3_COMPRESS_LZNT1 cpu_to_le16(0x0001)
181
- #define SMB3_COMPRESS_LZ77 cpu_to_le16(0x0002)
182
- #define SMB3_COMPRESS_LZ77_HUFF cpu_to_le16(0x0003)
183
-
184
- struct smb2_compression_ctx {
185
- __le16 ContextType ; /* 3 */
186
- __le16 DataLength ;
187
- __le32 Reserved ;
188
- __le16 CompressionAlgorithmCount ;
189
- __u16 Padding ;
190
- __le32 Reserved1 ;
191
- __le16 CompressionAlgorithms [];
192
- } __packed ;
193
-
194
- #define POSIX_CTXT_DATA_LEN 16
195
- struct smb2_posix_neg_context {
196
- __le16 ContextType ; /* 0x100 */
197
- __le16 DataLength ;
198
- __le32 Reserved ;
199
- __u8 Name [16 ]; /* POSIX ctxt GUID 93AD25509CB411E7B42383DE968BCD7C */
200
- } __packed ;
201
-
202
- struct smb2_netname_neg_context {
203
- __le16 ContextType ; /* 0x100 */
204
- __le16 DataLength ;
205
- __le32 Reserved ;
206
- __le16 NetName []; /* hostname of target converted to UCS-2 */
207
- } __packed ;
208
-
209
- /* Signing algorithms */
210
- #define SIGNING_ALG_HMAC_SHA256 cpu_to_le16(0)
211
- #define SIGNING_ALG_AES_CMAC cpu_to_le16(1)
212
- #define SIGNING_ALG_AES_GMAC cpu_to_le16(2)
213
-
214
- struct smb2_signing_capabilities {
215
- __le16 ContextType ; /* 8 */
216
- __le16 DataLength ;
217
- __le32 Reserved ;
218
- __le16 SigningAlgorithmCount ;
219
- __le16 SigningAlgorithms [];
220
- } __packed ;
221
-
222
- struct smb2_negotiate_rsp {
223
- struct smb2_hdr hdr ;
224
- __le16 StructureSize ; /* Must be 65 */
225
- __le16 SecurityMode ;
226
- __le16 DialectRevision ;
227
- __le16 NegotiateContextCount ; /* Prior to SMB3.1.1 was Reserved & MBZ */
228
- __u8 ServerGUID [16 ];
229
- __le32 Capabilities ;
230
- __le32 MaxTransactSize ;
231
- __le32 MaxReadSize ;
232
- __le32 MaxWriteSize ;
233
- __le64 SystemTime ; /* MBZ */
234
- __le64 ServerStartTime ;
235
- __le16 SecurityBufferOffset ;
236
- __le16 SecurityBufferLength ;
237
- __le32 NegotiateContextOffset ; /* Pre:SMB3.1.1 was reserved/ignored */
238
- __u8 Buffer [1 ]; /* variable length GSS security buffer */
239
- } __packed ;
240
-
241
100
/* Flags */
242
101
#define SMB2_SESSION_REQ_FLAG_BINDING 0x01
243
102
#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
0 commit comments