Simplify OEMCrypto_InstallOemPrivateKey fuzzer
Merged from https://widevine-internal-review.googlesource.com/174890 Merged from https://widevine-internal-review.googlesource.com/174856 Change-Id: If863e4a8f739ca5645311d7f7b08e6aec4cc7aca
This commit is contained in:
@@ -9,27 +9,17 @@
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
wvoec::RedirectStdoutToFile();
|
||||
|
||||
wvoec::LicenseWithUsageEntryFuzz entry;
|
||||
entry.Initialize();
|
||||
entry.CreateUsageTableHeader();
|
||||
// Open a session, create a usage entry.
|
||||
wvoec::Session* session = entry.license_messages().session();
|
||||
session->open();
|
||||
entry.InstallTestDrmKey(session);
|
||||
session->GenerateNonce();
|
||||
session->CreateNewUsageEntry();
|
||||
std::vector<uint8_t> encrypted_usage_header;
|
||||
session->UpdateUsageEntry(&encrypted_usage_header);
|
||||
wvoec::SessionFuzz session_fuzz;
|
||||
session_fuzz.Initialize();
|
||||
FuzzedDataProvider fuzzed_data(data, size);
|
||||
const OEMCrypto_PrivateKeyType key_type = wvoec::ConvertDataToValidEnum(
|
||||
fuzzed_data, OEMCrypto_PrivateKeyType_MaxValue);
|
||||
const std::vector<uint8_t> wrapped_private_key =
|
||||
fuzzed_data.ConsumeRemainingBytes<uint8_t>();
|
||||
OEMCrypto_InstallOemPrivateKey(session->session_id(), key_type,
|
||||
OEMCrypto_InstallOemPrivateKey(session_fuzz.session().session_id(), key_type,
|
||||
wrapped_private_key.data(),
|
||||
wrapped_private_key.size());
|
||||
session->close();
|
||||
OEMCrypto_Terminate();
|
||||
session_fuzz.Terminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user