~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/smb/server/ntlmssp.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: LGPL-2.1+ */
  2 /*
  3  *   Copyright (c) International Business Machines  Corp., 2002,2007
  4  *   Author(s): Steve French (sfrench@us.ibm.com)
  5  */
  6 
  7 #ifndef __KSMBD_NTLMSSP_H
  8 #define __KSMBD_NTLMSSP_H
  9 
 10 #define NTLMSSP_SIGNATURE "NTLMSSP"
 11 
 12 /* Security blob target info data */
 13 #define TGT_Name        "KSMBD"
 14 
 15 /*
 16  * Size of the crypto key returned on the negotiate SMB in bytes
 17  */
 18 #define CIFS_CRYPTO_KEY_SIZE    (8)
 19 #define CIFS_KEY_SIZE   (40)
 20 
 21 /*
 22  * Size of encrypted user password in bytes
 23  */
 24 #define CIFS_ENCPWD_SIZE        (16)
 25 #define CIFS_CPHTXT_SIZE        (16)
 26 
 27 /* Message Types */
 28 #define NtLmNegotiate     cpu_to_le32(1)
 29 #define NtLmChallenge     cpu_to_le32(2)
 30 #define NtLmAuthenticate  cpu_to_le32(3)
 31 #define UnknownMessage    cpu_to_le32(8)
 32 
 33 /* Negotiate Flags */
 34 #define NTLMSSP_NEGOTIATE_UNICODE         0x01 /* Text strings are unicode */
 35 #define NTLMSSP_NEGOTIATE_OEM             0x02 /* Text strings are in OEM */
 36 #define NTLMSSP_REQUEST_TARGET            0x04 /* Srv returns its auth realm */
 37 /* define reserved9                       0x08 */
 38 #define NTLMSSP_NEGOTIATE_SIGN          0x0010 /* Request signing capability */
 39 #define NTLMSSP_NEGOTIATE_SEAL          0x0020 /* Request confidentiality */
 40 #define NTLMSSP_NEGOTIATE_DGRAM         0x0040
 41 #define NTLMSSP_NEGOTIATE_LM_KEY        0x0080 /* Use LM session key */
 42 /* defined reserved 8                   0x0100 */
 43 #define NTLMSSP_NEGOTIATE_NTLM          0x0200 /* NTLM authentication */
 44 #define NTLMSSP_NEGOTIATE_NT_ONLY       0x0400 /* Lanman not allowed */
 45 #define NTLMSSP_ANONYMOUS               0x0800
 46 #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 /* reserved6 */
 47 #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
 48 #define NTLMSSP_NEGOTIATE_LOCAL_CALL    0x4000 /* client/server same machine */
 49 #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN   0x8000 /* Sign. All security levels  */
 50 #define NTLMSSP_TARGET_TYPE_DOMAIN     0x10000
 51 #define NTLMSSP_TARGET_TYPE_SERVER     0x20000
 52 #define NTLMSSP_TARGET_TYPE_SHARE      0x40000
 53 #define NTLMSSP_NEGOTIATE_EXTENDED_SEC 0x80000 /* NB:not related to NTLMv2 pwd*/
 54 /* #define NTLMSSP_REQUEST_INIT_RESP     0x100000 */
 55 #define NTLMSSP_NEGOTIATE_IDENTIFY    0x100000
 56 #define NTLMSSP_REQUEST_ACCEPT_RESP   0x200000 /* reserved5 */
 57 #define NTLMSSP_REQUEST_NON_NT_KEY    0x400000
 58 #define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000
 59 /* #define reserved4                 0x1000000 */
 60 #define NTLMSSP_NEGOTIATE_VERSION    0x2000000 /* we do not set */
 61 /* #define reserved3                 0x4000000 */
 62 /* #define reserved2                 0x8000000 */
 63 /* #define reserved1                0x10000000 */
 64 #define NTLMSSP_NEGOTIATE_128       0x20000000
 65 #define NTLMSSP_NEGOTIATE_KEY_XCH   0x40000000
 66 #define NTLMSSP_NEGOTIATE_56        0x80000000
 67 
 68 /* Define AV Pair Field IDs */
 69 enum av_field_type {
 70         NTLMSSP_AV_EOL = 0,
 71         NTLMSSP_AV_NB_COMPUTER_NAME,
 72         NTLMSSP_AV_NB_DOMAIN_NAME,
 73         NTLMSSP_AV_DNS_COMPUTER_NAME,
 74         NTLMSSP_AV_DNS_DOMAIN_NAME,
 75         NTLMSSP_AV_DNS_TREE_NAME,
 76         NTLMSSP_AV_FLAGS,
 77         NTLMSSP_AV_TIMESTAMP,
 78         NTLMSSP_AV_RESTRICTION,
 79         NTLMSSP_AV_TARGET_NAME,
 80         NTLMSSP_AV_CHANNEL_BINDINGS
 81 };
 82 
 83 /* Although typedefs are not commonly used for structure definitions */
 84 /* in the Linux kernel, in this particular case they are useful      */
 85 /* to more closely match the standards document for NTLMSSP from     */
 86 /* OpenGroup and to make the code more closely match the standard in */
 87 /* appearance */
 88 
 89 struct security_buffer {
 90         __le16 Length;
 91         __le16 MaximumLength;
 92         __le32 BufferOffset;    /* offset to buffer */
 93 } __packed;
 94 
 95 struct target_info {
 96         __le16 Type;
 97         __le16 Length;
 98         __u8 Content[];
 99 } __packed;
