Skip to content

Commit e4cd231

Browse files
committed
Allow handle generation to fail
When using older versions of the TSS libraries, the handle does not require fetching again. Signed-off-by: Ionut Mihalcea <[email protected]>
1 parent 36fe4fe commit e4cd231

File tree

1 file changed

+4
-4
lines changed
  • tss-esapi/tests/integration_tests/abstraction_tests

1 file changed

+4
-4
lines changed

tss-esapi/tests/integration_tests/abstraction_tests/nv_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn list() {
7272
.map(|(public, _)| public.nv_index())
7373
.any(|x| x == nv_index));
7474

75-
let _owner_nv_index_handle = write_nv_index(&mut context, nv_index);
75+
let owner_nv_index_handle = write_nv_index(&mut context, nv_index);
7676

7777
assert!(nv::list(&mut context)
7878
.unwrap()
@@ -83,7 +83,7 @@ fn list() {
8383
// Need to get the ESYS handle again, as it was closed by nv::list above
8484
let owner_nv_index_handle = context
8585
.tr_from_tpm_public(nv_index.into())
86-
.expect("Failed to get ObjectHandle for NV Index");
86+
.unwrap_or_else(|_| owner_nv_index_handle.into());
8787
context
8888
.nv_undefine_space(Provision::Owner, owner_nv_index_handle.into())
8989
.expect("Call to nv_undefine_space failed");
@@ -95,15 +95,15 @@ fn read_full() {
9595

9696
let nv_index = NvIndexTpmHandle::new(0x01500015).unwrap();
9797

98-
let _owner_nv_index_handle = write_nv_index(&mut context, nv_index);
98+
let owner_nv_index_handle = write_nv_index(&mut context, nv_index);
9999

100100
// Now read it back
101101
let read_result = nv::read_full(&mut context, NvAuth::Owner, nv_index);
102102

103103
// Need to get the ESYS handle again, as it was closed by nv::read_full above
104104
let owner_nv_index_handle = context
105105
.tr_from_tpm_public(nv_index.into())
106-
.expect("Failed to get ObjectHandle for NV Index");
106+
.unwrap_or_else(|_| owner_nv_index_handle.into());
107107
context
108108
.nv_undefine_space(Provision::Owner, owner_nv_index_handle.into())
109109
.expect("Call to nv_undefine_space failed");

0 commit comments

Comments
 (0)