Commit 86eb954
committed
initrd/bin/kexec-seal-key.sh tpmr.sh doc/tpm.md: fix PCR5 mismatch between LUKS DUK seal and unseal
When CONFIG_USB_KEYBOARD_REQUIRED=y, Heads loads USB kernel modules at boot and extends PCR 5 with their hashes. The LUKS DUK sealing policy includes PCR 5, so the sealed blob stores the PCR 5 value present at seal time.
The condition that decides whether PCR 5 has non-zero involvement at seal time checked CONFIG_USER_USB_KEYBOARD (a Makefile variable that defaults the USB keyboard GUI toggle to 'on') but not CONFIG_USB_KEYBOARD_REQUIRED. Boards with the latter but not the former would seal the DUK with PCR 5 = 0 (calcfuturepcr 5 returns zero when no firmware measured into that PCR), while at unseal time on the next boot PCR 5 had been extended by the loaded USB modules.
This produced:
tpm stdout: Error PCR mismatch from TPM_Unseal
TOTP unseal was unaffected because it excludes PCR 5 from its sealing policy.
Fix: add CONFIG_USB_KEYBOARD_REQUIRED to the condition so that boards requiring USB keyboards seal PCR 5 with the actual module-extended value, matching what the TPM sees at unseal time.
Additionally:
- Fix misleading comment in tpm1_unseal(): pcrl is not accepted by unsealfile.c, which has no -ix flag — only sealfile2.c has it. The sealed blob carries the PCR constraints baked in by TPM_Seal() and TPM_Unseal() enforces them automatically.
- doc/tpm.md: add Unsealing row to TPM1 vs TPM2 comparison table.
- doc/tpm.md: expand PCR 5 description to list the exact condition variables checked by kexec-seal-key.sh.
Signed-off-by: Thierry Laurion <insurgo@riseup.net>1 parent 273f52f commit 86eb954
3 files changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
| |||
424 | 428 | | |
425 | 429 | | |
426 | 430 | | |
427 | | - | |
| 431 | + | |
| 432 | + | |
428 | 433 | | |
429 | 434 | | |
430 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
888 | | - | |
889 | | - | |
890 | | - | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
891 | 893 | | |
892 | 894 | | |
893 | 895 | | |
| |||
0 commit comments