Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump cipher from 0.5.0-pre.6 to 0.5.0-pre.7 #368

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions chacha20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ categories = ["cryptography", "no-std"]

[dependencies]
cfg-if = "1"
cipher = { version = "=0.5.0-pre.6", optional = true }
cipher = { version = "=0.5.0-pre.7", optional = true }
rand_core = { version = "0.9.0-alpha.1", optional = true, default-features = false }
serde = { version = "1.0", features = ["derive"], optional = true }
zeroize = { version = "1.8.1", optional = true }
Expand All @@ -29,7 +29,7 @@ zeroize = { version = "1.8.1", optional = true }
cpufeatures = "0.2"

[dev-dependencies]
cipher = { version = "=0.5.0-pre.6", features = ["dev"] }
cipher = { version = "=0.5.0-pre.7", features = ["dev"] }
hex-literal = "0.4"
rand_chacha = "0.3.1"
serde_json = "1.0" # Only to test serde1
Expand Down
19 changes: 6 additions & 13 deletions chacha20/src/backends/avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ use core::marker::PhantomData;
use crate::{ChaChaCore, Variant};

#[cfg(feature = "cipher")]
use crate::{
STATE_WORDS,
chacha::Block
};
use crate::{chacha::Block, STATE_WORDS};

#[cfg(feature = "cipher")]
use cipher::{
StreamClosure,
consts::{U64, U4},
BlockSizeUser,
ParBlocksSizeUser,
ParBlocks,
StreamBackend
consts::{U4, U64},
BlockSizeUser, ParBlocks, ParBlocksSizeUser, StreamCipherBackend, StreamCipherClosure,
};

