Skip to content

Commit

Permalink
Bump dependencies to fix vulnerability from cargo audit (#223)
Browse files Browse the repository at this point in the history
* bump dependency version

- curve25519-dalek
- x25519-dalek
- age

* fix clippy warning

* fix clippy warnings
  • Loading branch information
wulfraem authored Jul 15, 2024
1 parent 47460d6 commit 489aa0e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ serde = { version = "1.0", optional = true, default-features = false, features =
sha3 = { version = "0.10", optional = true, default-features = false }
tiny-keccak = { version = "2.0", optional = true, default-features = false, features = [ "keccak" ] }
unicode-normalization = { version = "0.1", optional = true, default-features = false }
curve25519-dalek = { version = "3.2", optional = true, default-features = false, features = [ "u64_backend" ] }
x25519-dalek = { version = "1.1", optional = true, default-features = false, features = [ "u64_backend" ] }
curve25519-dalek = { version = "4.1.3", optional = true, default-features = false }
x25519-dalek = { version = "2.0.1", optional = true, default-features = false, features = ["static_secrets", "zeroize"] }
zeroize = { version = "1.5", optional = true, default-features = false, features = [ "zeroize_derive" ] }
scrypt = { version = "0.11", optional = true, default-features = false }
hkdf = { version = "0.12", optional = true, default-features = false }
Expand All @@ -141,7 +141,7 @@ hex = { version = "0.4", default-features = false, features = [ "alloc", "std" ]
rand = { version = "0.8", default-features = false, features = [ "std", "std_rng", "min_const_gen" ] }
serde = { version = "1.0", default-features = false, features = [ "derive" ] }
serde_json = { version = "1.0", default-features = false, features = [ "alloc", "std" ] }
age = { version = "0.9", default-features = false }
age = { version = "0.10", default-features = false }

[profile.dev]
split-debuginfo = "unpacked"
2 changes: 1 addition & 1 deletion src/encoding/ternary/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub trait RawEncodingBuf {
/// Convert this encoding into another encoding.
/// TODO: Rename this `reencode`
#[allow(clippy::wrong_self_convention)]
fn into_encoding<T: RawEncodingBuf>(this: TritBuf<Self>) -> TritBuf<T>
fn into_encoding<T>(this: TritBuf<Self>) -> TritBuf<T>
where
Self: Sized,
T: RawEncodingBuf,
Expand Down
6 changes: 3 additions & 3 deletions src/encoding/ternary/tryte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ impl TryFrom<char> for Tryte {
fn try_from(c: char) -> Result<Self, Self::Error> {
match c {
'9' => Ok(Tryte::Nine),
'N'..='Z' => Ok(unsafe { core::mem::transmute((c as u8 - b'N') as i8 - 13) }),
'A'..='M' => Ok(unsafe { core::mem::transmute((c as u8 - b'A') as i8 + 1) }),
'N'..='Z' => Ok(unsafe { core::mem::transmute::<i8, Self>((c as u8 - b'N') as i8 - 13) }),
'A'..='M' => Ok(unsafe { core::mem::transmute::<i8, Self>((c as u8 - b'A') as i8 + 1) }),
_ => Err(Error::InvalidRepr),
}
}
Expand All @@ -119,7 +119,7 @@ impl TryFrom<i8> for Tryte {

fn try_from(x: i8) -> Result<Self, Self::Error> {
match x {
-13..=13 => Ok(unsafe { core::mem::transmute(x) }),
-13..=13 => Ok(unsafe { core::mem::transmute::<i8, Self>(x) }),
_ => Err(Error::InvalidRepr),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/ternary/curl_p/batched/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{

/// The number of inputs that can be processed in a single batch.
pub const BATCH_SIZE: usize = 8 * core::mem::size_of::<usize>();
const HIGH_BITS: usize = usize::max_value();
const HIGH_BITS: usize = usize::MAX;
const NUM_ROUNDS: usize = 81;

/// A hasher that can process several inputs at the same time in batches.
Expand Down
8 changes: 4 additions & 4 deletions src/hashes/ternary/kerl/bigint/i384/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl Ord for I384<BigEndian, U8Repr> {
// MSU8s are equal. If they are not equal, then an early return will be triggered.

const NEGBIT: u8 = 0x80;
const UMAX: u8 = core::u8::MAX;
const UMAX: u8 = u8::MAX;
let numbers_negative = match zipped_iter.next() {
// Case 1: both numbers are negative, s is less.
Some((s @ NEGBIT..=UMAX, o @ NEGBIT..=UMAX)) if s > o => return Greater,
Expand Down Expand Up @@ -408,7 +408,7 @@ impl Ord for I384<BigEndian, U32Repr> {
// MSU32s are equal. If they are not equal, then an early return will be triggered.

const NEGBIT: u32 = 0x8000_0000;
const UMAX: u32 = core::u32::MAX;
const UMAX: u32 = u32::MAX;
let numbers_negative = match zipped_iter.next() {
// Case 1: both numbers are negative, s is less.
Some((s @ NEGBIT..=UMAX, o @ NEGBIT..=UMAX)) if s > o => return Greater,
Expand Down Expand Up @@ -504,7 +504,7 @@ impl Ord for I384<LittleEndian, U8Repr> {
// MSU8s are equal. If they are not equal, then an early return will be triggered.

const NEGBIT: u8 = 0x80;
const UMAX: u8 = core::u8::MAX;
const UMAX: u8 = u8::MAX;
let numbers_negative = match zipped_iter.next() {
// Case 1: both numbers are negative, s is less.
Some((s @ NEGBIT..=UMAX, o @ NEGBIT..=UMAX)) if s > o => return Greater,
Expand Down Expand Up @@ -734,7 +734,7 @@ impl Ord for I384<LittleEndian, U32Repr> {
// MSU32s are equal. If they are not equal, then an early return will be triggered.

const NEGBIT: u32 = 0x8000_0000;
const UMAX: u32 = core::u32::MAX;
const UMAX: u32 = u32::MAX;

let numbers_negative = match zipped_iter.next() {
// Case 1: both numbers are negative, s is less.
Expand Down
18 changes: 9 additions & 9 deletions src/hashes/ternary/kerl/bigint/split_integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ mod tests {
// i64
[split_i64_hi_one_is_zero, 1i64.hi(), 0i32],
[split_i64_lo_one_is_one, 1i64.lo(), 1u32],
[split_i64_hi_max_is_max, i64::max_value().hi(), i32::max_value()],
[split_i64_lo_max_is_max, i64::max_value().lo(), u32::max_value()],
[split_i64_hi_min_is_min, i64::min_value().hi(), i32::min_value()],
[split_i64_lo_min_is_zero, i64::min_value().lo(), 0u32],
[split_i64_hi_max_is_max, i64::MAX.hi(), i32::MAX],
[split_i64_lo_max_is_max, i64::MAX.lo(), u32::MAX],
[split_i64_hi_min_is_min, i64::MIN.hi(), i32::MIN],
[split_i64_lo_min_is_zero, i64::MIN.lo(), 0u32],
[split_i64_hi_neg_one_is_neg_one, (-1i64).hi(), -1i32],
[split_i64_lo_neg_one_is_max, (-1i64).lo(), u32::max_value()],
[split_i64_lo_neg_one_is_max, (-1i64).lo(), u32::MAX],
// u64
[split_u64_hi_one_is_zero, 1u64.hi(), 0u32],
[split_u64_lo_one_is_one, 1u64.lo(), 1u32],
[split_u64_hi_max_is_max, u64::max_value().hi(), u32::max_value()],
[split_u64_lo_max_is_max, u64::max_value().lo(), u32::max_value()],
[split_u64_hi_min_is_min, u64::min_value().hi(), 0u32],
[split_u64_lo_min_is_zero, u64::min_value().lo(), 0u32],
[split_u64_hi_max_is_max, u64::MAX.hi(), u32::MAX],
[split_u64_lo_max_is_max, u64::MAX.lo(), u32::MAX],
[split_u64_hi_min_is_min, u64::MIN.hi(), 0u32],
[split_u64_lo_min_is_zero, u64::MIN.lo(), 0u32],
);
}
4 changes: 2 additions & 2 deletions src/keys/bip39.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<'a> TryFrom<&'a str> for &'a MnemonicRef {
fn try_from(mnemonic_str: &'a str) -> Result<Self, Error> {
if is_nfkd(mnemonic_str) {
// SAFETY: MnemonicRef is represented exactly as str due to repr(transparent)
Ok(unsafe { core::mem::transmute(mnemonic_str) })
Ok(unsafe { core::mem::transmute::<&str, Self>(mnemonic_str) })
} else {
Err(Error::UnnormalizedMnemonic)
}
Expand Down Expand Up @@ -196,7 +196,7 @@ impl<'a> TryFrom<&'a str> for &'a PassphraseRef {
fn try_from(passphrase_str: &'a str) -> Result<Self, Error> {
if is_nfkd(passphrase_str) {
// SAFETY: PassphraseRef is represented exactly as str due to repr(transparent)
Ok(unsafe { core::mem::transmute(passphrase_str) })
Ok(unsafe { core::mem::transmute::<&str, Self>(passphrase_str) })
} else {
Err(Error::UnnormalizedPassphrase)
}
Expand Down

0 comments on commit 489aa0e

Please sign in to comment.