fix: clippy warnings (#280)

This commit is contained in:
Augusto Hack
2024-02-22 05:55:02 +01:00
committed by GitHub
parent 24f72c986b
commit dbab0e9aa9
51 changed files with 197 additions and 163 deletions

View File

@@ -1,6 +1,7 @@
use super::{LOG_N, MODULUS, PK_LEN};
use core::fmt;
use super::{LOG_N, MODULUS, PK_LEN};
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FalconError {
KeyGenerationFailed,

View File

@@ -96,9 +96,10 @@ pub struct Rpo128Context {
#[cfg(all(test, feature = "std"))]
mod tests {
use rand_utils::{rand_array, rand_value, rand_vector};
use super::*;
use crate::dsa::rpo_falcon512::{NONCE_LEN, PK_LEN, SIG_LEN, SK_LEN};
use rand_utils::{rand_array, rand_value, rand_vector};
#[test]
fn falcon_ffi() {

View File

@@ -1,11 +1,10 @@
#[cfg(feature = "std")]
use super::{ffi, NonceBytes, NONCE_LEN, PK_LEN, SIG_LEN, SK_LEN};
use super::{
ByteReader, ByteWriter, Deserializable, DeserializationError, FalconError, Polynomial,
PublicKeyBytes, Rpo256, SecretKeyBytes, Serializable, Signature, Word,
};
#[cfg(feature = "std")]
use super::{ffi, NonceBytes, NONCE_LEN, PK_LEN, SIG_LEN, SK_LEN};
// PUBLIC KEY
// ================================================================================================
@@ -182,9 +181,10 @@ impl Deserializable for KeyPair {
#[cfg(all(test, feature = "std"))]
mod tests {
use super::{super::Felt, KeyPair, NonceBytes, Word};
use rand_utils::{rand_array, rand_vector};
use super::{super::Felt, KeyPair, NonceBytes, Word};
#[test]
fn test_falcon_verification() {
// generate random keys

View File

@@ -1,9 +1,6 @@
use crate::{
hash::rpo::Rpo256,
utils::{
collections::Vec, ByteReader, ByteWriter, Deserializable, DeserializationError,
Serializable,
},
utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable},
Felt, Word, ZERO,
};

View File

@@ -1,6 +1,8 @@
use super::{FalconError, Felt, Vec, LOG_N, MODULUS, MODULUS_MINUS_1_OVER_TWO, N, PK_LEN};
use core::ops::{Add, Mul, Sub};
use super::{FalconError, Felt, LOG_N, MODULUS, MODULUS_MINUS_1_OVER_TWO, N, PK_LEN};
use crate::utils::collections::*;
// FALCON POLYNOMIAL
// ================================================================================================

View File

@@ -1,10 +1,11 @@
use core::cell::OnceCell;
use super::{
ByteReader, ByteWriter, Deserializable, DeserializationError, Felt, NonceBytes, NonceElements,
Polynomial, PublicKeyBytes, Rpo256, Serializable, SignatureBytes, Word, MODULUS, N,
SIG_L2_BOUND, ZERO,
};
use crate::utils::string::ToString;
use core::cell::OnceCell;
use crate::utils::string::*;
// FALCON SIGNATURE
// ================================================================================================
@@ -195,13 +196,14 @@ fn decode_nonce(nonce: &NonceBytes) -> NonceElements {
#[cfg(all(test, feature = "std"))]
mod tests {
use super::{
super::{ffi::*, Felt, KeyPair},
*,
};
use libc::c_void;
use rand_utils::rand_vector;
use super::{
super::{ffi::*, KeyPair},
*,
};
// Wrappers for unsafe functions
impl Rpo128Context {
/// Initializes the RPO state.