OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_NTLM_CONSTANTS_H_ | 5 #ifndef NET_BASE_NTLM_CONSTANTS_H_ |
6 #define NET_BASE_NTLM_CONSTANTS_H_ | 6 #define NET_BASE_NTLM_CONSTANTS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <string> | 10 #include <string> |
(...skipping 20 matching lines...) Expand all Loading... |
31 uint32_t offset; | 31 uint32_t offset; |
32 uint16_t length; | 32 uint16_t length; |
33 }; | 33 }; |
34 | 34 |
35 enum class NtlmVersion { | 35 enum class NtlmVersion { |
36 kNtlmV1 = 0x01, | 36 kNtlmV1 = 0x01, |
37 kNtlmV2 = 0x02, | 37 kNtlmV2 = 0x02, |
38 }; | 38 }; |
39 | 39 |
40 // There are 3 types of messages in NTLM. The message type is a field in | 40 // There are 3 types of messages in NTLM. The message type is a field in |
41 // every NTLM message header. | 41 // every NTLM message header. See [MS-NLMP] Section 2.2. |
42 enum class MessageType : uint32_t { | 42 enum class MessageType : uint32_t { |
43 kNegotiate = 0x01, | 43 kNegotiate = 0x01, |
44 kChallenge = 0x02, | 44 kChallenge = 0x02, |
45 kAuthenticate = 0x03, | 45 kAuthenticate = 0x03, |
46 }; | 46 }; |
47 | 47 |
48 // Defined in [MS-NLMP] Section 2.2.2.5 | 48 // Defined in [MS-NLMP] Section 2.2.2.5 |
49 // Only the used subset is defined. | 49 // Only the used subset is defined. |
50 enum class NegotiateFlags : uint32_t { | 50 enum class NegotiateFlags : uint32_t { |
51 kNone = 0, | 51 kNone = 0, |
(...skipping 19 matching lines...) Expand all Loading... |
71 | 71 |
72 return static_cast<NegotiateFlags>(static_cast<TFlagsInt>(lhs) & | 72 return static_cast<NegotiateFlags>(static_cast<TFlagsInt>(lhs) & |
73 static_cast<TFlagsInt>(rhs)); | 73 static_cast<TFlagsInt>(rhs)); |
74 } | 74 } |
75 | 75 |
76 static constexpr uint8_t kSignature[] = "NTLMSSP"; | 76 static constexpr uint8_t kSignature[] = "NTLMSSP"; |
77 static constexpr size_t kSignatureLen = arraysize(kSignature); | 77 static constexpr size_t kSignatureLen = arraysize(kSignature); |
78 static constexpr size_t kSecurityBufferLen = | 78 static constexpr size_t kSecurityBufferLen = |
79 (2 * sizeof(uint16_t)) + sizeof(uint32_t); | 79 (2 * sizeof(uint16_t)) + sizeof(uint32_t); |
80 static constexpr size_t kNegotiateMessageLen = 32; | 80 static constexpr size_t kNegotiateMessageLen = 32; |
| 81 static constexpr size_t kMinChallengeHeaderLen = 32; |
81 static constexpr size_t kChallengeHeaderLen = 32; | 82 static constexpr size_t kChallengeHeaderLen = 32; |
82 static constexpr size_t kResponseLenV1 = 24; | 83 static constexpr size_t kResponseLenV1 = 24; |
83 static constexpr size_t kChallengeLen = 8; | 84 static constexpr size_t kChallengeLen = 8; |
84 static constexpr size_t kNtlmHashLen = 16; | 85 static constexpr size_t kNtlmHashLen = 16; |
| 86 static constexpr size_t kAuthenticateHeaderLenV1 = 64; |
| 87 static constexpr size_t kMaxFqdnLen = 255; |
| 88 static constexpr size_t kMaxUsernameLen = 104; |
| 89 static constexpr size_t kMaxPasswordLen = 256; |
85 | 90 |
86 static constexpr NegotiateFlags kNegotiateMessageFlags = | 91 static constexpr NegotiateFlags kNegotiateMessageFlags = |
87 NegotiateFlags::kUnicode | NegotiateFlags::kOem | | 92 NegotiateFlags::kUnicode | NegotiateFlags::kOem | |
88 NegotiateFlags::kRequestTarget | NegotiateFlags::kNtlm | | 93 NegotiateFlags::kRequestTarget | NegotiateFlags::kNtlm | |
89 NegotiateFlags::kAlwaysSign | NegotiateFlags::kExtendedSessionSecurity; | 94 NegotiateFlags::kAlwaysSign | NegotiateFlags::kExtendedSessionSecurity; |
90 | 95 |
91 } // namespace ntlm | 96 } // namespace ntlm |
92 } // namespace net | 97 } // namespace net |
93 | 98 |
94 #endif // NET_BASE_NTLM_CONSTANTS_H_ | 99 #endif // NET_BASE_NTLM_CONSTANTS_H_ |
OLD | NEW |