From ae24585101304d1f3e22ffdde80b7d63ed617312 Mon Sep 17 00:00:00 2001 From: James Connolly Date: Sat, 2 May 2026 11:47:31 -0700 Subject: [PATCH 1/3] chore: bump `ssec-core` to `0.9` --- Cargo.lock | 28 +++++++++------------------- Cargo.toml | 2 +- src/chaff.rs | 6 ++++-- src/dec.rs | 6 ++++-- src/enc.rs | 6 ++++-- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7883099..1a0913f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,13 +4,13 @@ version = 4 [[package]] name = "aes" -version = "0.9.0-rc.4" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04097e08a47d9ad181c2e1f4a5fabc9ae06ce8839a333ba9a949bcb0d31fd2a3" +checksum = "66bd29a732b644c0431c6140f370d097879203d79b80c94a6747ba0872adaef8" dependencies = [ "cipher", "cpubits", - "cpufeatures 0.2.17", + "cpufeatures", "zeroize", ] @@ -87,7 +87,7 @@ checksum = "7af50940b73bf4e16c15c448a2b121c63f2d68e3e54b6a8731673cb4aa0cdff5" dependencies = [ "base64ct", "blake2", - "cpufeatures 0.3.0", + "cpufeatures", "password-hash", "zeroize", ] @@ -216,7 +216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", + "cpufeatures", "rand_core 0.10.0", ] @@ -358,15 +358,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ef0c543070d296ea414df2dd7625d1b24866ce206709d8a4a424f28377f5861" -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - [[package]] name = "cpufeatures" version = "0.3.0" @@ -387,9 +378,9 @@ dependencies = [ [[package]] name = "ctr" -version = "0.10.0-rc.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee683dd898fbd052617b4514bc31f98bc32081a83b69ec46adef3b1ef4ae36f" +checksum = "17469f8eb9bdbfad10f71f4cfddfd38b01143520c0e717d8796ccb4d44d44e42" dependencies = [ "cipher", ] @@ -1057,7 +1048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e24a010dd405bd7ed803e5253182815b41bf2e6a80cc3bfc066658e03a198aa" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", + "cpufeatures", ] [[package]] @@ -1699,8 +1690,7 @@ dependencies = [ [[package]] name = "ssec-core" version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "850207f1b3fb14e2719c2a91c7758db11e77cd2bcea0c42ebaed091a6abc40dd" +source = "git+https://github.com/james-conn/ssec-core.git?branch=variable_bytes_per_poll#890646b5ce4454bfae392580a54cb613fa9ffa90" dependencies = [ "aes", "argon2", diff --git a/Cargo.toml b/Cargo.toml index a23e2ea..1b8b3ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ version = "0.18" features = [ "tokio" ] [dependencies] -ssec-core = "0.8" +ssec-core = { version = "0.8", git = "https://github.com/james-conn/ssec-core.git", branch = "variable_bytes_per_poll" } futures-util = "0.3" zeroize = "1.8" rpassword = "7.4" diff --git a/src/chaff.rs b/src/chaff.rs index 29c7cee..d11b6cf 100644 --- a/src/chaff.rs +++ b/src/chaff.rs @@ -4,7 +4,7 @@ use rand::{TryRng, SeedableRng}; use rand::rngs::SysRng; use tokio::io::AsyncWriteExt; use futures_util::StreamExt; -use ssec_core::ChaffStream; +use ssec_core::{ChaffStream, ChaffStreamArgs}; use std::str::FromStr; use crate::cli::{Cli, ChaffArgs}; @@ -90,7 +90,9 @@ pub async fn chaff(args: ChaffArgs) -> Result<(), ()> { eprintln!("failed to open specified outout file {:?}: {e}", args.out_file); }).map(|f| tokio::io::BufWriter::with_capacity(f.max_buf_size(), f))?; - let mut chaff = ChaffStream::new(rand::rngs::StdRng::try_from_rng(&mut SysRng).unwrap(), size as usize, 8 * 1024).unwrap(); + let mut args = ChaffStreamArgs::with_length(size as usize); + args.set_chunk_size(8 * 1024).unwrap(); + let mut chaff = ChaffStream::new(args, rand::rngs::StdRng::try_from_rng(&mut SysRng).unwrap()); while let Some(bytes) = chaff.next().await { let b = bytes.unwrap(); diff --git a/src/dec.rs b/src/dec.rs index 0298bbc..a300763 100644 --- a/src/dec.rs +++ b/src/dec.rs @@ -1,4 +1,4 @@ -use ssec_core::decrypt::{Decrypt, SsecHeaderError}; +use ssec_core::decrypt::{Decrypt, DecryptArgs, SsecHeaderError}; use futures_util::{Stream, StreamExt}; use tokio::io::AsyncWriteExt; use zeroize::Zeroizing; @@ -48,7 +48,9 @@ where let (dec, f_out) = tokio::join!( async { - let dec = Decrypt::new(stream).await?; + let mut args = DecryptArgs::default(); + args.set_bytes_per_poll(core::num::NonZeroUsize::new(1024).unwrap()); + let dec = Decrypt::new(args, stream).await?; Ok::<_, SsecHeaderError>(tokio::task::spawn_blocking({ let progress = progress.clone(); move || { diff --git a/src/enc.rs b/src/enc.rs index 5ee339d..ece88fa 100644 --- a/src/enc.rs +++ b/src/enc.rs @@ -1,4 +1,4 @@ -use ssec_core::Encrypt; +use ssec_core::{Encrypt, EncryptArgs}; use futures_util::StreamExt; use tokio::io::AsyncWriteExt; use rand::rngs::SysRng; @@ -48,7 +48,9 @@ pub async fn enc(args: EncArgs, io: B) -> Result<(), ()> { spinner.set_style(ProgressStyle::with_template(SPINNER_STYLE).unwrap()); spinner.enable_steady_tick(std::time::Duration::from_millis(100)); - Encrypt::new_uncompressed(s, &password, &mut SysRng) + let mut args = EncryptArgs::default(); + args.set_bytes_per_poll(core::num::NonZeroUsize::new(2048).unwrap()); + Encrypt::new(args, &mut SysRng, &password, s) }).await.unwrap().unwrap(); let mut f_out = match args.out_file { From f2ed56dad7d105a7475d511898b98a82314d5c27 Mon Sep 17 00:00:00 2001 From: James Connolly Date: Sat, 2 May 2026 12:12:16 -0700 Subject: [PATCH 2/3] constant --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/dec.rs | 4 ++-- src/enc.rs | 4 ++-- src/lib.rs | 2 ++ 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a0913f..1b57de1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1690,7 +1690,7 @@ dependencies = [ [[package]] name = "ssec-core" version = "0.8.1" -source = "git+https://github.com/james-conn/ssec-core.git?branch=variable_bytes_per_poll#890646b5ce4454bfae392580a54cb613fa9ffa90" +source = "git+https://github.com/james-conn/ssec-core.git#3f0013e88906956d481e65aa4fe8ce9c4b9a3850" dependencies = [ "aes", "argon2", diff --git a/Cargo.toml b/Cargo.toml index 1b8b3ef..1263b8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ version = "0.18" features = [ "tokio" ] [dependencies] -ssec-core = { version = "0.8", git = "https://github.com/james-conn/ssec-core.git", branch = "variable_bytes_per_poll" } +ssec-core = { version = "0.8", git = "https://github.com/james-conn/ssec-core.git" } futures-util = "0.3" zeroize = "1.8" rpassword = "7.4" diff --git a/src/dec.rs b/src/dec.rs index a300763..10bc766 100644 --- a/src/dec.rs +++ b/src/dec.rs @@ -8,7 +8,7 @@ use crate::cli::{DecArgs, FetchArgs}; use crate::file::new_async_tempfile; use crate::password::prompt_password; use crate::io::IoBundle; -use crate::{DEFINITE_BAR_STYLE, INDEFINITE_BAR_STYLE}; +use crate::{DEFINITE_BAR_STYLE, INDEFINITE_BAR_STYLE, BYTES_PER_POLL}; const SPINNER_STYLE: &str = "{spinner} deriving decryption key"; @@ -49,7 +49,7 @@ where let (dec, f_out) = tokio::join!( async { let mut args = DecryptArgs::default(); - args.set_bytes_per_poll(core::num::NonZeroUsize::new(1024).unwrap()); + args.set_bytes_per_poll(BYTES_PER_POLL); let dec = Decrypt::new(args, stream).await?; Ok::<_, SsecHeaderError>(tokio::task::spawn_blocking({ let progress = progress.clone(); diff --git a/src/enc.rs b/src/enc.rs index ece88fa..d702679 100644 --- a/src/enc.rs +++ b/src/enc.rs @@ -6,7 +6,7 @@ use indicatif::{ProgressBar, ProgressStyle}; use crate::cli::EncArgs; use crate::password::prompt_password; use crate::io::IoBundle; -use crate::DEFINITE_BAR_STYLE; +use crate::{DEFINITE_BAR_STYLE, BYTES_PER_POLL}; const SPINNER_STYLE: &str = "{spinner} deriving encryption key"; @@ -49,7 +49,7 @@ pub async fn enc(args: EncArgs, io: B) -> Result<(), ()> { spinner.enable_steady_tick(std::time::Duration::from_millis(100)); let mut args = EncryptArgs::default(); - args.set_bytes_per_poll(core::num::NonZeroUsize::new(2048).unwrap()); + args.set_bytes_per_poll(BYTES_PER_POLL); Encrypt::new(args, &mut SysRng, &password, s) }).await.unwrap().unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 86a5a1e..cac51b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,6 +15,8 @@ mod tests; const DEFINITE_BAR_STYLE: &str = "[{elapsed_precise}] {binary_bytes_per_sec} {bar} {binary_bytes}/{binary_total_bytes} ({eta})"; const INDEFINITE_BAR_STYLE: &str = "[{elapsed_precise}] {binary_bytes_per_sec} ({eta})"; +const BYTES_PER_POLL: core::num::NonZeroUsize = core::num::NonZeroUsize::new(2048).unwrap(); + #[inline] fn handle_err(result: Result<(), ()>) -> std::process::ExitCode { match result { From 628f2a45d57168b8a79365391ba5a824ac7031a3 Mon Sep 17 00:00:00 2001 From: James Connolly Date: Sat, 2 May 2026 12:32:50 -0700 Subject: [PATCH 3/3] use crate --- Cargo.lock | 5 +++-- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1b57de1..4f18cfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1689,8 +1689,9 @@ dependencies = [ [[package]] name = "ssec-core" -version = "0.8.1" -source = "git+https://github.com/james-conn/ssec-core.git#3f0013e88906956d481e65aa4fe8ce9c4b9a3850" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713aa9aae93ae79f9acc0549dca3c3f77b344b19aad92c7e5c54cc744f246c68" dependencies = [ "aes", "argon2", diff --git a/Cargo.toml b/Cargo.toml index 1263b8e..c859736 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ version = "0.18" features = [ "tokio" ] [dependencies] -ssec-core = { version = "0.8", git = "https://github.com/james-conn/ssec-core.git" } +ssec-core = "0.9" futures-util = "0.3" zeroize = "1.8" rpassword = "7.4"