Merge Android odk fuzz changes(Adding corpus) from http://go/wvgerrit/98692
Google3 CLs: http://cl/308666040 Bug: b/154264716 Test: Locally ran and built odk fuzz binaries and tested fuzzer binaries on pixel device Change-Id: Icdb81291e101a0abdb75f84008f701c06e7384d6 Change-Id: Iad573209b47bd450c843a7cab5570a76c012fce9
This commit is contained in:
@@ -22,7 +22,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/license_request_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/license_request_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -39,7 +39,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/renewal_request_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/renewal_request_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -56,7 +56,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/provisioning_request_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/provisioning_request_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -73,7 +73,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/license_response_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/license_response_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -90,7 +90,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/renewal_response_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/renewal_response_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -107,7 +107,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/provisioning_response_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/provisioning_response_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -124,7 +124,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/license_response_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/license_response_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -141,7 +141,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/renewal_response_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/renewal_response_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
@@ -158,7 +158,7 @@ cc_fuzz {
|
||||
fuzz_config: {
|
||||
componentid: 425099,
|
||||
},
|
||||
corpus: ["corpus/arm64/provisioning_response_corpus/*"],
|
||||
corpus: ["corpus/little_endian_64bit/provisioning_response_corpus/*"],
|
||||
static_libs: [
|
||||
"libwv_kdo",
|
||||
"libwv_odk",
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2020 Google LLC. All rights reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine Master
|
||||
// License Agreement.
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Builds odk_corpus_generator shared library, which can be used with
|
||||
// LD_PRELOAD command to generate corpus by intercepting oemcrypto
|
||||
// unit tests.
|
||||
// ----------------------------------------------------------------
|
||||
// Builds libwv_odk.so, The ODK shared Library (libwv_odk) is used
|
||||
// by the OEMCrypto unit tests to generate corpus for ODK fuzz scrips.
|
||||
cc_library_shared {
|
||||
name: "libwv_odk_corpus_generator",
|
||||
include_dirs: [
|
||||
"vendor/widevine/libwvdrmengine/oemcrypto/include",
|
||||
"vendor/widevine/libwvdrmengine/oemcrypto/odk/include",
|
||||
"vendor/widevine/libwvdrmengine/oemcrypto/odk/test",
|
||||
],
|
||||
host_ldlibs: ["-ldl"],
|
||||
srcs: [
|
||||
"odk_corpus_generator.c",
|
||||
"odk_corpus_generator_helper.c",
|
||||
],
|
||||
proprietary: true,
|
||||
|
||||
owner: "widevine",
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "OEMCryptoCENCCommon.h"
|
||||
#include "fuzzing/corpus_generator/odk_corpus_generator_helper.h"
|
||||
#include "fuzzing/odk_fuzz_structs.h"
|
||||
#include "odk_structs.h"
|
||||
@@ -20,13 +19,11 @@ OEMCryptoResult ODK_PrepareCoreLicenseRequest(
|
||||
original_function = dlsym(RTLD_NEXT, "ODK_PrepareCoreLicenseRequest");
|
||||
OEMCryptoResult oem_crypto_result = (*original_function)(
|
||||
message, message_length, core_message_length, nonce_values);
|
||||
if (OEMCrypto_SUCCESS == oem_crypto_result) {
|
||||
char* file_name = GetFileName("license_request_corpus");
|
||||
char* file_name = GetFileName("license_request_corpus");
|
||||
|
||||
/* License Request format expected by fuzzer - [Core License Request] */
|
||||
AppendToFile(file_name, (const char*)message, *core_message_length);
|
||||
free(file_name);
|
||||
}
|
||||
/* License Request format expected by fuzzer - [Core License Request] */
|
||||
AppendToFile(file_name, (const char*)message, *core_message_length);
|
||||
free(file_name);
|
||||
return oem_crypto_result;
|
||||
}
|
||||
|
||||
@@ -51,17 +48,15 @@ OEMCryptoResult ODK_ParseLicense(
|
||||
message, message_length, core_message_length, initial_license_load,
|
||||
usage_entry_present, request_hash, timer_limits, clock_values,
|
||||
nonce_values, parsed_license);
|
||||
if (OEMCrypto_SUCCESS == oem_crypto_result) {
|
||||
char* file_name = GetFileName("license_response_corpus");
|
||||
char* file_name = GetFileName("license_response_corpus");
|
||||
|
||||
/* License Response format expected by fuzzer - [ODK_ParseLicense_Args][Core
|
||||
*/
|
||||
/* License Response] */
|
||||
AppendToFile(file_name, (const char*)&parse_license_args,
|
||||
sizeof(struct ODK_ParseLicense_Args));
|
||||
AppendToFile(file_name, (const char*)message, core_message_length);
|
||||
free(file_name);
|
||||
}
|
||||
/* License Response format expected by fuzzer - [ODK_ParseLicense_Args][Core
|
||||
*/
|
||||
/* License Response] */
|
||||
AppendToFile(file_name, (const char*)&parse_license_args,
|
||||
sizeof(struct ODK_ParseLicense_Args));
|
||||
AppendToFile(file_name, (const char*)message, core_message_length);
|
||||
free(file_name);
|
||||
return oem_crypto_result;
|
||||
}
|
||||
|
||||
@@ -77,15 +72,13 @@ OEMCryptoResult ODK_PrepareCoreRenewalRequest(uint8_t* message,
|
||||
OEMCryptoResult oem_crypto_result =
|
||||
(*original_function)(message, message_length, core_message_size,
|
||||
nonce_values, clock_values, system_time_seconds);
|
||||
if (OEMCrypto_SUCCESS == oem_crypto_result) {
|
||||
char* file_name = GetFileName("renewal_request_corpus");
|
||||
char* file_name = GetFileName("renewal_request_corpus");
|
||||
|
||||
/* License Request format expected by fuzzer - [ODK_ClockValues][Core */
|
||||
/* License Request] */
|
||||
AppendToFile(file_name, (const char*)clock_values, sizeof(ODK_ClockValues));
|
||||
AppendToFile(file_name, (const char*)message, *core_message_size);
|
||||
free(file_name);
|
||||
}
|
||||
/* License Request format expected by fuzzer - [ODK_ClockValues][Core */
|
||||
/* License Request] */
|
||||
AppendToFile(file_name, (const char*)clock_values, sizeof(ODK_ClockValues));
|
||||
AppendToFile(file_name, (const char*)message, *core_message_size);
|
||||
free(file_name);
|
||||
return oem_crypto_result;
|
||||
}
|
||||
|
||||
@@ -108,17 +101,15 @@ OEMCryptoResult ODK_ParseRenewal(const uint8_t* message, size_t message_length,
|
||||
OEMCryptoResult oem_crypto_result = (*original_function)(
|
||||
message, message_length, core_message_length, nonce_values, system_time,
|
||||
timer_limits, clock_values, timer_value);
|
||||
if (OEMCrypto_SUCCESS == oem_crypto_result) {
|
||||
char* file_name = GetFileName("renewal_response_corpus");
|
||||
char* file_name = GetFileName("renewal_response_corpus");
|
||||
|
||||
/* Renewal Response format expected by fuzzer - [ODK_ParseRenewal_Args][Core
|
||||
*/
|
||||
/* Renewal Response] */
|
||||
AppendToFile(file_name, (const char*)&parse_renewal_args,
|
||||
sizeof(struct ODK_ParseRenewal_Args));
|
||||
AppendToFile(file_name, (const char*)message, core_message_length);
|
||||
free(file_name);
|
||||
}
|
||||
/* Renewal Response format expected by fuzzer - [ODK_ParseRenewal_Args][Core
|
||||
*/
|
||||
/* Renewal Response] */
|
||||
AppendToFile(file_name, (const char*)&parse_renewal_args,
|
||||
sizeof(struct ODK_ParseRenewal_Args));
|
||||
AppendToFile(file_name, (const char*)message, core_message_length);
|
||||
free(file_name);
|
||||
return oem_crypto_result;
|
||||
}
|
||||
|
||||
@@ -133,14 +124,12 @@ OEMCryptoResult ODK_PrepareCoreProvisioningRequest(
|
||||
OEMCryptoResult oem_crypto_result =
|
||||
(*original_function)(message, message_length, core_message_length,
|
||||
nonce_values, device_id, device_id_length);
|
||||
if (OEMCrypto_SUCCESS == oem_crypto_result) {
|
||||
char* file_name = GetFileName("provisioning_request_corpus");
|
||||
char* file_name = GetFileName("provisioning_request_corpus");
|
||||
|
||||
/* Provisioning Request format expected by fuzzer - [Core Provisioning */
|
||||
/* Request] */
|
||||
AppendToFile(file_name, (const char*)message, *core_message_length);
|
||||
free(file_name);
|
||||
}
|
||||
/* Provisioning Request format expected by fuzzer - [Core Provisioning */
|
||||
/* Request] */
|
||||
AppendToFile(file_name, (const char*)message, *core_message_length);
|
||||
free(file_name);
|
||||
return oem_crypto_result;
|
||||
}
|
||||
|
||||
@@ -159,15 +148,13 @@ OEMCryptoResult ODK_ParseProvisioning(
|
||||
OEMCryptoResult oem_crypto_result = (*original_function)(
|
||||
message, message_length, core_message_length, nonce_values, device_id,
|
||||
device_id_length, parsed_response);
|
||||
if (OEMCrypto_SUCCESS == oem_crypto_result) {
|
||||
char* file_name = GetFileName("provisioning_response_corpus");
|
||||
char* file_name = GetFileName("provisioning_response_corpus");
|
||||
|
||||
/* Provisioning Response format expected by fuzzer - */
|
||||
/* [ODK_ParseProvisioning_Args][Core Provisioning Response] */
|
||||
AppendToFile(file_name, (const char*)&parse_provisioning_args,
|
||||
sizeof(struct ODK_ParseProvisioning_Args));
|
||||
AppendToFile(file_name, (const char*)message, core_message_length);
|
||||
free(file_name);
|
||||
}
|
||||
/* Provisioning Response format expected by fuzzer - */
|
||||
/* [ODK_ParseProvisioning_Args][Core Provisioning Response] */
|
||||
AppendToFile(file_name, (const char*)&parse_provisioning_args,
|
||||
sizeof(struct ODK_ParseProvisioning_Args));
|
||||
AppendToFile(file_name, (const char*)message, core_message_length);
|
||||
free(file_name);
|
||||
return oem_crypto_result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user