Clean up fuzz helper classes

- Remove OEMCrypto state changes hidden in constructors and destructors.
- Use composition instead of inheritance to structure classes.
- Avoid calling non-trivial destructors for objects with static
  lifetime.

Merged from https://widevine-internal-review.googlesource.com/168497
Merged from https://widevine-internal-review.googlesource.com/171170
Merged from https://widevine-internal-review.googlesource.com/171171
Merged from https://widevine-internal-review.googlesource.com/171870

Change-Id: I20476a7b1132d11f011b8650ec01e3c2dc3fc0e8
This commit is contained in:
Ian Benz
2023-03-20 17:46:15 +00:00
committed by Robert Shih
parent af070601b0
commit 53fe55cb72
30 changed files with 518 additions and 398 deletions

View File

@@ -1,13 +1,13 @@
#include "properties.h"
#include "oemcrypto_fuzz_helper.h"
#include "oemcrypto_session_tests_helper.h"
using namespace wvoec;
#include "properties.h"
static bool is_init = false;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
SessionUtil session_helper;
wvoec::SessionUtil session_helper;
if (!is_init) {
wvoec::RedirectStdoutToFile();
wvoec::global_features.Initialize();
wvoec::global_features.RestrictFilter("*");
wvutil::Properties::Init();
@@ -18,7 +18,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
OEMCrypto_EnterTestMode();
session_helper.EnsureTestROT();
Session s;
wvoec::Session s;
s.open();
s.GenerateDerivedKeysFromKeybox(session_helper.keybox_);
@@ -32,6 +32,5 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
s.close();
OEMCrypto_Terminate();
return 0;
}