Skip to content

Commit 5ba5c89

Browse files
committed
Bump bitflags, fix clippy lints
1 parent 47f1ea3 commit 5ba5c89

File tree

5 files changed

+10
-18
lines changed

5 files changed

+10
-18
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ version = "0.5.1"
1414

1515
[dependencies]
1616
base64 = { version = "0.21", optional = true }
17-
bitflags = "1.0"
17+
bitflags = "2.3"
1818
chacha20 = { version = "0.9", features = ["zeroize"] }
1919
curve25519-dalek = "4.0"
2020
generic-array = "0.14"

src/blake2b/blake2b_soft.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const IV: [u64; 8] = [
7979
0x5be0cd19137e2179,
8080
];
8181

82-
fn compress(sh: &mut [u64; 8], st: &mut [u64; 2], sf: &mut [u64; 2], block: &[u8]) {
82+
fn compress(sh: &mut [u64; 8], st: &[u64; 2], sf: &[u64; 2], block: &[u8]) {
8383
let mut tm = [0u64; 16];
8484
let mut tv = [0u64; 16];
8585

@@ -275,33 +275,23 @@ impl State {
275275

276276
if self.buf.len() > BLOCKBYTES {
277277
increment_counter(&mut self.t, BLOCKBYTES);
278-
compress(
279-
&mut self.h,
280-
&mut self.t,
281-
&mut self.f,
282-
&self.buf[..BLOCKBYTES],
283-
);
278+
compress(&mut self.h, &self.t, &self.f, &self.buf[..BLOCKBYTES]);
284279

285280
increment_counter(&mut self.t, self.buf.len() - BLOCKBYTES);
286281
self.set_lastblock();
287282

288283
// fill last block with zero padding
289284
self.buf.resize(2 * BLOCKBYTES, 0);
290285

291-
compress(
292-
&mut self.h,
293-
&mut self.t,
294-
&mut self.f,
295-
&self.buf[BLOCKBYTES..],
296-
);
286+
compress(&mut self.h, &self.t, &self.f, &self.buf[BLOCKBYTES..]);
297287
} else {
298288
increment_counter(&mut self.t, self.buf.len());
299289
self.set_lastblock();
300290

301291
// fill last block with zero padding
302292
self.buf.resize(BLOCKBYTES, 0);
303293

304-
compress(&mut self.h, &mut self.t, &mut self.f, &self.buf);
294+
compress(&mut self.h, &self.t, &self.f, &self.buf);
305295
}
306296
self.buf.zeroize();
307297

src/classic/crypto_core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn crypto_scalarmult(
4646
}
4747

4848
#[inline]
49-
fn chacha20_round(x: &mut u32, y: &mut u32, z: &mut u32, rot: u32) {
49+
fn chacha20_round(x: &mut u32, y: &u32, z: &mut u32, rot: u32) {
5050
*x = x.wrapping_add(*y);
5151
*z = (*z ^ *x).rotate_left(rot);
5252
}

src/dryocstream.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ pub mod protected {
176176

177177
bitflags! {
178178
/// Message tag definitions
179+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
179180
pub struct Tag: u8 {
180181
/// Describes a normal message in a stream.
181182
const MESSAGE = CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE;
@@ -185,7 +186,7 @@ bitflags! {
185186
/// Derives a new key for the stream.
186187
const REKEY = CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY;
187188
/// Indicates the end of the stream.
188-
const FINAL = Self::PUSH.bits | Self::REKEY.bits;
189+
const FINAL = Self::PUSH.bits() | Self::REKEY.bits();
189190
}
190191
}
191192

src/types.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::convert::TryFrom;
33
use lazy_static::__Deref;
44
use zeroize::{Zeroize, ZeroizeOnDrop};
55

6-
#[cfg(any(feature = "serde"))]
6+
#[cfg(feature = "serde")]
77
pub use crate::bytes_serde::*;
88
use crate::rng::copy_randombytes;
99

@@ -311,6 +311,7 @@ impl<const LENGTH: usize> Bytes for [u8; LENGTH] {
311311
}
312312
}
313313

314+
#[allow(suspicious_double_ref_op)]
314315
impl<const LENGTH: usize> Bytes for &[u8; LENGTH] {
315316
#[inline]
316317
fn as_slice(&self) -> &[u8] {

0 commit comments

Comments
 (0)