diff --git a/Cargo.bazel.lock b/Cargo.bazel.lock index 6a6dd08f520..d95311e75a3 100644 --- a/Cargo.bazel.lock +++ b/Cargo.bazel.lock @@ -335,6 +335,7 @@ dependencies = [ "hex", "hkdf", "hpke", + "lock_api", "log", "p256", "p384", @@ -348,6 +349,7 @@ dependencies = [ "serde", "serde_json", "sha2", + "spinning_top", "static_assertions", "strum", "time", @@ -635,6 +637,16 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.21" @@ -1036,6 +1048,12 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "sec1" version = "0.7.3" @@ -1120,6 +1138,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spinning_top" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" diff --git a/WORKSPACE b/WORKSPACE index f1c02b1b1fc..2adead16ef4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -364,7 +364,7 @@ crates_repository( ), "getrandom": crate.spec( default_features = False, - # While getrandom isn't used directly, rdrand is required to support x64_64-unknown-none. + # rdrand is required to support x64_64-unknown-none. features = ["rdrand"], version = "*", ), @@ -385,6 +385,9 @@ crates_repository( ], version = "*", ), + "lock_api": crate.spec( + features = ["arc_lock"], + ), "log": crate.spec( default_features = False, version = "*", @@ -451,6 +454,7 @@ crates_repository( default_features = False, version = "*", ), + "spinning_top": crate.spec(version = "*"), "static_assertions": crate.spec(version = "*"), "strum": crate.spec( default_features = False, diff --git a/cargo-bazel-lock.json b/cargo-bazel-lock.json index bd3953c9330..82dc3911d01 100644 --- a/cargo-bazel-lock.json +++ b/cargo-bazel-lock.json @@ -1,5 +1,5 @@ { - "checksum": "467a875ba77ed04a1e95a5bf7e79f1dd96a880873c6e46bd2ee4f5d75ec6dfbb", + "checksum": "f54fb811f525992881af16b92e3ff01179325e0e0b58d2629086625e10d0cae7", "crates": { "aead 0.5.2": { "name": "aead", @@ -2045,6 +2045,10 @@ "id": "hpke 0.11.0", "target": "hpke" }, + { + "id": "lock_api 0.4.11", + "target": "lock_api" + }, { "id": "log 0.4.21", "target": "log" @@ -2097,6 +2101,10 @@ "id": "sha2 0.10.8", "target": "sha2" }, + { + "id": "spinning_top 0.3.0", + "target": "spinning_top" + }, { "id": "static_assertions 1.1.0", "target": "static_assertions" @@ -3913,6 +3921,92 @@ ], "license_file": "LICENSE-APACHE" }, + "lock_api 0.4.11": { + "name": "lock_api", + "version": "0.4.11", + "package_url": "https://github.com/Amanieu/parking_lot", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/lock_api/0.4.11/download", + "sha256": "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" + } + }, + "targets": [ + { + "Library": { + "crate_name": "lock_api", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "lock_api", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "arc_lock", + "atomic_usize", + "default" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "lock_api 0.4.11", + "target": "build_script_build" + }, + { + "id": "scopeguard 1.2.0", + "target": "scopeguard" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "0.4.11" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "autocfg 1.2.0", + "target": "autocfg" + } + ], + "selects": {} + } + }, + "license": "MIT OR Apache-2.0", + "license_ids": [ + "Apache-2.0", + "MIT" + ], + "license_file": "LICENSE-APACHE" + }, "log 0.4.21": { "name": "log", "version": "0.4.21", @@ -6361,6 +6455,45 @@ ], "license_file": "LICENSE-APACHE" }, + "scopeguard 1.2.0": { + "name": "scopeguard", + "version": "1.2.0", + "package_url": "https://github.com/bluss/scopeguard", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/scopeguard/1.2.0/download", + "sha256": "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + } + }, + "targets": [ + { + "Library": { + "crate_name": "scopeguard", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "scopeguard", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2015", + "version": "1.2.0" + }, + "license": "MIT OR Apache-2.0", + "license_ids": [ + "Apache-2.0", + "MIT" + ], + "license_file": "LICENSE-APACHE" + }, "sec1 0.7.3": { "name": "sec1", "version": "0.7.3", @@ -6937,6 +7070,54 @@ ], "license_file": "LICENSE" }, + "spinning_top 0.3.0": { + "name": "spinning_top", + "version": "0.3.0", + "package_url": "https://github.com/rust-osdev/spinning_top", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/spinning_top/0.3.0/download", + "sha256": "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" + } + }, + "targets": [ + { + "Library": { + "crate_name": "spinning_top", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "spinning_top", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "lock_api 0.4.11", + "target": "lock_api" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "0.3.0" + }, + "license": "MIT/Apache-2.0", + "license_ids": [ + "Apache-2.0", + "MIT" + ], + "license_file": "LICENSE-APACHE" + }, "spki 0.7.3": { "name": "spki", "version": "0.7.3", @@ -8797,6 +8978,7 @@ "hex 0.4.3", "hkdf 0.12.4", "hpke 0.11.0", + "lock_api 0.4.11", "log 0.4.21", "p256 0.13.2", "p384 0.13.0", @@ -8810,6 +8992,7 @@ "serde 1.0.197", "serde_json 1.0.115", "sha2 0.10.8", + "spinning_top 0.3.0", "static_assertions 1.1.0", "strum 0.26.2", "time 0.3.34", diff --git a/oak_channel/BUILD b/oak_channel/BUILD new file mode 100644 index 00000000000..2dc5869f86f --- /dev/null +++ b/oak_channel/BUILD @@ -0,0 +1,34 @@ +# +# Copyright 2024 The Project Oak Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package( + default_visibility = ["//visibility:public"], + licenses = ["notice"], +) + +rust_library( + name = "oak_channel", + srcs = glob(["src/**"]), + deps = [ + "//oak_core", + "@oak_crates_index//:anyhow", + "@oak_crates_index//:bitflags", + "@oak_crates_index//:bytes", + "@oak_crates_index//:static_assertions", + ], +) diff --git a/oak_core/BUILD b/oak_core/BUILD new file mode 100644 index 00000000000..3abc4e52fbb --- /dev/null +++ b/oak_core/BUILD @@ -0,0 +1,32 @@ +# +# Copyright 2024 The Project Oak Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package( + default_visibility = ["//visibility:public"], + licenses = ["notice"], +) + +rust_library( + name = "oak_core", + srcs = glob(["src/**"]), + deps = [ + "@oak_crates_index//:getrandom", + "@oak_crates_index//:lock_api", + "@oak_crates_index//:spinning_top", + ], +)