Fix OEMCrypto_LoadEntitledContentKeys fuzzer
- Create an entitled key session for OEMCrypto v17 and later. - Refresh corpus files. Merged from https://widevine-internal-review.googlesource.com/168897 Merged from https://widevine-internal-review.googlesource.com/169292 Change-Id: Ied9fce445a837e417077381de71d2834f385f120
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,6 +20,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::vector<uint8_t> message(inputs[0].data,
|
||||
inputs[0].data + inputs[0].size);
|
||||
|
||||
// Copy data to OEMCrypto_EntitledContentKeyObject array.
|
||||
std::vector<OEMCrypto_EntitledContentKeyObject> entitled_content_keys(
|
||||
inputs[1].size / sizeof(OEMCrypto_EntitledContentKeyObject));
|
||||
@@ -29,18 +32,23 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
sizeof(OEMCrypto_EntitledContentKeyObject));
|
||||
}
|
||||
|
||||
// Load default entitlement license.
|
||||
OEMCryptoLicenseAPIFuzz license_api_fuzz;
|
||||
// Setting up state. Load default entitlement license to load entitlement
|
||||
// keys into sessions key table.
|
||||
license_api_fuzz.license_messages().set_license_type(
|
||||
OEMCrypto_EntitlementLicense);
|
||||
license_api_fuzz.LoadLicense();
|
||||
|
||||
// Create entitled key session.
|
||||
OEMCrypto_SESSION key_session;
|
||||
const OEMCryptoResult result = OEMCrypto_CreateEntitledKeySession(
|
||||
license_api_fuzz.session()->session_id(), &key_session);
|
||||
CheckStatusAndExitFuzzerOnFailure(result, OEMCrypto_SUCCESS);
|
||||
|
||||
// Call OEMCrypto_LoadEntitledContentKeys with fuzzed buffers.
|
||||
const std::vector<uint8_t> message(inputs[0].data,
|
||||
inputs[0].data + inputs[0].size);
|
||||
OEMCrypto_LoadEntitledContentKeys(
|
||||
license_api_fuzz.session()->session_id(), message.data(), message.size(),
|
||||
entitled_content_keys.size(), entitled_content_keys.data());
|
||||
OEMCrypto_LoadEntitledContentKeys(key_session, message.data(), message.size(),
|
||||
entitled_content_keys.size(),
|
||||
entitled_content_keys.data());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user