diff options
author | Raymond Mao <raymond.mao@linaro.org> | 2024-12-24 08:01:06 -0800 |
---|---|---|
committer | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2025-01-07 15:45:51 +0200 |
commit | 9f9797aaa8d4ea22a682e6cd28a9b3e5638d132f (patch) | |
tree | 6a1ee86f8360111cebc3e0f7bb3edbd336b4f367 /lib | |
parent | 0698f1331f286d4ed04bc2345de59acd86ee634e (diff) |
tpm: refactor tcg2_get_pcr_info()
Rename the arguments of tcg2_get_pcr_info() to clarify
they are bank masks, not PCR mask.
Remove the unused local variable.
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tpm_tcg2.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/tpm_tcg2.c b/lib/tpm_tcg2.c index edbe5f3aafa..0e267ff0a7d 100644 --- a/lib/tpm_tcg2.c +++ b/lib/tpm_tcg2.c @@ -20,19 +20,16 @@ #include <linux/unaligned/le_byteshift.h> #include "tpm-utils.h" -int tcg2_get_pcr_info(struct udevice *dev, u32 *supported_pcr, u32 *active_pcr, - u32 *pcr_banks) +int tcg2_get_pcr_info(struct udevice *dev, u32 *supported_bank, u32 *active_bank, + u32 *bank_num) { - u8 response[(sizeof(struct tpms_capability_data) - - offsetof(struct tpms_capability_data, data))]; struct tpml_pcr_selection pcrs; size_t i; u32 ret; - *supported_pcr = 0; - *active_pcr = 0; - *pcr_banks = 0; - memset(response, 0, sizeof(response)); + *supported_bank = 0; + *active_bank = 0; + *bank_num = 0; ret = tpm2_get_pcr_info(dev, &pcrs); if (ret) @@ -42,16 +39,16 @@ int tcg2_get_pcr_info(struct udevice *dev, u32 *supported_pcr, u32 *active_pcr, u32 hash_mask = tcg2_algorithm_to_mask(pcrs.selection[i].hash); if (hash_mask) { - *supported_pcr |= hash_mask; + *supported_bank |= hash_mask; if (tpm2_is_active_bank(&pcrs.selection[i])) - *active_pcr |= hash_mask; + *active_bank |= hash_mask; } else { printf("%s: unknown algorithm %x\n", __func__, pcrs.selection[i].hash); } } - *pcr_banks = pcrs.count; + *bank_num = pcrs.count; return 0; } |