`tpm2_get_best_pcr_bank()` only ever considered the SHA256 and SHA1 banks (both the `LoaderTpm2ActivePcrBanks` path and the capability guesswork). On a TPM whose only active bank is SHA384 it returned `-EOPNOTSUPP`, breaking sealing/enrollment (cryptenroll, credential encryption, legacy unseal). The restriction looks like a historical simplification — `efi_get_active_pcr_banks()` already decodes SHA384/SHA512 and `tpm2_hash_algorithms[]` already lists them. This PR introduces an explicit preference table (SHA256 > SHA512 > SHA384 > SHA1) and selects from it. SHA256 stays the top preference for backwards compatibility, so existing systems keep using the same bank and the legacy unseal-guess in `tpm2_unseal()` stays consistent; SHA384/SHA512 are only chosen when SHA256 is unavailable, SHA1 remains the last resort. Behavior for existing SHA256/SHA1 systems is unchanged. Includes a unit test for the bank-preference logic. Related to https://github.com/systemd/systemd/pull/42537
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
