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

Unified Diff: net/ntlm/ntlm_test_data.h

Issue 2873673002: Add unit tests for NTLMv1 portable implementation (Closed)
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 side-by-side diff with in-line comments
Download patch
Index: net/ntlm/ntlm_test_data.h
diff --git a/net/ntlm/ntlm_test_data.h b/net/ntlm/ntlm_test_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..da5bb17dec5f7164fdada528ac58f4b1f0551059
--- /dev/null
+++ b/net/ntlm/ntlm_test_data.h
@@ -0,0 +1,58 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains common input and result values use to verify the NTLM
+// implementation. They are defined in [MS-NLMP] Section 4.2 [1].
+//
+// [1] https://msdn.microsoft.com/en-us/library/cc236621.aspx
+
+#ifndef NET_BASE_NTLM_TEST_DATA_H_
+#define NET_BASE_NTLM_TEST_DATA_H_
+
+#include "net/ntlm/ntlm_constants.h"
+
+namespace net {
+namespace ntlm {
+
+// Common input values defined in [MS-NLMP] Section 4.2.1.
+const base::string16 NTLM_PASSWORD = base::UTF8ToUTF16("Password");
+const base::string16 NTLM_DOMAIN = base::UTF8ToUTF16("Domain");
+const base::string16 NTLM_USER = base::UTF8ToUTF16("User");
+const base::string16 NTLM_HOSTNAME = base::UTF8ToUTF16("COMPUTER");
+
+// ASCII Versions of the above strings.
+const std::string NTLM_DOMAIN_ASCII("Domain");
+const std::string NTLM_USER_ASCII("User");
+const std::string NTLM_HOSTNAME_ASCII("COMPUTER");
Ryan Sleevi 2017/07/12 17:56:38 So, both of these violate the https://google.githu
asanka 2017/07/12 19:53:16 Also, let's make it obvious that these are specifi
zentaro 2017/07/13 17:10:20 Done. Put the test data in a test:: namespace.
+
+// Challenge vectors defined in [MS-NLMP] Section 4.2.1.
+constexpr uint8_t SERVER_CHALLENGE[CHALLENGE_LEN] = {0x01, 0x23, 0x45, 0x67,
+ 0x89, 0xab, 0xcd, 0xef};
+constexpr uint8_t CLIENT_CHALLENGE[CHALLENGE_LEN] = {0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa};
+
+// Test result value for NTOWFv1() defined in [MS-NLMP] Section 4.2.2.1.2.
+constexpr uint8_t EXPECTED_V1_HASH[NTLM_HASH_LEN] = {
+ 0xa4, 0xf4, 0x9c, 0x40, 0x65, 0x10, 0xbd, 0xca,
+ 0xb6, 0x82, 0x4e, 0xe7, 0xc3, 0x0f, 0xd8, 0x52};
+
+// Test result value defined in [MS-NLMP] Section 4.2.2.1.
+constexpr uint8_t EXPECTED_V1_NTLM_RESPONSE[RESPONSE_V1_LEN] = {
+ 0x67, 0xc4, 0x30, 0x11, 0xf3, 0x02, 0x98, 0xa2, 0xad, 0x35, 0xec, 0xe6,
+ 0x4f, 0x16, 0x33, 0x1c, 0x44, 0xbd, 0xbe, 0xd9, 0x27, 0x84, 0x1f, 0x94};
+
+// Test result value defined in [MS-NLMP] Section 4.2.3.2.2.
+constexpr uint8_t EXPECTED_V1_WITH_SS_NTLM_RESPONSE[RESPONSE_V1_LEN] = {
+ 0x75, 0x37, 0xf8, 0x03, 0xae, 0x36, 0x71, 0x28, 0xca, 0x45, 0x82, 0x04,
+ 0xbd, 0xe7, 0xca, 0xf8, 0x1e, 0x97, 0xed, 0x26, 0x83, 0x26, 0x72, 0x32};
+
+// Test result value defined in [MS-NLMP] Section 4.2.3.2.1.
+constexpr uint8_t EXPECTED_V1_WITH_SS_LM_RESPONSE[RESPONSE_V1_LEN] = {
Ryan Sleevi 2017/07/12 17:56:38 Same naming concerns throughout
zentaro 2017/07/13 17:10:20 Done.
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+} // namespace ntlm
+} // namespace net
+
+#endif // NET_BASE_NTLM_TEST_DATA_H_
« net/ntlm/ntlm.h ('K') | « net/ntlm/ntlm_constants.h ('k') | net/ntlm/ntlm_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698