update_engine: replace std::vector<char> with chromeos::Blob
To make update engine consistent with the rest of platform2 code
replaced std::vector<char> as the container of binary data with
chromeos::Blob.
BUG=None
TEST=`FEATURES=test emerge-link update_engine`
Change-Id: I6385fd2257d15aa24bfa74ac35512c2a06c33012
Reviewed-on: https://chromium-review.googlesource.com/247793
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/payload_verifier.h b/payload_verifier.h
index f1668e9..3f4f165 100644
--- a/payload_verifier.h
+++ b/payload_verifier.h
@@ -9,6 +9,7 @@
#include <vector>
#include <base/macros.h>
+#include <chromeos/secure_blob.h>
#include "update_engine/update_metadata.pb.h"
@@ -24,26 +25,26 @@
public:
// Returns false if the payload signature can't be verified. Returns true
// otherwise and sets |out_hash| to the signed payload hash.
- static bool VerifySignature(const std::vector<char>& signature_blob,
+ static bool VerifySignature(const chromeos::Blob& signature_blob,
const std::string& public_key_path,
- std::vector<char>* out_hash_data);
+ chromeos::Blob* out_hash_data);
// Interprets signature_blob as a protocol buffer containing the Signatures
// message and decrypts the signature data using the public_key_path and
// stores the resultant raw hash data in out_hash_data. Returns true if
// everything is successful. False otherwise. It also takes the client_version
// and interprets the signature blob according to that version.
- static bool VerifySignatureBlob(const std::vector<char>& signature_blob,
+ static bool VerifySignatureBlob(const chromeos::Blob& signature_blob,
const std::string& public_key_path,
uint32_t client_version,
- std::vector<char>* out_hash_data);
+ chromeos::Blob* out_hash_data);
// Decrypts sig_data with the given public_key_path and populates
// out_hash_data with the decoded raw hash. Returns true if successful,
// false otherwise.
- static bool GetRawHashFromSignature(const std::vector<char>& sig_data,
+ static bool GetRawHashFromSignature(const chromeos::Blob& sig_data,
const std::string& public_key_path,
- std::vector<char>* out_hash_data);
+ chromeos::Blob* out_hash_data);
// Returns true if the payload in |payload_path| is signed and its hash can be
// verified using the public key in |public_key_path| with the signature
@@ -57,14 +58,14 @@
// hash should be a pointer to vector of exactly 256 bits. The vector
// will be modified in place and will result in having a length of
// 2048 bits. Returns true on success, false otherwise.
- static bool PadRSA2048SHA256Hash(std::vector<char>* hash);
+ static bool PadRSA2048SHA256Hash(chromeos::Blob* hash);
// Reads the payload from the given |payload_path| into the |out_payload|
// vector. It also parses the manifest protobuf in the payload and returns it
// in |out_manifest| along with the size of the entire metadata in
// |out_metadata_size|.
static bool LoadPayload(const std::string& payload_path,
- std::vector<char>* out_payload,
+ chromeos::Blob* out_payload,
DeltaArchiveManifest* out_manifest,
uint64_t* out_metadata_size);