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

Side by Side Diff: net/ntlm/ntlm_unittest.cc

Issue 2904633002: Replace NTLMv1 implementation with a functionally equivalent one.
Patch Set: Fix uninitialized read Created 3 years, 4 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
« no previous file with comments | « net/ntlm/ntlm_test_data.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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
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
OLDNEW
« no previous file with comments | « net/ntlm/ntlm_test_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698