diff --git a/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_get_random_fuzz.cc b/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_get_random_fuzz.cc new file mode 100644 index 00000000..e81f9565 --- /dev/null +++ b/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_get_random_fuzz.cc @@ -0,0 +1,24 @@ +// 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 + +#include "FuzzedDataProvider.h" +#include "OEMCryptoCENC.h" +#include "oemcrypto_fuzz_helper.h" + +extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { + wvoec::RedirectStdoutToFile(); + wvoec::SessionUtil session_util; + wvoec::InitializeFuzz(session_util); + return 0; +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + std::vector random_data( + FuzzedDataProvider(data, size) + .ConsumeIntegralInRange(0, wvoec::MAX_FUZZ_OUTPUT_LENGTH)); + OEMCrypto_GetRandom(random_data.data(), random_data.size()); + return 0; +}