AU: Sign delta payloads

- Change .proto to have explicit offset/length of signature. I was
  hoping the length could be kept out of the proto, but it needs to go
  in. The way we cheat and keep the signature in the file is to have a
  dummer install operation at the end that will cause old clients to
  write the signature data to nowhere.

- Change delta generator to take an optional private key, which if
  present will cause the payload to be signed

- Cleanup Omaha hash calculator, which should be renamed to SHA1 hash
  calculator, and allow export of the non-base64 encoded SHA1 result.

- Note: signatures are not yet checked. That will come in a future CL.

BUG=5662
TEST=unittests

Review URL: http://codereview.chromium.org/3132033
diff --git a/payload_signer_unittest.cc b/payload_signer_unittest.cc
index 4388f3c..2ee58f5 100644
--- a/payload_signer_unittest.cc
+++ b/payload_signer_unittest.cc
@@ -16,32 +16,32 @@
 // Note: the test key was generated with the following command:
 // openssl genrsa -out unittest_key.pem 1024
 
-const char kUnittestPrivateKeyPath[] = "unittest_key.pem";
-
 namespace chromeos_update_engine {
 
+const char* kUnittestPrivateKeyPath = "unittest_key.pem";
+
 //class PayloadSignerTest : public ::testing::Test {};
 
 TEST(PayloadSignerTest, SimpleTest) {
   // Some data and its corresponding signature:
   const string kDataToSign = "This is some data to sign.";
   const char kExpectedSignature[] = {
-    0x74, 0xd9, 0xea, 0x45, 0xf4, 0xd8, 0x64, 0x16,
-    0x88, 0x1b, 0x7f, 0x8b, 0x5d, 0xcb, 0x22, 0x2c,
-    0xb1, 0xce, 0x6d, 0x6d, 0x7c, 0x8f, 0x76, 0xf0,
-    0xb7, 0xa9, 0x80, 0xb3, 0x5e, 0x0b, 0xdd, 0x99,
-    0xfd, 0x88, 0x1f, 0x64, 0xd6, 0xac, 0x0c, 0x1b,
-    0xb1, 0x3c, 0x28, 0x11, 0x97, 0x15, 0x97, 0xec,
-    0x90, 0x25, 0xa0, 0x64, 0x90, 0x36, 0x5a, 0x96,
-    0x21, 0xdf, 0x16, 0x42, 0x6d, 0x7c, 0xb1, 0xf2,
-    0xf6, 0xe3, 0xb2, 0xa9, 0xea, 0xc8, 0xec, 0x6b,
-    0xa1, 0x99, 0x8a, 0xf0, 0x25, 0x0d, 0xcd, 0x41,
-    0x85, 0x76, 0x7c, 0xe1, 0xd6, 0x70, 0x71, 0xda,
-    0x02, 0x9f, 0xa2, 0x40, 0xb2, 0xfe, 0xfd, 0x84,
-    0x5c, 0xcf, 0x08, 0xa8, 0x50, 0x16, 0x46, 0xc1,
-    0x37, 0xe1, 0x16, 0xd2, 0xf5, 0x49, 0xe3, 0xcb,
-    0x58, 0x57, 0x11, 0x97, 0x49, 0x8f, 0x14, 0x1d,
-    0x4d, 0xa6, 0xfc, 0x75, 0x63, 0x64, 0xa3, 0xd5
+    0x00, 0x8d, 0x20, 0x22, 0x87, 0xd3, 0xd0, 0xeb,
+    0x85, 0x80, 0xde, 0x76, 0xa4, 0x5a, 0xac, 0xdc,
+    0xa8, 0xe0, 0x6e, 0x10, 0x98, 0xc3, 0xa4, 0x55,
+    0x48, 0xbf, 0x15, 0x98, 0x32, 0xda, 0xbe, 0x21,
+    0x3d, 0xa8, 0x1a, 0xb6, 0xf9, 0x93, 0x03, 0x70,
+    0x44, 0x1b, 0xec, 0x39, 0xe3, 0xd4, 0xfd, 0x6b,
+    0xff, 0x84, 0xee, 0x60, 0xbe, 0xed, 0x9e, 0x5b,
+    0xac, 0xd5, 0xd6, 0x1a, 0xf9, 0x4e, 0xdb, 0x6d,
+    0x11, 0x9e, 0x01, 0xb1, 0xcb, 0x55, 0x05, 0x52,
+    0x8c, 0xad, 0xb6, 0x8e, 0x9f, 0xf7, 0xc2, 0x1a,
+    0x26, 0xb3, 0x96, 0xd2, 0x4a, 0xfd, 0x7c, 0x96,
+    0x53, 0x38, 0x3a, 0xcf, 0xab, 0x95, 0x83, 0xbd,
+    0x8e, 0xe1, 0xbd, 0x07, 0x12, 0xa2, 0x80, 0x18,
+    0xca, 0x64, 0x91, 0xee, 0x9d, 0x9d, 0xe3, 0x69,
+    0xc0, 0xab, 0x1b, 0x75, 0x9f, 0xf0, 0x64, 0x74,
+    0x01, 0xb3, 0x49, 0xea, 0x87, 0x63, 0x04, 0x29
   };
 
   string data_path;