Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto flush #398

Closed
wants to merge 3 commits into from
Closed

Auto flush #398

wants to merge 3 commits into from

Conversation

whooo
Copy link
Contributor

@whooo whooo commented Nov 10, 2022

This PR adds the following functionality:

  • Flush transient/session handles when the ESAPI context is closed if flush_on_close is True (default is True)
  • Flush transient/session handles when the destructor is called on a ESYS_TR if flush_on_close is True

Also added ESAPI.trsess_get_attributes and type property to TPM2_HANDLE as they are needed for keeping track of if a session has TPMA_SESSION.CONTINUESESSION set and if a handle is a transient object/session

Fixes #372

@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Merging #398 (6806d4c) into master (bba1485) will increase coverage by 0.01%.
The diff coverage is 91.39%.

@@            Coverage Diff             @@
##           master     #398      +/-   ##
==========================================
+ Coverage   88.17%   88.19%   +0.01%     
==========================================
  Files          18       18              
  Lines        6630     6708      +78     
  Branches      972      991      +19     
==========================================
+ Hits         5846     5916      +70     
- Misses        639      643       +4     
- Partials      145      149       +4     
Impacted Files Coverage Δ
src/tpm2_pytss/ESAPI.py 97.56% <87.87%> (-0.56%) ⬇️
src/tpm2_pytss/constants.py 98.13% <100.00%> (+0.03%) ⬆️
src/tpm2_pytss/types.py 94.84% <100.00%> (+0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

src/tpm2_pytss/ESAPI.py Show resolved Hide resolved
src/tpm2_pytss/constants.py Outdated Show resolved Hide resolved
test/test_esapi.py Fixed Show fixed Hide fixed
test/test_esapi.py Fixed Show fixed Hide fixed
test/test_esapi.py Fixed Show fixed Hide fixed
@whooo whooo force-pushed the auto-flush branch 2 times, most recently from c789557 to 695d417 Compare November 21, 2022 09:29
test/test_esapi.py Show resolved Hide resolved
self.assertEqual(len(handles), 1)

session_copy = ESYS_TR(session)
session.__del__()

Check warning

Code scanning / CodeQL

`__del__` is called explicitly

The __del__ special method is called explicitly.
handles += list(data.data.handles)
self.assertEqual(len(handles), 1)

session_copy.__del__()

Check warning

Code scanning / CodeQL

`__del__` is called explicitly

The __del__ special method is called explicitly.
handles += list(data.data.handles)
self.assertEqual(len(handles), 1)

session.__del__()

Check warning

Code scanning / CodeQL

`__del__` is called explicitly

The __del__ special method is called explicitly.
test/test_esapi.py Fixed Show fixed Hide fixed
handles += list(data.data.handles)
self.assertEqual(len(handles), 1)

session.__del__()

Check warning

Code scanning / CodeQL

`__del__` is called explicitly

The __del__ special method is called explicitly.
@whooo whooo marked this pull request as ready for review November 21, 2022 10:13
Convinient property to get handle type instead of doing bitwise operations.

Signed-off-by: Erik Larsson <who+github@cnackers.org>
Signed-off-by: Erik Larsson <who+github@cnackers.org>
This commit adds the following functionality:
* Flush transient/session handles when the ESAPI context is closed
  if flush_on_close is True (default is True)
* Flush transient/session handles when the destructor is called on
  a ESYS_TR if flush_on_close is True

Signed-off-by: Erik Larsson <who+github@cnackers.org>
@williamcroberts williamcroberts added the hold hold this patch after release label Jan 5, 2023
@whooo whooo closed this Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hold hold this patch after release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add destructor for ESYS_TR handles
2 participants