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

Side by Side Diff: download_action.cc

Issue 3592008: AU: Verify delta payload signature and signed hash. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: move /tmp files to /var/run Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « delta_performer_unittest.cc ('k') | omaha_hash_calculator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 "update_engine/download_action.h" 5 #include "update_engine/download_action.h"
6 #include <errno.h> 6 #include <errno.h>
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <glib.h> 10 #include <glib.h>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if (omaha_hash_calculator_.hash() != install_plan_.download_hash) { 143 if (omaha_hash_calculator_.hash() != install_plan_.download_hash) {
144 LOG(ERROR) << "Download of " << install_plan_.download_url 144 LOG(ERROR) << "Download of " << install_plan_.download_url
145 << " failed. Expected hash " << install_plan_.download_hash 145 << " failed. Expected hash " << install_plan_.download_hash
146 << " but got hash " << omaha_hash_calculator_.hash(); 146 << " but got hash " << omaha_hash_calculator_.hash();
147 code = kActionCodeDownloadHashMismatchError; 147 code = kActionCodeDownloadHashMismatchError;
148 } else if (bytes_received_ != install_plan_.size) { 148 } else if (bytes_received_ != install_plan_.size) {
149 LOG(ERROR) << "Download of " << install_plan_.download_url 149 LOG(ERROR) << "Download of " << install_plan_.download_url
150 << " failed. Expected size " << install_plan_.size 150 << " failed. Expected size " << install_plan_.size
151 << " but got size " << bytes_received_; 151 << " but got size " << bytes_received_;
152 code = kActionCodeDownloadSizeMismatchError; 152 code = kActionCodeDownloadSizeMismatchError;
153 } else if (!install_plan_.is_full_update &&
154 !delta_performer_->VerifyPayload("")) {
155 LOG(ERROR) << "Download of " << install_plan_.download_url
156 << " failed due to payload verification error.";
157 code = kActionCodeDownloadPayloadVerificationError;
153 } 158 }
154 } 159 }
155 160
156 FlushLinuxCaches(); 161 FlushLinuxCaches();
157 162
158 // Write the path to the output pipe if we're successful. 163 // Write the path to the output pipe if we're successful.
159 if (code == kActionCodeSuccess && HasOutputPipe()) 164 if (code == kActionCodeSuccess && HasOutputPipe())
160 SetOutputObject(GetInputObject()); 165 SetOutputObject(GetInputObject());
161 processor_->ActionComplete(this, code); 166 processor_->ActionComplete(this, code);
162 } 167 }
163 168
164 }; // namespace {} 169 }; // namespace {}
OLDNEW
« no previous file with comments | « delta_performer_unittest.cc ('k') | omaha_hash_calculator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698