This is the second code drop for the white-box api reference implementation and tests. This corrects the errors in the license white-box reference implementation and implements the remaining test cases. It should be noted that there is one test case missing, the test case for handling ChromeOS's unique policy settings. In order to make the tests easier to create and read, a license builder class was created and golden content and keys were wrapped in their own classes. How key errors are communicated was changed in the API. WB_RESULT_NO_SUCH_KEY and WB_RESULT_WRONG_KEY_TYPE were merged into WB_RESULT_KEY_UNAVAILABLE.
119 lines
2.7 KiB
Python
119 lines
2.7 KiB
Python
# Copyright 2020 Google LLC. All Rights Reserved.
|
|
|
|
package(default_visibility = ["//visibility:private"])
|
|
|
|
cc_library(
|
|
name = "result",
|
|
hdrs = [
|
|
"result.h",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "aead_whitebox",
|
|
hdrs = [
|
|
"aead_whitebox.h",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":result",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "license_whitebox",
|
|
hdrs = [
|
|
"license_whitebox.h",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":result",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "test_data",
|
|
testonly = True,
|
|
hdrs = [
|
|
"test_data.h",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "golden_data",
|
|
testonly = True,
|
|
srcs = [
|
|
"golden_data.cc",
|
|
],
|
|
hdrs = [
|
|
"golden_data.h",
|
|
],
|
|
deps = [
|
|
"//chromium_deps/cdm/protos:license_protocol_proto",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "license_builder",
|
|
testonly = True,
|
|
srcs = ["license_builder.cc"],
|
|
hdrs = ["license_builder.h"],
|
|
deps = [
|
|
"//chromium_deps/base",
|
|
"//chromium_deps/cdm/keys:dev_certs",
|
|
"//chromium_deps/cdm/protos:license_protocol_proto",
|
|
"//crypto_utils:aes_cbc_encryptor",
|
|
"//crypto_utils:crypto_util",
|
|
"//crypto_utils:rsa_key",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "aead_whitebox_test",
|
|
testonly = True,
|
|
srcs = [
|
|
"aead_whitebox_create_test.cc",
|
|
"aead_whitebox_cross_instance_test.cc",
|
|
"aead_whitebox_decrypt_test.cc",
|
|
"aead_whitebox_encrypt_test.cc",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":aead_whitebox",
|
|
":test_data",
|
|
"//chromium_deps/testing:gtest",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "license_whitebox_test",
|
|
testonly = True,
|
|
srcs = [
|
|
"license_whitebox_create_test.cc",
|
|
"license_whitebox_decrypt_test.cc",
|
|
"license_whitebox_get_secret_string_test.cc",
|
|
"license_whitebox_masked_decrypt_test.cc",
|
|
"license_whitebox_process_license_response_test.cc",
|
|
"license_whitebox_sign_license_request_test.cc",
|
|
"license_whitebox_sign_renewal_request_test.cc",
|
|
"license_whitebox_test_base.cc",
|
|
"license_whitebox_verify_renewal_response_test.cc",
|
|
],
|
|
hdrs = [
|
|
"license_whitebox_test_base.h",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":golden_data",
|
|
":license_builder",
|
|
":license_whitebox",
|
|
":test_data",
|
|
"//chromium_deps/cdm/keys:api",
|
|
"//chromium_deps/cdm/protos:license_protocol_proto",
|
|
"//chromium_deps/testing:gtest",
|
|
"//crypto_utils:rsa_key",
|
|
],
|
|
)
|