blob: c377d8065d999385240c076bbe403b255a0b2671 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * fs/cifs/ntlmssp.h
3 *
Steve Frenchd38d8c72007-06-28 19:44:13 +00004 * Copyright (c) International Business Machines Corp., 2002,2007
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * Author(s): Steve French (sfrench@us.ibm.com)
6 *
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.
11 *
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.
16 *
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
Steve French6dc0f872007-07-06 23:13:06 +000019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 */
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#define NTLMSSP_SIGNATURE "NTLMSSP"
23/* Message Types */
24#define NtLmNegotiate cpu_to_le32(1)
25#define NtLmChallenge cpu_to_le32(2)
26#define NtLmAuthenticate cpu_to_le32(3)
27#define UnknownMessage cpu_to_le32(8)
28
29/* Negotiate Flags */
Steve Frenchd38d8c72007-06-28 19:44:13 +000030#define NTLMSSP_NEGOTIATE_UNICODE 0x01 /* Text strings are in unicode */
31#define NTLMSSP_NEGOTIATE_OEM 0x02 /* Text strings are in OEM */
32#define NTLMSSP_REQUEST_TARGET 0x04 /* Server return its auth realm */
33#define NTLMSSP_NEGOTIATE_SIGN 0x0010 /* Request signature capability */
34#define NTLMSSP_NEGOTIATE_SEAL 0x0020 /* Request confidentiality */
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#define NTLMSSP_NEGOTIATE_DGRAM 0x0040
Steve Frenchd38d8c72007-06-28 19:44:13 +000036#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 /* Sign/seal use LM session key */
37#define NTLMSSP_NEGOTIATE_NTLM 0x0200 /* NTLM authentication */
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000
39#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
Steve Frenchd38d8c72007-06-28 19:44:13 +000040#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 /* client/server on same machine */
41#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 /* Sign for all security levels */
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000
43#define NTLMSSP_TARGET_TYPE_SERVER 0x20000
44#define NTLMSSP_TARGET_TYPE_SHARE 0x40000
45#define NTLMSSP_NEGOTIATE_NTLMV2 0x80000
46#define NTLMSSP_REQUEST_INIT_RESP 0x100000
47#define NTLMSSP_REQUEST_ACCEPT_RESP 0x200000
48#define NTLMSSP_REQUEST_NOT_NT_KEY 0x400000
49#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000
50#define NTLMSSP_NEGOTIATE_128 0x20000000
51#define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000
52#define NTLMSSP_NEGOTIATE_56 0x80000000
53
54/* Although typedefs are not commonly used for structure definitions */
55/* in the Linux kernel, in this particular case they are useful */
56/* to more closely match the standards document for NTLMSSP from */
57/* OpenGroup and to make the code more closely match the standard in */
58/* appearance */
59
60typedef struct _SECURITY_BUFFER {
61 __le16 Length;
62 __le16 MaximumLength;
63 __le32 Buffer; /* offset to buffer */
Steve French0753ca72005-10-27 13:55:12 -070064} __attribute__((packed)) SECURITY_BUFFER;
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
66typedef struct _NEGOTIATE_MESSAGE {
Steve French582d21e2008-05-13 04:54:12 +000067 __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 __le32 MessageType; /* 1 */
69 __le32 NegotiateFlags;
70 SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */
71 SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */
72 char DomainString[0];
73 /* followed by WorkstationString */
Steve French0753ca72005-10-27 13:55:12 -070074} __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
76typedef struct _CHALLENGE_MESSAGE {
Steve French582d21e2008-05-13 04:54:12 +000077 __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 __le32 MessageType; /* 2 */
79 SECURITY_BUFFER TargetName;
80 __le32 NegotiateFlags;
81 __u8 Challenge[CIFS_CRYPTO_KEY_SIZE];
82 __u8 Reserved[8];
83 SECURITY_BUFFER TargetInfoArray;
Steve French0753ca72005-10-27 13:55:12 -070084} __attribute__((packed)) CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE;
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86typedef struct _AUTHENTICATE_MESSAGE {
87 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)];
88 __le32 MessageType; /* 3 */
89 SECURITY_BUFFER LmChallengeResponse;
90 SECURITY_BUFFER NtChallengeResponse;
91 SECURITY_BUFFER DomainName;
92 SECURITY_BUFFER UserName;
93 SECURITY_BUFFER WorkstationName;
94 SECURITY_BUFFER SessionKey;
95 __le32 NegotiateFlags;
96 char UserString[0];
Steve French0753ca72005-10-27 13:55:12 -070097} __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE;