From 280fc441a717c51463a6810ef351cc12790bf94a Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sat, 13 Aug 2022 08:50:30 -0400 Subject: [PATCH] Lint FROST Corrects ertrors introduced a couple commits ago as well. --- crypto/frost/src/curve/dalek.rs | 1 + crypto/frost/src/curve/kp256.rs | 1 + crypto/frost/src/curve/mod.rs | 6 ++---- crypto/frost/src/tests/schnorr.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crypto/frost/src/curve/dalek.rs b/crypto/frost/src/curve/dalek.rs index 6e329aa9..334e978a 100644 --- a/crypto/frost/src/curve/dalek.rs +++ b/crypto/frost/src/curve/dalek.rs @@ -28,6 +28,7 @@ macro_rules! dalek_curve { type G = $Point; const ID: &'static [u8] = $ID; + fn generator() -> Self::G { $POINT } diff --git a/crypto/frost/src/curve/kp256.rs b/crypto/frost/src/curve/kp256.rs index 41d1e35c..1bc427f6 100644 --- a/crypto/frost/src/curve/kp256.rs +++ b/crypto/frost/src/curve/kp256.rs @@ -31,6 +31,7 @@ macro_rules! kp_curve { type G = $lib::ProjectivePoint; const ID: &'static [u8] = $ID; + fn generator() -> Self::G { $lib::ProjectivePoint::GENERATOR } diff --git a/crypto/frost/src/curve/mod.rs b/crypto/frost/src/curve/mod.rs index 99351963..4c10d138 100644 --- a/crypto/frost/src/curve/mod.rs +++ b/crypto/frost/src/curve/mod.rs @@ -27,8 +27,6 @@ pub use kp256::{P256, IetfP256Hram}; /// Set of errors for curve-related operations, namely encoding and decoding #[derive(Clone, Error, Debug)] pub enum CurveError { - #[error("invalid length for data (expected {0}, got {0})")] - InvalidLength(usize, usize), #[error("invalid scalar")] InvalidScalar, #[error("invalid point")] @@ -59,8 +57,8 @@ pub trait Curve: Clone + Copy + PartialEq + Eq + Debug + Zeroize { // This doesn't actually need to be part of Curve as it does nothing with the curve // This also solely relates to FROST and with a proper Algorithm/HRAM, all projects using // aggregatable signatures over this curve will work without issue - // It is kept here as Curve + H{1, 2, 3} is effectively a ciphersuite according to the IETF draft - // and moving it to Schnorr would force all of them into being ciphersuite-specific + // It is kept here as Curve + H{1, 2, 3, 4} is effectively a ciphersuite according to the IETF + // draft and moving it to Schnorr would force all of them into being ciphersuite-specific // H2 is left to the Schnorr Algorithm as H2 is the H used in HRAM, which Schnorr further // modularizes fn hash_msg(msg: &[u8]) -> Vec; diff --git a/crypto/frost/src/tests/schnorr.rs b/crypto/frost/src/tests/schnorr.rs index 80a478c9..8c12b07d 100644 --- a/crypto/frost/src/tests/schnorr.rs +++ b/crypto/frost/src/tests/schnorr.rs @@ -2,7 +2,7 @@ use std::{marker::PhantomData, collections::HashMap}; use rand_core::{RngCore, CryptoRng}; -use group::{ff::Field, GroupEncoding}; +use group::{ff::Field, Group, GroupEncoding}; use crate::{ Curve, FrostKeys, @@ -29,7 +29,7 @@ pub(crate) fn core_verify(rng: &mut R) { assert!(!schnorr::verify::( C::generator() * C::F::random(&mut *rng), C::F::random(rng), - &SchnorrSignature { R: C::identity(), s: C::F::zero() } + &SchnorrSignature { R: C::G::identity(), s: C::F::zero() } )); }