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

Unified Diff: payload_signer.cc

Issue 3419018: AU: Switch from SHA-1 to SHA-256 hash. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: update unit test Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « omaha_request_action_unittest.cc ('k') | payload_signer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: payload_signer.cc
diff --git a/payload_signer.cc b/payload_signer.cc
index 2fa9616a1f104b51f62ef73feef24e92c1aaa281..5b0c2670e25e411ea35a16899317103b94b1df66 100644
--- a/payload_signer.cc
+++ b/payload_signer.cc
@@ -30,7 +30,7 @@ bool PayloadSigner::SignPayload(const string& unsigned_payload_path,
TEST_AND_RETURN_FALSE(
utils::MakeTempFile("/tmp/hash.XXXXXX", &hash_path, NULL));
ScopedPathUnlinker hash_path_unlinker(hash_path);
-
+
vector<char> hash_data;
{
vector<char> payload;
@@ -42,7 +42,7 @@ bool PayloadSigner::SignPayload(const string& unsigned_payload_path,
TEST_AND_RETURN_FALSE(utils::WriteFile(hash_path.c_str(),
&hash_data[0],
hash_data.size()));
-
+
// This runs on the server, so it's okay to cop out and call openssl
// executable rather than properly use the library
vector<string> cmd;
@@ -52,20 +52,20 @@ bool PayloadSigner::SignPayload(const string& unsigned_payload_path,
cmd[cmd.size() - 5] = private_key_path;
cmd[cmd.size() - 3] = hash_path;
cmd[cmd.size() - 1] = sig_path;
-
+
int return_code = 0;
TEST_AND_RETURN_FALSE(Subprocess::SynchronousExec(cmd, &return_code));
TEST_AND_RETURN_FALSE(return_code == 0);
-
+
vector<char> signature;
TEST_AND_RETURN_FALSE(utils::ReadFile(sig_path, &signature));
-
+
// Pack it into a protobuf
Signatures out_message;
Signatures_Signature* sig_message = out_message.add_signatures();
sig_message->set_version(kSignatureMessageVersion);
sig_message->set_data(signature.data(), signature.size());
-
+
// Serialize protobuf
string serialized;
TEST_AND_RETURN_FALSE(out_message.AppendToString(&serialized));
@@ -79,7 +79,7 @@ bool PayloadSigner::SignatureBlobLength(
const string& private_key_path,
uint64_t* out_length) {
DCHECK(out_length);
-
+
string x_path;
TEST_AND_RETURN_FALSE(
utils::MakeTempFile("/tmp/signed_data.XXXXXX", &x_path, NULL));
« no previous file with comments | « omaha_request_action_unittest.cc ('k') | payload_signer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698