Skip to content

Commit

Permalink
[fuzzing] Update DPE fuzzing target to match recent changes
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Doron <[email protected]>
  • Loading branch information
benjamindoron authored and jhand2 committed Aug 10, 2023
1 parent 8722a9b commit 1ac1a48
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions dpe/fuzz/src/fuzz_target_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use simplelog::{Config, WriteLogger};
use std::fs::OpenOptions;

use crypto::OpensslCrypto;
use dpe::dpe_instance::DpeEnv;
use dpe::dpe_instance::{DpeEnv, DpeTypes};
use dpe::{commands::Command, response::Response, DpeInstance, Support};
use platform::{DefaultPlatform, AUTO_INIT_LOCALITY};

Expand All @@ -35,22 +35,11 @@ const SUPPORT: Support = Support {
internal_dice: true,
};

struct SimEnv {
platform: DefaultPlatform,
crypto: OpensslCrypto,
}
struct SimTypes {}

impl DpeEnv for SimEnv {
type Crypto = OpensslCrypto;
impl DpeTypes for SimTypes {
type Crypto<'a> = OpensslCrypto;
type Platform = DefaultPlatform;

fn crypto(&mut self) -> &mut OpensslCrypto {
&mut self.crypto
}

fn platform(&mut self) -> &mut DefaultPlatform {
&mut self.platform
}
}

// Although fuzzers use persistent mode, using an internal worker shortens the lifetime.
Expand Down Expand Up @@ -78,12 +67,11 @@ fn harness(data: &[u8]) {
return;
}

// `new_for_test()` simply defines the issuer
let mut env = SimEnv {
let mut env = DpeEnv::<SimTypes> {
crypto: OpensslCrypto::new(),
platform: DefaultPlatform,
};
let mut dpe = DpeInstance::new_for_test(&mut env, SUPPORT).unwrap();
let mut dpe = DpeInstance::new(&mut env, SUPPORT).unwrap();

// Hard-code working locality
let response = dpe
Expand Down

0 comments on commit 1ac1a48

Please sign in to comment.