4 * Copyright (c) International Business Machines Corp., 2002
5 * Author(s): Steve French (sfrench@us.ibm.com)
7 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
12 * This library 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
15 * the GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #define NTLMSSP_SIGNATURE "NTLMSSP"
26 #define NtLmNegotiate cpu_to_le32(1)
27 #define NtLmChallenge cpu_to_le32(2)
28 #define NtLmAuthenticate cpu_to_le32(3)
29 #define UnknownMessage cpu_to_le32(8)
32 #define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode
33 #define NTLMSSP_NEGOTIATE_OEM 0x02 // Text strings are in OEM
34 #define NTLMSSP_REQUEST_TARGET 0x04 // Server return its auth realm
35 #define NTLMSSP_NEGOTIATE_SIGN 0x0010 // Request signature capability
36 #define NTLMSSP_NEGOTIATE_SEAL 0x0020 // Request confidentiality
37 #define NTLMSSP_NEGOTIATE_DGRAM 0x0040
38 #define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 // Use LM session key for sign/seal
39 #define NTLMSSP_NEGOTIATE_NTLM 0x0200 // NTLM authentication
40 #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000
41 #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
42 #define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 // client/server on same machine
43 #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 // Sign for all security levels
44 #define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000
45 #define NTLMSSP_TARGET_TYPE_SERVER 0x20000
46 #define NTLMSSP_TARGET_TYPE_SHARE 0x40000
47 #define NTLMSSP_NEGOTIATE_NTLMV2 0x80000
48 #define NTLMSSP_REQUEST_INIT_RESP 0x100000
49 #define NTLMSSP_REQUEST_ACCEPT_RESP 0x200000
50 #define NTLMSSP_REQUEST_NOT_NT_KEY 0x400000
51 #define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000
52 #define NTLMSSP_NEGOTIATE_128 0x20000000
53 #define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000
54 #define NTLMSSP_NEGOTIATE_56 0x80000000
56 /* Although typedefs are not commonly used for structure definitions */
57 /* in the Linux kernel, in this particular case they are useful */
58 /* to more closely match the standards document for NTLMSSP from */
59 /* OpenGroup and to make the code more closely match the standard in */
62 typedef struct _SECURITY_BUFFER
{
65 __le32 Buffer
; /* offset to buffer */
68 typedef struct _NEGOTIATE_MESSAGE
{
69 __u8 Signature
[sizeof (NTLMSSP_SIGNATURE
)];
70 __le32 MessageType
; /* 1 */
71 __le32 NegotiateFlags
;
72 SECURITY_BUFFER DomainName
; /* RFC 1001 style and ASCII */
73 SECURITY_BUFFER WorkstationName
; /* RFC 1001 and ASCII */
75 /* followed by WorkstationString */
76 } NEGOTIATE_MESSAGE
, *PNEGOTIATE_MESSAGE
;
78 typedef struct _CHALLENGE_MESSAGE
{
79 __u8 Signature
[sizeof (NTLMSSP_SIGNATURE
)];
80 __le32 MessageType
; /* 2 */
81 SECURITY_BUFFER TargetName
;
82 __le32 NegotiateFlags
;
83 __u8 Challenge
[CIFS_CRYPTO_KEY_SIZE
];
85 SECURITY_BUFFER TargetInfoArray
;
86 } CHALLENGE_MESSAGE
, *PCHALLENGE_MESSAGE
;
88 typedef struct _AUTHENTICATE_MESSAGE
{
89 __u8 Signature
[sizeof (NTLMSSP_SIGNATURE
)];
90 __le32 MessageType
; /* 3 */
91 SECURITY_BUFFER LmChallengeResponse
;
92 SECURITY_BUFFER NtChallengeResponse
;
93 SECURITY_BUFFER DomainName
;
94 SECURITY_BUFFER UserName
;
95 SECURITY_BUFFER WorkstationName
;
96 SECURITY_BUFFER SessionKey
;
97 __le32 NegotiateFlags
;
99 } AUTHENTICATE_MESSAGE
, *PAUTHENTICATE_MESSAGE
;
101 #pragma pack() /* resume default structure packing */