diff --git a/src/errors/mod.rs b/src/errors/mod.rs index b87ed5e..afe0116 100644 --- a/src/errors/mod.rs +++ b/src/errors/mod.rs @@ -17,7 +17,7 @@ pub enum PaaError { PaaLzoErr(#[from] lzokay_native::Error), #[error("LZSS Error")] - RvffLzssError(#[from] RvffLzssError), + LzssError(#[from] LzssError), #[error("Invalid state")] InvalidState, @@ -27,7 +27,7 @@ pub enum PaaError { } #[derive(Debug, Error)] -pub enum RvffLzssError { +pub enum LzssError { #[error("IO failed")] IOError(#[from] io::Error), @@ -39,7 +39,7 @@ pub enum RvffLzssError { } #[derive(Debug, PartialEq, Eq, Clone, Copy, Error)] -pub enum RvffOdolError { +pub enum OdolError { #[error("Signature Missing")] SignatureMissing, @@ -51,21 +51,21 @@ pub enum RvffOdolError { } #[derive(Debug, Error)] -pub enum RvffError { +pub enum AffError { #[error("IO failed {0}")] - RvffIOError(#[from] io::Error), + IOError(#[from] io::Error), #[error("FromUTF8 failed {0}")] - RvffUTFError(#[from] FromUtf8Error), + UTFError(#[from] FromUtf8Error), #[error("Binrw failed {0}")] - RvffBinrwError(#[from] binrw::Error), + BinrwError(#[from] binrw::Error), #[error("LZSS Error")] - RvffLzssError(#[from] RvffLzssError), + LzssError(#[from] LzssError), #[error("ODOL Error")] - RvffOdolError(#[from] RvffOdolError), + OdolError(#[from] OdolError), #[error("Invalid file")] InvalidFileError, @@ -77,5 +77,5 @@ pub enum RvffError { Unknown, #[error("Parsing failed: {0}")] - RvffParseError(String), + ParseError(String), } diff --git a/src/real_virtuality/core/lzss.rs b/src/real_virtuality/core/lzss.rs index 42e82fa..5e55c6f 100644 --- a/src/real_virtuality/core/lzss.rs +++ b/src/real_virtuality/core/lzss.rs @@ -7,13 +7,13 @@ use std::{ use byteorder::{LittleEndian, ReadBytesExt}; -use crate::errors::{RvffError, RvffLzssError}; +use crate::errors::{AffError, LzssError}; pub fn decompress_lzss( reader: &mut R, expected_size: usize, use_signed_checksum: bool, -) -> Result<(u64, Vec), RvffLzssError> +) -> Result<(u64, Vec), LzssError> where R: Read + Seek, { @@ -38,19 +38,19 @@ where while remaining_size > 0 { num5 >>= 1; if (num5 & 256) == 0 { - let val = reader.read_u8().unwrap(); + let val = reader.read_u8()?; num5 = i32::from(val) | 65280; } if (num5 & 1) == 0 { - let mut i = i32::from(reader.read_u8().unwrap()); - let mut val = i32::from(reader.read_u8().unwrap()); + let mut i = i32::from(reader.read_u8()?); + let mut val = i32::from(reader.read_u8()?); i |= (val & 240) << 4; val &= 15; val += 2; let mut j = num4 - i; let num8 = val + j; if (val + 1) as usize > remaining_size { - return Err(RvffLzssError::Overflow); + return Err(LzssError::Overflow); } while j <= num8 { let num6 = array[(j & 4095) as usize]; @@ -68,7 +68,7 @@ where j += 1; } } else { - let val = reader.read_u8().unwrap(); + let val = reader.read_u8()?; if use_signed_checksum { calculated_hash += i32::from(val as i8); } else { @@ -83,15 +83,15 @@ where } } - let hash = reader.read_i32::().unwrap(); + let hash = reader.read_i32::()?; if hash != calculated_hash { - return Err(RvffLzssError::ChecksumMissmatch); + return Err(LzssError::ChecksumMissmatch); } - let size = reader.stream_position().unwrap() - pos; + let size = reader.stream_position()? - pos; Ok((size, dst)) } -pub fn decompress_lzss_unk_size(reader: &mut R) -> Result, RvffError> +pub fn decompress_lzss_unk_size(reader: &mut R) -> Result, AffError> where R: Read + Seek, { @@ -105,8 +105,7 @@ where let threshold: i32 = 2; let mut text_buffer = vec![0_u8; (sliding_winding_size + best_match - 1) as usize]; - let mut out = Vec::new(); - out.reserve(in_size as usize * 4); + let mut out = Vec::with_capacity(in_size as usize * 4); let mut check_sum = 0_i32; let mut flags = 0_i32; @@ -161,14 +160,14 @@ where out.truncate(size); Ok(out) } else { - Err(RvffError::Unknown) + Err(AffError::Unknown) } } pub fn check_for_magic_and_decompress_lzss( reader: &mut R, magic: &[u8], -) -> Result>, RvffError> +) -> Result>, AffError> where R: Read + Seek, { @@ -194,7 +193,7 @@ where pub fn check_for_magic_and_decompress_lzss_file>( path: P, magic: &[u8], -) -> Result { +) -> Result { let mut file = File::open(&path)?; let uncomp_data = check_for_magic_and_decompress_lzss(&mut file, magic)?; diff --git a/src/real_virtuality/p3d/odol.rs b/src/real_virtuality/p3d/odol.rs index f685713..bc55138 100644 --- a/src/real_virtuality/p3d/odol.rs +++ b/src/real_virtuality/p3d/odol.rs @@ -10,7 +10,7 @@ use std::{ }; use crate::real_virtuality::core::decompress_lzss_unk_size; -use crate::{errors::RvffError, real_virtuality::p3d::model_info::ModelInfo}; +use crate::{errors::AffError, real_virtuality::p3d::model_info::ModelInfo}; use derivative::Derivative; use super::animations::Animations; @@ -207,27 +207,27 @@ impl ODOL { Self::default() } - pub fn from_path>(path: P) -> Result { + pub fn from_path>(path: P) -> Result { let file = File::open(path)?; let mut buf_reader = BufReader::new(file); Self::from_stream(&mut buf_reader) } - pub(crate) fn from_stream_lazy(reader: &mut R) -> Result + pub(crate) fn from_stream_lazy(reader: &mut R) -> Result where R: Read + Seek, { Self::read(reader, true) } - pub fn from_stream(reader: &mut R) -> Result + pub fn from_stream(reader: &mut R) -> Result where R: Read + Seek, { Self::read(reader, false) } - fn read(reader: &mut R, skip_lods: bool) -> Result + fn read(reader: &mut R, skip_lods: bool) -> Result where R: Read + Seek, { @@ -249,11 +249,7 @@ impl ODOL { Ok(Self::read_le_args(reader, (opt,))?) } - pub fn read_lod( - &self, - reader: &mut RS, - resolution: ResolutionEnum, - ) -> Result + pub fn read_lod(&self, reader: &mut RS, resolution: ResolutionEnum) -> Result where RS: Read + Seek, { @@ -286,7 +282,7 @@ impl OdolLazyReader where R: Read + Seek, { - pub fn from_reader(mut reader: R) -> Result { + pub fn from_reader(mut reader: R) -> Result { let odol = ODOL::from_stream_lazy(&mut reader)?; Ok(Self { lods: HashMap::new(), @@ -295,7 +291,7 @@ where }) } - pub fn read_lod(&mut self, resolution: ResolutionEnum) -> Result { + pub fn read_lod(&mut self, resolution: ResolutionEnum) -> Result { if let Some(lod_index) = self .odol .resolutions diff --git a/src/real_virtuality/pbo/archive.rs b/src/real_virtuality/pbo/archive.rs index 78e3b85..66db07f 100644 --- a/src/real_virtuality/pbo/archive.rs +++ b/src/real_virtuality/pbo/archive.rs @@ -7,7 +7,7 @@ use rsa::BigUint; use sha1::digest::Output; use sha1::{Digest, Sha1}; -use crate::errors::RvffError; +use crate::errors::AffError; use crate::real_virtuality::core::read::ReadExtTrait; use crate::real_virtuality::sign::{PrivateKey, PublicKey, SignVersion, Signature, KEY_LENGTH}; @@ -37,13 +37,13 @@ impl Pbo { Self::default() } - pub fn from_path>(path: P) -> Result { + pub fn from_path>(path: P) -> Result { let file = File::open(path)?; let mut buf_reader = BufReader::new(file); Self::from_stream(&mut buf_reader) } - pub fn from_stream(reader: &mut R) -> Result + pub fn from_stream(reader: &mut R) -> Result where R: BufRead + Seek, { @@ -78,7 +78,7 @@ impl Pbo { self.entries.contains_key(&self.handle_prefix(entry_path)) } - pub(crate) fn read(&mut self, reader: &mut R, skip_data: bool) -> Result<(), RvffError> + pub(crate) fn read(&mut self, reader: &mut R, skip_data: bool) -> Result<(), AffError> where R: BufRead + Seek, { @@ -86,7 +86,7 @@ impl Pbo { || reader.read_string(4)? != PBO_MAGIC || reader.read_bytes(16)?.into_iter().all(|x| x != 0) { - return Err(RvffError::InvalidFileError); + return Err(AffError::InvalidFileError); } while reader.peek_u8()? != 0 { @@ -125,7 +125,7 @@ impl Pbo { reader.seek(SeekFrom::Start(data_pos))?; if reader.read_u8()? != 0 { - return Err(RvffError::InvalidFileError); + return Err(AffError::InvalidFileError); } self.hash = reader.read_bytes(20)?; @@ -137,7 +137,7 @@ impl Pbo { &mut self, entry_path: &str, reader: &mut R, - ) -> Result, RvffError> + ) -> Result, AffError> where R: BufRead + Seek, { @@ -159,7 +159,7 @@ impl Pbo { out_path: &str, full_path: bool, reader: &mut R, - ) -> Result<(), RvffError> + ) -> Result<(), AffError> where R: BufRead + Seek, { @@ -187,7 +187,7 @@ impl Pbo { Ok(()) } else { - Err(RvffError::PboEntryNotFound(entry_path.clone())) + Err(AffError::PboEntryNotFound(entry_path.clone())) } } diff --git a/src/real_virtuality/pbo/archive_reader.rs b/src/real_virtuality/pbo/archive_reader.rs index 11d6b7c..68cbd7f 100644 --- a/src/real_virtuality/pbo/archive_reader.rs +++ b/src/real_virtuality/pbo/archive_reader.rs @@ -1,6 +1,6 @@ use std::io::{BufRead, Seek}; -use crate::errors::RvffError; +use crate::errors::AffError; use super::{Entry, Pbo}; @@ -17,7 +17,7 @@ impl PboReader where R: BufRead + Seek, { - pub fn from_stream(reader: R) -> Result { + pub fn from_stream(reader: R) -> Result { let mut pbo_reader = Self { reader, pbo: Pbo::new(), @@ -26,7 +26,7 @@ where Ok(pbo_reader) } - pub fn get_entry(&mut self, entry_path: &str) -> Result, RvffError> { + pub fn get_entry(&mut self, entry_path: &str) -> Result, AffError> { self.pbo.get_entry(entry_path, &mut self.reader) } @@ -39,7 +39,7 @@ where entry_path: &str, out_path: &str, full_path: bool, - ) -> Result<(), RvffError> { + ) -> Result<(), AffError> { self.pbo .extract_single_file(entry_path, out_path, full_path, &mut self.reader) } diff --git a/src/real_virtuality/pbo/entry.rs b/src/real_virtuality/pbo/entry.rs index d4027de..bc3698e 100644 --- a/src/real_virtuality/pbo/entry.rs +++ b/src/real_virtuality/pbo/entry.rs @@ -1,6 +1,6 @@ use std::io::{BufRead, Seek, SeekFrom, Write}; -use crate::errors::RvffError; +use crate::errors::AffError; use crate::real_virtuality::core::read::ReadExtTrait; use crate::real_virtuality::core::write::WriteExtTrait; #[derive(Debug, Default, PartialEq, Eq, Clone)] @@ -23,7 +23,7 @@ impl Entry { Self::default() } - pub fn read(&mut self, reader: &mut R) -> Result<(), RvffError> + pub fn read(&mut self, reader: &mut R) -> Result<(), AffError> where R: BufRead + Seek, { @@ -36,7 +36,7 @@ impl Entry { Ok(()) } - pub fn read_data(&mut self, reader: &mut R) -> Result<(), RvffError> + pub fn read_data(&mut self, reader: &mut R) -> Result<(), AffError> where R: BufRead + Seek, { @@ -45,7 +45,7 @@ impl Entry { Ok(()) } - pub fn write(&mut self, writer: &mut R) -> Result<(), RvffError> + pub fn write(&mut self, writer: &mut R) -> Result<(), AffError> where R: Write + Seek, { diff --git a/src/real_virtuality/rap/class.rs b/src/real_virtuality/rap/class.rs index 66530f0..e1f118a 100644 --- a/src/real_virtuality/rap/class.rs +++ b/src/real_virtuality/rap/class.rs @@ -1,6 +1,6 @@ use std::io::{BufRead, Seek}; -use crate::errors::RvffError; +use crate::errors::AffError; use crate::real_virtuality::core::read::ReadExtTrait; use super::{entry::CfgEntry, pretty_print::PrettyPrint, EntryReturn}; @@ -13,7 +13,7 @@ pub struct CfgClass { } impl CfgClass { - pub fn read_class(reader: &mut I) -> Result + pub fn read_class(reader: &mut I) -> Result where I: BufRead + Seek, { diff --git a/src/real_virtuality/rap/config.rs b/src/real_virtuality/rap/config.rs index 97252e9..da4c012 100644 --- a/src/real_virtuality/rap/config.rs +++ b/src/real_virtuality/rap/config.rs @@ -2,7 +2,7 @@ use std::io::{BufRead, Cursor, Seek}; use super::{entry::CfgEntry, parser::parse, pretty_print::PrettyPrint, EntryReturn}; use crate::{ - errors::RvffError, + errors::AffError, real_virtuality::core::{decompress_lzss_unk_size, read::ReadExtTrait}, }; @@ -23,12 +23,12 @@ impl Cfg { && matches!(reader.read_u32(), Ok(v) if v == 8) } - pub fn read_config(reader: &mut I) -> Result + pub fn read_config(reader: &mut I) -> Result where I: BufRead + Seek, { if !Self::is_valid_rap_bin(reader) { - return Err(RvffError::InvalidFileError); + return Err(AffError::InvalidFileError); } let enum_offset = reader.read_u32()?; @@ -49,12 +49,12 @@ impl Cfg { }) } - pub fn read_data(data: &[u8]) -> Result { + pub fn read_data(data: &[u8]) -> Result { let mut reader = Cursor::new(data); Self::read(&mut reader) } - pub fn read(reader: &mut I) -> Result + pub fn read(reader: &mut I) -> Result where I: BufRead + Seek, { @@ -98,7 +98,7 @@ impl Cfg { Self::parse_config(&cfg_text) } - pub fn parse_config(cfg: &str) -> Result { + pub fn parse_config(cfg: &str) -> Result { let entries = parse(cfg)?; Ok(Self { enum_offset: 0, diff --git a/src/real_virtuality/rap/entry.rs b/src/real_virtuality/rap/entry.rs index 73dcb76..7e7bde8 100644 --- a/src/real_virtuality/rap/entry.rs +++ b/src/real_virtuality/rap/entry.rs @@ -1,6 +1,6 @@ use std::io::{BufRead, Seek}; -use crate::{errors::RvffError, real_virtuality::core::read::ReadExtTrait}; +use crate::{errors::AffError, real_virtuality::core::read::ReadExtTrait}; use super::{class::CfgClass, pretty_print::PrettyPrint, property::CfgProperty, EntryReturn}; @@ -13,7 +13,7 @@ pub enum CfgEntry { } impl CfgEntry { - pub fn parse_entry(reader: &mut I) -> Result + pub fn parse_entry(reader: &mut I) -> Result where I: BufRead + Seek, { diff --git a/src/real_virtuality/rap/parser.rs b/src/real_virtuality/rap/parser.rs index 9e98345..d4fd242 100644 --- a/src/real_virtuality/rap/parser.rs +++ b/src/real_virtuality/rap/parser.rs @@ -1,4 +1,4 @@ -use crate::errors::RvffError; +use crate::errors::AffError; use crate::real_virtuality::rap::{CfgClass, CfgEntry, CfgProperty, CfgValue}; use ariadne::{Color, Fmt, Label, Report, ReportKind, Source}; use chumsky::{prelude::*, stream::Stream}; @@ -267,7 +267,7 @@ fn entry_parser() -> impl Parser>, Error = Simple< class.or(entry).repeated().then_ignore(end()) } -pub fn parse(src: &str) -> Result, RvffError> { +pub fn parse(src: &str) -> Result, AffError> { let (tokens, errs) = lexer().parse_recovery(src); // dbg!(&tokens); // dbg!(errs.clone()); @@ -370,5 +370,5 @@ pub fn parse(src: &str) -> Result, RvffError> { }) .collect(); - Err(RvffError::RvffParseError(errs_str.join("\n"))) + Err(AffError::ParseError(errs_str.join("\n"))) } diff --git a/src/real_virtuality/rap/property.rs b/src/real_virtuality/rap/property.rs index fc9e973..1862900 100644 --- a/src/real_virtuality/rap/property.rs +++ b/src/real_virtuality/rap/property.rs @@ -1,7 +1,7 @@ use std::io::{BufRead, Seek}; use super::{pretty_print::PrettyPrint, value::CfgValue}; -use crate::{errors::RvffError, real_virtuality::core::read::ReadExtTrait}; +use crate::{errors::AffError, real_virtuality::core::read::ReadExtTrait}; #[derive(Debug, PartialEq, Clone)] pub struct CfgProperty { @@ -10,7 +10,7 @@ pub struct CfgProperty { } impl CfgProperty { - pub fn read_property(reader: &mut I, is_array: bool) -> Result + pub fn read_property(reader: &mut I, is_array: bool) -> Result where I: BufRead + Seek, { diff --git a/src/real_virtuality/rap/value.rs b/src/real_virtuality/rap/value.rs index 672358e..bb62bda 100644 --- a/src/real_virtuality/rap/value.rs +++ b/src/real_virtuality/rap/value.rs @@ -1,6 +1,6 @@ use std::io::{BufRead, Seek}; -use crate::{errors::RvffError, real_virtuality::core::read::ReadExtTrait}; +use crate::{errors::AffError, real_virtuality::core::read::ReadExtTrait}; #[derive(Debug, PartialEq, Clone)] pub enum CfgValue { @@ -11,7 +11,7 @@ pub enum CfgValue { } impl CfgValue { - pub fn read_value(reader: &mut I, typ_id: Option) -> Result + pub fn read_value(reader: &mut I, typ_id: Option) -> Result where I: BufRead + Seek, { @@ -30,7 +30,7 @@ impl CfgValue { }) } - pub fn read_array(reader: &mut I) -> Result + pub fn read_array(reader: &mut I) -> Result where I: BufRead + Seek, { diff --git a/src/real_virtuality/sign/private_key.rs b/src/real_virtuality/sign/private_key.rs index 1b81b63..5a17d9f 100644 --- a/src/real_virtuality/sign/private_key.rs +++ b/src/real_virtuality/sign/private_key.rs @@ -1,5 +1,5 @@ use crate::{ - errors::RvffError, + errors::AffError, real_virtuality::core::{ binrw_utils::{read_biguint, write_biguint}, write::WriteExtTrait, @@ -104,13 +104,13 @@ impl PrivateKey { } } - pub fn from_path>(path: P) -> Result { + pub fn from_path>(path: P) -> Result { let file = File::open(path)?; let mut buf_reader = BufReader::new(file); Self::from_stream(&mut buf_reader) } - pub fn from_stream(reader: &mut R) -> Result + pub fn from_stream(reader: &mut R) -> Result where R: Read + Seek, { @@ -118,7 +118,7 @@ impl PrivateKey { Ok(prv_key) } - pub fn write_file>(&mut self, path: P) -> Result<(), RvffError> { + pub fn write_file>(&mut self, path: P) -> Result<(), AffError> { let path: &Path = &path.as_ref().with_extension(EXTENSION); let mut file = File::create(path)?; @@ -126,7 +126,7 @@ impl PrivateKey { Ok(()) } - pub fn write_data(&mut self) -> Result, RvffError> { + pub fn write_data(&mut self) -> Result, AffError> { let mut buf = Vec::new(); let mut cursor = Cursor::new(&mut buf); diff --git a/src/real_virtuality/sign/public_key.rs b/src/real_virtuality/sign/public_key.rs index 8887cd8..9bf4588 100644 --- a/src/real_virtuality/sign/public_key.rs +++ b/src/real_virtuality/sign/public_key.rs @@ -1,5 +1,5 @@ use crate::{ - errors::RvffError, + errors::AffError, real_virtuality::core::{ binrw_utils::{read_biguint, write_biguint}, write::WriteExtTrait, @@ -62,13 +62,13 @@ impl PublicKey { n: BigUint::default(), } } - pub fn from_path>(path: P) -> Result { + pub fn from_path>(path: P) -> Result { let file = File::open(path)?; let mut buf_reader = BufReader::new(file); Self::from_stream(&mut buf_reader) } - pub fn from_stream(reader: &mut R) -> Result + pub fn from_stream(reader: &mut R) -> Result where R: Read + Seek, { @@ -76,7 +76,7 @@ impl PublicKey { Ok(pub_key) } - pub fn write_file>(&mut self, path: P) -> Result<(), RvffError> { + pub fn write_file>(&mut self, path: P) -> Result<(), AffError> { let path: &Path = &path.as_ref().with_extension(EXTENSION); let mut file = File::create(path)?; @@ -84,7 +84,7 @@ impl PublicKey { Ok(()) } - pub fn write_data(&mut self) -> Result, RvffError> { + pub fn write_data(&mut self) -> Result, AffError> { let mut buf = Vec::new(); let mut cursor = Cursor::new(&mut buf); diff --git a/src/real_virtuality/sign/signature.rs b/src/real_virtuality/sign/signature.rs index 0cb04f7..924fb21 100644 --- a/src/real_virtuality/sign/signature.rs +++ b/src/real_virtuality/sign/signature.rs @@ -5,7 +5,7 @@ use std::io::Read; use std::io::Seek; use std::path::Path; -use crate::errors::RvffError; +use crate::errors::AffError; use crate::real_virtuality::core::binrw_utils::{read_biguint, write_biguint}; use crate::real_virtuality::core::write::WriteExtTrait; use binrw::{binrw, BinRead, Endian}; @@ -96,13 +96,13 @@ impl Signature { } } - pub fn from_path>(path: P) -> Result { + pub fn from_path>(path: P) -> Result { let file = File::open(path)?; let mut buf_reader = BufReader::new(file); Self::from_stream(&mut buf_reader) } - pub fn from_stream(reader: &mut R) -> Result + pub fn from_stream(reader: &mut R) -> Result where R: Read + Seek, { @@ -110,7 +110,7 @@ impl Signature { Ok(sig) } - pub fn write_file>(&mut self, path: P) -> Result<(), RvffError> { + pub fn write_file>(&mut self, path: P) -> Result<(), AffError> { let path: &Path = &path.as_ref().with_extension(EXTENSION); let mut file = File::create(path)?; @@ -118,7 +118,7 @@ impl Signature { Ok(()) } - pub fn write_data(&mut self) -> Result, RvffError> { + pub fn write_data(&mut self) -> Result, AffError> { let mut buf = Vec::new(); let mut cursor = Cursor::new(&mut buf); diff --git a/src/real_virtuality/wrp/oprw.rs b/src/real_virtuality/wrp/oprw.rs index d6d93dc..1a37053 100644 --- a/src/real_virtuality/wrp/oprw.rs +++ b/src/real_virtuality/wrp/oprw.rs @@ -3,7 +3,7 @@ use std::io::Read; use std::io::Seek; use super::QuadTree; -use crate::errors::RvffError; +use crate::errors::AffError; use crate::real_virtuality::core::binrw_utils::read_compressed_array_count; use crate::real_virtuality::core::decompress_lzss_unk_size; use crate::real_virtuality::core::types::XY; @@ -132,7 +132,7 @@ pub struct OPRW { } impl OPRW { - pub fn from_read(reader: &mut (impl Read + Seek)) -> Result { + pub fn from_read(reader: &mut (impl Read + Seek)) -> Result { // OPRW let mut magic_buf = vec![0_u8; 4]; reader.read_exact(&mut magic_buf)?; @@ -148,7 +148,7 @@ impl OPRW { Ok(oprw) } - fn read_oprw(reader: &mut (impl Read + Seek)) -> Result { + fn read_oprw(reader: &mut (impl Read + Seek)) -> Result { let mut oprw = Self::read_options(reader, Endian::Little, ())?; oprw.road_net.retain(|rn| rn.road_part_count > 0); Ok(oprw) diff --git a/tests/real_virtuality/pbo_test.rs b/tests/real_virtuality/pbo_test.rs index 1e099e9..51ea6df 100644 --- a/tests/real_virtuality/pbo_test.rs +++ b/tests/real_virtuality/pbo_test.rs @@ -60,11 +60,11 @@ fn pbo_lazy() { #[test] #[serial] fn verify_sig() { - let mut pub_key_file = File::open(format!("{}RVFF_TEST_KEY.bikey", INPUT_PATH_PREFIX)).unwrap(); + let mut pub_key_file = File::open(format!("{}AFF_TEST_KEY.bikey", INPUT_PATH_PREFIX)).unwrap(); let pub_key = PublicKey::from_stream(&mut pub_key_file).unwrap(); let mut sig_file = File::open(format!( - "{}grad_adminMessages.pbo.RVFF_TEST_KEY.bisign", + "{}grad_adminMessages.pbo.AFF_TEST_KEY.bisign", INPUT_PATH_PREFIX )) .unwrap(); @@ -81,7 +81,7 @@ fn verify_sig() { #[serial] fn read_priv_key() { let mut priv_key_file = - File::open(format!("{}RVFF_TEST_KEY.biprivatekey", INPUT_PATH_PREFIX)).unwrap(); + File::open(format!("{}AFF_TEST_KEY.biprivatekey", INPUT_PATH_PREFIX)).unwrap(); let _ = PrivateKey::from_stream(&mut priv_key_file).unwrap(); } @@ -90,20 +90,20 @@ fn read_priv_key() { fn sign_test() { let pbo = Pbo::from_path(format!("{}grad_adminMessages.pbo", INPUT_PATH_PREFIX)).unwrap(); - let auth = "RVFF_TEST_KEY2"; + let auth = "AFF_TEST_KEY2"; let mut priv_key = PrivateKey::generate(auth); priv_key - .write_file(format!("{}RVFF_TEST_KEY2", OUTPUT_PATH_PREFIX)) + .write_file(format!("{}AFF_TEST_KEY2", OUTPUT_PATH_PREFIX)) .unwrap(); let mut pub_key: PublicKey = priv_key.clone().into(); pub_key - .write_file(format!("{}RVFF_TEST_KEY2", OUTPUT_PATH_PREFIX)) + .write_file(format!("{}AFF_TEST_KEY2", OUTPUT_PATH_PREFIX)) .unwrap(); let mut sig = pbo.sign(SignVersion::V3, &priv_key); - sig.write_file(format!("{}RVFF_TEST_KEY2", OUTPUT_PATH_PREFIX)) + sig.write_file(format!("{}AFF_TEST_KEY2", OUTPUT_PATH_PREFIX)) .unwrap(); assert!(pbo.verify(&pub_key, &sig).is_ok()); diff --git a/tests/test-data/rv-test-data-part-1.7z b/tests/test-data/rv-test-data-part-1.7z index 65363a2..25e09aa 100644 Binary files a/tests/test-data/rv-test-data-part-1.7z and b/tests/test-data/rv-test-data-part-1.7z differ