summaryrefslogtreecommitdiff
path: root/host/lib/signature_digest.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2010-07-01 10:22:06 -0700
committerBill Richardson <wfrichar@chromium.org>2010-07-01 10:22:06 -0700
commitabf055045802cb06c57ff2d7b187736bdcb3b138 (patch)
treebe0cc0aaa1d8c64fb5402b66c975e7e7c018acd1 /host/lib/signature_digest.c
parenta08b5c9d032be485fe6e2790c23e8c9bb9fca2ad (diff)
downloadvboot-abf055045802cb06c57ff2d7b187736bdcb3b138.tar.gz
Switch to using .vbprivk for signing everything now.
This makes it much simpler to keep track of what we're doing. vbutil_key can now wrap both .keyb and .pem keys. It figures out which is which by trying both and just using the one that works. vbutil_keyblock and vbutil_kernel now use .vbprivk files for signing. replace debug() with VBDEBUG(()) in host-side sources, too. rename PrivateKeyRead to PrivateKeyReadPem Add real PrivateKeyRead and PrivateKeyWrite for .vbprivk files. Review URL: http://codereview.chromium.org/2871033
Diffstat (limited to 'host/lib/signature_digest.c')
-rw-r--r--host/lib/signature_digest.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/host/lib/signature_digest.c b/host/lib/signature_digest.c
index 4dba95a6..eaa60690 100644
--- a/host/lib/signature_digest.c
+++ b/host/lib/signature_digest.c
@@ -31,7 +31,7 @@ uint8_t* SignatureDigest(const uint8_t* buf, uint64_t len, int algorithm) {
uint8_t* digest = NULL;
if (algorithm >= kNumAlgorithms) {
- debug("SignatureDigest() called with invalid algorithm!\n");
+ VBDEBUG(("SignatureDigest() called with invalid algorithm!\n"));
} else if ((digest = DigestBuf(buf, len, algorithm))) {
info_digest = PrependDigestInfo(algorithm, digest);
}
@@ -49,22 +49,22 @@ uint8_t* SignatureBuf(const uint8_t* buf, uint64_t len, const char* key_file,
digestinfo_size_map[algorithm]);
key_fp = fopen(key_file, "r");
if (!key_fp) {
- debug("SignatureBuf(): Couldn't open key file: %s\n", key_file);
+ VBDEBUG(("SignatureBuf(): Couldn't open key file: %s\n", key_file));
Free(signature_digest);
return NULL;
}
if ((key = PEM_read_RSAPrivateKey(key_fp, NULL, NULL, NULL)))
signature = (uint8_t*) Malloc(siglen_map[algorithm]);
else
- debug("SignatureBuf(): Couldn't read private key from file: %s\n",
- key_file);
+ VBDEBUG(("SignatureBuf(): Couldn't read private key from file: %s\n",
+ key_file));
if (signature) {
if (-1 == RSA_private_encrypt(signature_digest_len, /* Input length. */
signature_digest, /* Input data. */
signature, /* Output signature. */
key, /* Key to use. */
RSA_PKCS1_PADDING)) /* Padding to use. */
- debug("SignatureBuf(): RSA_private_encrypt() failed.\n");
+ VBDEBUG(("SignatureBuf(): RSA_private_encrypt() failed.\n"));
}
fclose(key_fp);
if (key)