Skip to content

Commit

Permalink
report: Remove write_hex
Browse files Browse the repository at this point in the history
We can just serialize the raw bytes into a file, rather than write them
in hexadecimal.

Signed-off-by: Tyler Fanelli <[email protected]>
  • Loading branch information
tylerfanelli committed Aug 1, 2023
1 parent 639b2c4 commit 1ad76b1
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@ pub fn create_random_request() -> [u8; 64] {
data
}

// Write data into given file. Split it into 16 byte lines.
pub fn write_hex<W: Write>(file: &mut BufWriter<W>, data: &[u8]) -> Result<()> {
let mut line_counter = 0;
for val in data {
// Make it blocks for easier read
if line_counter.eq(&16) {
writeln!(file).context("Failed to write data to file")?;
line_counter = 0;
}
// Write byte into file
write!(file, "{:02x}", val).context("Failed to write data to file")?;
line_counter += 1;
}
Ok(())
}

#[derive(StructOpt)]
pub struct ReportArgs {
#[structopt(help = "File to write the attestation report to.")]
Expand Down

0 comments on commit 1ad76b1

Please sign in to comment.