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

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

Issue 2904633002: Replace NTLMv1 implementation with a functionally equivalent one.
Patch Set: Merge build config back to net 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 <type_traits> 10 #include <type_traits>
(...skipping 17 matching lines...) Expand all
28 uint32_t offset; 28 uint32_t offset;
29 uint16_t length; 29 uint16_t length;
30 }; 30 };
31 31
32 enum class NtlmVersion { 32 enum class NtlmVersion {
33 NTLM_V1 = 0x01, 33 NTLM_V1 = 0x01,
34 NTLM_V2 = 0x02, 34 NTLM_V2 = 0x02,
35 }; 35 };
36 36
37 // There are 3 types of messages in NTLM. The message type is a field in 37 // There are 3 types of messages in NTLM. The message type is a field in
38 // every NTLM message header. 38 // every NTLM message header. See [MS-NLMP] Section 2.2.
39 enum class MessageType : uint32_t { 39 enum class MessageType : uint32_t {
40 NEGOTIATE = 0x01, 40 NEGOTIATE = 0x01,
41 CHALLENGE = 0x02, 41 CHALLENGE = 0x02,
42 AUTHENTICATE = 0x03, 42 AUTHENTICATE = 0x03,
43 }; 43 };
44 44
45 // Defined in [MS-NLMP] Section 2.2.2.5 45 // Defined in [MS-NLMP] Section 2.2.2.5
46 // Only the used subset is defined. 46 // Only the used subset is defined.
47 enum class NegotiateFlags : uint32_t { 47 enum class NegotiateFlags : uint32_t {
48 NONE = 0, 48 NONE = 0,
(...skipping 19 matching lines...) Expand all
68 68
69 return static_cast<NegotiateFlags>(static_cast<TFlagsInt>(lhs) & 69 return static_cast<NegotiateFlags>(static_cast<TFlagsInt>(lhs) &
70 static_cast<TFlagsInt>(rhs)); 70 static_cast<TFlagsInt>(rhs));
71 } 71 }
72 72
73 static constexpr uint8_t SIGNATURE[] = "NTLMSSP"; 73 static constexpr uint8_t SIGNATURE[] = "NTLMSSP";
74 static constexpr size_t SIGNATURE_LEN = arraysize(SIGNATURE); 74 static constexpr size_t SIGNATURE_LEN = arraysize(SIGNATURE);
75 static constexpr size_t SECURITY_BUFFER_LEN = 75 static constexpr size_t SECURITY_BUFFER_LEN =
76 (2 * sizeof(uint16_t)) + sizeof(uint32_t); 76 (2 * sizeof(uint16_t)) + sizeof(uint32_t);
77 static constexpr size_t NEGOTIATE_MESSAGE_LEN = 32; 77 static constexpr size_t NEGOTIATE_MESSAGE_LEN = 32;
78 static constexpr size_t MIN_CHALLENGE_HEADER_LEN = 32;
78 static constexpr size_t CHALLENGE_HEADER_LEN = 32; 79 static constexpr size_t CHALLENGE_HEADER_LEN = 32;
79 static constexpr size_t RESPONSE_V1_LEN = 24; 80 static constexpr size_t RESPONSE_V1_LEN = 24;
80 static constexpr size_t CHALLENGE_LEN = 8; 81 static constexpr size_t CHALLENGE_LEN = 8;
81 static constexpr size_t NTLM_HASH_LEN = 16; 82 static constexpr size_t NTLM_HASH_LEN = 16;
83 static constexpr size_t AUTHENTICATE_HEADER_V1_LEN = 64;
82 84
83 static constexpr NegotiateFlags NEGOTIATE_MESSAGE_FLAGS = 85 static constexpr NegotiateFlags NEGOTIATE_MESSAGE_FLAGS =
84 NegotiateFlags::UNICODE | NegotiateFlags::OEM | 86 NegotiateFlags::UNICODE | NegotiateFlags::OEM |
85 NegotiateFlags::REQUEST_TARGET | NegotiateFlags::NTLM | 87 NegotiateFlags::REQUEST_TARGET | NegotiateFlags::NTLM |
86 NegotiateFlags::ALWAYS_SIGN | NegotiateFlags::EXTENDED_SESSIONSECURITY; 88 NegotiateFlags::ALWAYS_SIGN | NegotiateFlags::EXTENDED_SESSIONSECURITY;
87 89
88 } // namespace ntlm 90 } // namespace ntlm
89 } // namespace net 91 } // namespace net
90 92
91 #endif // NET_BASE_NTLM_CONSTANTS_H_ 93 #endif // NET_BASE_NTLM_CONSTANTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698