Remove PartialEq bounds (#107)

* make tests generic

* restore serialization test; remove Debug bound by using debugless-unwrap

* fix spacings in Cargo.toml

* Add PartialEq bound to Ciphersuite and Group; remove it from functions

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
This commit is contained in:
Conrado Gouvea 2022-09-05 17:54:58 -03:00 committed by GitHub
parent 298da8f5fd
commit 1ccee574ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View File

@ -96,7 +96,7 @@ pub type Scalar<C> = <<<C as Ciphersuite>::Group as Group>::Field as Field>::Sca
/// pass-through, implemented for a type just for the ciphersuite, and calls through to another
/// implementation underneath, so that this trait does not have to be implemented for types you
/// don't own.
pub trait Group: Copy + Clone {
pub trait Group: Copy + Clone + PartialEq {
/// A prime order finite field GF(q) over which all scalar values for our prime order group can
/// be multiplied are defined.
type Field: Field;
@ -157,7 +157,7 @@ pub type Element<C> = <<C as Ciphersuite>::Group as Group>::Element;
/// function.
///
/// [FROST ciphersuite]: https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-05.html#name-ciphersuites
pub trait Ciphersuite: Copy + Clone {
pub trait Ciphersuite: Copy + Clone + PartialEq {
/// The prime order group (or subgroup) that this ciphersuite operates over.
type Group: Group;

View File

@ -10,7 +10,7 @@ pub mod proptests;
pub mod vectors;
/// Test share generation with a Ciphersuite
pub fn check_share_generation<C: Ciphersuite + PartialEq, R: RngCore + CryptoRng>(mut rng: R) {
pub fn check_share_generation<C: Ciphersuite, R: RngCore + CryptoRng>(mut rng: R) {
let secret = frost::keys::Secret::<C>::random(&mut rng);
let secret_shares = frost::keys::generate_secret_shares(&secret, 5, 3, rng).unwrap();
@ -26,10 +26,7 @@ pub fn check_share_generation<C: Ciphersuite + PartialEq, R: RngCore + CryptoRng
}
/// Test FROST signing with trusted dealer with a Ciphersuite.
pub fn check_sign_with_dealer<C: Ciphersuite + PartialEq, R: RngCore + CryptoRng>(mut rng: R)
where
<C as Ciphersuite>::Group: std::cmp::PartialEq,
{
pub fn check_sign_with_dealer<C: Ciphersuite, R: RngCore + CryptoRng>(mut rng: R) {
////////////////////////////////////////////////////////////////////////////
// Key generation
////////////////////////////////////////////////////////////////////////////

View File

@ -139,10 +139,7 @@ pub fn parse_test_vectors<C: Ciphersuite>(
}
/// Test with the given test vectors for a ciphersuite.
pub fn check_sign_with_test_vectors<C: Ciphersuite + PartialEq>(json_vectors: &Value)
where
C::Group: PartialEq,
{
pub fn check_sign_with_test_vectors<C: Ciphersuite>(json_vectors: &Value) {
let (
group_public,
key_packages,