summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2014-09-21 16:25:27 -0400
committerPeter Jones <pjones@redhat.com>2014-09-21 16:25:27 -0400
commit213e29e25b771fea7146c7db2203759bc8c75e5a (patch)
tree20dd3b710f0cfdde65ec102fa68638a142b73dfa
parent0dcd5a8e90245e34c941eaf81342c560935a8082 (diff)
downloadefi-boot-shim-213e29e25b771fea7146c7db2203759bc8c75e5a.tar.gz
efi-boot-shim-213e29e25b771fea7146c7db2203759bc8c75e5a.zip
Don't call AuthenticodeVerify if vendor_cert_size is 0.
Actually check the size of our vendor cert quite early, so that there's no confusion as to what's going on. This isn't strictly necessary, in that in all cases if vendor_cert_size is 0, then AuthenticodeVerify -> Pkcs7Verify() -> d2i_X509() will result in a NULL "Cert", and it will return FALSE, and we'll reject the signature, but better to avoid all that code in the first place. Belt and suspenders and whatnot. Based on a patch from https://github.com/TBOpen . Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--shim.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/shim.c b/shim.c
index cfa90d10..caa05d89 100644
--- a/shim.c
+++ b/shim.c
@@ -923,14 +923,13 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
return status;
}
-
/*
* And finally, check against shim's built-in key
*/
- if (AuthenticodeVerify(cert->CertData,
- context->SecDir->Size - sizeof(cert->Hdr),
- vendor_cert, vendor_cert_size, sha256hash,
- SHA256_DIGEST_SIZE)) {
+ if (vendor_cert_size && AuthenticodeVerify(cert->CertData,
+ context->SecDir->Size - sizeof(cert->Hdr),
+ vendor_cert, vendor_cert_size, sha256hash,
+ SHA256_DIGEST_SIZE)) {
status = EFI_SUCCESS;
return status;
}