Add entitlement support for offline and migrate WORKSPACE

This commit is contained in:
Jacob Trimble
2025-01-17 23:55:54 +00:00
parent 77a33b906a
commit 5da305d9de
30 changed files with 253 additions and 320 deletions

View File

@@ -1 +1 @@
build --cxxopt='-std=c++17'
build --enable_bzlmod --cxxopt='-std=c++17'

0
whitebox-impl/BUILD Normal file
View File

View File

@@ -0,0 +1,28 @@
# Copyright 2025 Google LLC. All Rights Reserved.
module(name = "whitebox_api_intertrust")
bazel_dep(name = "whitebox")
local_path_override(
module_name = "whitebox",
path = "../whitebox",
)
# Add the repo a second time since "chromium_deps" is a separate dependency.
# See @whitebox//:MODULE.bazel for reasons.
bazel_dep(name = "chromium_deps")
local_path_override(
module_name = "chromium_deps",
path = "../whitebox/chromium_deps",
)
git_override(
module_name = "odk",
build_file = "//:odk.BUILD",
patches = ["//:odk.patch"],
patch_args = ["-p1"],
commit = "7b5fec3a7929cb36cf53db216565b09c99dc2c85", # 19.2
remote = "https://widevine-partner.googlesource.com/oemcrypto_core_message.git",
)

View File

@@ -1,107 +0,0 @@
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
local_repository(
name = "whitebox_api",
path = "../whitebox",
)
git_repository(
name = "glog_repo",
commit = "3ba8976592274bc1f907c402ce22558011d6fc5e", # 2020-02-16
remote = "https://github.com/google/glog.git",
)
git_repository(
name = "com_github_gflags_gflags",
commit = "2e227c3daae2ea8899f49858a23f3d318ea39b57", # 2020-01-15
remote = "https://github.com/gflags/gflags.git",
)
git_repository(
name = "abseil_repo",
commit = "fcb104594b0bb4b8ac306cb2f55ecdad40974683", # 2018-12-04
remote = "https://github.com/abseil/abseil-cpp.git",
)
git_repository(
name = "boringssl_repo",
commit = "d345d68d5c4b5471290ebe13f090f1fd5b7e8f58", # 2022-09-14
remote = "https://github.com/google/boringssl.git",
)
git_repository(
name = "googletest_repo",
commit = "b796f7d44681514f58a683a3a71ff17c94edb0c1", # 2023-01-17
remote = "https://github.com/google/googletest.git",
)
# We use "com_google_protobuf" instead of "protobuf_repo" because Bazel's proto
# rules implicitly depend on @com_google_protobuf. See
# https://bazel.build/blog/2017/02/27/protocol-buffers.html.
git_repository(
name = "com_google_protobuf",
remote = "https://github.com/google/protobuf.git",
tag = "v3.8.0",
)
# bazel_skylib is required by google protobuf.
git_repository(
name = "bazel_skylib",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
tag = "1.0.2",
)
# Protobuf library support. Not included in the recent protobuf release.
http_archive(
name = "zlib",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
sha256 = "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e",
strip_prefix = "zlib-1.3",
urls = ["https://zlib.net/zlib-1.3.tar.gz"],
)
# ODK
new_git_repository(
name = "odk_repo",
build_file = "@whitebox_api//external:odk.BUILD",
commit = "2bfd670424232fbff4e38f25d06cb28ee4c88b61", # 17.1
remote = "https://widevine-partner.googlesource.com/oemcrypto_core_message.git",
repo_mapping = {"@whitebox" : "@whitebox_api"}
)
bind(
name = "glog",
actual = "@glog_repo//:glog",
)
bind(
name = "gflags",
actual = "@com_github_gflags_gflags//:gflags",
)
bind(
name = "boringssl",
actual = "@boringssl_repo//:crypto",
)
bind(
name = "gtest",
actual = "@googletest_repo//:gtest",
)
bind(
name = "gtest_main",
actual = "@googletest_repo//:gtest_main",
)
bind(
name = "protobuf",
actual = "@com_google_protobuf//:protobuf",
)
bind(
name = "odk",
actual = "@odk_repo//:odk",
)

View File

@@ -30,3 +30,8 @@ cc_library(
name = "uat_license_whitebox",
visibility = ["//visibility:public"],
)
cc_library(
name = "license_whitebox_provider_keys_test_data",
visibility = ["//visibility:public"],
)

76
whitebox-impl/odk.BUILD Normal file
View File

