aboutsummaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorAndreas Fuchs <andreas.fuchs@sit.fraunhofer.de>2019-03-27 13:43:28 +0100
committerTadeusz Struk <tadeusz.struk@intel.com>2019-04-04 14:02:11 -0700
commit6b6dd55f734a6ed8e6d8fd53b89349ea7bc0a3bc (patch)
tree1bc537d811b1819763b7aa63e01c547cb8b8c109 /test/integration
parentd7c85ed9ba65ec549c1c416741b9f57e9f250e62 (diff)
downloadtpm2-tss-6b6dd55f734a6ed8e6d8fd53b89349ea7bc0a3bc.tar.gz
Tests: Restore PCR allocation in tests
The PCR_Allocate test will change the PCR allocations. We now store the previous allocations and restore them. Signed-off-by: Andreas Fuchs <andreas.fuchs@sit.fraunhofer.de>
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/esys-pcr-basic.int.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/integration/esys-pcr-basic.int.c b/test/integration/esys-pcr-basic.int.c
index fee61e68..48485bb8 100644
--- a/test/integration/esys-pcr-basic.int.c
+++ b/test/integration/esys-pcr-basic.int.c
@@ -37,6 +37,8 @@ test_esys_pcr_basic(ESYS_CONTEXT * esys_context)
TSS2_RC r;
int failure_return = EXIT_FAILURE;
+ TPMS_CAPABILITY_DATA *savedPCRs = NULL;
+
ESYS_TR pcrHandle_handle = 16;
TPML_DIGEST_VALUES digests
= {
@@ -119,6 +121,12 @@ test_esys_pcr_basic(ESYS_CONTEXT * esys_context)
UINT32 sizeNeeded;
UINT32 sizeAvailable;
+ r = Esys_GetCapability(esys_context,
+ ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE,
+ TPM2_CAP_PCRS, 0, 10, NULL, &savedPCRs);
+ goto_if_error(r, "Error: GetCapabilities", error);
+
+
r = Esys_PCR_Allocate(
esys_context,
ESYS_TR_RH_PLATFORM,
@@ -139,9 +147,26 @@ test_esys_pcr_basic(ESYS_CONTEXT * esys_context)
goto_if_error(r, "Error: PCR_Allocate", error);
+ r = Esys_PCR_Allocate(
+ esys_context,
+ ESYS_TR_RH_PLATFORM,
+ ESYS_TR_PASSWORD,
+ ESYS_TR_NONE,
+ ESYS_TR_NONE,
+ &savedPCRs->data.assignedPCR,
+ &allocationSuccess,
+ &maxPCR,
+ &sizeNeeded,
+ &sizeAvailable);
+
+ goto_if_error(r, "Error: PCR_Allocate", error);
+
+ Esys_Free(savedPCRs);
+
return EXIT_SUCCESS;
error:
+ if (savedPCRs) Esys_Free(savedPCRs);
return failure_return;
}