0001
0002
0003
0004
0005
0006
0007 #ifndef __KSMBD_NTLMSSP_H
0008 #define __KSMBD_NTLMSSP_H
0009
0010 #define NTLMSSP_SIGNATURE "NTLMSSP"
0011
0012
0013 #define TGT_Name "KSMBD"
0014
0015
0016
0017
0018 #define CIFS_CRYPTO_KEY_SIZE (8)
0019 #define CIFS_KEY_SIZE (40)
0020
0021
0022
0023
0024 #define CIFS_ENCPWD_SIZE (16)
0025 #define CIFS_CPHTXT_SIZE (16)
0026
0027
0028 #define NtLmNegotiate cpu_to_le32(1)
0029 #define NtLmChallenge cpu_to_le32(2)
0030 #define NtLmAuthenticate cpu_to_le32(3)
0031 #define UnknownMessage cpu_to_le32(8)
0032
0033
0034 #define NTLMSSP_NEGOTIATE_UNICODE 0x01
0035 #define NTLMSSP_NEGOTIATE_OEM 0x02
0036 #define NTLMSSP_REQUEST_TARGET 0x04
0037
0038 #define NTLMSSP_NEGOTIATE_SIGN 0x0010
0039 #define NTLMSSP_NEGOTIATE_SEAL 0x0020
0040 #define NTLMSSP_NEGOTIATE_DGRAM 0x0040
0041 #define NTLMSSP_NEGOTIATE_LM_KEY 0x0080
0042
0043 #define NTLMSSP_NEGOTIATE_NTLM 0x0200
0044 #define NTLMSSP_NEGOTIATE_NT_ONLY 0x0400
0045 #define NTLMSSP_ANONYMOUS 0x0800
0046 #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000
0047 #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
0048 #define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000
0049 #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000
0050 #define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000
0051 #define NTLMSSP_TARGET_TYPE_SERVER 0x20000
0052 #define NTLMSSP_TARGET_TYPE_SHARE 0x40000
0053 #define NTLMSSP_NEGOTIATE_EXTENDED_SEC 0x80000
0054
0055 #define NTLMSSP_NEGOTIATE_IDENTIFY 0x100000
0056 #define NTLMSSP_REQUEST_ACCEPT_RESP 0x200000
0057 #define NTLMSSP_REQUEST_NON_NT_KEY 0x400000
0058 #define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000
0059
0060 #define NTLMSSP_NEGOTIATE_VERSION 0x2000000
0061
0062
0063
0064 #define NTLMSSP_NEGOTIATE_128 0x20000000
0065 #define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000
0066 #define NTLMSSP_NEGOTIATE_56 0x80000000
0067
0068
0069 enum av_field_type {
0070 NTLMSSP_AV_EOL = 0,
0071 NTLMSSP_AV_NB_COMPUTER_NAME,
0072 NTLMSSP_AV_NB_DOMAIN_NAME,
0073 NTLMSSP_AV_DNS_COMPUTER_NAME,
0074 NTLMSSP_AV_DNS_DOMAIN_NAME,
0075 NTLMSSP_AV_DNS_TREE_NAME,
0076 NTLMSSP_AV_FLAGS,
0077 NTLMSSP_AV_TIMESTAMP,
0078 NTLMSSP_AV_RESTRICTION,
0079 NTLMSSP_AV_TARGET_NAME,
0080 NTLMSSP_AV_CHANNEL_BINDINGS
0081 };
0082
0083
0084
0085
0086
0087
0088
0089 struct security_buffer {
0090 __le16 Length;
0091 __le16 MaximumLength;
0092 __le32 BufferOffset;
0093 } __packed;
0094
0095 struct target_info {
0096 __le16 Type;
0097 __le16 Length;
0098 __u8 Content[];
0099 } __packed;
0100
0101 struct negotiate_message {
0102 __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
0103 __le32 MessageType;
0104 __le32 NegotiateFlags;
0105 struct security_buffer DomainName;
0106 struct security_buffer WorkstationName;
0107
0108
0109
0110
0111 char DomainString[];
0112
0113 } __packed;
0114
0115 struct challenge_message {
0116 __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
0117 __le32 MessageType;
0118 struct security_buffer TargetName;
0119 __le32 NegotiateFlags;
0120 __u8 Challenge[CIFS_CRYPTO_KEY_SIZE];
0121 __u8 Reserved[8];
0122 struct security_buffer TargetInfoArray;
0123
0124
0125
0126
0127 } __packed;
0128
0129 struct authenticate_message {
0130 __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
0131 __le32 MessageType;
0132 struct security_buffer LmChallengeResponse;
0133 struct security_buffer NtChallengeResponse;
0134 struct security_buffer DomainName;
0135 struct security_buffer UserName;
0136 struct security_buffer WorkstationName;
0137 struct security_buffer SessionKey;
0138 __le32 NegotiateFlags;
0139
0140
0141
0142
0143 char UserString[];
0144 } __packed;
0145
0146 struct ntlmv2_resp {
0147 char ntlmv2_hash[CIFS_ENCPWD_SIZE];
0148 __le32 blob_signature;
0149 __u32 reserved;
0150 __le64 time;
0151 __u64 client_chal;
0152 __u32 reserved2;
0153
0154 } __packed;
0155
0156
0157 struct ntlmssp_auth {
0158
0159 bool sesskey_per_smbsess;
0160
0161 __u32 client_flags;
0162
0163 __u32 conn_flags;
0164
0165 unsigned char ciphertext[CIFS_CPHTXT_SIZE];
0166
0167 char cryptkey[CIFS_CRYPTO_KEY_SIZE];
0168 };
0169 #endif