From 2eb19c45f9a9bf7485888ee0dd3ed6eb2fa10ade Mon Sep 17 00:00:00 2001 From: HaokunXing Date: Fri, 1 Mar 2024 11:01:54 +0800 Subject: [PATCH] common/golang: reorg sdk (#106) Signed-off-by: Xing, Haokun --- .gitignore | 2 +- common/golang/README.md | 1 + common/golang/{ => cctrusted_base}/api.go | 2 +- common/golang/{ => cctrusted_base}/blob.go | 0 common/golang/{ => cctrusted_base}/blob_test.go | 0 common/golang/{ => cctrusted_base}/event_log.go | 0 .../golang/{ => cctrusted_base}/event_log_test.go | 0 common/golang/{ => cctrusted_base}/go.mod | 0 common/golang/{ => cctrusted_base}/go.sum | 0 common/golang/{ => cctrusted_base}/ima_recorder.go | 0 .../{ => cctrusted_base}/ima_recorder_test.go | 0 common/golang/{ => cctrusted_base}/model.go | 0 common/golang/{ => cctrusted_base}/tcg.go | 0 common/golang/{ => cctrusted_base}/tdx/quote.go | 0 .../golang/{ => cctrusted_base}/tdx/quote_test.go | 0 common/golang/{ => cctrusted_base}/tdx/report.go | 0 common/golang/{ => cctrusted_base}/tdx/rtmr.go | 0 common/golang/{ => cctrusted_base}/tdx/tdx.go | 0 .../{ => cctrusted_base}/test_data/ccel_data.bin | Bin .../{ => cctrusted_base}/test_data/formated_el.txt | 0 .../test_data/formated_quote.txt | 0 .../{ => cctrusted_base}/test_data/ima_log.bin | 0 .../golang/{ => cctrusted_base}/test_data/quote.bin | Bin 23 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 common/golang/README.md rename common/golang/{ => cctrusted_base}/api.go (91%) rename common/golang/{ => cctrusted_base}/blob.go (100%) rename common/golang/{ => cctrusted_base}/blob_test.go (100%) rename common/golang/{ => cctrusted_base}/event_log.go (100%) rename common/golang/{ => cctrusted_base}/event_log_test.go (100%) rename common/golang/{ => cctrusted_base}/go.mod (100%) rename common/golang/{ => cctrusted_base}/go.sum (100%) rename common/golang/{ => cctrusted_base}/ima_recorder.go (100%) rename common/golang/{ => cctrusted_base}/ima_recorder_test.go (100%) rename common/golang/{ => cctrusted_base}/model.go (100%) rename common/golang/{ => cctrusted_base}/tcg.go (100%) rename common/golang/{ => cctrusted_base}/tdx/quote.go (100%) rename common/golang/{ => cctrusted_base}/tdx/quote_test.go (100%) rename common/golang/{ => cctrusted_base}/tdx/report.go (100%) rename common/golang/{ => cctrusted_base}/tdx/rtmr.go (100%) rename common/golang/{ => cctrusted_base}/tdx/tdx.go (100%) rename common/golang/{ => cctrusted_base}/test_data/ccel_data.bin (100%) rename common/golang/{ => cctrusted_base}/test_data/formated_el.txt (100%) rename common/golang/{ => cctrusted_base}/test_data/formated_quote.txt (100%) rename common/golang/{ => cctrusted_base}/test_data/ima_log.bin (100%) rename common/golang/{ => cctrusted_base}/test_data/quote.bin (100%) diff --git a/.gitignore b/.gitignore index 9bc390b3..81e9dbed 100644 --- a/.gitignore +++ b/.gitignore @@ -57,4 +57,4 @@ venv/ dist/ *.egg-info/ -!common/golang/go.mod +!common/golang/cctrusted_base/go.mod diff --git a/common/golang/README.md b/common/golang/README.md new file mode 100644 index 00000000..95976bef --- /dev/null +++ b/common/golang/README.md @@ -0,0 +1 @@ +# Golang SDK \ No newline at end of file diff --git a/common/golang/api.go b/common/golang/cctrusted_base/api.go similarity index 91% rename from common/golang/api.go rename to common/golang/cctrusted_base/api.go index 55f3e7d9..991aa8ed 100644 --- a/common/golang/api.go +++ b/common/golang/cctrusted_base/api.go @@ -29,7 +29,7 @@ func (t CC_Type) String() string { type CCTrustedAPI interface { GetDefaultAlgorithm() TCG_ALG - GetCCReport(nonce, userData string) (Report, error) + GetCCReport(nonce, userData string, extraArgs any) (Report, error) DumpCCReport(reportBytes []byte) error GetMeasurementCount() (int, error) diff --git a/common/golang/blob.go b/common/golang/cctrusted_base/blob.go similarity index 100% rename from common/golang/blob.go rename to common/golang/cctrusted_base/blob.go diff --git a/common/golang/blob_test.go b/common/golang/cctrusted_base/blob_test.go similarity index 100% rename from common/golang/blob_test.go rename to common/golang/cctrusted_base/blob_test.go diff --git a/common/golang/event_log.go b/common/golang/cctrusted_base/event_log.go similarity index 100% rename from common/golang/event_log.go rename to common/golang/cctrusted_base/event_log.go diff --git a/common/golang/event_log_test.go b/common/golang/cctrusted_base/event_log_test.go similarity index 100% rename from common/golang/event_log_test.go rename to common/golang/cctrusted_base/event_log_test.go diff --git a/common/golang/go.mod b/common/golang/cctrusted_base/go.mod similarity index 100% rename from common/golang/go.mod rename to common/golang/cctrusted_base/go.mod diff --git a/common/golang/go.sum b/common/golang/cctrusted_base/go.sum similarity index 100% rename from common/golang/go.sum rename to common/golang/cctrusted_base/go.sum diff --git a/common/golang/ima_recorder.go b/common/golang/cctrusted_base/ima_recorder.go similarity index 100% rename from common/golang/ima_recorder.go rename to common/golang/cctrusted_base/ima_recorder.go diff --git a/common/golang/ima_recorder_test.go b/common/golang/cctrusted_base/ima_recorder_test.go similarity index 100% rename from common/golang/ima_recorder_test.go rename to common/golang/cctrusted_base/ima_recorder_test.go diff --git a/common/golang/model.go b/common/golang/cctrusted_base/model.go similarity index 100% rename from common/golang/model.go rename to common/golang/cctrusted_base/model.go diff --git a/common/golang/tcg.go b/common/golang/cctrusted_base/tcg.go similarity index 100% rename from common/golang/tcg.go rename to common/golang/cctrusted_base/tcg.go diff --git a/common/golang/tdx/quote.go b/common/golang/cctrusted_base/tdx/quote.go similarity index 100% rename from common/golang/tdx/quote.go rename to common/golang/cctrusted_base/tdx/quote.go diff --git a/common/golang/tdx/quote_test.go b/common/golang/cctrusted_base/tdx/quote_test.go similarity index 100% rename from common/golang/tdx/quote_test.go rename to common/golang/cctrusted_base/tdx/quote_test.go diff --git a/common/golang/tdx/report.go b/common/golang/cctrusted_base/tdx/report.go similarity index 100% rename from common/golang/tdx/report.go rename to common/golang/cctrusted_base/tdx/report.go diff --git a/common/golang/tdx/rtmr.go b/common/golang/cctrusted_base/tdx/rtmr.go similarity index 100% rename from common/golang/tdx/rtmr.go rename to common/golang/cctrusted_base/tdx/rtmr.go diff --git a/common/golang/tdx/tdx.go b/common/golang/cctrusted_base/tdx/tdx.go similarity index 100% rename from common/golang/tdx/tdx.go rename to common/golang/cctrusted_base/tdx/tdx.go diff --git a/common/golang/test_data/ccel_data.bin b/common/golang/cctrusted_base/test_data/ccel_data.bin similarity index 100% rename from common/golang/test_data/ccel_data.bin rename to common/golang/cctrusted_base/test_data/ccel_data.bin diff --git a/common/golang/test_data/formated_el.txt b/common/golang/cctrusted_base/test_data/formated_el.txt similarity index 100% rename from common/golang/test_data/formated_el.txt rename to common/golang/cctrusted_base/test_data/formated_el.txt diff --git a/common/golang/test_data/formated_quote.txt b/common/golang/cctrusted_base/test_data/formated_quote.txt similarity index 100% rename from common/golang/test_data/formated_quote.txt rename to common/golang/cctrusted_base/test_data/formated_quote.txt diff --git a/common/golang/test_data/ima_log.bin b/common/golang/cctrusted_base/test_data/ima_log.bin similarity index 100% rename from common/golang/test_data/ima_log.bin rename to common/golang/cctrusted_base/test_data/ima_log.bin diff --git a/common/golang/test_data/quote.bin b/common/golang/cctrusted_base/test_data/quote.bin similarity index 100% rename from common/golang/test_data/quote.bin rename to common/golang/cctrusted_base/test_data/quote.bin