Commit 465e1f5
committed
initrd: fix TPM1 counter auth regression (#2068)
PR #2068 introduced a regression where `increment_tpm_counter`
was changed from hardcoded `-pwdc ''` (empty counter auth per
TCG spec) to `-pwdc "${tpm_passphrase:-}"` (owner passphrase),
while counters continued to be created with `-pwdc ''`. This
caused every increment to compute SHA1(owner_pass) against a
counter created with SHA1(""), producing persistent TPM_AUTHFAIL.
Per TCG TPM Main Spec Part 3, TPM_CreateCounter uses owner auth
(-pwdo) but TPM_IncrementCounter uses the counter's own authData
— not the owner password. The correct design for Heads' rollback
counter is empty auth.
The repeated auth failures (3 per boot) accumulated the TPM's
dictionary attack (DA) failedTries counter until lockout was
reached (~10 boots = 30 failures). Users reported "hours of
waiting" on affected hardware. On some implementations the DA
state persisted through tpm forceclear.
Fix: restore TCG-compliant empty counter auth:
- tpm1_counter_increment: detect explicit -pwdc '' and call tpm
directly, bypassing _tpm_auth_retry. Non-empty or absent -pwdc
falls through to owner-auth retry path for migration of counters
created by pre-fix code.
- check_tpm_counter: create counters with -pwdc '' instead of
owner passphrase.
- increment_tpm_counter: increment with -pwdc '' instead of
owner passphrase; counter_create fallback uses empty auth.
- oem-factory-reset.sh: create counters with -pwdc ''.
Signed-off-by: Thierry Laurion <insurgo@riseup.net>1 parent 7d3a28a commit 465e1f5
4 files changed
Lines changed: 66 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
333 | 364 | | |
334 | 365 | | |
335 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
868 | 868 | | |
869 | 869 | | |
870 | 870 | | |
871 | | - | |
| 871 | + | |
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
| 432 | + | |
| 433 | + | |
433 | 434 | | |
434 | 435 | | |
435 | 436 | | |
| |||
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
446 | 453 | | |
447 | 454 | | |
448 | 455 | | |
| 456 | + | |
| 457 | + | |
449 | 458 | | |
450 | 459 | | |
451 | 460 | | |
452 | | - | |
| 461 | + | |
453 | 462 | | |
454 | 463 | | |
455 | 464 | | |
456 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
457 | 476 | | |
458 | 477 | | |
459 | 478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1848 | 1848 | | |
1849 | 1849 | | |
1850 | 1850 | | |
1851 | | - | |
| 1851 | + | |
| 1852 | + | |
1852 | 1853 | | |
1853 | 1854 | | |
1854 | 1855 | | |
| |||
1857 | 1858 | | |
1858 | 1859 | | |
1859 | 1860 | | |
1860 | | - | |
1861 | | - | |
1862 | | - | |
1863 | | - | |
1864 | | - | |
1865 | | - | |
| 1861 | + | |
| 1862 | + | |
1866 | 1863 | | |
1867 | 1864 | | |
1868 | 1865 | | |
| |||
1872 | 1869 | | |
1873 | 1870 | | |
1874 | 1871 | | |
1875 | | - | |
| 1872 | + | |
1876 | 1873 | | |
1877 | 1874 | | |
1878 | 1875 | | |
| |||
2050 | 2047 | | |
2051 | 2048 | | |
2052 | 2049 | | |
2053 | | - | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
2054 | 2053 | | |
2055 | 2054 | | |
2056 | | - | |
2057 | | - | |
2058 | | - | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
2062 | | - | |
2063 | | - | |
2064 | | - | |
2065 | | - | |
2066 | | - | |
2067 | | - | |
2068 | | - | |
2069 | 2055 | | |
2070 | 2056 | | |
2071 | 2057 | | |
| |||
2094 | 2080 | | |
2095 | 2081 | | |
2096 | 2082 | | |
2097 | | - | |
| 2083 | + | |
2098 | 2084 | | |
2099 | 2085 | | |
2100 | 2086 | | |
| |||
2104 | 2090 | | |
2105 | 2091 | | |
2106 | 2092 | | |
2107 | | - | |
| 2093 | + | |
2108 | 2094 | | |
2109 | 2095 | | |
2110 | 2096 | | |
| |||
2123 | 2109 | | |
2124 | 2110 | | |
2125 | 2111 | | |
| 2112 | + | |
2126 | 2113 | | |
2127 | 2114 | | |
2128 | 2115 | | |
2129 | | - | |
| 2116 | + | |
2130 | 2117 | | |
2131 | 2118 | | |
2132 | 2119 | | |
| |||
0 commit comments