-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DXE_DRIVER Example: Replace Test Platform Key with a new Platform Key #247
base: dev/202405
Are you sure you want to change the base?
Conversation
Some platforms may have lost the private portion of the PlatformKey, or the PlatformKey may have been compromised. In these cases, it is necessary to replace the PlatformKey with a new one. This example demonstrates how to replace the old PlatformKey with a new one. That is intended to be used as a reference. Targets a Test certificate that is not provided to prevent accidents.
ead1b32
to
79cbb07
Compare
* | ||
* @param[in] Hash Pointer to the hash to compare against the existing PK. | ||
* @param[in] HashSize Size of the hash in bytes. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comments
@@ -0,0 +1,271 @@ | |||
#include <Uefi.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs doxygen header.
#ifndef PLATFORM_KEY_H_ | ||
#define PLATFORM_KEY_H_ | ||
|
||
#include <Uefi.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The included headers in this file need to be removed. They cause symbols to collide,
#include <Guid/ImageAuthentication.h> | ||
#include <Guid/VariableFormat.h> | ||
#include "PlatformKey.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <UefiSecureBoot.h> will need to be added. I'd just put it under <Uefi.h>
**** THIS SHOULD BE USED WITH CAUTION - PLEASE READ ****
Some platforms may have lost the private portion of the PK (Platform Key), or the PK may have been compromised (E.G Test Certificate). The former would prevent the operating system from updating the secure boot variables via a signed update. A Firmware update natively only updates the "Defaults" but not the active variables.
In these cases, it is necessary to replace the active PK with a new one via a firmware update. This example demonstrates how an OEM may replace the existing bad PK with a new one via firmware.
This shouldn't be included indefinitely in firmware and ideally is only transient. Do not arbitrarily add this to a platform's DSC without understanding the implications of it.
I've included a script that will generate a new Test PK on demand. However I am not providing a Test PK to prevent someone from adding that to their firmware. Additionally, I've set the payload to the windows PK so that if this driver does run it will replace the certificate with a well known good default.
How This Was Tested
QemuQ35
Boot with Secure Boot disabled
exit from the shell
enable secure boot (with an appropriate target certificate)
Integration Instructions
N/A