From 86fd8ed3e8ade7b350945c7327243483f935dc1f Mon Sep 17 00:00:00 2001 From: Noah Stiltner Date: Tue, 12 Mar 2024 21:38:53 -0500 Subject: [PATCH] removed getrandom dependency, removed .cargo folders that were for testing (and stopped working), fixed some spelling --- benches/.cargo/config.example | 13 ------------- benches/README.md | 6 +++--- chacha20/src/rng.rs | 4 ++-- 3 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 benches/.cargo/config.example diff --git a/benches/.cargo/config.example b/benches/.cargo/config.example deleted file mode 100644 index 3265450..0000000 --- a/benches/.cargo/config.example +++ /dev/null @@ -1,13 +0,0 @@ -# Note: This config file has completely stopped working in the last few weeks. -# The soft rustflag doesn't even work anymore. I've been having to manually run -# cargo test and cargo bench using RUSTFLAGS and shell scripts to simplify the command - -# This config file will choose which Rust Flag to use for the benches. -# Rename this file to "config" and uncomment out a rustflag to use it. -# The config file will be excluded with `*/.cargo/config` in the .gitignore - -#[build] -#rustflags = "--cfg chacha20_force_avx2 -C target-feature=+avx2" -#rustflags = "--cfg chacha20_force_sse2" -#rustflags = "--cfg chacha20_force_neon" -#rustflags = "--cfg chacha20_force_soft" \ No newline at end of file diff --git a/benches/README.md b/benches/README.md index 7edbd3f..6ad8e30 100644 --- a/benches/README.md +++ b/benches/README.md @@ -12,7 +12,7 @@ You can bench the ChaCha20 cipher using `cargo bench -- apply_keystream` You can bench ChaCha20Rng using `cargo bench -- fill_bytes` ## Measuring CPB for aarch64 -`criterion-cycles-per-byte` can work on `aarch64` with Linux, but it might produce an error. This error occurred on an up-to-date Raspberry Pi 4 (as of 12/14/2023): +`criterion-cycles-per-byte` can work on `aarch64` with Linux, but it might produce an error. This error occurred on an up-to-date Raspberry Pi 4b (as of 12/14/2023): ``` Running src/chacha20.rs (target/release/deps/chacha20-02f555ae0af3670b) Gnuplot not found, using plotters backend @@ -22,9 +22,9 @@ Caused by: process didn't exit successfully: `..../benches/target/release/deps/chacha20-02f555ae0af3670b --bench` (signal: 4, SIGILL: illegal instruction) ``` -The following code can fix this. +The following adjustment can fix this. -### Installing the cycle counter Linux Kernal Module on a Raspberry Pi 4b +### Installing the cycle counter Linux Kernel Module on a Raspberry Pi 4b ``` $ sudo apt-get update $ sudo apt-get upgrade diff --git a/chacha20/src/rng.rs b/chacha20/src/rng.rs index b0ad123..53447ed 100644 --- a/chacha20/src/rng.rs +++ b/chacha20/src/rng.rs @@ -623,7 +623,7 @@ pub(crate) mod tests { #[test] fn test_rng_output() { - let mut rng = ChaCha20Rng::from_seed(KEY.into()); + let mut rng = ChaCha20Rng::from_seed(KEY); let mut bytes = [0u8; 13]; rng.fill_bytes(&mut bytes); @@ -641,7 +641,7 @@ pub(crate) mod tests { #[test] fn test_wrapping_add() { - let mut rng = ChaCha20Rng::from_entropy(); + let mut rng = ChaCha20Rng::from_seed(KEY); rng.set_stream(1337 as u128); // test counter wrapping-add rng.set_word_pos((2 as u64).pow(36) - 1);