AU: Add support for signing of update payloads after they're generated.
The change adds 2 methods -- one that takes an unsigned payload and a raw
signature size and returns the hash that needs to be signed, and another one
that takes an unsigned payload and a raw signature and generates the signed
payload.
BUG=chromium-os:10872
TEST=unit tests
Change-Id: I65bbe72a1ec67e603e78508c33893695b7de0e6a
Review URL: http://codereview.chromium.org/6265001
diff --git a/delta_performer.h b/delta_performer.h
index 8a9914d..c693333 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -25,6 +25,12 @@
class DeltaPerformer : public FileWriter {
public:
+ enum MetadataParseResult {
+ kMetadataParseSuccess,
+ kMetadataParseError,
+ kMetadataParseInsufficientData,
+ };
+
DeltaPerformer(PrefsInterface* prefs)
: prefs_(prefs),
fd_(-1),
@@ -100,6 +106,17 @@
// success, false otherwise.
static bool ResetUpdateProgress(PrefsInterface* prefs, bool quick);
+ // Attempts to parse the update metadata starting from the beginning of
+ // |payload| into |manifest|. On success, sets |metadata_size| to the total
+ // metadata bytes (including the delta magic and metadata size fields), and
+ // returns kMetadataParseSuccess. Returns kMetadataParseInsufficientData if
+ // more data is needed to parse the complete metadata. Returns
+ // kMetadataParseError if the metadata can't be parsed given the payload.
+ static MetadataParseResult ParsePayloadMetadata(
+ const std::vector<char>& payload,
+ DeltaArchiveManifest* manifest,
+ uint64_t* metadata_size);
+
void set_current_kernel_hash(const std::vector<char>& hash) {
current_kernel_hash_ = hash;
}