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

vmsdk (python): refine get_quote output format #22

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

intelzhongjie
Copy link
Contributor

No description provided.

@intelzhongjie intelzhongjie force-pushed the dev-quote branch 9 times, most recently from 7bc033b to 7980bbd Compare December 19, 2023 01:57
@intelzhongjie intelzhongjie changed the title get_quote: refine output format vmsdk (python): refine get_quote output format Dec 19, 2023
print(f'{indent}{type(self).__name__}:')
if fmt == Quote.QUOTE_OUT_FORMAT_HUMAN:
i = indent + " "
print(f'{i}Header Version: {self.ver}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use LOG instead of print

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. Please review the updated version. Thanks!


class Quote(ABC):
"""
Quote abstract class (interface)
"""

QUOTE_OUT_FORMAT_RAW = "raw"
QUOTE_OUT_FORMAT_HUMAN = "human"

@abstractmethod
def get_header(self) -> QuoteHeader:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this applicable for TPM quote?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusing. Please let me clarify:
They are not defined by TPM. These format are used for dump() that is defined in our code.
I think the definition can be shared by TPM Quote dump and TDX Qute dump.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussion, I have removed these literal definitions from this top-level base class to avoid confusion.
Please review the updated version. Thanks!

@intelzhongjie intelzhongjie force-pushed the dev-quote branch 8 times, most recently from b21d5fb to 560e38e Compare December 20, 2023 08:05
Copy link
Member

@kenplusplus kenplusplus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return True
return False


class Tpm2Quote(Quote):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let move Tpm2Quote to a new directory

@kenplusplus kenplusplus merged commit 115712e into cc-api:main Dec 20, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants