-
Notifications
You must be signed in to change notification settings - Fork 172
Allow policy session to be extended more programatically #403
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
base: main
Are you sure you want to change the base?
Allow policy session to be extended more programatically #403
Conversation
|
It looked like most of the policy test were testing the functionality of the policy commands themselves so I'm not sure if the one test I modified is considered meaningful enough. I can add a separate test to just test this interface (perhaps with a trial session or something) if you think that is appropriate. |
tpm2/tpm2.go
Outdated
|
|
||
| // PolicyCommand is a TPM command that can be part of a TPM policy. | ||
| type PolicyCommand interface { | ||
| type PolicyCommand[R any, PR *R] interface { |
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.
Couple options come to mind here:
- We can toss the (non-error) response from the policy command, assuming that users who want to consume the output of the Policy command are not doing so using this interface.
- We could make this interface function just return any, error and leave it to the caller to do the type assertion if they wish to consume the data.
What do you think? Do either of these options break your use-case?
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.
I think returning an any would be better. I'm not currently using any of the fields in the returns, but I might want to and it wouldn't be too hard to handle returns from this in a switch statement to handle the non-trivial cases.
|
@chrisfenner, I found an |
|
Hi @friedrichsenm, sorry for losing track of this. If you're still interested in the change would you mind rebasing to resolve the merge conflicts? |
This PR updates the PolicyCommand interface to add ExecutePolicyInSession. This new method extends the given policy session with the policy command and returns the response.
f55f163 to
beb426b
Compare
|
@chrisfenner, sorry for the delayed response as well! You caught me when I was on vacation. I rebased my PR and it should be ready to go if there aren't any further changes/corrections. |
This PR updates the PolicyCommand interface to add ExecutePolicyInSession. This new method extends the given policy session with the policy command and returns the response.
Closes #401