Cherry pick 18.4 changes to udc-widevine-dev
Get the udc-widevine-dev Android branch and oemcrypto-v18 cdm branch in sync. The commit ID for 18.4 on oemcrypto-v18 is a2f23a2281e5e06dc2867585bdc516fa132b6396. Merged from go/wvgerrit/190151 Bug: 290252845 Test: WVTS tests are running and passing Change-Id: I457332e7ca70a5b5169345e1279b3eb9f18413b6
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
// Copyright 2023 Google LLC. All Rights Reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine
|
||||
// License Agreement.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "FuzzedDataProvider.h"
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "oemcrypto_fuzz_helper.h"
|
||||
|
||||
namespace {
|
||||
|
||||
enum class ApiMethod {
|
||||
kOpenSession,
|
||||
kCloseSession,
|
||||
kCreateEntitledKeySession,
|
||||
kReassociateEntitledKeySession,
|
||||
kRemoveEntitledKeySession,
|
||||
kMaxValue = kRemoveEntitledKeySession,
|
||||
};
|
||||
|
||||
struct Session {
|
||||
OEMCrypto_SESSION value;
|
||||
std::vector<OEMCrypto_SESSION>::const_iterator iterator;
|
||||
};
|
||||
|
||||
Session PickSession(FuzzedDataProvider& fuzzed_data,
|
||||
const std::vector<OEMCrypto_SESSION>& sessions) {
|
||||
Session session;
|
||||
|
||||
session.iterator =
|
||||
sessions.cbegin() +
|
||||
fuzzed_data.ConsumeIntegralInRange<size_t>(0, sessions.size());
|
||||
|
||||
if (session.iterator != sessions.cend()) {
|
||||
session.value = *session.iterator;
|
||||
} else {
|
||||
session.value = fuzzed_data.ConsumeIntegral<OEMCrypto_SESSION>();
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
wvoec::RedirectStdoutToFile();
|
||||
|
||||
wvoec::SessionUtil session_util;
|
||||
wvoec::InitializeFuzz(session_util);
|
||||
|
||||
// Contains all open and some closed OEMCrypto sessions.
|
||||
std::vector<OEMCrypto_SESSION> oec_sessions;
|
||||
|
||||
// Contains all current and some removed key sessions.
|
||||
std::vector<OEMCrypto_SESSION> key_sessions;
|
||||
|
||||
FuzzedDataProvider fuzzed_data(data, size);
|
||||
|
||||
while (fuzzed_data.remaining_bytes() > 0) {
|
||||
switch (fuzzed_data.ConsumeEnum<ApiMethod>()) {
|
||||
case ApiMethod::kOpenSession: {
|
||||
OEMCrypto_SESSION session = 0;
|
||||
const OEMCryptoResult result = OEMCrypto_OpenSession(&session);
|
||||
|
||||
if (result == OEMCrypto_SUCCESS) {
|
||||
oec_sessions.push_back(session);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ApiMethod::kCloseSession: {
|
||||
const Session session = PickSession(fuzzed_data, oec_sessions);
|
||||
|
||||
const OEMCryptoResult result = OEMCrypto_CloseSession(session.value);
|
||||
|
||||
if (result == OEMCrypto_SUCCESS &&
|
||||
session.iterator != oec_sessions.cend() &&
|
||||
fuzzed_data.ConsumeBool()) {
|
||||
oec_sessions.erase(session.iterator);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ApiMethod::kCreateEntitledKeySession: {
|
||||
const OEMCrypto_SESSION oec_session =
|
||||
PickSession(fuzzed_data, oec_sessions).value;
|
||||
|
||||
OEMCrypto_SESSION key_session_data = 0;
|
||||
OEMCrypto_SESSION* const key_session =
|
||||
fuzzed_data.ConsumeBool() ? &key_session_data : nullptr;
|
||||
|
||||
const OEMCryptoResult result =
|
||||
OEMCrypto_CreateEntitledKeySession(oec_session, key_session);
|
||||
|
||||
if (result == OEMCrypto_SUCCESS) {
|
||||
key_sessions.push_back(*key_session);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ApiMethod::kReassociateEntitledKeySession: {
|
||||
const OEMCrypto_SESSION key_session =
|
||||
PickSession(fuzzed_data, key_sessions).value;
|
||||
|
||||
const OEMCrypto_SESSION oec_session =
|
||||
PickSession(fuzzed_data, oec_sessions).value;
|
||||
|
||||
OEMCrypto_ReassociateEntitledKeySession(key_session, oec_session);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ApiMethod::kRemoveEntitledKeySession: {
|
||||
const Session key_session = PickSession(fuzzed_data, key_sessions);
|
||||
|
||||
const OEMCryptoResult result =
|
||||
OEMCrypto_RemoveEntitledKeySession(key_session.value);
|
||||
|
||||
if (result == OEMCrypto_SUCCESS &&
|
||||
key_session.iterator != key_sessions.cend() &&
|
||||
fuzzed_data.ConsumeBool()) {
|
||||
key_sessions.erase(key_session.iterator);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OEMCrypto_Terminate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
# Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||
#source code may only be used and distributed under the Widevine License
|
||||
#Agreement.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'boringssl_libcrypto_path%': '../../../third_party/boringssl/boringssl.gyp:crypto',
|
||||
'boringssl_libssl_path%': '../../../third_party/boringssl/boringssl.gyp:ssl',
|
||||
'oemcrypto_dir': '../..',
|
||||
'platform_specific_dir': '../../../linux/src',
|
||||
'privacy_crypto_impl%': 'boringssl',
|
||||
# Flag used to generate source based code coverage reports.
|
||||
'generate_code_coverage_report%': 'false',
|
||||
'util_dir': '../../../util',
|
||||
},
|
||||
'sources': [
|
||||
'../../odk/src/core_message_deserialize.cpp',
|
||||
'../../odk/src/core_message_features.cpp',
|
||||
'../../odk/src/core_message_serialize.cpp',
|
||||
'../oec_device_features.cpp',
|
||||
'../oec_key_deriver.cpp',
|
||||
'../oemcrypto_corpus_generator_helper.cpp',
|
||||
'../oec_session_util.cpp',
|
||||
'../oemcrypto_corpus_generator_helper.cpp',
|
||||
'oemcrypto_fuzz_helper.cc',
|
||||
'../oemcrypto_session_tests_helper.cpp',
|
||||
'<(platform_specific_dir)/file_store.cpp',
|
||||
'<(platform_specific_dir)/log.cpp',
|
||||
'<(util_dir)/src/platform.cpp',
|
||||
'<(util_dir)/src/rw_lock.cpp',
|
||||
'<(util_dir)/src/string_conversions.cpp',
|
||||
'<(util_dir)/src/string_format.cpp',
|
||||
'<(util_dir)/test/test_sleep.cpp',
|
||||
'<(util_dir)/test/test_clock.cpp',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../../../third_party/fuzz',
|
||||
'<(util_dir)/include',
|
||||
'<(util_dir)/test',
|
||||
'<(oemcrypto_dir)/include',
|
||||
'<(oemcrypto_dir)/test',
|
||||
'<(oemcrypto_dir)/test/fuzz_tests',
|
||||
'<(oemcrypto_dir)/odk/include',
|
||||
'<(oemcrypto_dir)/odk/src',
|
||||
'<(oemcrypto_dir)/opk/oemcrypto_ta',
|
||||
],
|
||||
'includes': [
|
||||
'../../../util/libssl_dependency.gypi',
|
||||
],
|
||||
'dependencies': [
|
||||
'../../../third_party/googletest.gyp:gtest',
|
||||
'../../../third_party/googletest.gyp:gmock',
|
||||
'<(oemcrypto_dir)/util/oec_ref_util.gyp:oec_ref_util',
|
||||
],
|
||||
'defines': [
|
||||
'OEMCRYPTO_FUZZ_TESTS',
|
||||
],
|
||||
'cflags': [
|
||||
'-fPIC',
|
||||
],
|
||||
'cflags_c': [
|
||||
'-std=c11',
|
||||
'-D_POSIX_C_SOURCE=200809L',
|
||||
],
|
||||
'cflags_cc': [
|
||||
'-std=c++14',
|
||||
],
|
||||
'ldflags': [
|
||||
'-fPIC',
|
||||
],
|
||||
'libraries': [
|
||||
'-lpthread',
|
||||
],
|
||||
'conditions': [
|
||||
['generate_code_coverage_report=="false"', {
|
||||
# Include flags to build fuzzer binaries for cluster fuzz.
|
||||
'cflags': [
|
||||
'-O0',
|
||||
'-fno-omit-frame-pointer',
|
||||
'-U_FORTIFY_SOURCE',
|
||||
'-fsanitize=fuzzer,address,undefined',
|
||||
'-fno-sanitize-recover=address,undefined',
|
||||
# Need -g flag to include source line numbers in error stack trace.
|
||||
'-g3',
|
||||
],
|
||||
'cflags_cc' : [
|
||||
'-frtti',
|
||||
],
|
||||
'ldflags': [
|
||||
# Sanitizers with link-time components must be repeated here.
|
||||
'-fsanitize=fuzzer,address',
|
||||
],
|
||||
}],
|
||||
['generate_code_coverage_report=="true"', {
|
||||
# Include flags to build fuzzer binaries to generate source based code coverage reports.
|
||||
'cflags': [
|
||||
'-fprofile-instr-generate',
|
||||
'-fcoverage-mapping',
|
||||
],
|
||||
'ldflags': [
|
||||
'-fsanitize=fuzzer',
|
||||
'-fprofile-instr-generate',
|
||||
'-fcoverage-mapping',
|
||||
],
|
||||
}],
|
||||
['oemcrypto_implementation_version=="opk"', {
|
||||
# Include oemcrypto opk implementation code for building opk
|
||||
# implementation fuzz binaries.
|
||||
'dependencies': [
|
||||
'<(oemcrypto_dir)/opk/ports/linux/ta/common/wtpi_impl/wtpi_test_impl.gyp:oemcrypto_ta_test_impl_no_ipc',
|
||||
],
|
||||
}],
|
||||
], # conditions
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "properties.h"
|
||||
#include "oemcrypto_session_tests_helper.h"
|
||||
|
||||
using namespace wvoec;
|
||||
|
||||
static bool is_init = false;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
SessionUtil session_helper;
|
||||
if (!is_init) {
|
||||
wvoec::global_features.Initialize();
|
||||
wvoec::global_features.RestrictFilter("*");
|
||||
wvutil::Properties::Init();
|
||||
is_init = true;
|
||||
}
|
||||
|
||||
OEMCrypto_Initialize();
|
||||
OEMCrypto_EnterTestMode();
|
||||
session_helper.EnsureTestROT();
|
||||
|
||||
Session s;
|
||||
s.open();
|
||||
s.GenerateDerivedKeysFromKeybox(session_helper.keybox_);
|
||||
|
||||
static const uint32_t SignatureBufferMaxLength = size;
|
||||
vector<uint8_t> signature(SignatureBufferMaxLength);
|
||||
size_t signature_length = signature.size();
|
||||
|
||||
OEMCryptoResult sts;
|
||||
sts = OEMCrypto_GenerateSignature(s.session_id(), data, size,
|
||||
&signature[0], &signature_length);
|
||||
|
||||
s.close();
|
||||
OEMCrypto_Terminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
# Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary
|
||||
# source code may only be used and distributed under the Widevine
|
||||
# License Agreement.
|
||||
{
|
||||
'target_defaults': {
|
||||
'type': 'executable',
|
||||
'includes': [
|
||||
'oemcrypto_fuzztests.gypi',
|
||||
],
|
||||
},
|
||||
'variables': {
|
||||
# Flag to select appropriate underlying oemcrypto implementation when
|
||||
# buiding fuzz binaries.
|
||||
'oemcrypto_implementation_version%': 'opk',
|
||||
'oemcrypto_dir': '../..',
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_copy_buffer_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_copy_buffer_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_deactivate_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_deactivate_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_decrypt_cenc_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_decrypt_cenc_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_decrypt_hash_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_decrypt_hash_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_dispatcher_fuzz',
|
||||
'include_dirs': [
|
||||
'<(oemcrypto_dir)/opk/serialization/common',
|
||||
'<(oemcrypto_dir)/opk/serialization/common/include',
|
||||
'<(oemcrypto_dir)/opk/serialization/os_interfaces',
|
||||
'<(oemcrypto_dir)/opk/serialization/tee',
|
||||
'<(oemcrypto_dir)/opk/serialization/tee/include',
|
||||
'<(oemcrypto_dir)/opk/ports/trusty/include/',
|
||||
],
|
||||
'dependencies': [
|
||||
'<(oemcrypto_dir)/opk/serialization/tee/tee.gyp:opk_tee',
|
||||
],
|
||||
'sources': [
|
||||
'oemcrypto_opk_dispatcher_fuzz.cc',
|
||||
'<(oemcrypto_dir)/opk/serialization/test/tos_secure_buffers.c',
|
||||
'<(oemcrypto_dir)/opk/serialization/test/tos_transport_interface.c',
|
||||
'<(oemcrypto_dir)/opk/serialization/test/tos_logging.c',
|
||||
'<(oemcrypto_dir)/opk/ports/trusty/serialization_adapter/shared_memory.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_entitled_key_session_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_entitled_key_session_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_generate_certificate_key_pair_first_stage_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generate_certificate_key_pair_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_generate_certificate_key_pair_second_stage_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generate_certificate_key_pair_fuzz.cc',
|
||||
],
|
||||
'defines': [
|
||||
'SECOND_STAGE',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_generate_rsa_signature_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generate_rsa_signature_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_generic_decrypt_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_decrypt_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_generic_encrypt_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_encrypt_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_generic_sign_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_sign_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_generic_verify_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_verify_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_get_boot_certificate_chain_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_boot_certificate_chain_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_get_device_information_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_device_information_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_get_device_signed_csr_payload_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_device_signed_csr_payload_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_get_key_handle_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_key_handle_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_get_random_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_random_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_install_oem_private_key_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_install_oem_private_key_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_license_request_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_license_request_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_load_entitled_content_keys_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_entitled_content_keys_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_load_license_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_license_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_load_provisioning_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_provisioning_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_load_renewal_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_renewal_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_load_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_load_usage_table_header_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_usage_table_header_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_move_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_move_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_provisioning_request_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_provisioning_request_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_query_key_control_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_query_key_control_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_renewal_request_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_renewal_request_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_report_usage_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_report_usage_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_reuse_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_reuse_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_opk_shrink_usage_table_header_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_shrink_usage_table_header_fuzz.cc',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
# Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary
|
||||
# source code may only be used and distributed under the Widevine
|
||||
# License Agreement.
|
||||
|
||||
# gypi file to be included using --includes option while building oemcrypto
|
||||
# opk fuzz binaries. OPK classes needs to be instrumented with fuzzer
|
||||
# but only when being built for fuzzing. Instead of directly updating
|
||||
# oemcrypto_ta.gyp target, we use gypi in build_oemcrypto_fuzztests script.
|
||||
{
|
||||
'target_defaults': {
|
||||
'variables': {
|
||||
# Flag used to generate source based code coverage reports.
|
||||
'generate_code_coverage_report%': 'false',
|
||||
# Flag to indicate that the code is being built with libFuzzer
|
||||
# instrumentation enabled.
|
||||
'enable_fuzzing_instrumentation': 'true',
|
||||
},
|
||||
# Include flags to build fuzzer binaries to generate source based code coverage reports.
|
||||
'cflags': [
|
||||
'-fPIC',
|
||||
'-O0',
|
||||
'-fno-omit-frame-pointer',
|
||||
'-U_FORTIFY_SOURCE',
|
||||
'-fsanitize=fuzzer,address,undefined',
|
||||
'-fno-sanitize-recover=address,undefined',
|
||||
# Need -g flag to include source line numbers in error stack trace.
|
||||
'-g3',
|
||||
],
|
||||
'cflags_c': [
|
||||
'-std=c11',
|
||||
'-D_POSIX_C_SOURCE=200809L',
|
||||
],
|
||||
'cflags_cc' : [
|
||||
'-frtti',
|
||||
'-std=c++14',
|
||||
],
|
||||
'ldflags': [
|
||||
'-fPIC',
|
||||
# Sanitizers with link-time components must be repeated here.
|
||||
'-fsanitize=address',
|
||||
# Fuzzer is put on its own line so targets that need to swap it for
|
||||
# the version without a main function can easily find it.
|
||||
'-fsanitize=fuzzer',
|
||||
],
|
||||
'libraries': [
|
||||
'-lpthread',
|
||||
],
|
||||
'defines': [
|
||||
'OPK_LOG_LEVEL=LOG_NONE',
|
||||
'OPK_CONFIG_SOC_VENDOR_NAME=test',
|
||||
'OPK_CONFIG_SOC_MODEL_NAME=test',
|
||||
'OPK_CONFIG_TEE_OS_NAME=TEE_Simulator',
|
||||
'OPK_CONFIG_TEE_OS_VERSION=0.0.0',
|
||||
'OPK_CONFIG_DEVICE_FORM_FACTOR=oemcrypto_opk_fuzztests',
|
||||
'OPK_CONFIG_IMPLEMENTER_NAME=Widevine',
|
||||
'FACTORY_BUILD_ONLY',
|
||||
],
|
||||
'conditions': [
|
||||
['generate_code_coverage_report=="true"', {
|
||||
# Include flags to build fuzzer binaries to generate source based code coverage reports.
|
||||
'cflags': [
|
||||
'-fprofile-instr-generate',
|
||||
'-fcoverage-mapping',
|
||||
],
|
||||
'ldflags': [
|
||||
'-fprofile-instr-generate',
|
||||
'-fcoverage-mapping',
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
# Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
|
||||
# source code may only be used and distributed under the Widevine License
|
||||
# Agreement.
|
||||
#
|
||||
# Gyp configurations to build fuzz tests for partners on linux.
|
||||
# This should be used by partners who want to run oemcrypto fuzz tests on
|
||||
# their implementation on linux.
|
||||
{
|
||||
'target_defaults': {
|
||||
'type': 'executable',
|
||||
'includes': [
|
||||
'partner_oemcrypto_fuzztests.gypi',
|
||||
],
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'oemcrypto_copy_buffer_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_copy_buffer_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_deactivate_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_deactivate_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_decrypt_cenc_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_decrypt_cenc_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_decrypt_hash_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_decrypt_hash_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_entitled_key_session_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_entitled_key_session_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_generate_certificate_key_pair_first_stage_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generate_certificate_key_pair_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_generate_certificate_key_pair_second_stage_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generate_certificate_key_pair_fuzz.cc',
|
||||
],
|
||||
'defines': [
|
||||
'SECOND_STAGE',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_generate_rsa_signature_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generate_rsa_signature_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_generic_decrypt_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_decrypt_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_generic_encrypt_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_encrypt_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_generic_sign_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_sign_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_generic_verify_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_generic_verify_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_get_boot_certificate_chain_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_boot_certificate_chain_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_get_device_information_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_device_information_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_get_device_signed_csr_payload_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_device_signed_csr_payload_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_get_key_handle_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_key_handle_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_get_random_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_get_random_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_install_oem_private_key_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_install_oem_private_key_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_license_request_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_license_request_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_load_entitled_content_keys_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_entitled_content_keys_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_load_license_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_license_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_load_provisioning_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_provisioning_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_load_renewal_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_renewal_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_load_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_load_usage_table_header_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_load_usage_table_header_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_move_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_move_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_provisioning_request_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_provisioning_request_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_query_key_control_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_query_key_control_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_renewal_request_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_renewal_request_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_report_usage_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_report_usage_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_reuse_usage_entry_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_reuse_usage_entry_fuzz.cc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'oemcrypto_shrink_usage_table_header_fuzz',
|
||||
'sources': [
|
||||
'oemcrypto_shrink_usage_table_header_fuzz.cc',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
# Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
|
||||
# source code may only be used and distributed under the Widevine License
|
||||
# Agreement.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'boringssl_libcrypto_path%': '../../../third_party/boringssl/boringssl.gyp:crypto',
|
||||
'boringssl_libssl_path%': '../../../third_party/boringssl/boringssl.gyp:ssl',
|
||||
'oemcrypto_dir': '../..',
|
||||
'platform_specific_dir': '../../../linux/src',
|
||||
'privacy_crypto_impl%': 'boringssl',
|
||||
'oemcrypto_static_library%': '',
|
||||
'util_dir': '../../../util',
|
||||
},
|
||||
'sources': [
|
||||
'../../odk/src/core_message_deserialize.cpp',
|
||||
'../../odk/src/core_message_serialize.cpp',
|
||||
'../oec_device_features.cpp',
|
||||
'../oec_key_deriver.cpp',
|
||||
'../oemcrypto_corpus_generator_helper.cpp',
|
||||
'../oec_session_util.cpp',
|
||||
'../oemcrypto_corpus_generator_helper.cpp',
|
||||
'oemcrypto_fuzz_helper.cc',
|
||||
'../oemcrypto_session_tests_helper.cpp',
|
||||
'<(platform_specific_dir)/file_store.cpp',
|
||||
'<(platform_specific_dir)/log.cpp',
|
||||
'<(util_dir)/src/platform.cpp',
|
||||
'<(util_dir)/src/rw_lock.cpp',
|
||||
'<(util_dir)/src/string_conversions.cpp',
|
||||
'<(util_dir)/src/string_format.cpp',
|
||||
'<(util_dir)/test/test_sleep.cpp',
|
||||
'<(util_dir)/test/test_clock.cpp',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../../../third_party/fuzz',
|
||||
'<(util_dir)/include',
|
||||
'<(util_dir)/test',
|
||||
'<(oemcrypto_dir)/include',
|
||||
'<(oemcrypto_dir)/test',
|
||||
'<(oemcrypto_dir)/test/fuzz_tests',
|
||||
'<(oemcrypto_dir)/odk/include',
|
||||
'<(oemcrypto_dir)/odk/src',
|
||||
'<(oemcrypto_dir)/opk/oemcrypto_ta',
|
||||
],
|
||||
'includes': [
|
||||
'../../../util/libssl_dependency.gypi',
|
||||
],
|
||||
'dependencies': [
|
||||
'../../../third_party/googletest.gyp:gtest',
|
||||
'../../../third_party/googletest.gyp:gmock',
|
||||
'<(oemcrypto_dir)/util/oec_ref_util.gyp:oec_ref_util',
|
||||
],
|
||||
'defines': [
|
||||
'OEMCRYPTO_FUZZ_TESTS',
|
||||
],
|
||||
# Include flags to build fuzzer binaries for cluster fuzz.
|
||||
'cflags': [
|
||||
'-fPIC',
|
||||
'-O0',
|
||||
'-fno-omit-frame-pointer',
|
||||
'-U_FORTIFY_SOURCE',
|
||||
'-fsanitize=fuzzer,address,undefined',
|
||||
'-fno-sanitize-recover=address,undefined',
|
||||
# Need -g flag to include source line numbers in error stack trace.
|
||||
'-g3',
|
||||
],
|
||||
'cflags_c': [
|
||||
'-std=c11',
|
||||
'-D_POSIX_C_SOURCE=200809L',
|
||||
],
|
||||
'cflags_cc': [
|
||||
'-std=c++14',
|
||||
'-frtti',
|
||||
],
|
||||
'ldflags': [
|
||||
'-fPIC',
|
||||
# Sanitizers with link-time components must be repeated here.
|
||||
'-fsanitize=fuzzer,address',
|
||||
],
|
||||
'libraries': [
|
||||
'-lpthread',
|
||||
# include absolute path to oemcrypto static library on the machine where
|
||||
# fuzz tests are being built here.
|
||||
'<(oemcrypto_static_library)',
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
# Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||
# source code may only be used and distributed under the Widevine
|
||||
# License Agreement.
|
||||
{
|
||||
# Here you can set platform-specific compiler settings.
|
||||
'target_defaults': {
|
||||
# These are flags passed to the compiler for all C & C++ files.
|
||||
'cflags': [
|
||||
'-fsanitize=address',
|
||||
'-fsanitize-coverage=trace-pc-guard',
|
||||
'-fPIC',
|
||||
],
|
||||
|
||||
# These are flags passed to the compiler for plain C only.
|
||||
'cflags_c': [
|
||||
'-fsanitize-coverage=trace-pc-guard',
|
||||
'-fsanitize=address',
|
||||
'-fPIC',
|
||||
],
|
||||
|
||||
# These are flags passed to the compiler for C++ only.
|
||||
'cflags_cc': [
|
||||
'-fsanitize-coverage=trace-pc-guard',
|
||||
'-fsanitize=address',
|
||||
'-fPIC',
|
||||
],
|
||||
|
||||
# These are flags passed to the linker.
|
||||
'ldflags': [
|
||||
'-fsanitize=address',
|
||||
],
|
||||
|
||||
# These are macros set by the compiler.
|
||||
'defines': [
|
||||
#'EXAMPLE_MACRO_WITH_NO_VALUE',
|
||||
#'EXAMPLE_KEY=EXAMPLE_VALUE',
|
||||
],
|
||||
|
||||
# These are additional include paths to search for headers.
|
||||
'include_dirs': [
|
||||
],
|
||||
|
||||
'target_conditions': [
|
||||
['_toolset == "host"', {
|
||||
# These are settings specifically for the host toolchain.
|
||||
# The extra equals sign in the key name instructs gyp to replace
|
||||
# the generic settings above rather than append to them.
|
||||
'cflags=': [
|
||||
'-fsanitize-coverage=trace-pc-guard',
|
||||
'-fsanitize=address',
|
||||
'-fPIC',
|
||||
],
|
||||
|
||||
'cflags_c=': [
|
||||
'-fsanitize-coverage=trace-pc-guard',
|
||||
'-fsanitize=address',
|
||||
'-fPIC',
|
||||
],
|
||||
|
||||
'cflags_cc=': [
|
||||
'-fsanitize-coverage=trace-pc-guard',
|
||||
'-fsanitize=address',
|
||||
'-fPIC',
|
||||
],
|
||||
|
||||
'ldflags=': [
|
||||
'-fsanitize=address',
|
||||
],
|
||||
|
||||
'defines=': [
|
||||
],
|
||||
|
||||
'include_dirs=': [
|
||||
],
|
||||
}], # end _toolset == "host" condition
|
||||
], # end target_conditions
|
||||
}, # end target_defaults
|
||||
}
|
||||
Reference in New Issue
Block a user