On Thu, Dec 13, 2018 at 08:57:17AM +0100, Roberto Sassu wrote: > > 1. The function does not fail if alg_id is not found. This will go > > silent. > > It is intentional. If alg_id is not found, the PCR is extended with the > first digest passed by the caller of tpm_pcr_extend(). If no digest was > provided, the PCR is extended with 0s. This is done to prevent that > PCRs in unused banks are extended later with fake measurements. > > > > 2. The function does not fail if there is a mismatch with the digest > > sizes. > > The data passed by the caller of tpm_pcr_extend() is copied to > dummy_hash, which has the maximum length. Then, tpm2_pcr_extend() takes > from dummy_hash as many bytes as needed, depending on the current > algorithm. I would suggest to document these corner cases to the function long description to make it easy and obvious to understand. /Jarkko