Re: [PATCH v6 5/7] tpm: retrieve digest size of unknown algorithms with PCR read
From: Jarkko Sakkinen
Date: Tue Dec 04 2018 - 18:53:58 EST
On Tue, Dec 04, 2018 at 09:21:36AM +0100, Roberto Sassu wrote:
> + for (i = 0; i < ARRAY_SIZE(tpm2_hash_map); i++) {
> + enum hash_algo crypto_algo = tpm2_hash_map[i].crypto_id;
> +
> + if (bank->alg_id != tpm2_hash_map[i].tpm_id)
> + continue;
> +
> + bank->digest_size = hash_digest_size[crypto_algo];
> + bank->crypto_id = crypto_algo;
> + return 0;
> + }
> +
> + return tpm2_pcr_read(chip, 0, &digest, &bank->digest_size);
> +}
This is a part that I don't get. Coud you just always call
tpm2_pcr_read() instead of this complexity
/Jarkko