100 
101 struct negotiate_message {
102         __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
103         __le32 MessageType;     /* NtLmNegotiate = 1 */
104         __le32 NegotiateFlags;
105         struct security_buffer DomainName;      /* RFC 1001 style and ASCII */
106         struct security_buffer WorkstationName; /* RFC 1001 and ASCII */
107         /*
108          * struct security_buffer for version info not present since we
109          * do not set the version is present flag
110          */
111         char DomainString[];
112         /* followed by WorkstationString */
113 } __packed;
114 
115 struct challenge_message {
116         __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
117         __le32 MessageType;   /* NtLmChallenge = 2 */
118         struct security_buffer TargetName;
119         __le32 NegotiateFlags;
120         __u8 Challenge[CIFS_CRYPTO_KEY_SIZE];
121         __u8 Reserved[8];
122         struct security_buffer TargetInfoArray;
123         /*
124          * struct security_buffer for version info not present since we
125          * do not set the version is present flag
126          */
127 } __packed;
128 
129 struct authenticate_message {
130         __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
131         __le32 MessageType;  /* NtLmsAuthenticate = 3 */
132         struct security_buffer LmChallengeResponse;
133         struct security_buffer NtChallengeResponse;
134         struct security_buffer DomainName;
135         struct security_buffer UserName;
136         struct security_buffer WorkstationName;
137         struct security_buffer SessionKey;
138         __le32 NegotiateFlags;
139         /*
140          * struct security_buffer for version info not present since we
141          * do not set the version is present flag
142          */
143         char UserString[];
144 } __packed;
145 
146 struct ntlmv2_resp {
147         char ntlmv2_hash[CIFS_ENCPWD_SIZE];
148         __le32 blob_signature;
149         __u32  reserved;
150         __le64  time;
151         __u64  client_chal; /* random */
152         __u32  reserved2;
153         /* array of name entries could follow ending in minimum 4 byte struct */
154 } __packed;
155 
156 /* per smb session structure/fields */
157 struct ntlmssp_auth {
158         /* whether session key is per smb session */
159         bool            sesskey_per_smbsess;
160         /* sent by client in type 1 ntlmsssp exchange */
161         __u32           client_flags;
162         /* sent by server in type 2 ntlmssp exchange */
163         __u32           conn_flags;
164         /* sent to server */
165         unsigned char   ciphertext[CIFS_CPHTXT_SIZE];
166         /* used by ntlmssp */
167         char            cryptkey[CIFS_CRYPTO_KEY_SIZE];
168 };
169 #endif /* __KSMBD_NTLMSSP_H */
170 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php