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 #ifndef CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <set> |
| 11 |
10 namespace base { | 12 namespace base { |
11 namespace win { | 13 namespace win { |
12 class PEImage; | 14 class PEImage; |
13 class PEImageAsData; | 15 class PEImageAsData; |
14 } // namespace win | 16 } // namespace win |
15 } // namespace base | 17 } // namespace base |
16 | 18 |
17 namespace safe_browsing { | 19 namespace safe_browsing { |
18 | 20 |
19 // This enum defines the possible module states VerifyModule can return. | 21 // This enum defines the possible module states VerifyModule can return. |
20 enum ModuleState { | 22 enum ModuleState { |
21 MODULE_STATE_UNKNOWN, | 23 MODULE_STATE_UNKNOWN, |
22 MODULE_STATE_UNMODIFIED, | 24 MODULE_STATE_UNMODIFIED, |
23 MODULE_STATE_MODIFIED, | 25 MODULE_STATE_MODIFIED, |
24 }; | 26 }; |
25 | 27 |
26 // Helper to grab the addresses and size of the code section of a PEImage. | 28 // Helper to grab the addresses and size of the code section of a PEImage. |
27 // Returns two addresses: one for the dll loaded as a library, the other for the | 29 // Returns two addresses: one for the dll loaded as a library, the other for the |
28 // dll loaded as data. | 30 // dll loaded as data. |
29 bool GetCodeAddrsAndSize(const base::win::PEImage& mem_peimage, | 31 bool GetCodeAddrsAndSize(const base::win::PEImage& mem_peimage, |
30 const base::win::PEImageAsData& disk_peimage, | 32 const base::win::PEImageAsData& disk_peimage, |
31 uint8_t** mem_code_addr, | 33 uint8_t** mem_code_addr, |
32 uint8_t** disk_code_addr, | 34 uint8_t** disk_code_addr, |
33 uint32_t* code_size); | 35 uint32_t* code_size); |
34 | 36 |
35 // Helper to count the number of bytes differing between two pointers. | |
36 int CountBytesDiffInPtr(uintptr_t num_a, uintptr_t num_b); | |
37 | |
38 // Examines the code section of the given module in memory and on disk, looking | 37 // Examines the code section of the given module in memory and on disk, looking |
39 // for unexpected differences. | 38 // for unexpected differences. Returns a ModuleState and and a set of the |
40 ModuleState VerifyModule(const wchar_t* module_name); | 39 // possibly modified exports. |
| 40 ModuleState VerifyModule(const wchar_t* module_name, |
| 41 std::set<std::string>* modified_exports); |
41 | 42 |
42 } // namespace safe_browsing | 43 } // namespace safe_browsing |
43 | 44 |
44 #endif // CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ | 45 #endif // CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ |
OLD | NEW |