From cd61206000c3247006f57240ca3f48e63e4fd56f Mon Sep 17 00:00:00 2001 From: Jacob Latonis Date: Mon, 30 Dec 2024 06:56:41 -0500 Subject: [PATCH] refactor: move asn1 parsing to utils folder to make accessible for multiple modules (#275) --- lib/src/modules/mod.rs | 2 ++ lib/src/modules/pe/authenticode.rs | 2 +- lib/src/modules/pe/mod.rs | 1 - lib/src/modules/{pe => utils}/asn1.rs | 0 lib/src/modules/utils/mod.rs | 1 + 5 files changed, 4 insertions(+), 2 deletions(-) rename lib/src/modules/{pe => utils}/asn1.rs (100%) create mode 100644 lib/src/modules/utils/mod.rs diff --git a/lib/src/modules/mod.rs b/lib/src/modules/mod.rs index 156175e1b..d776d48b7 100644 --- a/lib/src/modules/mod.rs +++ b/lib/src/modules/mod.rs @@ -278,3 +278,5 @@ pub mod mods { super::BUILTIN_MODULES.keys().copied() } } + +pub(crate) mod utils; diff --git a/lib/src/modules/pe/authenticode.rs b/lib/src/modules/pe/authenticode.rs index fb5873e7f..0cb44a608 100644 --- a/lib/src/modules/pe/authenticode.rs +++ b/lib/src/modules/pe/authenticode.rs @@ -25,7 +25,7 @@ use x509_parser::x509::{AlgorithmIdentifier, SubjectPublicKeyInfo, X509Name}; #[cfg(feature = "logging")] use log::error; -use crate::modules::pe::asn1::{ +use crate::modules::utils::asn1::{ oid, oid_to_object_identifier, oid_to_str, Attribute, Certificate, ContentInfo, DigestInfo, SignedData, SignerInfo, SpcIndirectDataContent, SpcSpOpusInfo, TstInfo, diff --git a/lib/src/modules/pe/mod.rs b/lib/src/modules/pe/mod.rs index 55ca6a432..7053cedbf 100644 --- a/lib/src/modules/pe/mod.rs +++ b/lib/src/modules/pe/mod.rs @@ -23,7 +23,6 @@ use crate::types::Struct; #[cfg(test)] mod tests; -mod asn1; mod authenticode; pub mod parser; mod rva2off; diff --git a/lib/src/modules/pe/asn1.rs b/lib/src/modules/utils/asn1.rs similarity index 100% rename from lib/src/modules/pe/asn1.rs rename to lib/src/modules/utils/asn1.rs diff --git a/lib/src/modules/utils/mod.rs b/lib/src/modules/utils/mod.rs new file mode 100644 index 000000000..a10eabcde --- /dev/null +++ b/lib/src/modules/utils/mod.rs @@ -0,0 +1 @@ +pub mod asn1;