blob: eed24cb549ec123847091cda33548d80bd2cbe90 [file] [log] [blame]
Andrew de los Reyes09e56d62010-04-23 13:45:53 -07001// 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
3// found in the LICENSE file.
4
Gilad Arnoldcf175a02014-07-10 16:48:47 -07005#ifndef UPDATE_ENGINE_DELTA_PERFORMER_H_
6#define UPDATE_ENGINE_DELTA_PERFORMER_H_
Andrew de los Reyes09e56d62010-04-23 13:45:53 -07007
8#include <inttypes.h>
Darin Petkovd7061ab2010-10-06 14:37:09 -07009
Alex Vakulenkod2779df2014-06-16 13:19:00 -070010#include <string>
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070011#include <vector>
Darin Petkovd7061ab2010-10-06 14:37:09 -070012
Alex Vakulenko75039d72014-03-25 12:36:28 -070013#include <base/time/time.h>
Alex Vakulenkof68bbbc2015-02-09 12:53:18 -080014#include <chromeos/secure_blob.h>
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070015#include <google/protobuf/repeated_field.h>
Andrew de los Reyes353777c2010-10-08 10:34:30 -070016#include <gtest/gtest_prod.h> // for FRIEND_TEST
Darin Petkovd7061ab2010-10-06 14:37:09 -070017
Nam T. Nguyenf1d582e2014-12-08 15:07:17 -080018#include "update_engine/file_descriptor.h"
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070019#include "update_engine/file_writer.h"
Jay Srinivasan51dcf262012-09-13 17:24:32 -070020#include "update_engine/install_plan.h"
Darin Petkovd7061ab2010-10-06 14:37:09 -070021#include "update_engine/omaha_hash_calculator.h"
Jay Srinivasanf0572052012-10-23 18:12:56 -070022#include "update_engine/system_state.h"
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070023#include "update_engine/update_metadata.pb.h"
24
25namespace chromeos_update_engine {
26
Darin Petkov73058b42010-10-06 16:32:19 -070027class PrefsInterface;
28
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070029// This class performs the actions in a delta update synchronously. The delta
30// update itself should be passed in in chunks as it is received.
31
32class DeltaPerformer : public FileWriter {
33 public:
Darin Petkov9574f7e2011-01-13 10:48:12 -080034 enum MetadataParseResult {
35 kMetadataParseSuccess,
36 kMetadataParseError,
37 kMetadataParseInsufficientData,
38 };
39
Jay Srinivasanf4318702012-09-24 11:56:24 -070040 static const uint64_t kDeltaVersionSize;
41 static const uint64_t kDeltaManifestSizeSize;
Don Garrett4d039442013-10-28 18:40:06 -070042 static const uint64_t kSupportedMajorPayloadVersion;
Don Garrettb8dd1d92013-11-22 17:40:02 -080043 static const uint64_t kSupportedMinorPayloadVersion;
44 static const uint64_t kFullPayloadMinorVersion;
Darin Petkovabc7bc02011-02-23 14:39:43 -080045 static const char kUpdatePayloadPublicKeyPath[];
46
Gilad Arnold8a86fa52013-01-15 12:35:05 -080047 // Defines the granularity of progress logging in terms of how many "completed
48 // chunks" we want to report at the most.
49 static const unsigned kProgressLogMaxChunks;
50 // Defines a timeout since the last progress was logged after which we want to
51 // force another log message (even if the current chunk was not completed).
52 static const unsigned kProgressLogTimeoutSeconds;
53 // These define the relative weights (0-100) we give to the different work
54 // components associated with an update when computing an overall progress.
55 // Currently they include the download progress and the number of completed
56 // operations. They must add up to one hundred (100).
57 static const unsigned kProgressDownloadWeight;
58 static const unsigned kProgressOperationsWeight;
59
Jay Srinivasanf0572052012-10-23 18:12:56 -070060 DeltaPerformer(PrefsInterface* prefs,
61 SystemState* system_state,
62 InstallPlan* install_plan)
Darin Petkov73058b42010-10-06 16:32:19 -070063 : prefs_(prefs),
Jay Srinivasanf0572052012-10-23 18:12:56 -070064 system_state_(system_state),
Jay Srinivasan51dcf262012-09-13 17:24:32 -070065 install_plan_(install_plan),
Nam T. Nguyenf1d582e2014-12-08 15:07:17 -080066 fd_(nullptr),
67 kernel_fd_(nullptr),
Gilad Arnolddaa27402014-01-23 11:56:17 -080068 manifest_parsed_(false),
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070069 manifest_valid_(false),
Gilad Arnoldfe133932014-01-14 12:25:50 -080070 metadata_size_(0),
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -070071 next_operation_num_(0),
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070072 buffer_offset_(0),
Darin Petkov0406e402010-10-06 21:33:11 -070073 last_updated_buffer_offset_(kuint64max),
Jay Srinivasan51dcf262012-09-13 17:24:32 -070074 block_size_(0),
Gilad Arnold8a86fa52013-01-15 12:35:05 -080075 public_key_path_(kUpdatePayloadPublicKeyPath),
76 total_bytes_received_(0),
77 num_rootfs_operations_(0),
78 num_total_operations_(0),
79 overall_progress_(0),
80 last_progress_chunk_(0),
81 forced_progress_log_wait_(
82 base::TimeDelta::FromSeconds(kProgressLogTimeoutSeconds)) {}
Darin Petkovd7061ab2010-10-06 14:37:09 -070083
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -070084 // Opens the kernel. Should be called before or after Open(), but before
85 // Write(). The kernel file will be close()d when Close() is called.
86 bool OpenKernel(const char* kernel_path);
87
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070088 // flags and mode ignored. Once Close()d, a DeltaPerformer can't be
89 // Open()ed again.
Alex Deymo610277e2014-11-11 21:18:11 -080090 int Open(const char* path, int flags, mode_t mode) override;
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070091
Jay Srinivasan51dcf262012-09-13 17:24:32 -070092 // FileWriter's Write implementation where caller doesn't care about
93 // error codes.
Alex Deymo610277e2014-11-11 21:18:11 -080094 bool Write(const void* bytes, size_t count) override {
David Zeuthena99981f2013-04-29 13:42:47 -070095 ErrorCode error;
Jay Srinivasan51dcf262012-09-13 17:24:32 -070096 return Write(bytes, count, &error);
97 }
98
99 // FileWriter's Write implementation that returns a more specific |error| code
100 // in case of failures in Write operation.
Alex Deymo610277e2014-11-11 21:18:11 -0800101 bool Write(const void* bytes, size_t count, ErrorCode *error) override;
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700102
103 // Wrapper around close. Returns 0 on success or -errno on error.
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -0700104 // Closes both 'path' given to Open() and the kernel path.
Alex Deymo610277e2014-11-11 21:18:11 -0800105 int Close() override;
Darin Petkovd7061ab2010-10-06 14:37:09 -0700106
David Zeuthen8f191b22013-08-06 12:27:50 -0700107 // Returns |true| only if the manifest has been processed and it's valid.
108 bool IsManifestValid();
109
Darin Petkovd7061ab2010-10-06 14:37:09 -0700110 // Verifies the downloaded payload against the signed hash included in the
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700111 // payload, against the update check hash (which is in base64 format) and
Gilad Arnoldd1c4d2d2014-06-05 14:07:53 -0700112 // size using the public key and returns ErrorCode::kSuccess on success, an
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700113 // error code on failure. This method should be called after closing the
114 // stream. Note this method skips the signed hash check if the public key is
Gilad Arnoldd1c4d2d2014-06-05 14:07:53 -0700115 // unavailable; it returns ErrorCode::kSignedDeltaPayloadExpectedError if the
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700116 // public key is available but the delta payload doesn't include a signature.
David Zeuthena99981f2013-04-29 13:42:47 -0700117 ErrorCode VerifyPayload(const std::string& update_check_response_hash,
Andrew de los Reyes771e1bd2011-08-30 14:47:23 -0700118 const uint64_t update_check_response_size);
Darin Petkovd7061ab2010-10-06 14:37:09 -0700119
Darin Petkov3aefa862010-12-07 14:45:00 -0800120 // Reads from the update manifest the expected sizes and hashes of the target
121 // kernel and rootfs partitions. These values can be used for applied update
122 // hash verification. This method must be called after the update manifest has
123 // been parsed (e.g., after closing the stream). Returns true on success, and
124 // false on failure (e.g., when the values are not present in the update
125 // manifest).
126 bool GetNewPartitionInfo(uint64_t* kernel_size,
Alex Vakulenkof68bbbc2015-02-09 12:53:18 -0800127 chromeos::Blob* kernel_hash,
Darin Petkov3aefa862010-12-07 14:45:00 -0800128 uint64_t* rootfs_size,
Alex Vakulenkof68bbbc2015-02-09 12:53:18 -0800129 chromeos::Blob* rootfs_hash);
Darin Petkov2dd01092010-10-08 15:43:05 -0700130
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700131 // Converts an ordered collection of Extent objects which contain data of
132 // length full_length to a comma-separated string. For each Extent, the
133 // string will have the start offset and then the length in bytes.
134 // The length value of the last extent in the string may be short, since
135 // the full length of all extents in the string is capped to full_length.
136 // Also, an extent starting at kSparseHole, appears as -1 in the string.
137 // For example, if the Extents are {1, 1}, {4, 2}, {kSparseHole, 1},
138 // {0, 1}, block_size is 4096, and full_length is 5 * block_size - 13,
139 // the resulting string will be: "4096:4096,16384:8192,-1:4096,0:4083"
140 static bool ExtentsToBsdiffPositionsString(
141 const google::protobuf::RepeatedPtrField<Extent>& extents,
142 uint64_t block_size,
143 uint64_t full_length,
144 std::string* positions_string);
145
Darin Petkov0406e402010-10-06 21:33:11 -0700146 // Returns true if a previous update attempt can be continued based on the
147 // persistent preferences and the new update check response hash.
148 static bool CanResumeUpdate(PrefsInterface* prefs,
149 std::string update_check_response_hash);
150
151 // Resets the persistent update progress state to indicate that an update
Darin Petkov9b230572010-10-08 10:20:09 -0700152 // can't be resumed. Performs a quick update-in-progress reset if |quick| is
153 // true, otherwise resets all progress-related update state. Returns true on
154 // success, false otherwise.
155 static bool ResetUpdateProgress(PrefsInterface* prefs, bool quick);
Darin Petkov0406e402010-10-06 21:33:11 -0700156
Darin Petkov9574f7e2011-01-13 10:48:12 -0800157 // Attempts to parse the update metadata starting from the beginning of
Gilad Arnolddaa27402014-01-23 11:56:17 -0800158 // |payload|. On success, returns kMetadataParseSuccess. Returns
Gilad Arnoldfe133932014-01-14 12:25:50 -0800159 // kMetadataParseInsufficientData if more data is needed to parse the complete
160 // metadata. Returns kMetadataParseError if the metadata can't be parsed given
161 // the payload.
Alex Vakulenkof68bbbc2015-02-09 12:53:18 -0800162 MetadataParseResult ParsePayloadMetadata(const chromeos::Blob& payload,
Gilad Arnolddaa27402014-01-23 11:56:17 -0800163 ErrorCode* error);
Darin Petkov9574f7e2011-01-13 10:48:12 -0800164
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700165 void set_public_key_path(const std::string& public_key_path) {
166 public_key_path_ = public_key_path;
Darin Petkov698d0412010-10-13 10:59:44 -0700167 }
168
Don Garrett4d039442013-10-28 18:40:06 -0700169 // Returns the byte offset at which the payload version can be found.
170 static uint64_t GetVersionOffset();
Jay Srinivasanf4318702012-09-24 11:56:24 -0700171
172 // Returns the byte offset where the size of the manifest is stored in
173 // a payload. This offset precedes the actual start of the manifest
174 // that's returned by the GetManifestOffset method.
175 static uint64_t GetManifestSizeOffset();
176
Don Garrett4d039442013-10-28 18:40:06 -0700177 // Returns the byte offset at which the manifest protobuf begins in a
178 // payload.
179 static uint64_t GetManifestOffset();
180
Gilad Arnoldfe133932014-01-14 12:25:50 -0800181 // Returns the size of the payload metadata, which includes the payload header
182 // and the manifest. Is the header was not yet parsed, returns zero.
183 uint64_t GetMetadataSize() const;
184
Gilad Arnolddaa27402014-01-23 11:56:17 -0800185 // If the manifest was successfully parsed, copies it to |*out_manifest_p|.
186 // Returns true on success.
187 bool GetManifest(DeltaArchiveManifest* out_manifest_p) const;
188
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700189 private:
Andrew de los Reyes353777c2010-10-08 10:34:30 -0700190 friend class DeltaPerformerTest;
191 FRIEND_TEST(DeltaPerformerTest, IsIdempotentOperationTest);
David Zeuthene7f89172013-10-31 10:21:04 -0700192 FRIEND_TEST(DeltaPerformerTest, UsePublicKeyFromResponse);
Andrew de los Reyes353777c2010-10-08 10:34:30 -0700193
Gilad Arnoldfe133932014-01-14 12:25:50 -0800194 // Appends up to |*count_p| bytes from |*bytes_p| to |buffer_|, but only to
195 // the extent that the size of |buffer_| does not exceed |max|. Advances
196 // |*cbytes_p| and decreases |*count_p| by the actual number of bytes copied,
197 // and returns this number.
198 size_t CopyDataToBuffer(const char** bytes_p, size_t* count_p, size_t max);
199
200 // If |op_result| is false, emits an error message using |op_type_name| and
201 // sets |*error| accordingly. Otherwise does nothing. Returns |op_result|.
202 bool HandleOpResult(bool op_result, const char* op_type_name,
203 ErrorCode* error);
204
Gilad Arnold8a86fa52013-01-15 12:35:05 -0800205 // Logs the progress of downloading/applying an update.
206 void LogProgress(const char* message_prefix);
207
208 // Update overall progress metrics, log as necessary.
209 void UpdateOverallProgress(bool force_log, const char* message_prefix);
210
Andrew de los Reyes353777c2010-10-08 10:34:30 -0700211 static bool IsIdempotentOperation(
212 const DeltaArchiveManifest_InstallOperation& op);
213
Darin Petkov698d0412010-10-13 10:59:44 -0700214 // Verifies that the expected source partition hashes (if present) match the
Alex Vakulenko072359c2014-07-18 11:41:07 -0700215 // hashes for the current partitions. Returns true if there are no expected
Darin Petkov698d0412010-10-13 10:59:44 -0700216 // hashes in the payload (e.g., if it's a new-style full update) or if the
217 // hashes match; returns false otherwise.
218 bool VerifySourcePartitions();
219
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700220 // Returns true if enough of the delta file has been passed via Write()
221 // to be able to perform a given install operation.
222 bool CanPerformInstallOperation(
223 const DeltaArchiveManifest_InstallOperation& operation);
Darin Petkovd7061ab2010-10-06 14:37:09 -0700224
Gilad Arnold21504f02013-05-24 08:51:22 -0700225 // Checks the integrity of the payload manifest. Returns true upon success,
226 // false otherwise.
227 ErrorCode ValidateManifest();
228
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700229 // Validates that the hash of the blobs corresponding to the given |operation|
230 // matches what's specified in the manifest in the payload.
Gilad Arnoldd1c4d2d2014-06-05 14:07:53 -0700231 // Returns ErrorCode::kSuccess on match or a suitable error code otherwise.
David Zeuthena99981f2013-04-29 13:42:47 -0700232 ErrorCode ValidateOperationHash(
Gilad Arnold8a86fa52013-01-15 12:35:05 -0800233 const DeltaArchiveManifest_InstallOperation& operation);
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700234
235 // Interprets the given |protobuf| as a DeltaArchiveManifest protocol buffer
236 // of the given protobuf_length and verifies that the signed hash of the
Jay Srinivasanf4318702012-09-24 11:56:24 -0700237 // metadata matches what's specified in the install plan from Omaha.
Gilad Arnoldd1c4d2d2014-06-05 14:07:53 -0700238 // Returns ErrorCode::kSuccess on match or a suitable error code otherwise.
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700239 // This method must be called before any part of the |protobuf| is parsed
240 // so that a man-in-the-middle attack on the SSL connection to the payload
241 // server doesn't exploit any vulnerability in the code that parses the
242 // protocol buffer.
Alex Vakulenkof68bbbc2015-02-09 12:53:18 -0800243 ErrorCode ValidateMetadataSignature(const void* protobuf,
244 uint64_t protobuf_length);
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700245
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700246 // Returns true on success.
247 bool PerformInstallOperation(
248 const DeltaArchiveManifest_InstallOperation& operation);
Darin Petkovd7061ab2010-10-06 14:37:09 -0700249
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700250 // These perform a specific type of operation and return true on success.
251 bool PerformReplaceOperation(
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -0700252 const DeltaArchiveManifest_InstallOperation& operation,
253 bool is_kernel_partition);
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700254 bool PerformMoveOperation(
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -0700255 const DeltaArchiveManifest_InstallOperation& operation,
256 bool is_kernel_partition);
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700257 bool PerformBsdiffOperation(
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -0700258 const DeltaArchiveManifest_InstallOperation& operation,
259 bool is_kernel_partition);
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700260
Darin Petkovd7061ab2010-10-06 14:37:09 -0700261 // Returns true if the payload signature message has been extracted from
262 // |operation|, false otherwise.
263 bool ExtractSignatureMessage(
264 const DeltaArchiveManifest_InstallOperation& operation);
265
Gilad Arnoldfe133932014-01-14 12:25:50 -0800266 // Updates the hash calculator with the bytes in |buffer_|. Then discard the
Gilad Arnolddaa27402014-01-23 11:56:17 -0800267 // content, ensuring that memory is being deallocated. If |do_advance_offset|,
268 // advances the internal offset counter accordingly.
269 void DiscardBuffer(bool do_advance_offset);
Darin Petkovd7061ab2010-10-06 14:37:09 -0700270
Darin Petkov0406e402010-10-06 21:33:11 -0700271 // Checkpoints the update progress into persistent storage to allow this
272 // update attempt to be resumed after reboot.
Darin Petkov73058b42010-10-06 16:32:19 -0700273 bool CheckpointUpdateProgress();
274
Darin Petkov9b230572010-10-08 10:20:09 -0700275 // Primes the required update state. Returns true if the update state was
276 // successfully initialized to a saved resume state or if the update is a new
277 // update. Returns false otherwise.
278 bool PrimeUpdateState();
279
Jay Srinivasanf0572052012-10-23 18:12:56 -0700280 // Sends UMA statistics for the given error code.
David Zeuthena99981f2013-04-29 13:42:47 -0700281 void SendUmaStat(ErrorCode code);
Jay Srinivasanf0572052012-10-23 18:12:56 -0700282
David Zeuthene7f89172013-10-31 10:21:04 -0700283 // If the Omaha response contains a public RSA key and we're allowed
284 // to use it (e.g. if we're in developer mode), extract the key from
285 // the response and store it in a temporary file and return true. In
286 // the affirmative the path to the temporary file is stored in
287 // |out_tmp_key| and it is the responsibility of the caller to clean
288 // it up.
289 bool GetPublicKeyFromResponse(base::FilePath *out_tmp_key);
290
Darin Petkov73058b42010-10-06 16:32:19 -0700291 // Update Engine preference store.
292 PrefsInterface* prefs_;
293
Jay Srinivasanf0572052012-10-23 18:12:56 -0700294 // Global context of the system.
295 SystemState* system_state_;
296
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700297 // Install Plan based on Omaha Response.
298 InstallPlan* install_plan_;
299
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700300 // File descriptor of open device.
Nam T. Nguyenf1d582e2014-12-08 15:07:17 -0800301 FileDescriptorPtr fd_;
Darin Petkovd7061ab2010-10-06 14:37:09 -0700302
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -0700303 // File descriptor of the kernel device
Nam T. Nguyenf1d582e2014-12-08 15:07:17 -0800304 FileDescriptorPtr kernel_fd_;
Darin Petkovd7061ab2010-10-06 14:37:09 -0700305
Andrew de los Reyesf4c7ef12010-04-30 10:37:00 -0700306 std::string path_; // Path that fd_ refers to.
307 std::string kernel_path_; // Path that kernel_fd_ refers to.
Darin Petkovd7061ab2010-10-06 14:37:09 -0700308
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700309 DeltaArchiveManifest manifest_;
Gilad Arnolddaa27402014-01-23 11:56:17 -0800310 bool manifest_parsed_;
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700311 bool manifest_valid_;
Gilad Arnoldfe133932014-01-14 12:25:50 -0800312 uint64_t metadata_size_;
Darin Petkovd7061ab2010-10-06 14:37:09 -0700313
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700314 // Index of the next operation to perform in the manifest.
Gilad Arnold8a86fa52013-01-15 12:35:05 -0800315 size_t next_operation_num_;
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700316
Gilad Arnoldfe133932014-01-14 12:25:50 -0800317 // A buffer used for accumulating downloaded data. Initially, it stores the
318 // payload metadata; once that's downloaded and parsed, it stores data for the
319 // next update operation.
Alex Vakulenkof68bbbc2015-02-09 12:53:18 -0800320 chromeos::Blob buffer_;
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700321 // Offset of buffer_ in the binary blobs section of the update.
322 uint64_t buffer_offset_;
Darin Petkovd7061ab2010-10-06 14:37:09 -0700323
Darin Petkov0406e402010-10-06 21:33:11 -0700324 // Last |buffer_offset_| value updated as part of the progress update.
325 uint64_t last_updated_buffer_offset_;
326
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700327 // The block size (parsed from the manifest).
328 uint32_t block_size_;
Darin Petkovd7061ab2010-10-06 14:37:09 -0700329
Darin Petkov437adc42010-10-07 13:12:24 -0700330 // Calculates the payload hash.
Darin Petkovd7061ab2010-10-06 14:37:09 -0700331 OmahaHashCalculator hash_calculator_;
332
Darin Petkov437adc42010-10-07 13:12:24 -0700333 // Saves the signed hash context.
334 std::string signed_hash_context_;
335
Darin Petkovd7061ab2010-10-06 14:37:09 -0700336 // Signatures message blob extracted directly from the payload.
Alex Vakulenkof68bbbc2015-02-09 12:53:18 -0800337 chromeos::Blob signatures_message_data_;
Darin Petkovd7061ab2010-10-06 14:37:09 -0700338
Jay Srinivasan51dcf262012-09-13 17:24:32 -0700339 // The public key to be used. Provided as a member so that tests can
340 // override with test keys.
341 std::string public_key_path_;
Darin Petkov698d0412010-10-13 10:59:44 -0700342
Gilad Arnold8a86fa52013-01-15 12:35:05 -0800343 // The number of bytes received so far, used for progress tracking.
344 size_t total_bytes_received_;
345
346 // The number rootfs and total operations in a payload, once we know them.
347 size_t num_rootfs_operations_;
348 size_t num_total_operations_;
349
350 // An overall progress counter, which should reflect both download progress
351 // and the ratio of applied operations. Range is 0-100.
352 unsigned overall_progress_;
353
354 // The last progress chunk recorded.
355 unsigned last_progress_chunk_;
356
357 // The timeout after which we should force emitting a progress log (constant),
358 // and the actual point in time for the next forced log to be emitted.
359 const base::TimeDelta forced_progress_log_wait_;
360 base::Time forced_progress_log_time_;
361
Andrew de los Reyes09e56d62010-04-23 13:45:53 -0700362 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer);
363};
364
365} // namespace chromeos_update_engine
366
Gilad Arnoldcf175a02014-07-10 16:48:47 -0700367#endif // UPDATE_ENGINE_DELTA_PERFORMER_H_