Role of SHA-256 in UEFI Secure Boot Validation

UEFI Secure Boot establishes a hardware-rooted chain of trust by ensuring that only authenticated, unmodified code executes during the pre-boot phase. Cryptographic hash algorithms, most notably SHA-256, are the foundation of this process. They generate deterministic, fixed-size digests of boot components—such as bootloaders, drivers, and OS kernels—allowing the firmware to verify code integrity and confirm digital signatures against stored security keys before control of the system is handed over.

The Role of Hash Functions in Digital Signatures

Asymmetric cryptography (such as RSA or ECDSA) is computationally expensive and cannot efficiently sign large executable files directly. Hash functions solve this limitation:

  1. Digest Generation: During development, the binary (in PE/COFF format) is passed through a hashing algorithm, typically SHA-256. This produces a unique 256-bit representation of the executable, excluding mutable fields like checksums and the signature directory itself (using the Microsoft Authenticode specification).
  2. Signature Creation: The software vendor encrypts this 256-bit digest with their private key to create the digital signature embedded inside the binary.
  3. Firmware Verification: At boot time, UEFI firmware extracts the certificate, computes the SHA-256 hash of the binary independently, and decrypts the embedded signature using the corresponding public key. If the computed hash matches the decrypted hash, the firmware confirms that the binary has not been modified and comes from a trusted authority.

Direct Whitelisting and Revocation

Beyond validating certificate-based digital signatures, SHA-256 hashes play a direct role in the non-volatile UEFI variable databases:

  • The Allowed Database (db): Individual binaries that are unsigned or signed with an untrusted key can still be authorized by placing their exact SHA-256 hash directly into the db. The firmware will permit execution if the binary's hash matches an entry.
  • The Revoked Database (dbx): When a vulnerability is discovered in a previously signed bootloader or driver, authorities cannot easily revoke the entire signing certificate without invalidating thousands of legitimate files. Instead, the SHA-256 hash of the vulnerable binary is added to the dbx. Before executing any code, UEFI firmware compares the binary's hash against the dbx; if a match is found, execution is blocked immediately, overriding any valid signature.

Collision Resistance and Security

Secure Boot depends heavily on the cryptographic strength of SHA-256. The algorithm’s collision resistance ensures that an attacker cannot generate a malicious binary that produces the same 256-bit hash as an approved one. As older standards like SHA-1 have been deprecated due to collision vulnerabilities, SHA-256 remains the minimum standard for ensuring that every pre-boot component executed by the UEFI remains immutable and authentic.