Add TDX bazel files

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-03-20 11:15:57 +01:00 committed by Malte Poll
parent bda999d54e
commit c478df36fa
10 changed files with 30 additions and 23 deletions

View File

@ -6,19 +6,10 @@ provider "registry.terraform.io/dmacvicar/libvirt" {
constraints = "0.7.1"
hashes = [
"h1:1yEJVPVFkRkbRY63+sFRAWau/eJ0xlecHWLCV8spkWU=",
"h1:2TW4H7EJz0p6rMGjJ14Fy1etM/pGp4vPOllymBmRl90=",
"h1:6n+4i1nSCzOcAdvqAoWM43uZbL5qnZvIAXF8UvhB/to=",
"h1:6qa1y7cSCcdMYgWpVVSZzCemOQfy2ncGj/rxfjMcvyw=",
"h1:7mozCSkEConY5A0SVKeXJK5W2DjQuPiAPwZw6gWfSfI=",
"h1:AJn6IML1iiq9oIUdDQTDApMvsfSKfMncF4RoKnhpNaY=",
"h1:G114r+ESpxpMCnBxFXZZ3+HktoNK4WXAJ5M3GRwvgBQ=",
"h1:IWlvnTGnDMZFUxW1BFHlM4VpGfYrTFjjSO7cXoruu54=",
"h1:SJd8sKf1raygPGCWi+BDQVIgk6D7cNTAqCOWDF6aR7U=",
"h1:ZG+KVAKVm++wfWnGdc8QIFn1LHRycUnmYibMg4REQyk=",
"h1:bKcU6mYeMAXvtv1wbJSEKqNxYmxkqXY+Obztn22Y4g4=",
"h1:kk1aVdohwN9Shcsd5oHsQWMUet428NbQP5VvTfu5cCo=",
"h1:rDm9KgxNWuhdTCJpfepeTzCB/b24bKrOMN57637RZtU=",
"h1:sba9mbcScff5YyBWaGzCy17Tzk2qbpYO6FutG06PqMo=",
"zh:1c59f2ab68da6326637ee8b03433e84af76b3e3562f251a7f2aa239a7b262a8d",
"zh:236e24ecf036e99d9d1e2081a39dc9cb4b8993850a37141a1449f20750f883d6",
"zh:4519c22b1f00c1d37d60ac6c2cb7ad5ab9dbcd44a80b4f61e68aacb54eae017d",

View File

@ -12,6 +12,7 @@ go_library(
"//disk-mapper/internal/rejoinclient",
"//disk-mapper/internal/setup",
"//internal/attestation/choose",
"//internal/attestation/tdx",
"//internal/attestation/vtpm",
"//internal/cloud/aws",
"//internal/cloud/azure",

View File

@ -127,7 +127,7 @@ func main() {
// Use TDX if available
openDevice := vtpm.OpenVTPM
if attestVariant.OID().Equal(oid.QEMUTDX{}.OID()) {
if attestVariant.OID().Equal(variant.QEMUTDX{}.OID()) {
openDevice = func() (io.ReadWriteCloser, error) {
return tdx.Open()
}

View File

@ -15,6 +15,7 @@ go_library(
deps = [
"//internal/cloud/cloudprovider",
"//internal/sigstore",
"//internal/variant",
"@com_github_google_go_tpm//tpmutil",
"@com_github_siderolabs_talos_pkg_machinery//config/encoder",
"@in_gopkg_yaml_v3//:yaml_v3",

View File

@ -48,6 +48,7 @@ go_test(
"//internal/config/instancetypes",
"//internal/constants",
"//internal/file",
"//internal/variant",
"@com_github_go_playground_locales//en",
"@com_github_go_playground_universal_translator//:universal-translator",
"@com_github_go_playground_validator_v10//:validator",

View File

@ -11,6 +11,7 @@ go_library(
"//internal/logger",
"//internal/variant",
"//measurement-reader/internal/sorted",
"//measurement-reader/internal/tdx",
"//measurement-reader/internal/tpm",
"@org_uber_go_zap//:zap",
"@org_uber_go_zap//zapcore",

View File

@ -1,8 +1,20 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel/go:go_test.bzl", "go_test")
go_library(
name = "sorted",
srcs = ["sorted.go"],
importpath = "github.com/edgelesssys/constellation/v2/measurement-reader/internal/sorted",
visibility = ["//measurement-reader:__subpackages__"],
deps = ["//internal/attestation/measurements"],
)
go_test(
name = "sorted_test",
srcs = ["sorted_test.go"],
embed = [":sorted"],
deps = [
"//internal/attestation/measurements",
"@com_github_stretchr_testify//assert",
],
)

View File

@ -23,6 +23,7 @@ type Measurement struct {
// MeasurementType are the supported attestation types we can sort.
type MeasurementType uint32
// Available measurement types.
const (
TPM MeasurementType = iota
TDX

View File

@ -0,0 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "tdx",
srcs = ["tdx.go"],
importpath = "github.com/edgelesssys/constellation/v2/measurement-reader/internal/tdx",
visibility = ["//measurement-reader:__subpackages__"],
deps = [
"//internal/attestation/tdx",
"//measurement-reader/internal/sorted",
],
)

View File

@ -1,5 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel/go:go_test.bzl", "go_test")
go_library(
name = "tpm",
@ -7,21 +6,9 @@ go_library(
importpath = "github.com/edgelesssys/constellation/v2/measurement-reader/internal/tpm",
visibility = ["//measurement-reader:__subpackages__"],
deps = [
"//internal/attestation/measurements",
"//internal/attestation/vtpm",
"//measurement-reader/internal/sorted",
"@com_github_google_go_tpm//tpm2",
"@com_github_google_go_tpm_tools//client",
],
)
go_test(
name = "tpm_test",
srcs = ["tpm_test.go"],
embed = [":tpm"],
deps = [
"//internal/attestation/measurements",
"//measurement-reader/internal/sorted",
"@com_github_stretchr_testify//assert",
],
)