From 9b8988a6e4bf40c6d3bc546b08b4628c004570ec Mon Sep 17 00:00:00 2001 From: Juergen Repp Date: Thu, 16 Nov 2023 16:42:51 +0100 Subject: [PATCH] ESYS TEST: Check reference counting for Esys_TR_FromTPMPublic. The test esys-tr-fromTpmPublic-key is extended. It is tested whether an esys object can be still used after two calls of Esys_TR_FromTPMPublic and one Esys_Close for this object. Signed-off-by: Juergen Repp --- test/integration/esys-tr-fromTpmPublic-key.int.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/integration/esys-tr-fromTpmPublic-key.int.c b/test/integration/esys-tr-fromTpmPublic-key.int.c index 3c1ee34c2..c6a14db59 100644 --- a/test/integration/esys-tr-fromTpmPublic-key.int.c +++ b/test/integration/esys-tr-fromTpmPublic-key.int.c @@ -142,13 +142,21 @@ test_esys_tr_fromTpmPublic_key(ESYS_CONTEXT * ectx) goto_if_error(r, "Flushing primary", error_name1); r = Esys_TR_Close(ectx, &keyHandle); - goto_if_error(r, "TR close on nv object", error_name1); + goto_if_error(r, "TR close on object", error_name1); r = Esys_TR_FromTPMPublic(ectx, TPM2_PERSISTENT_FIRST, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, &keyHandle); goto_if_error(r, "TR from TPM public", error_name1); + r = Esys_TR_FromTPMPublic(ectx, TPM2_PERSISTENT_FIRST, + ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, + &keyHandle); + goto_if_error(r, "TR from TPM public", error_name1); + + r = Esys_TR_Close(ectx, &keyHandle); + goto_if_error(r, "TR close on object", error_name1) + LOG_ERROR("Key handle (2) 0x%x", keyHandle); r = Esys_TR_GetName(ectx, keyHandle, &name2);