OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/os_crypt/ie7_password_win.h" | 5 #include "components/os_crypt/ie7_password_win.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <string> | 10 #include <string> |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
11 #include "base/sha1.h" | 14 #include "base/sha1.h" |
12 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
14 #include "crypto/wincrypt_shim.h" | 17 #include "crypto/wincrypt_shim.h" |
15 | 18 |
16 namespace { | 19 namespace { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (information->pre_header.pre_header_size != sizeof(PreHeader)) | 71 if (information->pre_header.pre_header_size != sizeof(PreHeader)) |
69 return false; | 72 return false; |
70 | 73 |
71 const int entry_count = information->header.item_count; | 74 const int entry_count = information->header.item_count; |
72 if (entry_count % 2) // Usernames and Passwords | 75 if (entry_count % 2) // Usernames and Passwords |
73 return false; | 76 return false; |
74 | 77 |
75 if (information->header.fixed_header_size != sizeof(Header)) | 78 if (information->header.fixed_header_size != sizeof(Header)) |
76 return false; | 79 return false; |
77 | 80 |
78 const uint8* offset_to_data = &data[0] + | 81 const uint8_t* offset_to_data = &data[0] + |
79 information->pre_header.header_size + | 82 information->pre_header.header_size + |
80 information->pre_header.pre_header_size; | 83 information->pre_header.pre_header_size; |
81 | 84 |
82 for (int i = 0; i < entry_count / 2; ++i) { | 85 for (int i = 0; i < entry_count / 2; ++i) { |
83 | 86 |
84 const Entry* user_entry = &information->entry[2*i]; | 87 const Entry* user_entry = &information->entry[2*i]; |
85 const Entry* pass_entry = user_entry+1; | 88 const Entry* pass_entry = user_entry+1; |
86 | 89 |
87 DecryptedCredentials c; | 90 DecryptedCredentials c; |
88 c.username = reinterpret_cast<const wchar_t*>(offset_to_data + | 91 c.username = reinterpret_cast<const wchar_t*>(offset_to_data + |
89 user_entry->offset); | 92 user_entry->offset); |
90 c.password = reinterpret_cast<const wchar_t*>(offset_to_data + | 93 c.password = reinterpret_cast<const wchar_t*>(offset_to_data + |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 GetUserPassFromData(decrypted_data, credentials); | 148 GetUserPassFromData(decrypted_data, credentials); |
146 | 149 |
147 LocalFree(output.pbData); | 150 LocalFree(output.pbData); |
148 return true; | 151 return true; |
149 } | 152 } |
150 | 153 |
151 return false; | 154 return false; |
152 } | 155 } |
153 | 156 |
154 } // namespace ie7_password | 157 } // namespace ie7_password |
OLD | NEW |