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 // Tests on exact results from cryptographic operations are based on test data | 5 // Tests on exact results from cryptographic operations are based on test data |
6 // provided in [MS-NLMP] Version 28.0 [1] Section 4.2. | 6 // provided in [MS-NLMP] Version 28.0 [1] Section 4.2. |
7 // | 7 // |
8 // Additional sanity checks on the low level hashing operations test for | 8 // Additional sanity checks on the low level hashing operations test for |
9 // properties of the outputs, such as whether the hashes change, whether they | 9 // properties of the outputs, such as whether the hashes change, whether they |
10 // should be zeroed out, or whether they should be the same or different. | 10 // should be zeroed out, or whether they should be the same or different. |
11 // | 11 // |
12 // [1] https://msdn.microsoft.com/en-us/library/cc236621.aspx | 12 // [1] https://msdn.microsoft.com/en-us/library/cc236621.aspx |
13 | 13 |
14 #include "net/ntlm/ntlm.h" | 14 #include "net/ntlm/ntlm.h" |
15 | 15 |
16 #include <string> | |
17 | |
18 #include "base/strings/string_util.h" | |
16 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "build/build_config.h" | |
21 #include "net/ntlm/ntlm.h" | |
asanka
2017/07/20 19:35:46
duplicate
zentaro
2017/08/01 18:21:36
Done.
| |
22 #include "net/ntlm/ntlm_buffer_reader.h" | |
23 #include "net/ntlm/ntlm_buffer_writer.h" | |
asanka
2017/07/20 19:35:46
why are these necessary? There doesn't seem to be
zentaro
2017/08/01 18:21:36
Done.
| |
17 #include "net/ntlm/ntlm_test_data.h" | 24 #include "net/ntlm/ntlm_test_data.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/platform_test.h" |
19 | 26 |
20 namespace net { | 27 namespace net { |
21 namespace ntlm { | 28 namespace ntlm { |
22 | 29 |
23 TEST(NtlmTest, GenerateNtlmHashV1PasswordSpecTests) { | 30 TEST(NtlmTest, GenerateNtlmHashV1PasswordSpecTests) { |
24 uint8_t hash[kNtlmHashLen]; | 31 uint8_t hash[kNtlmHashLen]; |
25 GenerateNtlmHashV1(test::kPassword, hash); | 32 GenerateNtlmHashV1(test::kPassword, hash); |
26 ASSERT_EQ(0, memcmp(hash, test::kExpectedNtlmHashV1, kNtlmHashLen)); | 33 ASSERT_EQ(0, memcmp(hash, test::kExpectedNtlmHashV1, kNtlmHashLen)); |
27 } | 34 } |
28 | 35 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 GenerateResponsesV1(test::kPassword, test::kServerChallenge, lm_response2, | 117 GenerateResponsesV1(test::kPassword, test::kServerChallenge, lm_response2, |
111 ntlm_response2); | 118 ntlm_response2); |
112 | 119 |
113 // Verify that the responses with session security are not the | 120 // Verify that the responses with session security are not the |
114 // same as without it. | 121 // same as without it. |
115 ASSERT_NE(0, memcmp(lm_response1, lm_response2, kResponseLenV1)); | 122 ASSERT_NE(0, memcmp(lm_response1, lm_response2, kResponseLenV1)); |
116 ASSERT_NE(0, memcmp(ntlm_response1, ntlm_response2, kResponseLenV1)); | 123 ASSERT_NE(0, memcmp(ntlm_response1, ntlm_response2, kResponseLenV1)); |
117 } | 124 } |
118 | 125 |
119 } // namespace ntlm | 126 } // namespace ntlm |
120 } // namespace net | 127 } // namespace net |
OLD | NEW |