From 5f19c793157d0a2ea9dc6e4af65865cb09e1729f Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Tue, 30 Jul 2024 16:33:39 +0200 Subject: [PATCH] Mla/Fuzz: switch to mlakey-parser --- mla-fuzz-afl/Cargo.toml | 2 +- mla-fuzz-afl/src/main.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mla-fuzz-afl/Cargo.toml b/mla-fuzz-afl/Cargo.toml index 08c4643..50771fa 100644 --- a/mla-fuzz-afl/Cargo.toml +++ b/mla-fuzz-afl/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" afl = "0" bincode = "~1.3" serde = { version = "1", features = ["derive"] } -curve25519-parser = { version = "0.4", default-features = false } +mlakey-parser = { path = "../mlakey-parser", version = "0", default-features = false } mla = { path = "../mla" } [lints.rust] diff --git a/mla-fuzz-afl/src/main.rs b/mla-fuzz-afl/src/main.rs index 31f79a5..cfe775b 100644 --- a/mla-fuzz-afl/src/main.rs +++ b/mla-fuzz-afl/src/main.rs @@ -2,7 +2,7 @@ use afl::fuzz; extern crate afl; use bincode::Options; -use curve25519_parser::{parse_openssl_25519_privkey, parse_openssl_25519_pubkey}; +use mlakey_parser::{parse_mlakey_privkey, parse_mlakey_pubkey}; use serde::{Deserialize, Serialize}; use std::fs::File; use std::io::{self, Cursor, Read, Write}; @@ -13,8 +13,8 @@ use mla::{ArchiveFailSafeReader, ArchiveFileID, ArchiveReader, ArchiveWriter, La use std::collections::HashMap; -static PUB_KEY: &[u8] = include_bytes!("../../samples/test_x25519_pub.pem"); -static PRIV_KEY: &[u8] = include_bytes!("../../samples/test_x25519.pem"); +static PUB_KEY: &[u8] = include_bytes!("../../samples/test_mlakey_pub.pem"); +static PRIV_KEY: &[u8] = include_bytes!("../../samples/test_mlakey.pem"); #[derive(Serialize, Deserialize, Debug)] struct TestInput { @@ -45,7 +45,7 @@ fn run(data: &[u8]) { } // Load the needed public key - let public_key = parse_openssl_25519_pubkey(PUB_KEY).unwrap(); + let public_key = parse_mlakey_pubkey(PUB_KEY).unwrap(); // Create a MLA Archive let mut buf = Vec::new(); @@ -120,7 +120,7 @@ fn run(data: &[u8]) { // Parse the created MLA Archive let dest = mla.into_raw(); let buf = Cursor::new(dest.as_slice()); - let private_key = parse_openssl_25519_privkey(PRIV_KEY).unwrap(); + let private_key = parse_mlakey_privkey(PRIV_KEY).unwrap(); let mut config = ArchiveReaderConfig::new(); config.add_private_keys(&[private_key]); let mut mla_read = ArchiveReader::from_config(buf, config).unwrap(); @@ -148,7 +148,7 @@ fn run(data: &[u8]) { // Build FailSafeReader let buf = Cursor::new(dest.as_slice()); let mut config = ArchiveReaderConfig::new(); - let private_key = parse_openssl_25519_privkey(PRIV_KEY).unwrap(); + let private_key = parse_mlakey_privkey(PRIV_KEY).unwrap(); config.add_private_keys(&[private_key]); let mut mla_fsread = ArchiveFailSafeReader::from_config(buf, config).unwrap(); @@ -195,7 +195,7 @@ fn run(data: &[u8]) { // Check the resulting files let buf = Cursor::new(dest_mut.as_slice()); let mut config = ArchiveReaderConfig::new(); - let private_key = parse_openssl_25519_privkey(PRIV_KEY).unwrap(); + let private_key = parse_mlakey_privkey(PRIV_KEY).unwrap(); config.add_private_keys(&[private_key]); let _do_steps = || -> Result<(), Error> { let mut mla_read = ArchiveReader::from_config(buf, ArchiveReaderConfig::new())?; @@ -213,7 +213,7 @@ fn run(data: &[u8]) { // Build FailSafeReader let buf = Cursor::new(dest_mut.as_slice()); let mut config = ArchiveReaderConfig::new(); - let private_key = parse_openssl_25519_privkey(PRIV_KEY).unwrap(); + let private_key = parse_mlakey_privkey(PRIV_KEY).unwrap(); config.add_private_keys(&[private_key]); let mut mla_fsread = { if let Ok(mla) = ArchiveFailSafeReader::from_config(buf, config) {