Skip to content

Commit 7fc596c

Browse files
authored
Merge pull request #83 from iron-fish/no-std-sign
no-std for signing
2 parents 06f16dd + cb2a632 commit 7fc596c

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ homepage = "https://ironfish.network/"
99
repository = "https://github.com/iron-fish/ironfish-frost"
1010

1111
[dependencies]
12-
blake3 = { version = "1.5.0", optional = true }
12+
blake3 = { version = "1.5.0", optional = true, default-features = false }
1313
chacha20 = "0.9.1"
1414
chacha20poly1305 = "0.10.1"
1515
ed25519-dalek = { version = "2.1.0", default-features = false, features = ["rand_core", "alloc"] }
16-
rand_chacha = { version = "0.3.1", optional = true }
16+
rand_chacha = { version = "0.3.1", optional = true, default-features = false }
1717
rand_core = { version = "0.6.4", default-features = false, features = ["alloc"] }
1818
reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev="ed49e9ca0699a6450f6d4a9fe62ff168f5ea1ead", features = ["frost"], default-features = false }
1919
siphasher = { version = "1.0.0", default-features = false }
@@ -24,8 +24,8 @@ hex-literal = "0.4.1"
2424
rand = "0.8.5"
2525

2626
[features]
27-
default = ["dkg", "signing"]
27+
default = ["dkg", "signing", "std"]
2828

2929
std = ["reddsa/std"]
30-
signing = ["dep:blake3", "dep:rand_chacha", "std"]
30+
signing = ["dep:blake3", "dep:rand_chacha"]
3131
dkg = []

src/nonces.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,19 @@ use crate::participant::Identity;
88
use crate::participant::IdentitySerialization;
99
use rand_chacha::ChaCha20Rng;
1010
use rand_core::SeedableRng;
11+
12+
#[cfg(feature = "std")]
1113
use std::borrow::Borrow;
1214

15+
#[cfg(not(feature = "std"))]
16+
use core::borrow::Borrow;
17+
18+
#[cfg(not(feature = "std"))]
19+
extern crate alloc;
20+
21+
#[cfg(not(feature = "std"))]
22+
use alloc::vec::Vec;
23+
1324
type ParticipantCount = u32;
1425

1526
fn nonces_seed<I>(

src/signature_share.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

5-
use std::io;
5+
use crate::io;
66

77
use reddsa::frost::redjubjub::round2::SignatureShare as FrostSignatureShare;
88

src/signing_commitment.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@ use crate::error::IronfishFrostError;
1010
use crate::frost::keys::SigningShare;
1111
use crate::frost::round1::NonceCommitment;
1212
use crate::frost::round1::SigningCommitments;
13+
use crate::io;
1314
use crate::nonces::deterministic_signing_nonces;
1415
use crate::participant::Identity;
1516
use crate::participant::Secret;
1617
use crate::participant::Signature;
1718
use crate::participant::IDENTITY_LEN;
18-
use std::borrow::Borrow;
19-
use std::hash::Hasher;
20-
use std::io;
19+
use core::borrow::Borrow;
20+
use core::hash::Hasher;
21+
22+
#[cfg(not(feature = "std"))]
23+
extern crate alloc;
24+
25+
#[cfg(not(feature = "std"))]
26+
use alloc::vec::Vec;
2127

2228
const NONCE_COMMITMENT_LEN: usize = 32;
2329
pub const AUTHENTICATED_DATA_LEN: usize = IDENTITY_LEN + NONCE_COMMITMENT_LEN * 2 + CHECKSUM_LEN;

0 commit comments

Comments
 (0)