You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.1 KiB
61 lines
2.1 KiB
8 months ago
|
From 0bbab32b4f969a62fcc1fc5495017fc49cd30d33 Mon Sep 17 00:00:00 2001
|
||
|
From: Dan Streetman <ddstreet@ieee.org>
|
||
|
Date: Thu, 8 Jun 2023 13:41:33 -0400
|
||
|
Subject: [PATCH] tpm2: replace tpm2_capability_pcrs() macro with direct
|
||
|
c->capaiblity_pcrs use
|
||
|
|
||
|
(cherry picked from commit 9ea0ffe61264a107b3a1bcb13bef225c85c9239f)
|
||
|
|
||
|
Related: RHEL-16182
|
||
|
---
|
||
|
src/shared/tpm2-util.c | 10 ++--------
|
||
|
1 file changed, 2 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c
|
||
|
index 4759430cb2..cbdae73759 100644
|
||
|
--- a/src/shared/tpm2-util.c
|
||
|
+++ b/src/shared/tpm2-util.c
|
||
|
@@ -220,8 +220,6 @@ static int tpm2_cache_capabilities(Tpm2Context *c) {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-#define tpm2_capability_pcrs(c) ((c)->capability_pcrs)
|
||
|
-
|
||
|
/* Get the TPMA_ALGORITHM for a TPM2_ALG_ID.
|
||
|
*
|
||
|
* Returns 1 if the TPM supports the algorithm and the TPMA_ALGORITHM is provided, or 0 if the TPM does not
|
||
|
@@ -1791,15 +1789,13 @@ static int tpm2_get_best_pcr_bank(
|
||
|
uint32_t pcr_mask,
|
||
|
TPMI_ALG_HASH *ret) {
|
||
|
|
||
|
- TPML_PCR_SELECTION pcrs;
|
||
|
TPMI_ALG_HASH supported_hash = 0, hash_with_valid_pcr = 0;
|
||
|
int r;
|
||
|
|
||
|
assert(c);
|
||
|
assert(ret);
|
||
|
|
||
|
- pcrs = tpm2_capability_pcrs(c);
|
||
|
- FOREACH_TPMS_PCR_SELECTION_IN_TPML_PCR_SELECTION(selection, &pcrs) {
|
||
|
+ FOREACH_TPMS_PCR_SELECTION_IN_TPML_PCR_SELECTION(selection, &c->capability_pcrs) {
|
||
|
TPMI_ALG_HASH hash = selection->hash;
|
||
|
int good;
|
||
|
|
||
|
@@ -1874,15 +1870,13 @@ int tpm2_get_good_pcr_banks(
|
||
|
TPMI_ALG_HASH **ret) {
|
||
|
|
||
|
_cleanup_free_ TPMI_ALG_HASH *good_banks = NULL, *fallback_banks = NULL;
|
||
|
- TPML_PCR_SELECTION pcrs;
|
||
|
size_t n_good_banks = 0, n_fallback_banks = 0;
|
||
|
int r;
|
||
|
|
||
|
assert(c);
|
||
|
assert(ret);
|
||
|
|
||
|
- pcrs = tpm2_capability_pcrs(c);
|
||
|
- FOREACH_TPMS_PCR_SELECTION_IN_TPML_PCR_SELECTION(selection, &pcrs) {
|
||
|
+ FOREACH_TPMS_PCR_SELECTION_IN_TPML_PCR_SELECTION(selection, &c->capability_pcrs) {
|
||
|
TPMI_ALG_HASH hash = selection->hash;
|
||
|
|
||
|
/* Let's see if this bank is superficially OK, i.e. has at least 24 enabled registers */
|