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

Side by Side Diff: syzygy/experimental/protect/protect_lib/protect_flummox.cc

Issue 2535563002: Added all code for integrity check transform (Closed)
Patch Set: Created 4 years 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
OLDNEW
(Empty)
1 // Copyright 2015 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "syzygy/experimental/protect/protect_lib/protect_flummox.h"
16
17 #include <algorithm>
18 #include <sstream>
19
20 #include "base/files/file_util.h"
21 #include "base/strings/string_util.h"
22 #include "syzygy/application/application.h"
23
24 namespace protect {
25
26 bool CustomFlummoxInstrumenter::InstrumentPrepare() {
27 return config_.ReadFromJSONPath(flummox_config_path_);
28 }
29
30 bool CustomFlummoxInstrumenter::InstrumentImpl() {
31 flummox_transform_.reset(
32 new protect::IntegrityCheckTransform(&config_));
33
34 if (!relinker_->AppendTransform(flummox_transform_.get())) {
35 LOG(ERROR) << "Failed to apply transform.";
36 return false;
37 }
38
39 layout_transform_.reset(
40 new protect::IntegrityCheckLayoutTransform(&config_));
41
42 if (!relinker_->AppendLayoutTransform(layout_transform_.get())) {
43 LOG(ERROR) << "Failed to apply layout transform.";
44 return false;
45 }
46 return true;
47 }
48
49 bool CustomFlummoxInstrumenter::DoCommandLineParse(
50 const base::CommandLine* command_line) {
51 DCHECK(command_line != nullptr);
52
53 if (!Super::DoCommandLineParse(command_line))
54 return false;
55
56 // Parse the target list filename.
57 flummox_config_path_ = application::AppImplBase::AbsolutePath(
58 command_line->GetSwitchValuePath("flummox-config-path"));
59 if (flummox_config_path_.empty()) {
60 LOG(ERROR) << "You must specify --flummox-config-path.";
61 return false;
62 }
63
64 return true;
65 }
66
67 } // namespace protect
OLDNEW
« no previous file with comments | « syzygy/experimental/protect/protect_lib/protect_flummox.h ('k') | syzygy/experimental/protect/protect_lib/protect_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698