Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: net/ntlm/ntlm_constants.h

Issue 2904633002: Replace NTLMv1 implementation with a functionally equivalent one.
Patch Set: Cleanup Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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;
85 87
86 static constexpr NegotiateFlags kNegotiateMessageFlags = 88 static constexpr NegotiateFlags kNegotiateMessageFlags =
87 NegotiateFlags::kUnicode | NegotiateFlags::kOem | 89 NegotiateFlags::kUnicode | NegotiateFlags::kOem |
88 NegotiateFlags::kRequestTarget | NegotiateFlags::kNtlm | 90 NegotiateFlags::kRequestTarget | NegotiateFlags::kNtlm |
89 NegotiateFlags::kAlwaysSign | NegotiateFlags::kExtendedSessionSecurity; 91 NegotiateFlags::kAlwaysSign | NegotiateFlags::kExtendedSessionSecurity;
90 92
91 } // namespace ntlm 93 } // namespace ntlm
92 } // namespace net 94 } // namespace net
93 95
94 #endif // NET_BASE_NTLM_CONSTANTS_H_ 96 #endif // NET_BASE_NTLM_CONSTANTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698