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)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
// 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 "OEMCryptoCENC.h"
|
||||
#include "oemcrypto_fuzz_helper.h"
|
||||
|
||||
namespace wvoec {
|
||||
|
||||
void RedirectStdoutToFile() { freopen("log.txt", "a", stdout); }
|
||||
|
||||
std::vector<FuzzedData> SplitFuzzedData(const uint8_t* data, size_t size) {
|
||||
@@ -22,14 +25,58 @@ std::vector<FuzzedData> SplitFuzzedData(const uint8_t* data, size_t size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void OEMCryptoLicenseAPIFuzz::LoadLicense() {
|
||||
void InitializeFuzz(SessionUtil& session_util) {
|
||||
wvoec::global_features.Initialize();
|
||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||
OEMCrypto_Initialize();
|
||||
OEMCrypto_EnterTestMode();
|
||||
session_util.EnsureTestROT();
|
||||
}
|
||||
|
||||
void SessionFuzz::Initialize() {
|
||||
InitializeFuzz(session_util_);
|
||||
session_.open();
|
||||
}
|
||||
|
||||
void SessionFuzz::Terminate() {
|
||||
session_.close();
|
||||
OEMCrypto_Terminate();
|
||||
}
|
||||
|
||||
void OEMCryptoLicenseAPIFuzz::Initialize() {
|
||||
session_fuzz_.Initialize();
|
||||
session_fuzz_.InstallTestDrmKey();
|
||||
session_fuzz_.session().GenerateNonce();
|
||||
}
|
||||
|
||||
void OEMCryptoLicenseAPIFuzz::Terminate() {
|
||||
session_fuzz_.Terminate();
|
||||
}
|
||||
|
||||
void OEMCryptoLicenseAPIFuzz::LoadLicense(bool generic_crypto_keys) {
|
||||
license_messages_.SignAndVerifyRequest();
|
||||
license_messages_.CreateDefaultResponse();
|
||||
if (generic_crypto_keys) {
|
||||
license_messages_.CreateResponseWithGenericCryptoKeys();
|
||||
} else {
|
||||
license_messages_.CreateDefaultResponse();
|
||||
}
|
||||
license_messages_.EncryptAndSignResponse();
|
||||
OEMCryptoResult sts = license_messages_.LoadResponse();
|
||||
CheckStatusAndExitFuzzerOnFailure(sts, OEMCrypto_SUCCESS);
|
||||
}
|
||||
|
||||
void OEMCryptoProvisioningAPIFuzz::Initialize() {
|
||||
InitializeFuzz(session_util_);
|
||||
|
||||
// Opens a session and Generates Nonce.
|
||||
provisioning_messages_.PrepareSession(session_util_.keybox_);
|
||||
}
|
||||
|
||||
void OEMCryptoProvisioningAPIFuzz::Terminate() {
|
||||
session_.close();
|
||||
OEMCrypto_Terminate();
|
||||
}
|
||||
|
||||
void OEMCryptoProvisioningAPIFuzz::LoadProvisioning() {
|
||||
provisioning_messages_.SignAndVerifyRequest();
|
||||
provisioning_messages_.CreateDefaultResponse();
|
||||
@@ -62,4 +109,5 @@ void CheckStatusAndExitFuzzerOnFailure(OEMCryptoResult result,
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace wvoec
|
||||
|
||||
Reference in New Issue
Block a user