Files
android/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_load_license_fuzz.cc
Ian Benz 5c5433a8d8 Update OEMCrypto_LoadLicense corpus for ODK_Packing_ParsedLicense
- Regenerate corpus files.
- Change nonce endianness.

Merged from https://widevine-internal-review.googlesource.com/177010

Change-Id: I5f288a054325097d6ea696cd755fc0557d0eadd1
2024-01-26 16:20:39 -08:00

30 lines
1.1 KiB
C++

// Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine
// License Agreement.
#include "oemcrypto_fuzz_helper.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
wvoec::RedirectStdoutToFile();
if (size < sizeof(ODK_Packing_ParsedLicense) + sizeof(wvoec::MessageData)) {
return 0;
}
wvoec::OEMCryptoLicenseAPIFuzz license_api_fuzz;
license_api_fuzz.Initialize();
license_api_fuzz.license_messages().SignAndVerifyRequest();
// Interpreting input fuzz data as unencrypted core_response + response_data +
// key_array from license server.
license_api_fuzz.license_messages().InjectFuzzedResponseData(data, size);
// Convert OEMCrypto_LicenseType in core_response to a valid enum value.
wvoec::ConvertDataToValidEnum(
OEMCrypto_LicenseType_MaxValue,
license_api_fuzz.license_messages().core_response().license_type);
license_api_fuzz.license_messages().EncryptAndSignResponse();
license_api_fuzz.license_messages().LoadResponse();
license_api_fuzz.Terminate();
return 0;
}