Files
android/libwvdrmengine/oemcrypto/test/fuzz_tests/oemcrypto_get_random_fuzz.cc
Vicky Min bc20b9dac9 Cherry pick cdm udc-widevine-release changes to udc-widevine-dev to be in sync with 18.3 release
Merged from go/wvgerrit/178231

Bug: 290252845
Test: WVTS tests seem to be running and passing
Change-Id: Ifff9123a73e173e835a6e89ba7c2760e1cd500fd
(cherry picked from commit 6889845d2e7e24f22c00b333335c34259b3fc96e)
2023-07-25 20:14:41 +00:00

25 lines
768 B
C++

// 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 <vector>
#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<uint8_t> random_data(
FuzzedDataProvider(data, size)
.ConsumeIntegralInRange<size_t>(0, wvoec::MAX_FUZZ_OUTPUT_LENGTH));
OEMCrypto_GetRandom(random_data.data(), random_data.size());
return 0;
}