Chromium Code Reviews| 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_INCIDENT_REPORTING_BINARY_INTEGRITY_ANALYZE R_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_BINARY_INTEGRITY_ANALYZE R_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_BINARY_INTEGRITY_ANALYZE R_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_BINARY_INTEGRITY_ANALYZE R_H_ |
| 7 | 7 |
| 8 #include <string> | |
| 9 #include <utility> | |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 12 #include "base/files/file_util.h" | |
| 10 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 11 | 14 |
| 12 namespace base { | 15 namespace base { |
| 13 class FilePath; | 16 class TimeDelta; |
| 14 } // namespace base | 17 } // namespace base |
| 15 | 18 |
| 16 namespace safe_browsing { | 19 namespace safe_browsing { |
| 17 | 20 |
| 18 class IncidentReceiver; | 21 class IncidentReceiver; |
| 19 | 22 |
| 23 #if defined(OS_MACOSX) | |
|
Robert Sesek
2015/10/20 22:57:27
Move this closer to where it's used by the functio
| |
| 24 // Wraps a path to a code object and its specified code requirement. | |
| 25 struct PathAndRequirement { | |
| 26 PathAndRequirement(const base::FilePath& path, const std::string& requirement) | |
| 27 : path_(path), requirement_(requirement) { } | |
| 28 base::FilePath path_; | |
|
Robert Sesek
2015/10/20 22:57:27
nit: public struct members don't get trailing _
| |
| 29 std::string requirement_; | |
| 30 }; | |
| 31 #endif // defined(OS_MACOSX) | |
| 32 | |
| 20 // Registers a process-wide analysis with the incident reporting service that | 33 // Registers a process-wide analysis with the incident reporting service that |
| 21 // will verify the signature of the most critical binaries used by Chrome. It | 34 // will verify the signature of the most critical binaries used by Chrome. It |
| 22 // will send an incident report every time a signature verification fails. | 35 // will send an incident report every time a signature verification fails. |
| 23 void RegisterBinaryIntegrityAnalysis(); | 36 void RegisterBinaryIntegrityAnalysis(); |
| 24 | 37 |
| 25 // Callback to pass to the incident reporting service. The incident reporting | 38 // Callback to pass to the incident reporting service. The incident reporting |
| 26 // service will decide when to start the analysis. | 39 // service will decide when to start the analysis. |
| 27 void VerifyBinaryIntegrity(scoped_ptr<IncidentReceiver> incident_receiver); | 40 void VerifyBinaryIntegrity(scoped_ptr<IncidentReceiver> incident_receiver); |
| 28 | 41 |
| 29 // Returns a vector containing the paths to all the binaries to verify. | 42 // Returns a vector containing the paths to all the binaries to verify. |
| 30 std::vector<base::FilePath> GetCriticalBinariesPath(); | 43 std::vector<base::FilePath> GetCriticalBinariesPath(); |
| 31 | 44 |
| 45 // Record how long the signature verification took. | |
| 46 void RecordSignatureVerificationTime(size_t file_index, | |
| 47 const base::TimeDelta& verification_time); | |
| 48 | |
| 49 #if defined(OS_MACOSX) | |
| 50 // Returns a vector of pairs, each of which contains the paths to the binaries | |
| 51 // to verify, and the codesign requirement to use when verifying. | |
| 52 std::vector<PathAndRequirement> GetCriticalPathsAndRequirements(); | |
| 53 | |
| 54 // This is a helper stub to allow the signature checking code to be tested with | |
| 55 // custom requirements and files. | |
| 56 void VerifyBinaryIntegrityForTesting(IncidentReceiver* incident_receiver, | |
| 57 const base::FilePath& path, | |
| 58 const std::string& requirement); | |
| 59 #endif // defined(OS_MACOSX) | |
| 60 | |
| 32 } // namespace safe_browsing | 61 } // namespace safe_browsing |
| 33 | 62 |
| 34 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_BINARY_INTEGRITY_ANAL YZER_H_ | 63 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_BINARY_INTEGRITY_ANAL YZER_H_ |
| OLD | NEW |