Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
|
Ryan Sleevi
2017/06/08 18:36:33
No (c) needed
zentaro
2017/06/12 23:12:05
Done. Here and others. I assume this is new since
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_BASE_NTLM_H_ | |
| 6 #define NET_BASE_NTLM_H_ | |
|
asanka
2017/06/08 18:44:57
Nit: I'd suggest using the ntlm.h header for the A
zentaro
2017/06/12 23:12:04
TODO(zentaro): I'm going to do this round of feedb
| |
| 7 | |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "net/base/net_export.h" | |
| 13 | |
| 14 namespace net { | |
| 15 namespace ntlm { | |
| 16 | |
| 17 struct SecurityBuffer { | |
|
Ryan Sleevi
2017/06/08 18:36:33
Document?
zentaro
2017/06/12 23:12:04
Done.
asanka
2017/06/16 03:21:28
Add that the offset is relative to the start of th
zentaro
2017/06/21 00:38:46
Done.
| |
| 18 SecurityBuffer(uint32_t offset, uint16_t length) | |
| 19 : offset(offset), length(length) {} | |
| 20 | |
| 21 SecurityBuffer() : SecurityBuffer(0, 0) {} | |
| 22 uint32_t offset; | |
| 23 uint16_t length; | |
| 24 }; | |
| 25 | |
| 26 enum NtlmVersion { | |
| 27 VERSION_NTLM_V1 = 0x01, | |
| 28 VERSION_NTLM_V2 = 0x02, | |
| 29 }; | |
| 30 | |
| 31 enum MessageType { | |
| 32 MESSAGE_NEGOTIATE = 0x01, | |
| 33 MESSAGE_CHALLENGE = 0x02, | |
| 34 MESSAGE_AUTHENTICATE = 0x03, | |
| 35 }; | |
| 36 | |
| 37 // Defined in NTLMSSP Spec 2.2.2.5 | |
|
asanka
2017/06/08 18:44:57
Let's refer to the spec as [MS-NLMP] which is what
zentaro
2017/06/12 23:12:04
Done. And others.
| |
| 38 // Only the used subset is defined. | |
| 39 enum NegotiateFlags { | |
|
asanka
2017/06/08 18:44:57
Let's make these typed enums. Here and elsewhere.
zentaro
2017/06/12 23:12:04
Done.
asanka
2017/06/16 03:21:28
Thanks for doing this.
| |
| 40 NTLMSSP_NEGOTIATE_UNICODE = 0x01, | |
| 41 NTLMSSP_NEGOTIATE_OEM = 0x02, | |
| 42 NTLMSSP_REQUEST_TARGET = 0x04, | |
| 43 NTLMSSP_NEGOTIATE_NTLM = 0x200, | |
| 44 NTLMSSP_NEGOTIATE_ALWAYS_SIGN = 0x8000, | |
| 45 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY = 0x80000, | |
| 46 }; | |
| 47 | |
| 48 static constexpr uint8_t SIGNATURE[] = "NTLMSSP"; | |
| 49 static constexpr size_t SIGNATURE_LEN = arraysize(SIGNATURE); | |
| 50 static constexpr size_t SECURITY_BUFFER_LEN = | |
| 51 (2 * sizeof(uint16_t)) + sizeof(uint32_t); | |
| 52 static constexpr size_t NEGOTIATE_MESSAGE_LEN = 32; | |
|
asanka
2017/06/08 18:44:57
Recent versions of Windows use a 40 byte NEGOTIATE
zentaro
2017/06/12 23:12:04
Yes. It will be in the CL that adds NTLMv2 (and it
| |
| 53 static constexpr size_t RESPONSE_V1_LEN = 24; | |
| 54 static constexpr size_t CHALLENGE_LEN = 8; | |
| 55 static constexpr size_t NTLM_HASH_LEN = 16; | |
| 56 | |
| 57 static constexpr uint32_t NEGOTIATE_MESSAGE_FLAGS = | |
| 58 NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM | NTLMSSP_REQUEST_TARGET | | |
| 59 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_ALWAYS_SIGN | | |
| 60 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY; | |
| 61 | |
| 62 } // namespce ntlm | |
| 63 } // namespace net | |
| 64 | |
| 65 #endif // NET_BASE_NTLM_H_ | |
| OLD | NEW |