Skip to content

Commit

Permalink
vmsdk: seperate the TDX API from the common API file (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: Lu, Ken <[email protected]>
  • Loading branch information
kenplusplus authored Dec 14, 2023
1 parent d0e76a4 commit a9181eb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions vmsdk/python/cctrusted/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

# pylint: disable=syntax-error
from .api import*
from .api_tdx import *
13 changes: 1 addition & 12 deletions vmsdk/python/cctrusted/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
# pylint: disable=unused-import
from cctrusted_base.imr import TcgIMR
from cctrusted_base.tcg import TcgAlgorithmRegistry
from cctrusted_base.tdx.report import TdReport
from .cvm import ConfidentialVM, TdxVM
from .cvm import ConfidentialVM

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -43,13 +42,3 @@ def get_measurement(imr_select:[int, int]) -> TcgIMR:
algo_id = cvm_inst.default_algo_id

return cvm_inst.imrs[imr_index].digest(algo_id)

def get_tdx_report() -> TdReport:
"""
Get TDX Report
"""
cvm_inst = ConfidentialVM.inst()
cvm_inst.dump()

assert isinstance(cvm_inst, TdxVM)
return cvm_inst.tdreport
19 changes: 19 additions & 0 deletions vmsdk/python/cctrusted/api_tdx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
API implementation for TDX specific
"""
import logging

from cctrusted_base.tdx.report import TdReport
from .cvm import ConfidentialVM, TdxVM

LOG = logging.getLogger(__name__)

def get_tdx_report() -> TdReport:
"""
Get TDX Report
"""
cvm_inst = ConfidentialVM.inst()
cvm_inst.dump()

assert isinstance(cvm_inst, TdxVM)
return cvm_inst.tdreport

0 comments on commit a9181eb

Please sign in to comment.