diff --git a/libcrux-ml-dsa/src/encoding/error.rs b/libcrux-ml-dsa/src/encoding/error.rs index 104931418..80080945c 100644 --- a/libcrux-ml-dsa/src/encoding/error.rs +++ b/libcrux-ml-dsa/src/encoding/error.rs @@ -53,7 +53,7 @@ fn deserialize( result.simd_units[i] = SIMDUnit::error_deserialize::(&serialized_chunks.next().unwrap()); } - + result } diff --git a/libcrux-ml-dsa/src/encoding/signature.rs b/libcrux-ml-dsa/src/encoding/signature.rs index 867141959..cc94028ee 100644 --- a/libcrux-ml-dsa/src/encoding/signature.rs +++ b/libcrux-ml-dsa/src/encoding/signature.rs @@ -1,6 +1,6 @@ use crate::{ - constants::COEFFICIENTS_IN_RING_ELEMENT, encoding, types::Signature, - polynomial::PolynomialRingElement, simd::traits::Operations, VerificationError, + constants::COEFFICIENTS_IN_RING_ELEMENT, encoding, polynomial::PolynomialRingElement, + simd::traits::Operations, types::Signature, VerificationError, }; impl< diff --git a/libcrux-ml-dsa/src/hash_functions.rs b/libcrux-ml-dsa/src/hash_functions.rs index 36d043c16..7274dfede 100644 --- a/libcrux-ml-dsa/src/hash_functions.rs +++ b/libcrux-ml-dsa/src/hash_functions.rs @@ -168,7 +168,7 @@ pub(crate) mod portable { [u8; shake128::BLOCK_SIZE], ) { squeeze_next_block(self) - } + } } /// Portable SHAKE 128 state @@ -177,7 +177,7 @@ pub(crate) mod portable { fn shake128(input: &[u8], out: &mut [u8; OUTPUT_LENGTH]) { libcrux_sha3::portable::shake128(out, input); } - + impl shake128::Xof for Shake128 { fn shake128(input: &[u8], out: &mut [u8; OUTPUT_LENGTH]) { shake128(input, out); @@ -190,7 +190,6 @@ pub(crate) mod portable { state: libcrux_sha3::portable::KeccakState, } - fn shake256(input: &[u8], out: &mut [u8; OUTPUT_LENGTH]) { libcrux_sha3::portable::shake256(out, input); } @@ -302,9 +301,7 @@ pub(crate) mod portable { (out0, out1, out2, out3) } - impl shake256::XofX4 for Shake256X4 { - fn init_absorb_x4(input0: &[u8], input1: &[u8], input2: &[u8], input3: &[u8]) -> Self { init_absorb_x4(input0, input1, input2, input3) } @@ -350,27 +347,31 @@ pub(crate) mod portable { #[cfg_attr(hax, hax_lib::opaque_type)] pub(crate) struct Shake256Absorb { - state: libcrux_sha3::portable::incremental::Shake256Absorb + state: libcrux_sha3::portable::incremental::Shake256Absorb, } - + #[cfg_attr(hax, hax_lib::opaque_type)] pub(crate) struct Shake256Squeeze { - state: libcrux_sha3::portable::incremental::Shake256Squeeze + state: libcrux_sha3::portable::incremental::Shake256Squeeze, } use libcrux_sha3::portable::incremental::{XofAbsorb, XofSqueeze}; - pub(crate) fn shake256_init() -> Shake256Absorb { - Shake256Absorb {state: libcrux_sha3::portable::incremental::Shake256Absorb::new ()} + pub(crate) fn shake256_init() -> Shake256Absorb { + Shake256Absorb { + state: libcrux_sha3::portable::incremental::Shake256Absorb::new(), + } } - pub(crate) fn shake256_absorb(st:&mut Shake256Absorb, input:&[u8]) { - st.state.absorb (input) + pub(crate) fn shake256_absorb(st: &mut Shake256Absorb, input: &[u8]) { + st.state.absorb(input) } - pub(crate) fn shake256_absorb_final(st:Shake256Absorb, input:&[u8]) -> Shake256Squeeze { - Shake256Squeeze {state: st.state.absorb_final (input)} + pub(crate) fn shake256_absorb_final(st: Shake256Absorb, input: &[u8]) -> Shake256Squeeze { + Shake256Squeeze { + state: st.state.absorb_final(input), + } } - pub(crate) fn shake256_squeeze(st:&mut Shake256Squeeze, out: &mut [u8]) { - st.state.squeeze (out) + pub(crate) fn shake256_squeeze(st: &mut Shake256Squeeze, out: &mut [u8]) { + st.state.squeeze(out) } } @@ -378,10 +379,9 @@ pub(crate) mod portable { #[cfg(feature = "simd256")] pub(crate) mod simd256 { + use super::{shake128, shake256}; use libcrux_sha3::avx2::x4; use libcrux_sha3::portable; - use super::{shake128, shake256}; - /// AVX2 SHAKE 128 state /// @@ -406,13 +406,7 @@ pub(crate) mod simd256 { out2: &mut [u8; shake128::FIVE_BLOCKS_SIZE], out3: &mut [u8; shake128::FIVE_BLOCKS_SIZE], ) { - x4::incremental::shake128_squeeze_first_five_blocks( - &mut x.state, - out0, - out1, - out2, - out3, - ); + x4::incremental::shake128_squeeze_first_five_blocks(&mut x.state, out0, out1, out2, out3); } fn squeeze_next_block( @@ -443,7 +437,7 @@ pub(crate) mod simd256 { fn init_absorb(input0: &[u8], input1: &[u8], input2: &[u8], input3: &[u8]) -> Self { init_absorb(input0, input1, input2, input3) } - + fn squeeze_first_five_blocks( &mut self, out0: &mut [u8; shake128::FIVE_BLOCKS_SIZE], @@ -471,7 +465,6 @@ pub(crate) mod simd256 { /// AVX2 SHAKE 256 state pub(crate) type Shake256 = super::portable::Shake256; - // impl shake256::Xof for Shake256 { // fn shake256(input: &[u8], out: &mut [u8; OUTPUT_LENGTH]) { @@ -570,11 +563,10 @@ pub(crate) mod simd256 { } impl shake256::XofX4 for Shake256x4 { - fn init_absorb_x4(input0: &[u8], input1: &[u8], input2: &[u8], input3: &[u8]) -> Self { init_absorb_x4(input0, input2, input2, input3) } - + fn squeeze_first_block_x4( &mut self, ) -> ( @@ -616,8 +608,8 @@ pub(crate) mod simd256 { #[cfg(feature = "simd128")] pub(crate) mod neon { - use libcrux_sha3::neon::x2; use super::{shake128, shake256}; + use libcrux_sha3::neon::x2; #[cfg_attr(hax, hax_lib::opaque_type)] pub(crate) type KeccakState = x2::incremental::KeccakState; @@ -705,7 +697,7 @@ pub(crate) mod neon { } fn squeeze_first_block_x4( - x:&mut Shake256x4, + x: &mut Shake256x4, ) -> ( [u8; shake256::BLOCK_SIZE], [u8; shake256::BLOCK_SIZE], diff --git a/libcrux-ml-dsa/src/ml_dsa_generic.rs b/libcrux-ml-dsa/src/ml_dsa_generic.rs index dfe47172a..b188342b7 100644 --- a/libcrux-ml-dsa/src/ml_dsa_generic.rs +++ b/libcrux-ml-dsa/src/ml_dsa_generic.rs @@ -4,18 +4,20 @@ use crate::{ }, constants::*, encoding, - hash_functions::{shake128, shake256, - portable::{shake256_init, shake256_absorb, shake256_absorb_final, shake256_squeeze}}, + hash_functions::{ + portable::{shake256_absorb, shake256_absorb_final, shake256_init, shake256_squeeze}, + shake128, shake256, + }, matrix::{ add_vectors, compute_A_times_mask, compute_As1_plus_s2, compute_w_approx, subtract_vectors, vector_times_ring_element, }, ntt::ntt, - types::{SigningError, VerificationError, Signature}, pre_hash::{DomainSeparationContext, DomainSeparationError, PreHash}, sample::{sample_challenge_ring_element, sample_mask_vector}, samplex4, simd::traits::Operations, + types::{Signature, SigningError, VerificationError}, utils::into_padded_array, MLDSASignature, }; @@ -23,7 +25,6 @@ use crate::{ pub(crate) mod instantiations; pub(crate) mod multiplexing; - /// Generate a key pair. pub(crate) fn generate_key_pair< SIMDUnit: Operations, @@ -122,34 +123,28 @@ pub(crate) fn sign_pre_hashed< let pre_hashed_message = PH::hash(message); // TODO: Support implicit into() in ? so that this match becomes unnecessary match DomainSeparationContext::new(context, Some(&PH::oid())) { - Ok(d) => - sign_internal::< - SIMDUnit, - Shake128X4, - Shake256, - Shake256X4, - ROWS_IN_A, - COLUMNS_IN_A, - ETA, - ERROR_RING_ELEMENT_SIZE, - GAMMA1_EXPONENT, - GAMMA2, - COMMITMENT_RING_ELEMENT_SIZE, - COMMITMENT_VECTOR_SIZE, - COMMITMENT_HASH_SIZE, - ONES_IN_VERIFIER_CHALLENGE, - MAX_ONES_IN_HINT, - GAMMA1_RING_ELEMENT_SIZE, - SIGNING_KEY_SIZE, - SIGNATURE_SIZE, - >( - &signing_key, - &pre_hashed_message, - Some(d), - randomness, - ), - - Err(DomainSeparationError::ContextTooLongError) => Err(SigningError::ContextTooLongError) + Ok(d) => sign_internal::< + SIMDUnit, + Shake128X4, + Shake256, + Shake256X4, + ROWS_IN_A, + COLUMNS_IN_A, + ETA, + ERROR_RING_ELEMENT_SIZE, + GAMMA1_EXPONENT, + GAMMA2, + COMMITMENT_RING_ELEMENT_SIZE, + COMMITMENT_VECTOR_SIZE, + COMMITMENT_HASH_SIZE, + ONES_IN_VERIFIER_CHALLENGE, + MAX_ONES_IN_HINT, + GAMMA1_RING_ELEMENT_SIZE, + SIGNING_KEY_SIZE, + SIGNATURE_SIZE, + >(&signing_key, &pre_hashed_message, Some(d), randomness), + + Err(DomainSeparationError::ContextTooLongError) => Err(SigningError::ContextTooLongError), } } @@ -181,35 +176,29 @@ pub(crate) fn sign< ) -> Result, SigningError> { // TODO: Support implicit into() in ? so that this match becomes unnecessary match DomainSeparationContext::new(context, None) { - Ok(d) => - sign_internal::< - SIMDUnit, - Shake128X4, - Shake256, - Shake256X4, - ROWS_IN_A, - COLUMNS_IN_A, - ETA, - ERROR_RING_ELEMENT_SIZE, - GAMMA1_EXPONENT, - GAMMA2, - COMMITMENT_RING_ELEMENT_SIZE, - COMMITMENT_VECTOR_SIZE, - COMMITMENT_HASH_SIZE, - ONES_IN_VERIFIER_CHALLENGE, - MAX_ONES_IN_HINT, - GAMMA1_RING_ELEMENT_SIZE, - SIGNING_KEY_SIZE, - SIGNATURE_SIZE, - >( - &signing_key, - message, - Some(d), - randomness, - ), - Err(DomainSeparationError::ContextTooLongError) => Err(SigningError::ContextTooLongError) + Ok(d) => sign_internal::< + SIMDUnit, + Shake128X4, + Shake256, + Shake256X4, + ROWS_IN_A, + COLUMNS_IN_A, + ETA, + ERROR_RING_ELEMENT_SIZE, + GAMMA1_EXPONENT, + GAMMA2, + COMMITMENT_RING_ELEMENT_SIZE, + COMMITMENT_VECTOR_SIZE, + COMMITMENT_HASH_SIZE, + ONES_IN_VERIFIER_CHALLENGE, + MAX_ONES_IN_HINT, + GAMMA1_RING_ELEMENT_SIZE, + SIGNING_KEY_SIZE, + SIGNATURE_SIZE, + >(&signing_key, message, Some(d), randomness), + Err(DomainSeparationError::ContextTooLongError) => Err(SigningError::ContextTooLongError), } -} +} /// The internal signing API. /// @@ -431,8 +420,14 @@ fn derive_message_representative( let mut shake = shake256_init(); shake256_absorb(&mut shake, &verification_key_hash); if let Some(domain_separation_context) = domain_separation_context { - shake256_absorb(&mut shake, &[domain_separation_context.pre_hash_oid().is_some() as u8]); - shake256_absorb(&mut shake, &[domain_separation_context.context().len() as u8]); + shake256_absorb( + &mut shake, + &[domain_separation_context.pre_hash_oid().is_some() as u8], + ); + shake256_absorb( + &mut shake, + &[domain_separation_context.context().len() as u8], + ); shake256_absorb(&mut shake, domain_separation_context.context()); if let Some(pre_hash_oid) = domain_separation_context.pre_hash_oid() { shake256_absorb(&mut shake, pre_hash_oid) @@ -573,32 +568,33 @@ pub(crate) fn verify< ) -> Result<(), VerificationError> { // TODO: Support implicit into() in ? so that this match becomes unnecessary match DomainSeparationContext::new(context, None) { - Ok(d) => - verify_internal::< - SIMDUnit, - Shake128X4, - Shake256, - ROWS_IN_A, - COLUMNS_IN_A, - SIGNATURE_SIZE, - VERIFICATION_KEY_SIZE, - GAMMA1_EXPONENT, - GAMMA1_RING_ELEMENT_SIZE, - GAMMA2, - BETA, - COMMITMENT_RING_ELEMENT_SIZE, - COMMITMENT_VECTOR_SIZE, - COMMITMENT_HASH_SIZE, - ONES_IN_VERIFIER_CHALLENGE, - MAX_ONES_IN_HINT, - >( - &verification_key_serialized, - message, - Some(d), - &signature_serialized, - ), - Err(DomainSeparationError::ContextTooLongError) => Err(VerificationError::ContextTooLongError) + Ok(d) => verify_internal::< + SIMDUnit, + Shake128X4, + Shake256, + ROWS_IN_A, + COLUMNS_IN_A, + SIGNATURE_SIZE, + VERIFICATION_KEY_SIZE, + GAMMA1_EXPONENT, + GAMMA1_RING_ELEMENT_SIZE, + GAMMA2, + BETA, + COMMITMENT_RING_ELEMENT_SIZE, + COMMITMENT_VECTOR_SIZE, + COMMITMENT_HASH_SIZE, + ONES_IN_VERIFIER_CHALLENGE, + MAX_ONES_IN_HINT, + >( + &verification_key_serialized, + message, + Some(d), + &signature_serialized, + ), + Err(DomainSeparationError::ContextTooLongError) => { + Err(VerificationError::ContextTooLongError) } + } } #[allow(non_snake_case)] @@ -631,8 +627,7 @@ pub(crate) fn verify_pre_hashed< // TODO: Support implicit into() in ? so that this match becomes unnecessary match DomainSeparationContext::new(context, Some(&PH::oid())) { - Ok(d) => - verify_internal::< + Ok(d) => verify_internal::< SIMDUnit, Shake128X4, Shake256, @@ -654,7 +649,9 @@ pub(crate) fn verify_pre_hashed< &pre_hashed_message, Some(d), &signature_serialized, - ), - Err(DomainSeparationError::ContextTooLongError) => Err(VerificationError::ContextTooLongError) + ), + Err(DomainSeparationError::ContextTooLongError) => { + Err(VerificationError::ContextTooLongError) + } } } diff --git a/libcrux-ml-dsa/src/ml_dsa_generic/instantiations.rs b/libcrux-ml-dsa/src/ml_dsa_generic/instantiations.rs index 89b8fe4cb..aa859d7d5 100644 --- a/libcrux-ml-dsa/src/ml_dsa_generic/instantiations.rs +++ b/libcrux-ml-dsa/src/ml_dsa_generic/instantiations.rs @@ -3,9 +3,9 @@ macro_rules! instantiate { pub mod $modp { use crate::{ constants::*, - types::{SigningError, VerificationError}, pre_hash::SHAKE128_PH, types::*, + types::{SigningError, VerificationError}, }; /// Generate key pair. diff --git a/libcrux-ml-dsa/src/pre_hash.rs b/libcrux-ml-dsa/src/pre_hash.rs index 677e24299..06855c0f9 100644 --- a/libcrux-ml-dsa/src/pre_hash.rs +++ b/libcrux-ml-dsa/src/pre_hash.rs @@ -5,7 +5,8 @@ //!/perform the pre-hash of the message. This module implements the //! pre-hash trait for SHAKE-128, with a digest length of 256 bytes. use crate::{ - constants::CONTEXT_MAX_LEN, hash_functions::shake128::Xof, + constants::CONTEXT_MAX_LEN, + hash_functions::shake128::Xof, types::{SigningError, VerificationError}, }; diff --git a/libcrux-ml-dsa/src/samplex4.rs b/libcrux-ml-dsa/src/samplex4.rs index 774dab1f2..389da763d 100644 --- a/libcrux-ml-dsa/src/samplex4.rs +++ b/libcrux-ml-dsa/src/samplex4.rs @@ -10,13 +10,15 @@ fn generate_domain_separator(row: u8, column: u8) -> u16 { (column as u16) | ((row as u16) << 8) } -type Matrix = - [[PolynomialRingElement; COLUMNS_IN_A]; ROWS_IN_A]; +type Matrix = + [[PolynomialRingElement; COLUMNS_IN_A]; ROWS_IN_A]; fn update_matrix( m: &mut Matrix, - i: usize, j: usize, - v: PolynomialRingElement) { + i: usize, + j: usize, + v: PolynomialRingElement, +) { m[i][j] = v; } @@ -30,7 +32,7 @@ pub(crate) fn matrix_A_4_by_4< >( seed: [u8; 34], ) -> Matrix { - let mut A : Matrix:: = + let mut A: Matrix = [[PolynomialRingElement::::ZERO(); COLUMNS_IN_A]; ROWS_IN_A]; let four_ring_elements = sample_four_ring_elements::( diff --git a/libcrux-ml-dsa/src/simd.rs b/libcrux-ml-dsa/src/simd.rs index 653246a60..376602844 100644 --- a/libcrux-ml-dsa/src/simd.rs +++ b/libcrux-ml-dsa/src/simd.rs @@ -6,4 +6,3 @@ pub(crate) mod traits; #[cfg(test)] pub(crate) mod tests; - diff --git a/libcrux-ml-dsa/src/simd/avx2.rs b/libcrux-ml-dsa/src/simd/avx2.rs index ed6d52177..f891d39be 100644 --- a/libcrux-ml-dsa/src/simd/avx2.rs +++ b/libcrux-ml-dsa/src/simd/avx2.rs @@ -1,10 +1,10 @@ use crate::simd::traits::{Operations, SIMD_UNITS_IN_RING_ELEMENT}; -mod vector_type; mod arithmetic; mod encoding; mod ntt; mod rejection_sample; +mod vector_type; pub(crate) use vector_type::AVX2SIMDUnit; diff --git a/libcrux-ml-dsa/src/simd/avx2/vector_type.rs b/libcrux-ml-dsa/src/simd/avx2/vector_type.rs index 2fb5d62dd..13fa15372 100644 --- a/libcrux-ml-dsa/src/simd/avx2/vector_type.rs +++ b/libcrux-ml-dsa/src/simd/avx2/vector_type.rs @@ -22,4 +22,4 @@ pub(crate) fn to_coefficient_array(x: &AVX2SIMDUnit) -> [i32; 8] { let mut coefficient_array = [0i32; 8]; libcrux_intrinsics::avx2::mm256_storeu_si256_i32(&mut coefficient_array, x.coefficients); coefficient_array -} \ No newline at end of file +} diff --git a/libcrux-ml-dsa/src/simd/portable.rs b/libcrux-ml-dsa/src/simd/portable.rs index e04bf4953..d45daf829 100644 --- a/libcrux-ml-dsa/src/simd/portable.rs +++ b/libcrux-ml-dsa/src/simd/portable.rs @@ -1,7 +1,7 @@ use crate::simd::traits::{Operations, SIMD_UNITS_IN_RING_ELEMENT}; -mod vector_type; mod arithmetic; +mod vector_type; // Some of the portable implementations are used in lieu of vectorized ones in // the AVX2 module. pub(crate) mod encoding; diff --git a/libcrux-ml-dsa/src/simd/portable/arithmetic.rs b/libcrux-ml-dsa/src/simd/portable/arithmetic.rs index 50744017b..a24847132 100644 --- a/libcrux-ml-dsa/src/simd/portable/arithmetic.rs +++ b/libcrux-ml-dsa/src/simd/portable/arithmetic.rs @@ -1,13 +1,11 @@ -use super::vector_type::{PortableSIMDUnit, FieldElement, ZERO}; +use super::vector_type::{FieldElement, PortableSIMDUnit, ZERO}; use crate::{ constants::BITS_IN_LOWER_PART_OF_T, simd::traits::{ - FieldElementTimesMontgomeryR, FIELD_MODULUS, - INVERSE_OF_MODULUS_MOD_MONTGOMERY_R, + FieldElementTimesMontgomeryR, FIELD_MODULUS, INVERSE_OF_MODULUS_MOD_MONTGOMERY_R, }, }; - /// If 'x' denotes a value of type `fe`, values having this type hold a /// representative y ≡ x·MONTGOMERY_R^(-1) (mod FIELD_MODULUS). /// We use 'mfe' as a shorthand for this type @@ -145,9 +143,7 @@ pub fn infinity_norm_exceeds(simd_unit: PortableSIMDUnit, bound: i32) -> bool { // straightforward way to do so (returning false) will not go through hax; // revisit if performance is impacted. for coefficient in simd_unit.coefficients.into_iter() { - debug_assert!( - coefficient > -FIELD_MODULUS && coefficient < FIELD_MODULUS - ); + debug_assert!(coefficient > -FIELD_MODULUS && coefficient < FIELD_MODULUS); // This norm is calculated using the absolute value of the // signed representative in the range: // @@ -227,9 +223,7 @@ pub fn compute_hint( #[allow(non_snake_case)] #[inline(always)] fn decompose_element(r: i32) -> (i32, i32) { - debug_assert!( - r > -FIELD_MODULUS && r < FIELD_MODULUS - ); + debug_assert!(r > -FIELD_MODULUS && r < FIELD_MODULUS); // Convert the signed representative to the standard unsigned one. let r = r + ((r >> 31) & FIELD_MODULUS); diff --git a/libcrux-ml-dsa/src/simd/portable/ntt.rs b/libcrux-ml-dsa/src/simd/portable/ntt.rs index 951215294..df0db5a8a 100644 --- a/libcrux-ml-dsa/src/simd/portable/ntt.rs +++ b/libcrux-ml-dsa/src/simd/portable/ntt.rs @@ -1,7 +1,7 @@ use super::arithmetic::{self, montgomery_multiply_by_constant, montgomery_multiply_fe_by_fer}; use super::vector_type::PortableSIMDUnit; use crate::simd::traits::{ - COEFFICIENTS_IN_SIMD_UNIT, SIMD_UNITS_IN_RING_ELEMENT, ZETAS_TIMES_MONTGOMERY_R, + COEFFICIENTS_IN_SIMD_UNIT, SIMD_UNITS_IN_RING_ELEMENT, ZETAS_TIMES_MONTGOMERY_R, }; #[inline(always)] @@ -209,7 +209,8 @@ fn ntt_at_layer_3_plus( let step_by = step / COEFFICIENTS_IN_SIMD_UNIT; for j in offset..offset + step_by { - let t = montgomery_multiply_by_constant(re[j + step_by], ZETAS_TIMES_MONTGOMERY_R[*zeta_i]); + let t = + montgomery_multiply_by_constant(re[j + step_by], ZETAS_TIMES_MONTGOMERY_R[*zeta_i]); re[j + step_by] = arithmetic::subtract(&re[j], &t); re[j] = arithmetic::add(&re[j], &t); diff --git a/libcrux-ml-dsa/src/simd/portable/vector_type.rs b/libcrux-ml-dsa/src/simd/portable/vector_type.rs index 47a736cbe..6cecdac4c 100644 --- a/libcrux-ml-dsa/src/simd/portable/vector_type.rs +++ b/libcrux-ml-dsa/src/simd/portable/vector_type.rs @@ -21,6 +21,6 @@ pub(crate) fn from_coefficient_array(array: &[i32]) -> PortableSIMDUnit { } } -pub(crate) fn to_coefficient_array(x:&PortableSIMDUnit) -> [i32; 8] { +pub(crate) fn to_coefficient_array(x: &PortableSIMDUnit) -> [i32; 8] { x.coefficients -} \ No newline at end of file +} diff --git a/libcrux-ml-dsa/src/simd/tests.rs b/libcrux-ml-dsa/src/simd/tests.rs index a83f97aaa..acd67ac45 100644 --- a/libcrux-ml-dsa/src/simd/tests.rs +++ b/libcrux-ml-dsa/src/simd/tests.rs @@ -51,8 +51,7 @@ fn test_power2round_generic() { let expected_low = SIMDUnit::from_coefficient_array(&[3861, 3691, 437, 2882, -3959, 1028, -4020, -2308]); - let expected_high = - SIMDUnit::from_coefficient_array(&[848, 410, 706, 721, 789, 702, 106, 448]); + let expected_high = SIMDUnit::from_coefficient_array(&[848, 410, 706, 721, 789, 702, 106, 448]); let (low, high) = SIMDUnit::power2round(input); diff --git a/libcrux-ml-dsa/src/types.rs b/libcrux-ml-dsa/src/types.rs index 12cc34779..d432b1e99 100644 --- a/libcrux-ml-dsa/src/types.rs +++ b/libcrux-ml-dsa/src/types.rs @@ -34,11 +34,7 @@ pub struct MLDSAKeyPair, } -use crate::{ - constants::*, - simd::traits::Operations, - polynomial::PolynomialRingElement, -}; +use crate::{constants::*, polynomial::PolynomialRingElement, simd::traits::Operations}; pub(crate) struct Signature< SIMDUnit: Operations, @@ -63,4 +59,4 @@ pub enum VerificationError { pub enum SigningError { RejectionSamplingError, ContextTooLongError, -} \ No newline at end of file +}