Comments (4)
I think that the specification says it pretty clear:
When an authorization session is no longer needed, TPM2_FlushContext()
may be used to delete all context associated with the session from TPM memory (see 30.6).
The session handle for this command may use an upper octet of either 0x02 or 0x03.
All Transient Objects are flushed from TPM memory on any TPM2_Startup().
A loaded Transient Object context may be flushed from TPM memory using
TPM2_FlushContext() and indicating the handle of
the loaded context to be flushed.
So flush_context
can only be used if the handle is a HmacSession, LoadedSession or Transient.
But one thing that should be done for all handles when the context is dropped is to close them.
That is not so complicated to check for in tr_from_tpm_public()
To take care of the handles from evict_control
what we would have to do is:
If you make something persistent then you will have to look that handle up and say 'close but not flush'.If you make something persistent then the handle you provided will 'flushed' and 'closed' (isch, according to the ESAPI specification) and the handle returned should be added as 'close but not flush'.- If you make something persistent then the handle that is returned will be closed when the context is dropped.
-If you make something non persistent then you would have to say 'close and flush'. If you make something non persistent then it will be 'flushed' and 'closed' (isch, according to the ESAPI specification) and the handle will become invalid. And should be removed from the list of open handles.- If you make something non persistent then the handle used will become invalid (i.e. closed) and the returned value will be ObjectHandle::Null. Nothing will be done with the handle when the context is dropped.
from rust-tss-esapi.
I may also have run into a bug in tpm2-tss when trying to get this to work.
from rust-tss-esapi.
Hi! Thanks for reporting this, it does indeed sound like a bug. It actually made me realize it's actually a wider problem, we should try and tackle it under this issue.
For tr_from_tpm_public
I think a bunch of those handle types should not be flushed: Permanent
, Persistent
, AttachedComponent
- maybe NvIndex
and Pcr
but I'll defer those to @Superhepper and @puiterwijk . It might be the case that it's easier to just figure out which ones need flushing - (some of) the session handles, Transient
for sure... For sessions, the Architecture spec says:
All session contexts in TPM memory are flushed on any TPM2_Startup(). The saved session contexts remain valid until a TPM Reset.
So we probably shouldn't flush SavedSession
.
The reason why I mentioned a larger issue is that I noticed evict_control
does not do anything to the open handles. Presumably, it should check whether the operation was succesful and depending on the operation (was it transient -> persistent or the other way around) it should change open_handles
accordingly.
Maybe we need to check all methods again, make sure they all keep open_handles
consistent. Maybe we also need some methods on Context
to let the user decide if some handles shouldn't be flushed - it would also help mitigate any problem like this in the future.
from rust-tss-esapi.
I got it all wrong. Either you flush a handle or you close a handle. You cannot do both. FlushContext removes all the data from the TPM and cleans up all the Esys resources while close only cleans up the Esys resources and should therefor be used with handles that we are not allowed to flush.
from rust-tss-esapi.
Related Issues (20)
- Creating an ecc attestation key fails due to missing public HOT 1
- Windows TCTI/TBS support HOT 29
- No 7.3.0 tag in git HOT 2
- Support - help needed with key duplication for another example HOT 1
- Add CI job for examples
- Remove clippy checks from test scripts
- Incorrect handling of FFI `size_t` in marshalling and unmarshalling trait implementation.
- Set rust-version in Cargo.toml
- No way to sign without hashcheck ticket HOT 4
- how to use nv_read_public()? HOT 2
- The max size of the 'SensitiveData' buffer is to big.
- Non sized buffers are not checked for exact size.
- v8.0.0 stabilization work HOT 21
- Change minimum required tpm2-tss version.
- Idea: PublicBuilder presets for common usecases HOT 3
- Support Created Loaded HOT 5
- Update Rust edition.
- Add Ci for Windows
- Dependency mbox 0.6.1 which hard requires Rust 2018 HOT 2
- Make the serde dependency optional.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-tss-esapi.