mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-07 20:50:39 +00:00
Fix new nightly redundant import lint warns (#638)
This commit is contained in:
parent
a62e4a5c57
commit
19c7f4a5d5
11 changed files with 19 additions and 35 deletions
|
|
@ -164,7 +164,6 @@ impl VartimeMultiscalarMul for Pippenger {
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::constants;
|
use crate::constants;
|
||||||
use crate::scalar::Scalar;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_vartime_pippenger() {
|
fn test_vartime_pippenger() {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use core::convert::From;
|
|
||||||
use core::ops::{Add, Neg, Sub};
|
use core::ops::{Add, Neg, Sub};
|
||||||
|
|
||||||
use subtle::Choice;
|
use subtle::Choice;
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@
|
||||||
use core::array::TryFromSliceError;
|
use core::array::TryFromSliceError;
|
||||||
use core::borrow::Borrow;
|
use core::borrow::Borrow;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use core::iter::Iterator;
|
|
||||||
use core::iter::Sum;
|
use core::iter::Sum;
|
||||||
use core::ops::{Add, Neg, Sub};
|
use core::ops::{Add, Neg, Sub};
|
||||||
use core::ops::{AddAssign, SubAssign};
|
use core::ops::{AddAssign, SubAssign};
|
||||||
|
|
@ -110,10 +109,12 @@ use digest::{generic_array::typenum::U64, Digest};
|
||||||
#[cfg(feature = "group")]
|
#[cfg(feature = "group")]
|
||||||
use {
|
use {
|
||||||
group::{cofactor::CofactorGroup, prime::PrimeGroup, GroupEncoding},
|
group::{cofactor::CofactorGroup, prime::PrimeGroup, GroupEncoding},
|
||||||
rand_core::RngCore,
|
|
||||||
subtle::CtOption,
|
subtle::CtOption,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "group")]
|
||||||
|
use rand_core::RngCore;
|
||||||
|
|
||||||
use subtle::Choice;
|
use subtle::Choice;
|
||||||
use subtle::ConditionallyNegatable;
|
use subtle::ConditionallyNegatable;
|
||||||
use subtle::ConditionallySelectable;
|
use subtle::ConditionallySelectable;
|
||||||
|
|
@ -258,7 +259,7 @@ impl TryFrom<&[u8]> for CompressedEdwardsY {
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::de::Visitor;
|
use serde::de::Visitor;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
impl Serialize for EdwardsPoint {
|
impl Serialize for EdwardsPoint {
|
||||||
|
|
@ -1591,8 +1592,10 @@ impl CofactorGroup for EdwardsPoint {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{field::FieldElement, scalar::Scalar};
|
|
||||||
use subtle::ConditionallySelectable;
|
// If `group` is set, then this is already imported in super
|
||||||
|
#[cfg(not(feature = "group"))]
|
||||||
|
use rand_core::RngCore;
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
@ -1600,8 +1603,6 @@ mod test {
|
||||||
#[cfg(feature = "precomputed-tables")]
|
#[cfg(feature = "precomputed-tables")]
|
||||||
use crate::constants::ED25519_BASEPOINT_TABLE;
|
use crate::constants::ED25519_BASEPOINT_TABLE;
|
||||||
|
|
||||||
use rand_core::RngCore;
|
|
||||||
|
|
||||||
/// X coordinate of the basepoint.
|
/// X coordinate of the basepoint.
|
||||||
/// = 15112221349535400772501151409588531511454012693041857206046113283949847762202
|
/// = 15112221349535400772501151409588531511454012693041857206046113283949847762202
|
||||||
static BASE_X_COORD_BYTES: [u8; 32] = [
|
static BASE_X_COORD_BYTES: [u8; 32] = [
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@
|
||||||
|
|
||||||
#![allow(unused_qualifications)]
|
#![allow(unused_qualifications)]
|
||||||
|
|
||||||
use core::cmp::{Eq, PartialEq};
|
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
use subtle::Choice;
|
use subtle::Choice;
|
||||||
|
|
@ -310,7 +308,6 @@ impl FieldElement {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::field::*;
|
use crate::field::*;
|
||||||
use subtle::ConditionallyNegatable;
|
|
||||||
|
|
||||||
/// Random element a of GF(2^255-19), from Sage
|
/// Random element a of GF(2^255-19), from Sage
|
||||||
/// a = 1070314506888354081329385823235218444233221\
|
/// a = 1070314506888354081329385823235218444233221\
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ impl TryFrom<&[u8]> for CompressedRistretto {
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::de::Visitor;
|
use serde::de::Visitor;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
impl Serialize for RistrettoPoint {
|
impl Serialize for RistrettoPoint {
|
||||||
|
|
@ -1277,8 +1277,6 @@ impl Zeroize for RistrettoPoint {
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::edwards::CompressedEdwardsY;
|
use crate::edwards::CompressedEdwardsY;
|
||||||
use crate::scalar::Scalar;
|
|
||||||
use crate::traits::Identity;
|
|
||||||
|
|
||||||
use rand_core::OsRng;
|
use rand_core::OsRng;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,6 @@
|
||||||
//! has been enabled.
|
//! has been enabled.
|
||||||
|
|
||||||
use core::borrow::Borrow;
|
use core::borrow::Borrow;
|
||||||
use core::cmp::{Eq, PartialEq};
|
|
||||||
use core::convert::TryInto;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use core::iter::{Product, Sum};
|
use core::iter::{Product, Sum};
|
||||||
use core::ops::Index;
|
use core::ops::Index;
|
||||||
|
|
@ -124,13 +122,13 @@ use core::ops::{Sub, SubAssign};
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
|
#[cfg(feature = "group")]
|
||||||
|
use group::ff::{Field, FromUniformBytes, PrimeField};
|
||||||
#[cfg(feature = "group-bits")]
|
#[cfg(feature = "group-bits")]
|
||||||
use group::ff::{FieldBits, PrimeFieldBits};
|
use group::ff::{FieldBits, PrimeFieldBits};
|
||||||
#[cfg(feature = "group")]
|
|
||||||
use {
|
#[cfg(any(test, feature = "group"))]
|
||||||
group::ff::{Field, FromUniformBytes, PrimeField},
|
use rand_core::RngCore;
|
||||||
rand_core::RngCore,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(any(test, feature = "rand_core"))]
|
#[cfg(any(test, feature = "rand_core"))]
|
||||||
use rand_core::CryptoRngCore;
|
use rand_core::CryptoRngCore;
|
||||||
|
|
@ -402,7 +400,7 @@ impl ConditionallySelectable for Scalar {
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::de::Visitor;
|
use serde::de::Visitor;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||||
|
|
@ -1393,13 +1391,10 @@ pub const fn clamp_integer(mut bytes: [u8; 32]) -> [u8; 32] {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod test {
|
pub(crate) mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::constants;
|
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
use rand::RngCore;
|
|
||||||
|
|
||||||
/// x = 2238329342913194256032495932344128051776374960164957527413114840482143558222
|
/// x = 2238329342913194256032495932344128051776374960164957527413114840482143558222
|
||||||
pub static X: Scalar = Scalar {
|
pub static X: Scalar = Scalar {
|
||||||
bytes: [
|
bytes: [
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,8 @@
|
||||||
|
|
||||||
use core::borrow::Borrow;
|
use core::borrow::Borrow;
|
||||||
|
|
||||||
use subtle;
|
|
||||||
|
|
||||||
use crate::scalar::{clamp_integer, Scalar};
|
use crate::scalar::{clamp_integer, Scalar};
|
||||||
|
use subtle::ConstantTimeEq;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// Public Traits
|
// Public Traits
|
||||||
|
|
@ -41,7 +40,7 @@ pub trait IsIdentity {
|
||||||
/// constructor.
|
/// constructor.
|
||||||
impl<T> IsIdentity for T
|
impl<T> IsIdentity for T
|
||||||
where
|
where
|
||||||
T: subtle::ConstantTimeEq + Identity,
|
T: ConstantTimeEq + Identity,
|
||||||
{
|
{
|
||||||
fn is_identity(&self) -> bool {
|
fn is_identity(&self) -> bool {
|
||||||
self.ct_eq(&T::identity()).into()
|
self.ct_eq(&T::identity()).into()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
use core::convert::TryFrom;
|
|
||||||
use core::iter::once;
|
use core::iter::once;
|
||||||
|
|
||||||
use curve25519_dalek::constants;
|
use curve25519_dalek::constants;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
//! An ed25519 signature.
|
//! An ed25519 signature.
|
||||||
|
|
||||||
use core::convert::TryFrom;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|
||||||
use curve25519_dalek::edwards::CompressedEdwardsY;
|
use curve25519_dalek::edwards::CompressedEdwardsY;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
//! ed25519 public keys.
|
//! ed25519 public keys.
|
||||||
|
|
||||||
use core::convert::TryFrom;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,11 @@ mod vectors {
|
||||||
scalar::Scalar,
|
scalar::Scalar,
|
||||||
traits::IsIdentity,
|
traits::IsIdentity,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "digest"))]
|
||||||
use sha2::{digest::Digest, Sha512};
|
use sha2::{digest::Digest, Sha512};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
convert::TryFrom,
|
|
||||||
fs::File,
|
fs::File,
|
||||||
io::{BufRead, BufReader},
|
io::{BufRead, BufReader},
|
||||||
ops::Neg,
|
ops::Neg,
|
||||||
|
|
@ -288,8 +289,6 @@ mod vectors {
|
||||||
mod integrations {
|
mod integrations {
|
||||||
use super::*;
|
use super::*;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
#[cfg(feature = "digest")]
|
|
||||||
use sha2::Sha512;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue