Hello Ilias,
On 10.11.25 12:51, Ilias Apalodimas wrote:
Hello Heiko,
Thanks for doing this.
This patch is fine. I do think we should extend this more though.
Adding the missing SM3 algo is indeed needed. But when using a TPM,
the specs that currently describe it require all the PCR banks to be
extended. IOW we need to add some code to lib/tpm_tcg2.c as well.
I haven't looked at all the details yet, but we at least need to add
the new algo to tcg2_create_digest(). I am happy to help if you need
more details.
If you can help me here, that would be great, as I have not that deep
knowledge here!
I try to add SM3 in lib/tpm_tcg2.c and send a v2.
Thanks!
[...]
/* NV index attributes */
diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
index 5b21c57ae42..0fea35e5ae0 100644
--- a/lib/tpm-v2.c
+++ b/lib/tpm-v2.c
@@ -686,10 +686,10 @@ int tpm2_get_pcr_info(struct udevice *dev, struct
tpml_pcr_selection *pcrs)
pcrs->count = get_unaligned_be32(response);
/*
- * We only support 4 algorithms for now so check against that
+ * We only support 5 algorithms for now so check against that
* instead of TPM2_NUM_PCR_BANKS
*/
- if (pcrs->count > 4 || pcrs->count < 1) {
+ if (pcrs->count > 5 || pcrs->count < 1) {
Since you are changing this we might as well make it future proof.
Can you please change this and just use the ARRAY_SIZE() of the
hash_algo_list[] instead?
Yes that makes sense!
bye,
Heiko
printf("%s: too many pcrs: %u\n", __func__, pcrs->count);
return -EMSGSIZE;
}
--
2.20.1
Regards
/Ilias
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: [email protected]
Geschäftsführer : Stefano Babic