-
Notifications
You must be signed in to change notification settings - Fork 45
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
examples: create examples structure and add first example #317
Conversation
@niooss-ledger, could you have a look and see if you think this can close #298 |
I wonder if we should mention in the ESYS_TR class documentation that to go from a TPM2_HANDLE to an ESYS_TR you should use tr_from_public. |
Codecov Report
@@ Coverage Diff @@
## master #317 +/- ##
==========================================
- Coverage 93.54% 93.53% -0.02%
==========================================
Files 15 15
Lines 4662 4699 +37
Branches 590 600 +10
==========================================
+ Hits 4361 4395 +34
- Misses 218 224 +6
+ Partials 83 80 -3
Continue to review full report at Codecov.
|
Wouldn't hurt, I can create another PR for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! I agree this would be a nice way to close #298 :)
I added some comments. Also, the example does not work as-is on a TPM I am using, due to an issue that I reported in #318, but when I work around this issue, I managed to run it. And the code of the example is easy to understand :)
I have mixed feelings about example code as well, it's often times left to rot, plus how do we know if something we do breaks an example. We need to figure out a way to get this into our test suite. |
6af8863
to
261f8af
Compare
I worry about the rot as well and I think having good tests might be hard as some of the examples I plan on writing will require extra dependencies. |
Wouldn't they just be dev dependencies? As long as you can pip install and add them to the dev section, I don't really care. |
b8754d8
to
5581417
Compare
Signed-off-by: Erik Larsson <[email protected]>
Putting the dependencies under dev should be enough for now. |
This examples covers tpm2-tss-engine / tpm2-openssl key usage and signing using ESAPI. Signed-off-by: Erik Larsson <[email protected]>
FYI, I've started putting examples up at: https://github.com/tpm2dev/tpm.dev.tutorials/tree/master/PythonExamples |
I think if we have examples, to ensure they are complete they should run with the test harness, i'm sure we could plumb them in somehow. |
I'll close this for now, might revisit it in the future |
This is a starting point for example usage of the different APIs, starting with a basic example of using ESAPI.
My plan is to add more examples over time which somewhat should cover real world use cases while being readable.