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/string16.h" |
16 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
17 #include "net/ntlm/ntlm_test_data.h" | 20 #include "net/ntlm/ntlm_test_data.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
19 | 22 |
20 namespace net { | 23 namespace net { |
21 namespace ntlm { | 24 namespace ntlm { |
22 | 25 |
23 TEST(NtlmTest, GenerateNtlmHashV1PasswordSpecTests) { | 26 TEST(NtlmTest, GenerateNtlmHashV1PasswordSpecTests) { |
24 uint8_t hash[kNtlmHashLen]; | 27 uint8_t hash[kNtlmHashLen]; |
25 GenerateNtlmHashV1(test::kPassword, hash); | 28 GenerateNtlmHashV1(test::kPassword, hash); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 GenerateResponsesV1(test::kPassword, test::kServerChallenge, lm_response2, | 113 GenerateResponsesV1(test::kPassword, test::kServerChallenge, lm_response2, |
111 ntlm_response2); | 114 ntlm_response2); |
112 | 115 |
113 // Verify that the responses with session security are not the | 116 // Verify that the responses with session security are not the |
114 // same as without it. | 117 // same as without it. |
115 ASSERT_NE(0, memcmp(lm_response1, lm_response2, kResponseLenV1)); | 118 ASSERT_NE(0, memcmp(lm_response1, lm_response2, kResponseLenV1)); |
116 ASSERT_NE(0, memcmp(ntlm_response1, ntlm_response2, kResponseLenV1)); | 119 ASSERT_NE(0, memcmp(ntlm_response1, ntlm_response2, kResponseLenV1)); |
117 } | 120 } |
118 | 121 |
119 } // namespace ntlm | 122 } // namespace ntlm |
120 } // namespace net | 123 } // namespace net |
OLD | NEW |