| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  *   fs/cifs/ntlmssp.h | 
 | 3 |  * | 
| Steve French | d38d8c7 | 2007-06-28 19:44:13 +0000 | [diff] [blame] | 4 |  *   Copyright (c) International Business Machines  Corp., 2002,2007 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 |  *   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 French | 6dc0f87 | 2007-07-06 23:13:06 +0000 | [diff] [blame] | 19 |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 |  */ | 
 | 21 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #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 French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 30 | #define NTLMSSP_NEGOTIATE_UNICODE         0x01 /* Text strings are unicode */ | 
 | 31 | #define NTLMSSP_NEGOTIATE_OEM             0x02 /* Text strings are in OEM */ | 
 | 32 | #define NTLMSSP_REQUEST_TARGET            0x04 /* Srv returns its auth realm */ | 
 | 33 | /* define reserved9                       0x08 */ | 
 | 34 | #define NTLMSSP_NEGOTIATE_SIGN          0x0010 /* Request signing capability */ | 
 | 35 | #define NTLMSSP_NEGOTIATE_SEAL          0x0020 /* Request confidentiality */ | 
 | 36 | #define NTLMSSP_NEGOTIATE_DGRAM         0x0040 | 
 | 37 | #define NTLMSSP_NEGOTIATE_LM_KEY        0x0080 /* Use LM session key */ | 
 | 38 | /* defined reserved 8                   0x0100 */ | 
 | 39 | #define NTLMSSP_NEGOTIATE_NTLM          0x0200 /* NTLM authentication */ | 
 | 40 | #define NTLMSSP_NEGOTIATE_NT_ONLY       0x0400 /* Lanman not allowed */ | 
 | 41 | #define NTLMSSP_ANONYMOUS               0x0800 | 
 | 42 | #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 /* reserved6 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000 | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 44 | #define NTLMSSP_NEGOTIATE_LOCAL_CALL    0x4000 /* client/server same machine */ | 
 | 45 | #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN   0x8000 /* Sign. All security levels  */ | 
 | 46 | #define NTLMSSP_TARGET_TYPE_DOMAIN     0x10000 | 
 | 47 | #define NTLMSSP_TARGET_TYPE_SERVER     0x20000 | 
 | 48 | #define NTLMSSP_TARGET_TYPE_SHARE      0x40000 | 
 | 49 | #define NTLMSSP_NEGOTIATE_EXTENDED_SEC 0x80000 /* NB:not related to NTLMv2 pwd*/ | 
 | 50 | /* #define NTLMSSP_REQUEST_INIT_RESP     0x100000 */ | 
 | 51 | #define NTLMSSP_NEGOTIATE_IDENTIFY    0x100000 | 
 | 52 | #define NTLMSSP_REQUEST_ACCEPT_RESP   0x200000 /* reserved5 */ | 
 | 53 | #define NTLMSSP_REQUEST_NON_NT_KEY    0x400000 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000 | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 55 | /* #define reserved4                 0x1000000 */ | 
 | 56 | #define NTLMSSP_NEGOTIATE_VERSION    0x2000000 /* we do not set */ | 
 | 57 | /* #define reserved3                 0x4000000 */ | 
 | 58 | /* #define reserved2                 0x8000000 */ | 
 | 59 | /* #define reserved1                0x10000000 */ | 
 | 60 | #define NTLMSSP_NEGOTIATE_128       0x20000000 | 
 | 61 | #define NTLMSSP_NEGOTIATE_KEY_XCH   0x40000000 | 
 | 62 | #define NTLMSSP_NEGOTIATE_56        0x80000000 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 |  | 
 | 64 | /* Although typedefs are not commonly used for structure definitions */ | 
 | 65 | /* in the Linux kernel, in this particular case they are useful      */ | 
 | 66 | /* to more closely match the standards document for NTLMSSP from     */ | 
 | 67 | /* OpenGroup and to make the code more closely match the standard in */ | 
 | 68 | /* appearance */ | 
 | 69 |  | 
 | 70 | typedef struct _SECURITY_BUFFER { | 
 | 71 | 	__le16 Length; | 
 | 72 | 	__le16 MaximumLength; | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 73 | 	__le32 BufferOffset;	/* offset to buffer */ | 
| Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 74 | } __attribute__((packed)) SECURITY_BUFFER; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 |  | 
 | 76 | typedef struct _NEGOTIATE_MESSAGE { | 
| Steve French | 582d21e | 2008-05-13 04:54:12 +0000 | [diff] [blame] | 77 | 	__u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 78 | 	__le32 MessageType;     /* NtLmNegotiate = 1 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | 	__le32 NegotiateFlags; | 
 | 80 | 	SECURITY_BUFFER DomainName;	/* RFC 1001 style and ASCII */ | 
 | 81 | 	SECURITY_BUFFER WorkstationName;	/* RFC 1001 and ASCII */ | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 82 | 	/* SECURITY_BUFFER for version info not present since we | 
 | 83 | 	   do not set the version is present flag */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | 	char DomainString[0]; | 
 | 85 | 	/* followed by WorkstationString */ | 
| Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 86 | } __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 |  | 
 | 88 | typedef struct _CHALLENGE_MESSAGE { | 
| Steve French | 582d21e | 2008-05-13 04:54:12 +0000 | [diff] [blame] | 89 | 	__u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 90 | 	__le32 MessageType;   /* NtLmChallenge = 2 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | 	SECURITY_BUFFER TargetName; | 
 | 92 | 	__le32 NegotiateFlags; | 
 | 93 | 	__u8 Challenge[CIFS_CRYPTO_KEY_SIZE]; | 
 | 94 | 	__u8 Reserved[8]; | 
 | 95 | 	SECURITY_BUFFER TargetInfoArray; | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 96 | 	/* SECURITY_BUFFER for version info not present since we | 
 | 97 | 	   do not set the version is present flag */ | 
| Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 98 | } __attribute__((packed)) CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 |  | 
 | 100 | typedef struct _AUTHENTICATE_MESSAGE { | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 101 | 	__u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; | 
 | 102 | 	__le32 MessageType;  /* NtLmsAuthenticate = 3 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | 	SECURITY_BUFFER LmChallengeResponse; | 
 | 104 | 	SECURITY_BUFFER NtChallengeResponse; | 
 | 105 | 	SECURITY_BUFFER DomainName; | 
 | 106 | 	SECURITY_BUFFER UserName; | 
 | 107 | 	SECURITY_BUFFER WorkstationName; | 
 | 108 | 	SECURITY_BUFFER SessionKey; | 
 | 109 | 	__le32 NegotiateFlags; | 
| Steve French | e14b2fe | 2009-05-01 04:37:43 +0000 | [diff] [blame] | 110 | 	/* SECURITY_BUFFER for version info not present since we | 
 | 111 | 	   do not set the version is present flag */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | 	char UserString[0]; | 
| Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 113 | } __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; |