Fix OEMCrypto_GenerateRSASignature fuzzer

Ensure OEMCrypto is in the correct state before invoking
OEMCrypto_GenerateRSASignature.

Merged from https://widevine-internal-review.googlesource.com/168857
Merged from https://widevine-internal-review.googlesource.com/172171
Merged from https://widevine-internal-review.googlesource.com/172410
Merged from https://widevine-internal-review.googlesource.com/173130

Change-Id: I774f59af8044939c5a9618de348f2120a834e043
This commit is contained in:
Ian Benz
2023-03-23 23:01:28 +00:00
committed by Robert Shih
parent 57b391c8b9
commit a66143bec4
3 changed files with 42 additions and 14 deletions

View File

@@ -38,9 +38,28 @@ struct FuzzedData {
// OEMCrypto APIs.
void InitializeFuzz(SessionUtil& session_util);
class SessionFuzz {
public:
void Initialize();
void Terminate();
void InstallTestDrmKey() {
session_util_.InstallTestDrmKey(&session_);
}
Session& session() { return session_; }
const Session& session() const { return session_; }
private:
SessionUtil session_util_;
Session session_;
};
class OEMCryptoLicenseAPIFuzz {
public:
OEMCryptoLicenseAPIFuzz() : license_messages_(&session_) {}
OEMCryptoLicenseAPIFuzz() : license_messages_(&session_fuzz_.session()) {}
void Initialize();
@@ -54,15 +73,14 @@ class OEMCryptoLicenseAPIFuzz {
const LicenseRoundTrip& license_messages() const { return license_messages_; }
Session& session() { return session_; }
Session& session() { return session_fuzz_.session(); }
const Session& session() const { return session_; }
const Session& session() const { return session_fuzz_.session(); }
private:
void LoadLicense(bool generic_crypto_keys);
SessionUtil session_util_;
Session session_;
SessionFuzz session_fuzz_;
LicenseRoundTrip license_messages_;
};