Matthew Garrett ([personal profile] mjg59) wrote2011-09-23 11:24 am
Entry tags:

Supporting UEFI secure boot on Linux: the details

(Update January 18th 2012 - you probably want to read this for details on why the technical details described below are not the difficult bit of the problem)

An obvious question is why Linux doesn't support UEFI secure booting. Let's ignore the issues of key distribution and the GPL and all of those things, and instead just focus on what would be required. There's two components - the signed binary and the authenticated variables.

The UEFI 2.3.1 spec describes the modification to the binary format required to produce a signed binary. It's not especially difficult - you add an extra entry to the image directory, generate a hash of the entire binary other than the checksum, the certificate directory entry and the signatures themselves, encrypt that hash with your key and embed the encrypted hash in the binary. The problem has been that there was a disagreement between Microsoft and Intel over whether this signature was supposed to include the PKCS header or not, and until earlier this week the only widely available developer firmware (Intel's) was incompatible with the only widely available signed OS (Microsoft's). There's further hilarity in that the specification lists six supported hash algorithms, but the implementations will only accept two. So pretty normal, really. Developing towards a poorly defined target is a pain. Now that there's more clarity we'll probably have a signing tool before too long.

Authenticated variables are the other part of the puzzle. If a variable requires authentication, the operating system's attempt to write it will fail unless the new data is appropriately signed. The key databases (white and blacklists) are examples of authenticated variables. The signing actually takes place in userspace, and the handoff between the kernel and firmware is identical for both this case and the unauthenticated case. The only problem in Linux's support here is that our EFI variable support was written to a pre-1.0 version of the EFI specification which stated that variables had a maximum size of 1024 bytes, and this limitation ended up exposed to userspace. So all we really need to do there is add a new interface to let arbitrary sized variables be written.

Summary: We don't really support secure boot right now, but that's ok because you can't buy any hardware that supports it yet. Adding support is probably about a week's worth of effort at most.

Please be serious

(Anonymous) 2011-09-26 08:44 am (UTC)(link)
Dear (other) Anonymous, this is not a subject you can use for your own delirium :D


@ Matthew: how does Coreboot enter in this picture?

DMCA. Unjail your PC, jail yourself.

(Anonymous) 2011-10-20 12:45 am (UTC)(link)
What are the odds the DMCA will be invoked against "owners" (physical holders) of the hardware un-jailing their systems and getting jailed themselves?

They could say it allows overriding DRM or even put a poem in the firmware to force it to be considered a DMCA violation because access to a copyrighted work has been obtained by circumvention.

5 years in prison and being a felon (look at the Perl guy who was banned from Canada for life) is enough to scare almost everyone off of Linux. Not to mention the reality of how physically brutalized the average geek would be in prison - 5 hours would be enough to destroy him.