Blame tpm2-tools-limit-selected-pcrs-to-8.patch
|
Peter Robinson |
9880cb |
From 4050d845fdd3819708329a8b4f52eb2de485fbf4 Mon Sep 17 00:00:00 2001
|
|
Peter Robinson |
9880cb |
From: William Roberts <william.c.roberts@intel.com>
|
|
Peter Robinson |
9880cb |
Date: Tue, 30 Jan 2018 10:12:14 -0800
|
|
Peter Robinson |
9880cb |
Subject: [PATCH] Limit selected PCRs to 8
|
|
Peter Robinson |
9880cb |
|
|
Peter Robinson |
9880cb |
When a PCR selection has more than 8 selections, the pcrSelections
|
|
Peter Robinson |
9880cb |
array was being indexed past its end.
|
|
Peter Robinson |
9880cb |
|
|
Peter Robinson |
9880cb |
Fixes: #778
|
|
Peter Robinson |
9880cb |
|
|
Peter Robinson |
9880cb |
Signed-off-by: William Roberts <william.c.roberts@intel.com>
|
|
Peter Robinson |
9880cb |
---
|
|
Peter Robinson |
9880cb |
lib/tpm2_policy.c | 5 +++++
|
|
Peter Robinson |
9880cb |
1 file changed, 5 insertions(+)
|
|
Peter Robinson |
9880cb |
|
|
Peter Robinson |
9880cb |
diff --git a/lib/tpm2_policy.c b/lib/tpm2_policy.c
|
|
Peter Robinson |
9880cb |
index b1fc8182c..aff0a1724 100644
|
|
Peter Robinson |
9880cb |
--- a/lib/tpm2_policy.c
|
|
Peter Robinson |
9880cb |
+++ b/lib/tpm2_policy.c
|
|
Peter Robinson |
9880cb |
@@ -58,6 +58,11 @@ static bool evaluate_populate_pcr_digests(TPML_PCR_SELECTION *pcr_selections,
|
|
Peter Robinson |
9880cb |
total_indices_for_this_alg += tpm2_util_pop_count(group_val);
|
|
Peter Robinson |
9880cb |
}
|
|
Peter Robinson |
9880cb |
|
|
Peter Robinson |
9880cb |
+ if(pcr_values->count + total_indices_for_this_alg > ARRAY_LEN(pcr_values->digests)) {
|
|
Peter Robinson |
9880cb |
+ LOG_ERR("Number of PCR is limited to %zu", ARRAY_LEN(pcr_values->digests));
|
|
Peter Robinson |
9880cb |
+ return false;
|
|
Peter Robinson |
9880cb |
+ }
|
|
Peter Robinson |
9880cb |
+
|
|
Peter Robinson |
9880cb |
//digest size returned per the hashAlg type
|
|
Peter Robinson |
9880cb |
unsigned dgst_size = tpm2_alg_util_get_hash_size(pcr_selections->pcrSelections[i].hash);
|
|
Peter Robinson |
9880cb |
if (!dgst_size) {
|
|
Peter Robinson |
9880cb |
|