Skip to content

Commit 43b7e17

Browse files
committed
[cryptography] Switch evrf to vendored ed25519 implementation
1 parent 2749af6 commit 43b7e17

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cryptography/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ crc-fast = { workspace = true, features = ["std"], optional = true }
3030
ctutils.workspace = true
3131
curve25519-dalek = { workspace = true, features = ["digest"] }
3232
ecdsa.workspace = true
33-
ed25519-consensus.workspace = true
3433
num-rational = { workspace = true, optional = true }
3534
num-traits = { workspace = true, optional = true }
3635
p256 = { workspace = true, features = ["ecdsa"] }

cryptography/src/bls12381/golden_dkg/evrf.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
22
bls12381::primitives::group::{Scalar, G1},
3-
ed25519,
3+
ed25519::{self, core as ed_core},
44
transcript::{Summary, Transcript},
55
Secret,
66
};
@@ -15,7 +15,7 @@ use core::{
1515
ops::Deref,
1616
};
1717
use curve25519_dalek::edwards::CompressedEdwardsY;
18-
use ed25519_consensus::VerificationKey;
18+
use ed_core::VerificationKey;
1919
use rand_core::CryptoRngCore;
2020
use sha2::{Digest, Sha512};
2121
use std::num::NonZeroU32;
@@ -25,13 +25,13 @@ const PUBLIC_KEY_LENGTH: usize = 32;
2525

2626
#[derive(Clone, Debug)]
2727
pub struct PrivateKey {
28-
inner: Secret<ed25519_consensus::SigningKey>,
28+
inner: Secret<ed_core::SigningKey>,
2929
}
3030

3131
impl Random for PrivateKey {
3232
fn random(rng: impl CryptoRngCore) -> Self {
3333
Self {
34-
inner: Secret::new(ed25519_consensus::SigningKey::new(rng)),
34+
inner: Secret::new(ed_core::SigningKey::new(rng)),
3535
}
3636
}
3737
}
@@ -149,7 +149,7 @@ impl Read for PrivateKey {
149149

150150
fn read_cfg(buf: &mut impl Buf, _: &()) -> Result<Self, CodecError> {
151151
let raw = Zeroizing::new(<[u8; Self::SIZE]>::read(buf)?);
152-
let key = ed25519_consensus::SigningKey::from(*raw);
152+
let key = ed_core::SigningKey::from(*raw);
153153
Ok(Self {
154154
inner: Secret::new(key),
155155
})
@@ -175,7 +175,7 @@ impl crate::Verifier for PublicKey {
175175
let payload = union_unique(namespace, msg);
176176
self.inner
177177
.verify(
178-
&ed25519_consensus::Signature::from(<[u8; 64]>::try_from(sig.as_ref()).unwrap()),
178+
&ed_core::Signature::from(<[u8; 64]>::try_from(sig.as_ref()).unwrap()),
179179
&payload,
180180
)
181181
.is_ok()
@@ -196,7 +196,7 @@ impl Read for PublicKey {
196196
fn read_cfg(buf: &mut impl Buf, _: &()) -> Result<Self, CodecError> {
197197
let raw = <[u8; PUBLIC_KEY_LENGTH]>::read_cfg(buf, &())?;
198198
let inner = VerificationKey::try_from(raw)
199-
.map_err(|e: ed25519_consensus::Error| CodecError::Wrapped("evrf", e.into()))?;
199+
.map_err(|e: ed_core::Error| CodecError::Wrapped("evrf", e.into()))?;
200200
Ok(Self { inner })
201201
}
202202
}

cryptography/src/ed25519/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//! ```
2828
2929
pub mod certificate;
30-
pub(in crate::ed25519) mod core;
30+
pub(crate) mod core;
3131
mod scheme;
3232

3333
pub use scheme::{Batch, PrivateKey, PublicKey, Signature};

0 commit comments

Comments
 (0)