add no-std support to ciphersuite crates
This commit is contained in:
parent
b255bb4b93
commit
d63af0964d
|
@ -32,7 +32,8 @@ postcard = { version = "1.0.0", features = ["alloc"], optional = true }
|
|||
rand_core = { version = "0.6", default-features = false }
|
||||
serde = { version = "1.0.160", default-features = false, features = ["derive"], optional = true }
|
||||
serdect = { version = "0.2.0", optional = true }
|
||||
thiserror = { version = "1.0", package = "thiserror-nostd-notrait", default-features = false }
|
||||
thiserror-nostd-notrait = { version = "1.0", default-features = false }
|
||||
thiserror = { version = "1.0", default-features = false, optional = true }
|
||||
visibility = "0.1.0"
|
||||
zeroize = { version = "1.5.4", default-features = false, features = ["derive"] }
|
||||
itertools = { version = "0.12.0", default-features = false }
|
||||
|
@ -50,8 +51,10 @@ rand_chacha = "0.3"
|
|||
serde_json = "1.0"
|
||||
|
||||
[features]
|
||||
default = ["serialization", "cheater-detection"]
|
||||
default = ["serialization", "cheater-detection", "std"]
|
||||
#! ## Features
|
||||
## Enable standard library support.
|
||||
std = ["dep:thiserror"]
|
||||
## Expose internal types, which do not have SemVer guarantees. This is an advanced
|
||||
## feature which can be useful if you need to build a modified version of FROST.
|
||||
## The docs won't list them, you will need to check the source code.
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
//! FROST Error types
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use thiserror_nostd_notrait::Error;
|
||||
|
||||
use crate::{Ciphersuite, Identifier};
|
||||
|
||||
#[derive(Error, Debug, Clone, Copy, Eq, PartialEq)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![no_std]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(non_snake_case)]
|
||||
// It's emitting false positives; see https://github.com/rust-lang/rust-clippy/issues/9413
|
||||
#![allow(clippy::derive_partial_eq_without_eq)]
|
||||
|
|
|
@ -328,6 +328,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>>,
|
||||
|
|
|
@ -25,8 +25,8 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
[dependencies]
|
||||
curve25519-dalek = { version = "=4.1.2", features = ["rand_core"] }
|
||||
document-features = "0.2.7"
|
||||
frost-core = { path = "../frost-core", version = "1.0.0" }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0" }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", default-features = false }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0", default-features = false }
|
||||
rand_core = "0.6"
|
||||
sha2 = { version = "0.10.2", default-features = false }
|
||||
|
||||
|
@ -45,15 +45,18 @@ serde_json = "1.0"
|
|||
|
||||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
default = ["serialization", "cheater-detection", "std"]
|
||||
#! ## Features
|
||||
## Enable standard library support.
|
||||
std = ["frost-core/std"]
|
||||
## 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 a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![no_std]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(non_snake_case)]
|
||||
#![deny(missing_docs)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
|
@ -26,7 +26,9 @@ use frost_core as frost;
|
|||
mod tests;
|
||||
|
||||
// Re-exports in our public API
|
||||
pub use frost_core::{serde, Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
#[cfg(feature = "serde")]
|
||||
pub use frost_core::serde;
|
||||
pub use frost_core::{Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
pub use rand_core;
|
||||
|
||||
/// An error.
|
||||
|
|
|
@ -24,8 +24,8 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
[dependencies]
|
||||
document-features = "0.2.7"
|
||||
ed448-goldilocks = { version = "0.9.0" }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0" }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0" }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", default-features = false }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0", default-features = false }
|
||||
rand_core = "0.6"
|
||||
sha3 = { version = "0.10.6", default-features = false }
|
||||
|
||||
|
@ -43,15 +43,18 @@ serde_json = "1.0"
|
|||
|
||||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
default = ["serialization", "cheater-detection", "std"]
|
||||
#! ## Features
|
||||
## Enable standard library support.
|
||||
std = ["frost-core/std"]
|
||||
## 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 a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -26,7 +26,9 @@ use frost_core as frost;
|
|||
mod tests;
|
||||
|
||||
// Re-exports in our public API
|
||||
pub use frost_core::{serde, Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
#[cfg(feature = "serde")]
|
||||
pub use frost_core::serde;
|
||||
pub use frost_core::{Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
pub use rand_core;
|
||||
|
||||
/// An error.
|
||||
|
|
|
@ -25,8 +25,8 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
[dependencies]
|
||||
document-features = "0.2.7"
|
||||
p256 = { version = "0.13.0", features = ["hash2curve"], default-features = false }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0" }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0" }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", default-features = false }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0", default-features = false }
|
||||
rand_core = "0.6"
|
||||
sha2 = { version = "0.10.2", default-features = false }
|
||||
|
||||
|
@ -44,15 +44,18 @@ serde_json = "1.0"
|
|||
|
||||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
default = ["serialization", "cheater-detection", "std"]
|
||||
#! ## Features
|
||||
## Enable standard library support.
|
||||
std = ["frost-core/std"]
|
||||
## 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 a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![no_std]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(non_snake_case)]
|
||||
#![deny(missing_docs)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
|
@ -29,7 +29,9 @@ use frost_core as frost;
|
|||
mod tests;
|
||||
|
||||
// Re-exports in our public API
|
||||
pub use frost_core::{serde, Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
#[cfg(feature = "serde")]
|
||||
pub use frost_core::serde;
|
||||
pub use frost_core::{Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
pub use rand_core;
|
||||
|
||||
/// An error.
|
||||
|
|
|
@ -6,8 +6,11 @@ edition = "2021"
|
|||
# - Update CHANGELOG.md
|
||||
# - Create git tag.
|
||||
version = "1.0.0"
|
||||
authors = ["Deirdre Connolly <durumcrustulum@gmail.com>", "Chelsea Komlo <me@chelseakomlo.com>",
|
||||
"Conrado Gouvea <conradoplg@gmail.com>"]
|
||||
authors = [
|
||||
"Deirdre Connolly <durumcrustulum@gmail.com>",
|
||||
"Chelsea Komlo <me@chelseakomlo.com>",
|
||||
"Conrado Gouvea <conradoplg@gmail.com>",
|
||||
]
|
||||
readme = "README.md"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/ZcashFoundation/frost"
|
||||
|
@ -22,7 +25,9 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
[dependencies]
|
||||
derive-getters = "0.3.0"
|
||||
document-features = "0.2.7"
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", features = ["internals"] }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", features = [
|
||||
"internals",
|
||||
], default-features = false }
|
||||
rand_core = "0.6"
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -32,11 +37,13 @@ nightly = []
|
|||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
#! ## Features
|
||||
## Enable standard library support.
|
||||
std = ["frost-core/std"]
|
||||
## 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"]
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//! - Each participant should call [`sign`] and send the resulting
|
||||
//! [`frost::round2::SignatureShare`] back to the Coordinator;
|
||||
//! - The Coordinator should then call [`aggregate`].
|
||||
#![no_std]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
extern crate alloc;
|
||||
|
@ -22,10 +22,12 @@ use alloc::collections::BTreeMap;
|
|||
use derive_getters::Getters;
|
||||
pub use frost_core;
|
||||
|
||||
#[cfg(feature = "serialization")]
|
||||
use frost_core::SigningPackage;
|
||||
use frost_core::{
|
||||
self as frost,
|
||||
keys::{KeyPackage, PublicKeyPackage, SigningShare, VerifyingShare},
|
||||
Ciphersuite, Error, Field, Group, Scalar, SigningPackage, VerifyingKey,
|
||||
Ciphersuite, Error, Field, Group, Scalar, VerifyingKey,
|
||||
};
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
|
@ -35,6 +37,7 @@ use frost_core::serialization::ScalarSerialization;
|
|||
|
||||
// When pulled into `reddsa`, that has its own sibling `rand_core` import.
|
||||
// For the time being, we do not re-export this `rand_core`.
|
||||
#[cfg(feature = "serialization")]
|
||||
use rand_core::{CryptoRng, RngCore};
|
||||
|
||||
/// Randomize the given key type for usage in a FROST signing with re-randomized keys,
|
||||
|
@ -172,6 +175,7 @@ where
|
|||
/// The [`SigningPackage`] must be the signing package being used in the
|
||||
/// current FROST signing run. It is hashed into the randomizer calculation,
|
||||
/// which binds it to that specific package.
|
||||
#[cfg(feature = "serialization")]
|
||||
pub fn new<R: RngCore + CryptoRng>(
|
||||
mut rng: R,
|
||||
signing_package: &SigningPackage<C>,
|
||||
|
@ -182,6 +186,7 @@ where
|
|||
|
||||
/// Create a final Randomizer from a random Randomizer and a SigningPackage.
|
||||
/// Function refactored out for testing, should always be private.
|
||||
#[cfg(feature = "serialization")]
|
||||
fn from_randomizer_and_signing_package(
|
||||
rng_randomizer: <<<C as Ciphersuite>::Group as Group>::Field as Field>::Scalar,
|
||||
signing_package: &SigningPackage<C>,
|
||||
|
@ -269,6 +274,7 @@ where
|
|||
{
|
||||
/// Create a new [`RandomizedParams`] for the given [`VerifyingKey`] and
|
||||
/// the given `participants`.
|
||||
#[cfg(feature = "serialization")]
|
||||
pub fn new<R: RngCore + CryptoRng>(
|
||||
group_verifying_key: &VerifyingKey<C>,
|
||||
signing_package: &SigningPackage<C>,
|
||||
|
|
|
@ -19,10 +19,10 @@ features = ["serde"]
|
|||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dependencies]
|
||||
curve25519-dalek = { version = "=4.1.2", features = ["serde", "rand_core"] }
|
||||
curve25519-dalek = { version = "=4.1.2", features = ["rand_core"] }
|
||||
document-features = "0.2.7"
|
||||
frost-core = { path = "../frost-core", version = "1.0.0" }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0" }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", default-features = false }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0", default-features = false }
|
||||
rand_core = "0.6"
|
||||
sha2 = { version = "0.10.2", default-features = false }
|
||||
|
||||
|
@ -41,15 +41,18 @@ serde_json = "1.0"
|
|||
|
||||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
default = ["serialization", "cheater-detection", "std"]
|
||||
#! ## Features
|
||||
## Enable standard library support.
|
||||
std = ["frost-core/std"]
|
||||
## 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"]
|
||||
serde = ["frost-core/serde", "curve25519-dalek/serde"]
|
||||
## Enable a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![no_std]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(non_snake_case)]
|
||||
#![deny(missing_docs)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
@ -23,7 +23,9 @@ use frost_core as frost;
|
|||
mod tests;
|
||||
|
||||
// Re-exports in our public API
|
||||
pub use frost_core::{serde, Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
#[cfg(feature = "serde")]
|
||||
pub use frost_core::serde;
|
||||
pub use frost_core::{Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
pub use rand_core;
|
||||
|
||||
/// An error.
|
||||
|
|
|
@ -23,8 +23,8 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
|
||||
[dependencies]
|
||||
document-features = "0.2.7"
|
||||
frost-core = { path = "../frost-core", version = "1.0.0" }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0" }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", default-features = false }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0", default-features = false }
|
||||
k256 = { version = "0.13.0", features = ["arithmetic", "expose-field", "hash2curve"], default-features = false }
|
||||
rand_core = "0.6"
|
||||
sha2 = { version = "0.10.2", default-features = false }
|
||||
|
@ -43,15 +43,18 @@ serde_json = "1.0"
|
|||
|
||||
[features]
|
||||
nightly = []
|
||||
default = ["serialization", "cheater-detection"]
|
||||
serialization = ["serde", "frost-core/serialization"]
|
||||
default = ["serialization", "cheater-detection", "std"]
|
||||
#! ## Features
|
||||
## Enable standard library support.
|
||||
std = ["frost-core/std"]
|
||||
## 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 a default serialization format. Enables `serde`.
|
||||
serialization = ["serde", "frost-core/serialization", "frost-rerandomized/serialization"]
|
||||
## Enable cheater detection
|
||||
cheater-detection = ["frost-core/cheater-detection"]
|
||||
cheater-detection = ["frost-core/cheater-detection", "frost-rerandomized/cheater-detection"]
|
||||
|
||||
[lib]
|
||||
# Disables non-criterion benchmark which is not used; prevents errors
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![no_std]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(non_snake_case)]
|
||||
#![deny(missing_docs)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
|
@ -30,7 +30,9 @@ use frost_core as frost;
|
|||
mod tests;
|
||||
|
||||
// Re-exports in our public API
|
||||
pub use frost_core::{serde, Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
#[cfg(feature = "serde")]
|
||||
pub use frost_core::serde;
|
||||
pub use frost_core::{Ciphersuite, Field, FieldError, Group, GroupError};
|
||||
pub use rand_core;
|
||||
|
||||
/// An error.
|
||||
|
|
Loading…
Reference in New Issue