|
60 | 60 |
|
61 | 61 | #define NUMBER_OF_SMB2_COMMANDS 0x0013 |
62 | 62 |
|
| 63 | +/* |
| 64 | + * Size of the session key (crypto key encrypted with the password |
| 65 | + */ |
| 66 | +#define SMB2_NTLMV2_SESSKEY_SIZE 16 |
| 67 | +#define SMB2_SIGNATURE_SIZE 16 |
| 68 | +#define SMB2_HMACSHA256_SIZE 32 |
| 69 | +#define SMB2_CMACAES_SIZE 16 |
| 70 | +#define SMB3_GCM128_CRYPTKEY_SIZE 16 |
| 71 | +#define SMB3_GCM256_CRYPTKEY_SIZE 32 |
| 72 | + |
| 73 | +/* |
| 74 | + * Size of the smb3 encryption/decryption keys |
| 75 | + * This size is big enough to store any cipher key types. |
| 76 | + */ |
| 77 | +#define SMB3_ENC_DEC_KEY_SIZE 32 |
| 78 | + |
| 79 | +/* |
| 80 | + * Size of the smb3 signing key |
| 81 | + */ |
| 82 | +#define SMB3_SIGN_KEY_SIZE 16 |
| 83 | + |
| 84 | +#define CIFS_CLIENT_CHALLENGE_SIZE 8 |
| 85 | + |
| 86 | +/* Maximum buffer size value we can send with 1 credit */ |
| 87 | +#define SMB2_MAX_BUFFER_SIZE 65536 |
| 88 | + |
| 89 | +/* |
| 90 | + * The default wsize is 1M for SMB2 (and for some CIFS cases). |
| 91 | + * find_get_pages seems to return a maximum of 256 |
| 92 | + * pages in a single call. With PAGE_SIZE == 4k, this means we can |
| 93 | + * fill a single wsize request with a single call. |
| 94 | + */ |
| 95 | +#define SMB3_DEFAULT_IOSIZE (4 * 1024 * 1024) |
| 96 | + |
63 | 97 | /* |
64 | 98 | * SMB2 Header Definition |
65 | 99 | * |
|
88 | 122 | #define SMB2_FLAGS_DFS_OPERATIONS cpu_to_le32(0x10000000) |
89 | 123 | #define SMB2_FLAGS_REPLAY_OPERATION cpu_to_le32(0x20000000) /* SMB3 & up */ |
90 | 124 |
|
| 125 | +/* |
| 126 | + * Definitions for SMB2 Protocol Data Units (network frames) |
| 127 | + * |
| 128 | + * See MS-SMB2.PDF specification for protocol details. |
| 129 | + * The Naming convention is the lower case version of the SMB2 |
| 130 | + * command code name for the struct. Note that structures must be packed. |
| 131 | + * |
| 132 | + */ |
| 133 | + |
91 | 134 | /* See MS-SMB2 section 2.2.1 */ |
92 | 135 | struct smb2_hdr { |
93 | 136 | __le32 ProtocolId; /* 0xFE 'S' 'M' 'B' */ |
@@ -997,6 +1040,13 @@ struct smb2_create_rsp { |
997 | 1040 | __u8 Buffer[1]; |
998 | 1041 | } __packed; |
999 | 1042 |
|
| 1043 | +struct create_posix { |
| 1044 | + struct create_context ccontext; |
| 1045 | + __u8 Name[16]; |
| 1046 | + __le32 Mode; |
| 1047 | + __u32 Reserved; |
| 1048 | +} __packed; |
| 1049 | + |
1000 | 1050 | #define SMB2_LEASE_NONE_LE cpu_to_le32(0x00) |
1001 | 1051 | #define SMB2_LEASE_READ_CACHING_LE cpu_to_le32(0x01) |
1002 | 1052 | #define SMB2_LEASE_HANDLE_CACHING_LE cpu_to_le32(0x02) |
@@ -1036,6 +1086,41 @@ struct create_lease_v2 { |
1036 | 1086 | __u8 Pad[4]; |
1037 | 1087 | } __packed; |
1038 | 1088 |
|
| 1089 | +/* See MS-SMB2 2.2.31 and 2.2.32 */ |
| 1090 | +struct smb2_ioctl_req { |
| 1091 | + struct smb2_hdr hdr; |
| 1092 | + __le16 StructureSize; /* Must be 57 */ |
| 1093 | + __le16 Reserved; /* offset from start of SMB2 header to write data */ |
| 1094 | + __le32 CtlCode; |
| 1095 | + __u64 PersistentFileId; |
| 1096 | + __u64 VolatileFileId; |
| 1097 | + __le32 InputOffset; /* Reserved MBZ */ |
| 1098 | + __le32 InputCount; |
| 1099 | + __le32 MaxInputResponse; |
| 1100 | + __le32 OutputOffset; |
| 1101 | + __le32 OutputCount; |
| 1102 | + __le32 MaxOutputResponse; |
| 1103 | + __le32 Flags; |
| 1104 | + __le32 Reserved2; |
| 1105 | + __u8 Buffer[]; |
| 1106 | +} __packed; |
| 1107 | + |
| 1108 | +struct smb2_ioctl_rsp { |
| 1109 | + struct smb2_hdr hdr; |
| 1110 | + __le16 StructureSize; /* Must be 49 */ |
| 1111 | + __le16 Reserved; |
| 1112 | + __le32 CtlCode; |
| 1113 | + __u64 PersistentFileId; |
| 1114 | + __u64 VolatileFileId; |
| 1115 | + __le32 InputOffset; /* Reserved MBZ */ |
| 1116 | + __le32 InputCount; |
| 1117 | + __le32 OutputOffset; |
| 1118 | + __le32 OutputCount; |
| 1119 | + __le32 Flags; |
| 1120 | + __le32 Reserved2; |
| 1121 | + __u8 Buffer[]; |
| 1122 | +} __packed; |
| 1123 | + |
1039 | 1124 | /* Possible InfoType values */ |
1040 | 1125 | #define SMB2_O_INFO_FILE 0x01 |
1041 | 1126 | #define SMB2_O_INFO_FILESYSTEM 0x02 |
|
0 commit comments