Fix --no-default-features (#630)
* fix --no-default-features; also make sure everything compilers with every feature combination * backport some fixes from no-std PR * update CHANGELOG
This commit is contained in:
parent
a47177da4c
commit
c205ef73e0
|
@ -4,6 +4,12 @@ Entries are listed in reverse chronological order.
|
|||
|
||||
## Unreleased
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Fixed `no-default-features`, previously it wouldn't compile.
|
||||
* Fixed some feature handling that would include unneeded dependencies in some
|
||||
cases.
|
||||
|
||||
## Released
|
||||
|
||||
## 1.0.0
|
||||
|
|
|
@ -62,7 +62,7 @@ internals = []
|
|||
serde = ["dep:serde", "dep:serdect"]
|
||||
serialization = ["serde", "dep:postcard"]
|
||||
# Exposes ciphersuite-generic tests for other crates to use
|
||||
test-impl = ["proptest", "serde_json", "criterion"]
|
||||
test-impl = ["dep:proptest", "dep:serde_json", "dep:criterion"]
|
||||
# Enable cheater detection
|
||||
cheater-detection = []
|
||||
|
||||
|
|
|
@ -17,14 +17,15 @@ use rand_core::{CryptoRng, RngCore};
|
|||
use zeroize::{DefaultIsZeroes, Zeroize};
|
||||
|
||||
use crate::{
|
||||
serialization::{Deserialize, Serialize},
|
||||
Ciphersuite, Element, Error, Field, Group, Header, Identifier, Scalar, SigningKey,
|
||||
VerifyingKey,
|
||||
Ciphersuite, Element, Error, Field, Group, Header, Identifier, Scalar, SigningKey, VerifyingKey,
|
||||
};
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
use crate::serialization::{ElementSerialization, ScalarSerialization};
|
||||
|
||||
#[cfg(feature = "serialization")]
|
||||
use crate::serialization::{Deserialize, Serialize};
|
||||
|
||||
use super::compute_lagrange_coefficient;
|
||||
|
||||
pub mod dkg;
|
||||
|
|
|
@ -50,6 +50,7 @@ pub mod round1 {
|
|||
use derive_getters::Getters;
|
||||
use zeroize::Zeroize;
|
||||
|
||||
#[cfg(feature = "serialization")]
|
||||
use crate::serialization::{Deserialize, Serialize};
|
||||
|
||||
use super::*;
|
||||
|
@ -167,6 +168,7 @@ pub mod round2 {
|
|||
use derive_getters::Getters;
|
||||
use zeroize::Zeroize;
|
||||
|
||||
#[cfg(feature = "serialization")]
|
||||
use crate::serialization::{Deserialize, Serialize};
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -153,7 +153,7 @@ struct Header<C: Ciphersuite> {
|
|||
serde(deserialize_with = "crate::serialization::ciphersuite_deserialize::<_, C>")
|
||||
)]
|
||||
ciphersuite: (),
|
||||
#[serde(skip)]
|
||||
#[cfg_attr(feature = "serde", serde(skip))]
|
||||
phantom: PhantomData<C>,
|
||||
}
|
||||
|
||||
|
|
|
@ -12,15 +12,14 @@ use hex::FromHex;
|
|||
use rand_core::{CryptoRng, RngCore};
|
||||
use zeroize::Zeroize;
|
||||
|
||||
use crate as frost;
|
||||
use crate::{
|
||||
serialization::{Deserialize, Serialize},
|
||||
Ciphersuite, Element, Error, Field, Group, Header, Scalar,
|
||||
};
|
||||
use crate::{Ciphersuite, Element, Error, Field, Group, Header, Scalar};
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
use crate::serialization::{ElementSerialization, ScalarSerialization};
|
||||
|
||||
#[cfg(feature = "serialization")]
|
||||
use crate::serialization::{Deserialize, Serialize};
|
||||
|
||||
use super::{keys::SigningShare, Identifier};
|
||||
|
||||
/// A scalar that is a signing nonce.
|
||||
|
@ -353,11 +352,12 @@ where
|
|||
/// Computes the [signature commitment share] from these round one signing commitments.
|
||||
///
|
||||
/// [signature commitment share]: https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-14.html#name-signature-share-verificatio
|
||||
#[cfg(any(feature = "cheater-detection", feature = "internals"))]
|
||||
#[cfg_attr(feature = "internals", visibility::make(pub))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
|
||||
pub(super) fn to_group_commitment_share(
|
||||
self,
|
||||
binding_factor: &frost::BindingFactor<C>,
|
||||
binding_factor: &crate::BindingFactor<C>,
|
||||
) -> GroupCommitmentShare<C> {
|
||||
GroupCommitmentShare::<C>(self.hiding.0 + (self.binding.0 * binding_factor.0))
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ where
|
|||
/// This is the final step of [`verify_signature_share`] from the spec.
|
||||
///
|
||||
/// [`verify_signature_share`]: https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-14.html#name-signature-share-verificatio
|
||||
#[cfg(any(feature = "cheater-detection", feature = "internals"))]
|
||||
#[cfg_attr(feature = "internals", visibility::make(pub))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
|
||||
pub(crate) fn verify(
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
//! Serialization support.
|
||||
|
||||
use crate::{Ciphersuite, Error, Field, Group};
|
||||
#[cfg(feature = "serde")]
|
||||
use crate::{Ciphersuite, Field, Group};
|
||||
|
||||
#[cfg(feature = "serialization")]
|
||||
use crate::Error;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg_attr(feature = "internals", visibility::make(pub))]
|
||||
|
@ -89,6 +93,7 @@ where
|
|||
|
||||
// The short 4-byte ID. Derived as the CRC-32 of the UTF-8
|
||||
// encoded ID in big endian format.
|
||||
#[cfg(feature = "serde")]
|
||||
const fn short_id<C>() -> [u8; 4]
|
||||
where
|
||||
C: Ciphersuite,
|
||||
|
|
|
@ -326,6 +326,7 @@ fn check_aggregate_errors<C: Ciphersuite + PartialEq>(
|
|||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "cheater-detection")]
|
||||
fn check_aggregate_corrupted_share<C: Ciphersuite + PartialEq>(
|
||||
signing_package: frost::SigningPackage<C>,
|
||||
mut signature_shares: BTreeMap<frost::Identifier<C>, frost::round2::SignatureShare<C>>,
|
||||
|
|
|
@ -46,14 +46,15 @@ serde_json = "1.0"
|
|||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
#! ## Features
|
||||
## Enable `serde` support for types that need to be communicated. You
|
||||
## can use `serde` to serialize structs with any encoder that supports
|
||||
## `serde` (e.g. JSON with `serde_json`).
|
||||
serde = ["frost-core/serde"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
## Enable a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -44,14 +44,15 @@ serde_json = "1.0"
|
|||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
#! ## Features
|
||||
## Enable `serde` support for types that need to be communicated. You
|
||||
## can use `serde` to serialize structs with any encoder that supports
|
||||
## `serde` (e.g. JSON with `serde_json`).
|
||||
serde = ["frost-core/serde"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
## Enable a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -45,14 +45,15 @@ serde_json = "1.0"
|
|||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
#! ## Features
|
||||
## Enable `serde` support for types that need to be communicated. You
|
||||
## can use `serde` to serialize structs with any encoder that supports
|
||||
## `serde` (e.g. JSON with `serde_json`).
|
||||
serde = ["frost-core/serde"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
## Enable a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -30,13 +30,14 @@ rand_core = "0.6"
|
|||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
#! ## Features
|
||||
## Enable `serde` support for types that need to be communicated. You
|
||||
## can use `serde` to serialize structs with any encoder that supports
|
||||
## `serde` (e.g. JSON with `serde_json`).
|
||||
serde = ["frost-core/serde"]
|
||||
# Exposes ciphersuite-generic tests for other crates to use
|
||||
test-impl = ["frost-core/test-impl"]
|
||||
test-impl = ["frost-core/test-impl", "serialization"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
## Enable a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
|
|
|
@ -42,14 +42,15 @@ serde_json = "1.0"
|
|||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
#! ## Features
|
||||
## Enable `serde` support for types that need to be communicated. You
|
||||
## can use `serde` to serialize structs with any encoder that supports
|
||||
## `serde` (e.g. JSON with `serde_json`).
|
||||
serde = ["frost-core/serde"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
## Enable a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -44,14 +44,15 @@ serde_json = "1.0"
|
|||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
#! ## Features
|
||||
## Enable `serde` support for types that need to be communicated. You
|
||||
## can use `serde` to serialize structs with any encoder that supports
|
||||
## `serde` (e.g. JSON with `serde_json`).
|
||||
serde = ["frost-core/serde"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
## Enable a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
Loading…
Reference in New Issue