#[cfg(target_arch = "x86")]
Expand All @@ -36,7 +29,7 @@ const N: usize = PAR_BLOCKS / 2;
pub(crate) unsafe fn inner<R, F>(state: &mut [u32; STATE_WORDS], f: F)
where
R: Rounds,
F: StreamClosure<BlockSize = U64>,
F: StreamCipherClosure<BlockSize = U64>,
{
let state_ptr = state.as_ptr() as *const __m128i;
let v = [
Expand Down Expand Up @@ -68,7 +61,7 @@ where
pub(crate) unsafe fn rng_inner<R, V>(core: &mut ChaChaCore<R, V>, buffer: &mut [u32; 64])
where
R: Rounds,
V: Variant
V: Variant,
{
let state_ptr = core.state.as_ptr() as *const __m128i;
let v = [
Expand Down Expand Up @@ -111,7 +104,7 @@ impl<R: Rounds> ParBlocksSizeUser for Backend<R> {
}

#[cfg(feature = "cipher")]
impl<R: Rounds> StreamBackend for Backend<R> {
impl<R: Rounds> StreamCipherBackend for Backend<R> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block) {
unsafe {
Expand Down
6 changes: 3 additions & 3 deletions chacha20/src/backends/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::chacha::Block;
#[cfg(feature = "cipher")]
use cipher::{
consts::{U4, U64},
BlockSizeUser, ParBlocks, ParBlocksSizeUser, StreamBackend, StreamClosure,
BlockSizeUser, ParBlocks, ParBlocksSizeUser, StreamCipherBackend, StreamCipherClosure,
};

struct Backend<R: Rounds> {
Expand Down Expand Up @@ -53,7 +53,7 @@ impl<R: Rounds> Backend<R> {
pub(crate) unsafe fn inner<R, F>(state: &mut [u32; STATE_WORDS], f: F)
where
R: Rounds,
F: StreamClosure<BlockSize = U64>,
F: StreamCipherClosure<BlockSize = U64>,
{
let mut backend = Backend::<R>::new(state);

Expand Down Expand Up @@ -105,7 +105,7 @@ macro_rules! add_assign_vec {
}

#[cfg(feature = "cipher")]
impl<R: Rounds> StreamBackend for Backend<R> {
impl<R: Rounds> StreamCipherBackend for Backend<R> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block) {
let state3 = self.state[3];
Expand Down
4 changes: 2 additions & 2 deletions chacha20/src/backends/soft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::chacha::Block;
#[cfg(feature = "cipher")]
use cipher::{
consts::{U1, U64},
BlockSizeUser, ParBlocksSizeUser, StreamBackend,
BlockSizeUser, ParBlocksSizeUser, StreamCipherBackend,
};

pub(crate) struct Backend<'a, R: Rounds, V: Variant>(pub(crate) &'a mut ChaChaCore<R, V>);
Expand All @@ -24,7 +24,7 @@ impl<'a, R: Rounds, V: Variant> ParBlocksSizeUser for Backend<'a, R, V> {
}

#[cfg(feature = "cipher")]
impl<'a, R: Rounds, V: Variant> StreamBackend for Backend<'a, R, V> {
impl<'a, R: Rounds, V: Variant> StreamCipherBackend for Backend<'a, R, V> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block) {
let res = run_rounds::<R>(&self.0.state);
Expand Down
15 changes: 6 additions & 9 deletions chacha20/src/backends/sse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ use crate::Rounds;
use crate::{ChaChaCore, Variant};

#[cfg(feature = "cipher")]
use crate::{STATE_WORDS, chacha::Block};
use crate::{chacha::Block, STATE_WORDS};
#[cfg(feature = "cipher")]
use cipher::{
StreamClosure,
consts::{U1, U64},
StreamBackend,
BlockSizeUser,
ParBlocksSizeUser
BlockSizeUser, ParBlocksSizeUser, StreamCipherBackend, StreamCipherClosure,
};
use core::marker::PhantomData;

Expand All @@ -26,7 +23,7 @@ use core::arch::x86_64::*;
pub(crate) unsafe fn inner<R, F>(state: &mut [u32; STATE_WORDS], f: F)
where
R: Rounds,
F: StreamClosure<BlockSize = U64>,
F: StreamCipherClosure<BlockSize = U64>,
{
let state_ptr = state.as_ptr() as *const __m128i;
let mut backend = Backend::<R> {
Expand Down Expand Up @@ -60,7 +57,7 @@ impl<R: Rounds> ParBlocksSizeUser for Backend<R> {
}

#[cfg(feature = "cipher")]
impl<R: Rounds> StreamBackend for Backend<R> {
impl<R: Rounds> StreamCipherBackend for Backend<R> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block) {
unsafe {
Expand All @@ -81,7 +78,7 @@ impl<R: Rounds> StreamBackend for Backend<R> {
pub(crate) unsafe fn rng_inner<R, V>(core: &mut ChaChaCore<R, V>, buffer: &mut [u32; 64])
where
R: Rounds,
V: Variant
V: Variant,
{
let state_ptr = core.state.as_ptr() as *const __m128i;
let mut backend = Backend::<R> {
Expand All @@ -95,7 +92,7 @@ where
};

for i in 0..4 {
backend.gen_ks_block(&mut buffer[i << 4..(i+1) << 4]);
backend.gen_ks_block(&mut buffer[i << 4..(i + 1) << 4]);
}

core.state[12] = _mm_cvtsi128_si32(backend.v[3]) as u32;
Expand Down
5 changes: 4 additions & 1 deletion chacha20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ impl<R: Rounds, V: Variant> StreamCipherCore for ChaChaCore<R, V> {
rem.try_into().ok()
}

fn process_with_backend(&mut self, f: impl cipher::StreamClosure<BlockSize = Self::BlockSize>) {
fn process_with_backend(
&mut self,
f: impl cipher::StreamCipherClosure<BlockSize = Self::BlockSize>,
) {
cfg_if! {
if #[cfg(chacha20_force_soft)] {
f.call(&mut backends::soft::Backend(self));
Expand Down
6 changes: 3 additions & 3 deletions chacha20/src/xchacha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use cipher::{
array::Array,
consts::{U16, U24, U32, U64},
BlockSizeUser, IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherCore, StreamCipherCoreWrapper,
StreamCipherSeekCore, StreamClosure,
BlockSizeUser, IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherClosure, StreamCipherCore,
StreamCipherCoreWrapper, StreamCipherSeekCore,
};

use crate::{
Expand Down Expand Up @@ -75,7 +75,7 @@ impl<R: Rounds> StreamCipherCore for XChaChaCore<R> {
}

#[inline(always)]
fn process_with_backend(&mut self, f: impl StreamClosure<BlockSize = Self::BlockSize>) {
fn process_with_backend(&mut self, f: impl StreamCipherClosure<BlockSize = Self::BlockSize>) {
self.0.process_with_backend(f);
}
}
Expand Down
4 changes: 2 additions & 2 deletions hc-256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ keywords = ["crypto", "stream-cipher", "trait"]
categories = ["cryptography", "no-std"]

[dependencies]
cipher = "=0.5.0-pre.6"
cipher = "=0.5.0-pre.7"

[dev-dependencies]
cipher = { version = "=0.5.0-pre.6", features = ["dev"] }
cipher = { version = "=0.5.0-pre.7", features = ["dev"] }
hex-literal = "0.4"

[features]
Expand Down
7 changes: 4 additions & 3 deletions hc-256/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ pub use cipher;
use cipher::{
consts::{U1, U32, U4},
AlgorithmName, Block, BlockSizeUser, Iv, IvSizeUser, Key, KeyIvInit, KeySizeUser,
ParBlocksSizeUser, StreamBackend, StreamCipherCore, StreamCipherCoreWrapper, StreamClosure,
ParBlocksSizeUser, StreamCipherBackend, StreamCipherClosure, StreamCipherCore,
StreamCipherCoreWrapper,
};
use core::fmt;

Expand Down Expand Up @@ -157,7 +158,7 @@ impl StreamCipherCore for Hc256Core {
None
}

fn process_with_backend(&mut self, f: impl StreamClosure<BlockSize = Self::BlockSize>) {
fn process_with_backend(&mut self, f: impl StreamCipherClosure<BlockSize = Self::BlockSize>) {
f.call(&mut Backend(self));
}
}
Expand Down Expand Up @@ -255,7 +256,7 @@ impl<'a> ParBlocksSizeUser for Backend<'a> {
type ParBlocksSize = U1;
}

impl<'a> StreamBackend for Backend<'a> {
impl<'a> StreamCipherBackend for Backend<'a> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block<Self>) {
block.copy_from_slice(&self.0.gen_word().to_le_bytes());
Expand Down
4 changes: 2 additions & 2 deletions rabbit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ keywords = ["crypto", "rabbit", "stream-cipher", "trait"]
categories = ["cryptography", "no-std"]

[dependencies]
cipher = "=0.5.0-pre.6"
cipher = "=0.5.0-pre.7"

[dev-dependencies]
cipher = { version = "=0.5.0-pre.6", features = ["dev"] }
cipher = { version = "=0.5.0-pre.7", features = ["dev"] }
hex-literal = "0.4"

[features]
Expand Down
8 changes: 4 additions & 4 deletions rabbit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ use cipher::{
consts::{U1, U16, U8},
crypto_common::InnerUser,
Block, BlockSizeUser, InnerIvInit, IvSizeUser, KeyInit, KeySizeUser, ParBlocksSizeUser,
StreamBackend, StreamCipherCore, StreamCipherCoreWrapper, StreamClosure,
StreamCipherBackend, StreamCipherClosure, StreamCipherCore, StreamCipherCoreWrapper,
};

#[cfg(feature = "zeroize")]
Expand Down Expand Up @@ -290,7 +290,7 @@ impl StreamCipherCore for RabbitKeyOnlyCore {
None
}

fn process_with_backend(&mut self, f: impl StreamClosure<BlockSize = Self::BlockSize>) {
fn process_with_backend(&mut self, f: impl StreamCipherClosure<BlockSize = Self::BlockSize>) {
f.call(&mut Backend(&mut self.state));
}
}
Expand Down Expand Up @@ -334,7 +334,7 @@ impl StreamCipherCore for RabbitCore {
None
}

fn process_with_backend(&mut self, f: impl StreamClosure<BlockSize = Self::BlockSize>) {
fn process_with_backend(&mut self, f: impl StreamCipherClosure<BlockSize = Self::BlockSize>) {
f.call(&mut Backend(&mut self.state));
}
}
Expand All @@ -349,7 +349,7 @@ impl<'a> ParBlocksSizeUser for Backend<'a> {
type ParBlocksSize = U1;
}

impl<'a> StreamBackend for Backend<'a> {
impl<'a> StreamCipherBackend for Backend<'a> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block<Self>) {
block.copy_from_slice(&self.0.next_block());
Expand Down
2 changes: 1 addition & 1 deletion rc4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["arc4", "arcfour", "crypto", "stream-cipher", "trait"]
categories = ["cryptography", "no-std"]

[dependencies]
cipher = "=0.5.0-pre.6"
cipher = "=0.5.0-pre.7"

[dev-dependencies]
hex-literal = "0.4"
Expand Down
8 changes: 4 additions & 4 deletions rc4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ pub use cipher::{self, consts, KeyInit, StreamCipher};

use cipher::{
array::{Array, ArraySize},
Block, BlockSizeUser, KeySizeUser, ParBlocksSizeUser, StreamBackend, StreamCipherCore,
StreamCipherCoreWrapper, StreamClosure,
Block, BlockSizeUser, KeySizeUser, ParBlocksSizeUser, StreamCipherBackend, StreamCipherClosure,
StreamCipherCore, StreamCipherCoreWrapper,
};

use core::marker::PhantomData;
Expand Down Expand Up @@ -94,7 +94,7 @@ impl<KeySize> StreamCipherCore for Rc4Core<KeySize> {
None
}

fn process_with_backend(&mut self, f: impl StreamClosure<BlockSize = Self::BlockSize>) {
fn process_with_backend(&mut self, f: impl StreamCipherClosure<BlockSize = Self::BlockSize>) {
f.call(&mut Backend(&mut self.state));
}
}
Expand All @@ -113,7 +113,7 @@ impl<'a> ParBlocksSizeUser for Backend<'a> {
type ParBlocksSize = consts::U1;
}

impl<'a> StreamBackend for Backend<'a> {
impl<'a> StreamCipherBackend for Backend<'a> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block<Self>) {
block[0] = self.0.prga();
Expand Down
4 changes: 2 additions & 2 deletions salsa20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ categories = ["cryptography", "no-std"]

[dependencies]
cfg-if = "1"
cipher = "=0.5.0-pre.6"
cipher = "=0.5.0-pre.7"

[dev-dependencies]
cipher = { version = "=0.5.0-pre.6", features = ["dev"] }
cipher = { version = "=0.5.0-pre.7", features = ["dev"] }
hex-literal = "0.4"

[features]
Expand Down
4 changes: 2 additions & 2 deletions salsa20/src/backends/soft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use crate::{Block, SalsaCore, Unsigned, STATE_WORDS};
use cipher::{
consts::{U1, U64},
BlockSizeUser, ParBlocksSizeUser, StreamBackend, StreamCipherSeekCore,
BlockSizeUser, ParBlocksSizeUser, StreamCipherBackend, StreamCipherSeekCore,
};

pub(crate) struct Backend<'a, R: Unsigned>(pub(crate) &'a mut SalsaCore<R>);
Expand All @@ -17,7 +17,7 @@ impl<'a, R: Unsigned> ParBlocksSizeUser for Backend<'a, R> {
type ParBlocksSize = U1;
}

impl<'a, R: Unsigned> StreamBackend for Backend<'a, R> {
impl<'a, R: Unsigned> StreamCipherBackend for Backend<'a, R> {
#[inline(always)]
fn gen_ks_block(&mut self, block: &mut Block<Self>) {
let res = run_rounds::<R>(&self.0.state);
Expand Down
Loading
Loading