ntlmssp.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * fs/cifs/ntlmssp.h
  3. *
  4. * Copyright (c) International Business Machines Corp., 2002,2007
  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
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #define NTLMSSP_SIGNATURE "NTLMSSP"
  22. /* Message Types */
  23. #define NtLmNegotiate cpu_to_le32(1)
  24. #define NtLmChallenge cpu_to_le32(2)
  25. #define NtLmAuthenticate cpu_to_le32(3)
  26. #define UnknownMessage cpu_to_le32(8)
  27. /* Negotiate Flags */
  28. #define NTLMSSP_NEGOTIATE_UNICODE 0x01 /* Text strings are unicode */
  29. #define NTLMSSP_NEGOTIATE_OEM 0x02 /* Text strings are in OEM */
  30. #define NTLMSSP_REQUEST_TARGET 0x04 /* Srv returns its auth realm */
  31. /* define reserved9 0x08 */
  32. #define NTLMSSP_NEGOTIATE_SIGN 0x0010 /* Request signing capability */
  33. #define NTLMSSP_NEGOTIATE_SEAL 0x0020 /* Request confidentiality */
  34. #define NTLMSSP_NEGOTIATE_DGRAM 0x0040
  35. #define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 /* Use LM session key */
  36. /* defined reserved 8 0x0100 */
  37. #define NTLMSSP_NEGOTIATE_NTLM 0x0200 /* NTLM authentication */
  38. #define NTLMSSP_NEGOTIATE_NT_ONLY 0x0400 /* Lanman not allowed */
  39. #define NTLMSSP_ANONYMOUS 0x0800
  40. #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 /* reserved6 */
  41. #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
  42. #define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 /* client/server same machine */
  43. #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 /* Sign. 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_EXTENDED_SEC 0x80000 /* NB:not related to NTLMv2 pwd*/
  48. /* #define NTLMSSP_REQUEST_INIT_RESP 0x100000 */
  49. #define NTLMSSP_NEGOTIATE_IDENTIFY 0x100000
  50. #define NTLMSSP_REQUEST_ACCEPT_RESP 0x200000 /* reserved5 */
  51. #define NTLMSSP_REQUEST_NON_NT_KEY 0x400000
  52. #define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000
  53. /* #define reserved4 0x1000000 */
  54. #define NTLMSSP_NEGOTIATE_VERSION 0x2000000 /* we do not set */
  55. /* #define reserved3 0x4000000 */
  56. /* #define reserved2 0x8000000 */
  57. /* #define reserved1 0x10000000 */
  58. #define NTLMSSP_NEGOTIATE_128 0x20000000
  59. #define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000
  60. #define NTLMSSP_NEGOTIATE_56 0x80000000
  61. /* Define AV Pair Field IDs */
  62. enum av_field_type {
  63. NTLMSSP_AV_EOL = 0,
  64. NTLMSSP_AV_NB_COMPUTER_NAME,
  65. NTLMSSP_AV_NB_DOMAIN_NAME,
  66. NTLMSSP_AV_DNS_COMPUTER_NAME,
  67. NTLMSSP_AV_DNS_DOMAIN_NAME,
  68. NTLMSSP_AV_DNS_TREE_NAME,
  69. NTLMSSP_AV_FLAGS,
  70. NTLMSSP_AV_TIMESTAMP,
  71. NTLMSSP_AV_RESTRICTION,
  72. NTLMSSP_AV_TARGET_NAME,
  73. NTLMSSP_AV_CHANNEL_BINDINGS
  74. };
  75. /* Although typedefs are not commonly used for structure definitions */
  76. /* in the Linux kernel, in this particular case they are useful */
  77. /* to more closely match the standards document for NTLMSSP from */
  78. /* OpenGroup and to make the code more closely match the standard in */
  79. /* appearance */
  80. typedef struct _SECURITY_BUFFER {
  81. __le16 Length;
  82. __le16 MaximumLength;
  83. __le32 BufferOffset; /* offset to buffer */
  84. } __attribute__((packed)) SECURITY_BUFFER;
  85. typedef struct _NEGOTIATE_MESSAGE {
  86. __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
  87. __le32 MessageType; /* NtLmNegotiate = 1 */
  88. __le32 NegotiateFlags;
  89. SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */
  90. SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */
  91. /* SECURITY_BUFFER for version info not present since we
  92. do not set the version is present flag */
  93. char DomainString[0];
  94. /* followed by WorkstationString */
  95. } __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE;
  96. typedef struct _CHALLENGE_MESSAGE {
  97. __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
  98. __le32 MessageType; /* NtLmChallenge = 2 */
  99. SECURITY_BUFFER TargetName;
  100. __le32 NegotiateFlags;
  101. __u8 Challenge[CIFS_CRYPTO_KEY_SIZE];
  102. __u8 Reserved[8];
  103. SECURITY_BUFFER TargetInfoArray;
  104. /* SECURITY_BUFFER for version info not present since we
  105. do not set the version is present flag */
  106. } __attribute__((packed)) CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE;
  107. typedef struct _AUTHENTICATE_MESSAGE {
  108. __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
  109. __le32 MessageType; /* NtLmsAuthenticate = 3 */
  110. SECURITY_BUFFER LmChallengeResponse;
  111. SECURITY_BUFFER NtChallengeResponse;
  112. SECURITY_BUFFER DomainName;
  113. SECURITY_BUFFER UserName;
  114. SECURITY_BUFFER WorkstationName;
  115. SECURITY_BUFFER SessionKey;
  116. __le32 NegotiateFlags;
  117. /* SECURITY_BUFFER for version info not present since we
  118. do not set the version is present flag */
  119. char UserString[0];
  120. } __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE;