Allow policy session to be extended more programatically#403
Allow policy session to be extended more programatically#403friedrichsenm wants to merge 2 commits intogoogle:mainfrom
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.
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.
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