Script to recompute SHA1 hashes for Lenovo ThinkPad Sandy Bridge laptops to get rid of 5 beeps on boot
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a small utility which checks and recomputes sha1 hashes used to validate Lenovo ThinkPad X220/T420 (and probably other Sandy Bridge ThinkPads) firmware integrity. You can hear 5 beeps twice if the firmware fails validation and you have TPM (security chip) turned on, which is pretty common for modified firmwares.

This utility is now fully automatic, it can re-hash TCPA blocks, recompute RSA signatures of said blocks and replace Lenovo public key with yours.

How to get rid of 5 beeps automatically

run --output recomputed_fw.FL1 modified_fw.FL1
where modified_fw.FL1 is a file you modified and need to recompute hashes for and recomputed_fw.FL1 is an output file.

How to get rid of 5 beeps manually

You need to recompute SHA1 hashes of modified firmware files in UEFI Volume 7A9354D9-0468-444A-81CE-0BF617D890DF, change RSA key and change SHA1 hashes, RSA public key and RSA signature to yours.

  1. Change all the files you want in UEFI Volume 7A9354D9-0468-444A-81CE-0BF617D890DF.

  2. Generate your RSA 1024 bit key with exponent=3

$ openssl genrsa -3 -out my_key.pem 1024
Generating RSA private key, 1024 bit long modulus
e is 3 (0x3)
$ openssl rsa -in my_key.pem -outform der -pubout -out my_key_pub.der
writing RSA key
$ openssl rsa -pubin -inform der -in my_key_pub.der -text -noout
Public-Key: (1024 bit)
Exponent: 3 (0x3)

  1. Run this script, find and replace modified checksums in the firmware using hex editor

  2. Search for "TCPABIOS" string using hex editor. Right before next block (where another TCPA block starts) copy 128 bytes from the end of the block. This is RSA signature.

  3. Search for FF 12 04 00, this is RSA modulus (should be right after TCPABBLK block). Replace the modulus with the modulus from your key (it always starts with 00 and is 129 bytes long).

  4. Create 128 byte file with SHA1 sum of the whole TCPABIOS block excluding RSA signature (so, right from the TCPABIOS header and until lots of zeros and FF FF, excluding FF FF), padded with zeros from the beginning, and sign it with your key:

openssl rsautl -inkey my_key.pem -sign -in mod_sign_sha1 -raw > mod_signature
  1. Replace the signature (last 128 bytes of TCPABIOS block).