treewide: introduce osbase package and move things around
All except localregistry moved from metropolis/pkg to osbase,
localregistry moved to metropolis/test as its only used there anyway.
Change-Id: If1a4bf377364bef0ac23169e1b90379c71b06d72
Reviewed-on: https://review.monogon.dev/c/monogon/+/3079
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/osbase/tpm/proto/BUILD.bazel b/osbase/tpm/proto/BUILD.bazel
new file mode 100644
index 0000000..712e3a3
--- /dev/null
+++ b/osbase/tpm/proto/BUILD.bazel
@@ -0,0 +1,25 @@
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+proto_library(
+ name = "proto_proto",
+ srcs = ["tpm.proto"],
+ visibility = ["//visibility:public"],
+ deps = ["@com_github_google_go_tpm_tools//proto/tpm:tpm_proto"], #keep
+)
+
+go_proto_library(
+ name = "proto_go_proto",
+ importpath = "source.monogon.dev/osbase/tpm/proto",
+ proto = ":proto_proto",
+ visibility = ["//visibility:public"],
+ deps = ["@com_github_google_go_tpm_tools//proto/tpm"], #keep
+)
+
+go_library(
+ name = "proto",
+ embed = [":proto_go_proto"],
+ importpath = "source.monogon.dev/osbase/tpm/proto",
+ visibility = ["//visibility:public"],
+)
diff --git a/osbase/tpm/proto/gomod-generated-placeholder.go b/osbase/tpm/proto/gomod-generated-placeholder.go
new file mode 100644
index 0000000..92256db
--- /dev/null
+++ b/osbase/tpm/proto/gomod-generated-placeholder.go
@@ -0,0 +1 @@
+package proto
diff --git a/osbase/tpm/proto/tpm.proto b/osbase/tpm/proto/tpm.proto
new file mode 100644
index 0000000..e5455d2
--- /dev/null
+++ b/osbase/tpm/proto/tpm.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+option go_package = "source.monogon.dev/osbase/tpm/proto";
+package metropolis.pkg.tpm;
+
+import "proto/tpm/tpm.proto";
+
+// ExtendedSealedBytes contains data sealed by a TPM2 via an indirection to
+// allow for more than 128 bytes of payload. It seals an ephemeral key for
+// a nacl secretbox in the TPM and stores the encrypted box next to the sealed
+// key.
+message ExtendedSealedBytes {
+ // The secretbox key, as sealed by the TPM.
+ .tpm.SealedBytes sealed_key = 1;
+ // The encrypted box contents.
+ bytes encrypted_payload = 2;
+}
\ No newline at end of file