Skip to content

Commit

Permalink
Bump hybrid-array to v0.2.0-pre.9 (#835)
Browse files Browse the repository at this point in the history
Fixes deprecation warnings
  • Loading branch information
tarcieri authored Jul 27, 2024
1 parent 44f6c0b commit 9566f5e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions ecdsa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ where
/// - `Err(err)` if the `r` and/or `s` component of the signature is
/// out-of-range when interpreted as a big endian integer.
pub fn from_bytes(bytes: &SignatureBytes<C>) -> Result<Self> {
let (r_bytes, s_bytes) = bytes.split_at(C::FieldBytesSize::USIZE);
let r = FieldBytes::<C>::clone_from_slice(r_bytes);
let s = FieldBytes::<C>::clone_from_slice(s_bytes);
let chunks = FieldBytes::<C>::slice_as_chunks(bytes).0;
let r = chunks[0].clone();
let s = chunks[1].clone();
Self::from_scalars(r, s)
}

Expand Down
1 change: 1 addition & 0 deletions slh-dsa/src/fors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl<P: ForsParams> TryFrom<&[u8]> for ForsMTSig<P> {
if slice.len() != ForsMTSig::<P>::SIZE {
return Err(());
}
#[allow(deprecated)]
let sk = Array::clone_from_slice(&slice[..P::N::USIZE]);
let mut auth: Array<Array<u8, P::N>, P::A> = Array::default();
for i in 0..P::A::USIZE {
Expand Down
3 changes: 3 additions & 0 deletions slh-dsa/src/hashes/sha2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// TODO(tarcieri): fix `hybrid-array` deprecation warnings
#![allow(deprecated)]

use core::fmt::Debug;

use crate::hashes::HashSuite;
Expand Down
1 change: 1 addition & 0 deletions slh-dsa/src/signature_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ impl<P: ParameterSet> TryFrom<&[u8]> for Signature<P> {
}

let (rand_bytes, rest) = bytes.split_at(P::N::USIZE);
#[allow(deprecated)]
let randomizer = Array::clone_from_slice(rand_bytes);

let (fors_bytes, ht_bytes) = rest.split_at(ForsSignature::<P>::SIZE);
Expand Down
2 changes: 2 additions & 0 deletions slh-dsa/src/signing_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl<N: ArraySize> AsRef<[u8]> for SkSeed<N> {
}
impl<N: ArraySize> From<&[u8]> for SkSeed<N> {
fn from(slice: &[u8]) -> Self {
#[allow(deprecated)]
Self(Array::clone_from_slice(slice))
}
}
Expand All @@ -37,6 +38,7 @@ impl<N: ArraySize> AsRef<[u8]> for SkPrf<N> {
}
impl<N: ArraySize> From<&[u8]> for SkPrf<N> {
fn from(slice: &[u8]) -> Self {
#[allow(deprecated)]
Self(Array::clone_from_slice(slice))
}
}
Expand Down
1 change: 1 addition & 0 deletions slh-dsa/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn base_2b<OutLen: ArraySize, B: Unsigned>(x: &[u8]) -> Array<u16, OutLen> {

/// Separates the digest into the FORS message, the Xmss tree index, and the Xmss leaf index.
pub fn split_digest<P: ForsParams>(digest: &Array<u8, P::M>) -> (&Array<u8, P::MD>, u64, u32) {
#[allow(deprecated)]
let m = Array::from_slice(&digest[..P::MD::USIZE]);
let idx_tree_size = (P::H::USIZE - P::HPrime::USIZE).div_ceil(8);
let idx_leaf_size = P::HPrime::USIZE.div_ceil(8);
Expand Down
3 changes: 3 additions & 0 deletions slh-dsa/src/verifying_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl<N: ArraySize> AsRef<[u8]> for PkSeed<N> {
}
impl<N: ArraySize> From<&[u8]> for PkSeed<N> {
fn from(slice: &[u8]) -> Self {
#[allow(deprecated)]
Self(Array::clone_from_slice(slice))
}
}
Expand Down Expand Up @@ -79,6 +80,7 @@ impl<P: ParameterSet> From<&VerifyingKey<P>> for Array<u8, P::VkLen> {
}

impl<P: ParameterSet> From<Array<u8, P::VkLen>> for VerifyingKey<P> {
#[allow(deprecated)] // clone_from_slice
fn from(bytes: Array<u8, P::VkLen>) -> VerifyingKey<P> {
debug_assert!(P::VkLen::USIZE == 2 * P::N::USIZE);
let pk_seed = PkSeed(Array::clone_from_slice(&bytes[..P::N::USIZE]));
Expand All @@ -90,6 +92,7 @@ impl<P: ParameterSet> From<Array<u8, P::VkLen>> for VerifyingKey<P> {
impl<P: ParameterSet> TryFrom<&[u8]> for VerifyingKey<P> {
type Error = Error;

#[allow(deprecated)] // clone_from_slice
fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> {
if bytes.len() != P::N::USIZE * 2 {
return Err(Error::new());
Expand Down

0 comments on commit 9566f5e

Please sign in to comment.