@@ -0,0 +1,76 @@
# Copyright 2020 Google LLC. All Rights Reserved.
package(default_visibility = ["//visibility:public"])
filegroup(
name = "odk_common_hdrs",
srcs = [
"oemcrypto/odk/src/odk_serialize.h",
"oemcrypto/odk/src/odk_structs_priv.h",
"oemcrypto/odk/src/serialization_base.h",
],
)
cc_library(
name = "core",
srcs = [
"oemcrypto/odk/src/odk.c",
"oemcrypto/odk/src/odk_assert.h",
"oemcrypto/odk/src/odk_endian.h",
"oemcrypto/odk/src/odk_message.c",
"oemcrypto/odk/src/odk_message_priv.h",
"oemcrypto/odk/src/odk_overflow.c",
"oemcrypto/odk/src/odk_overflow.h",
"oemcrypto/odk/src/odk_serialize.c",
"oemcrypto/odk/src/odk_timer.c",
"oemcrypto/odk/src/odk_util.c",
"oemcrypto/odk/src/odk_util.h",
"oemcrypto/odk/src/serialization_base.c",
":odk_common_hdrs",
],
hdrs = [
"oemcrypto/odk/include/core_message_features.h",
"oemcrypto/odk/include/OEMCryptoCENCCommon.h",
"oemcrypto/odk/include/odk.h",
"oemcrypto/odk/include/odk_attributes.h",
"oemcrypto/odk/include/odk_message.h",
"oemcrypto/odk/include/odk_structs.h",
"oemcrypto/odk/include/odk_target.h",
],
copts = ["-std=c99 -Wno-array-parameter"],
includes = [
"oemcrypto/odk/include",
],
)
cc_library(
name = "serialization",
srcs = [
"oemcrypto/odk/src/core_message_deserialize.cpp",
"oemcrypto/odk/src/core_message_features.cpp",
"oemcrypto/odk/src/core_message_serialize.cpp",
"oemcrypto/odk/src/core_message_serialize_proto.cpp",
":odk_common_hdrs",
],
hdrs = [
"oemcrypto/odk/include/core_message_deserialize.h",
"oemcrypto/odk/include/core_message_serialize.h",
"oemcrypto/odk/include/core_message_serialize_proto.h",
"oemcrypto/odk/include/core_message_types.h",
],
includes = [
"oemcrypto/odk/include",
],
deps = [
":core",
"@chromium_deps//cdm/protos",
],
)
cc_library(
name = "odk",
deps = [
":core",
":serialization",
],
)

8
whitebox-impl/odk.patch Normal file
View File

@@ -0,0 +1,8 @@
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..21ba670
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,2 @@
+module(name = "odk")
+bazel_dep(name = "chromium_deps")

View File

@@ -26,7 +26,7 @@ cc_test(
name = "aead_whitebox_test",
size = "small",
deps = [
"@whitebox_api//api:aead_whitebox_test",
"@whitebox//api:aead_whitebox_test",
"//impl:test_aead_whitebox",
],
)
@@ -35,7 +35,7 @@ cc_test(
name = "aead_whitebox_benchmark",
size = "small",
deps = [
"@whitebox_api//api:aead_whitebox_benchmark",
"@whitebox//api:aead_whitebox_benchmark",
"//impl:test_aead_whitebox",
],
)
@@ -48,7 +48,7 @@ cc_test(
name = "license_whitebox_test",
size = "small",
deps = [
"@whitebox_api//api:license_whitebox_test",
"@whitebox//api:license_whitebox_test",
"//impl:general_license_whitebox",
],
)
@@ -57,7 +57,7 @@ cc_test(
name = "remote_attestation_and_verification_test",
size = "small",
deps = [
"@whitebox_api//api:remote_attestation_and_verification_test",
"@whitebox//api:remote_attestation_and_verification_test",
"//impl:general_license_whitebox",
],
)
@@ -66,7 +66,7 @@ cc_test(
name = "license_whitebox_benchmark",
size = "small",
deps = [
"@whitebox_api//api:license_whitebox_benchmark",
"@whitebox//api:license_whitebox_benchmark",
"//impl:general_license_whitebox",
],
)
@@ -75,7 +75,7 @@ cc_test(
name = "license_whitebox_uat_test",
size = "small",
deps = [
"@whitebox_api//api:license_whitebox_uat_test",
"@whitebox//api:license_whitebox_uat_test",
"//impl:uat_license_whitebox",
],
)
@@ -88,8 +88,8 @@ cc_binary(
name = "license_whitebox_main",
testonly = True,
deps = [
"@whitebox_api//api:license_whitebox_main",
"//impl:test_license_whitebox",
"@whitebox//api:license_whitebox_main",
"//impl:general_license_whitebox",
"//impl:license_whitebox_provider_keys_test_data"
],
)