mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Remove deprecated APIs from dalek-ff-group
For backwards compatibility, we now use as a patch (as prior done with `ciphersuite`). Removes `crypto-bigint 0.5` from the tree and shapes up what the next release will look like.
This commit is contained in:
61
Cargo.lock
generated
61
Cargo.lock
generated
@@ -1939,7 +1939,7 @@ name = "ciphersuite"
|
||||
version = "0.4.99"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2457,7 +2457,6 @@ name = "dalek-ff-group"
|
||||
version = "0.4.6"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"crypto-bigint 0.5.5",
|
||||
"crypto-bigint 0.6.1",
|
||||
"curve25519-dalek",
|
||||
"digest 0.10.7",
|
||||
@@ -2470,6 +2469,16 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dalek-ff-group"
|
||||
version = "0.4.99"
|
||||
dependencies = [
|
||||
"crypto-bigint 0.5.5",
|
||||
"crypto-bigint 0.6.1",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"prime-field",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.11"
|
||||
@@ -2795,7 +2804,7 @@ dependencies = [
|
||||
"blake2 0.11.0-rc.0",
|
||||
"ciphersuite 0.4.2",
|
||||
"ciphersuite-kp256",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg",
|
||||
"dkg-recovery",
|
||||
"ec-divisors",
|
||||
@@ -2820,7 +2829,7 @@ name = "dkg-musig"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg",
|
||||
"dkg-recovery",
|
||||
"multiexp",
|
||||
@@ -2913,7 +2922,7 @@ name = "ec-divisors"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/monero-oxide/monero-oxide?rev=a6f8797007e768488568b821435cf5006517a962#a6f8797007e768488568b821435cf5006517a962"
|
||||
dependencies = [
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.99",
|
||||
"ff",
|
||||
"group",
|
||||
"rand_core 0.6.4",
|
||||
@@ -3025,7 +3034,7 @@ dependencies = [
|
||||
"blake2 0.11.0-rc.0",
|
||||
"ciphersuite 0.4.2",
|
||||
"curve25519-dalek",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"ff-group-tests",
|
||||
"generalized-bulletproofs-ec-gadgets",
|
||||
"hex",
|
||||
@@ -3535,7 +3544,7 @@ name = "frost-schnorrkel"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"flexible-transcript",
|
||||
"group",
|
||||
"modular-frost",
|
||||
@@ -6074,7 +6083,7 @@ version = "0.10.1"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"ciphersuite-kp256",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg",
|
||||
"dkg-dealer",
|
||||
"dkg-recovery",
|
||||
@@ -6148,7 +6157,7 @@ version = "0.1.0"
|
||||
source = "git+https://github.com/monero-oxide/monero-oxide?rev=6966575e05fe09b77674c46984b21686ed9304ff#6966575e05fe09b77674c46984b21686ed9304ff"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.99",
|
||||
"flexible-transcript",
|
||||
"group",
|
||||
"modular-frost",
|
||||
@@ -6170,7 +6179,7 @@ source = "git+https://github.com/monero-oxide/monero-oxide?rev=6966575e05fe09b77
|
||||
dependencies = [
|
||||
"crypto-bigint 0.5.5",
|
||||
"curve25519-dalek",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.99",
|
||||
"group",
|
||||
"monero-io",
|
||||
"sha3 0.10.8",
|
||||
@@ -6267,7 +6276,7 @@ version = "0.1.0"
|
||||
source = "git+https://github.com/monero-oxide/monero-oxide?rev=6966575e05fe09b77674c46984b21686ed9304ff#6966575e05fe09b77674c46984b21686ed9304ff"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.99",
|
||||
"flexible-transcript",
|
||||
"hex",
|
||||
"modular-frost",
|
||||
@@ -6318,7 +6327,7 @@ dependencies = [
|
||||
name = "multiexp"
|
||||
version = "0.4.2"
|
||||
dependencies = [
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"ff",
|
||||
"group",
|
||||
"k256",
|
||||
@@ -9456,7 +9465,7 @@ name = "schnorr-signatures"
|
||||
version = "0.5.2"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"flexible-transcript",
|
||||
"hex",
|
||||
"multiexp",
|
||||
@@ -9741,7 +9750,7 @@ dependencies = [
|
||||
"borsh",
|
||||
"ciphersuite 0.4.2",
|
||||
"ciphersuite-kp256",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg-musig",
|
||||
"dockertest",
|
||||
"frame-system",
|
||||
@@ -9802,7 +9811,7 @@ dependencies = [
|
||||
"blake2 0.11.0-rc.0",
|
||||
"borsh",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg-musig",
|
||||
"env_logger",
|
||||
"flexible-transcript",
|
||||
@@ -9893,7 +9902,7 @@ dependencies = [
|
||||
"blake2 0.11.0-rc.0",
|
||||
"borsh",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg",
|
||||
"log",
|
||||
"parity-scale-codec",
|
||||
@@ -10157,7 +10166,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"env_logger",
|
||||
"flexible-transcript",
|
||||
"hex",
|
||||
@@ -10178,7 +10187,7 @@ name = "serai-message-queue-tests"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dockertest",
|
||||
"hex",
|
||||
"rand_core 0.6.4",
|
||||
@@ -10195,7 +10204,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg-evrf",
|
||||
"log",
|
||||
"modular-frost",
|
||||
@@ -10225,7 +10234,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitcoin-serai",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg",
|
||||
"dkg-evrf",
|
||||
"embedwards25519",
|
||||
@@ -10247,7 +10256,7 @@ dependencies = [
|
||||
"ciphersuite-kp256",
|
||||
"clap",
|
||||
"curve25519-dalek",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"embedwards25519",
|
||||
"frame-benchmarking",
|
||||
"futures-util",
|
||||
@@ -10298,7 +10307,7 @@ name = "serai-orchestrator"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"embedwards25519",
|
||||
"flexible-transcript",
|
||||
"hex",
|
||||
@@ -10536,7 +10545,7 @@ dependencies = [
|
||||
"blake2 0.11.0-rc.0",
|
||||
"borsh",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"frost-schnorrkel",
|
||||
"log",
|
||||
"modular-frost",
|
||||
@@ -10714,7 +10723,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg-musig",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
@@ -10749,7 +10758,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"dkg-musig",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
@@ -12602,7 +12611,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"blake2 0.11.0-rc.0",
|
||||
"ciphersuite 0.4.2",
|
||||
"dalek-ff-group",
|
||||
"dalek-ff-group 0.4.6",
|
||||
"flexible-transcript",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
|
||||
@@ -14,10 +14,12 @@ members = [
|
||||
"patches/option-ext",
|
||||
"patches/directories-next",
|
||||
|
||||
# monero-oxide expects ciphersuite, yet the ciphersuite in-tree here has breaking changes
|
||||
# This re-exports the in-tree ciphersuite _without_ changes breaking to monero-oxide
|
||||
# monero-oxide expects `ciphersuite`, yet the `ciphersuite` in-tree here has breaking changes
|
||||
# This re-exports the in-tree `ciphersuite` _without_ changes breaking to monero-oxide
|
||||
# Not included in workspace to prevent having two crates with the same name (an error)
|
||||
# "patches/ciphersuite",
|
||||
# Same for `dalek-ff-group`
|
||||
# "patches/dalek-ff-group",
|
||||
|
||||
"common/std-shims",
|
||||
"common/zalloc",
|
||||
@@ -196,7 +198,7 @@ simple-request = { path = "common/request" }
|
||||
multiexp = { path = "crypto/multiexp" }
|
||||
flexible-transcript = { path = "crypto/transcript" }
|
||||
ciphersuite = { path = "patches/ciphersuite" }
|
||||
dalek-ff-group = { path = "crypto/dalek-ff-group" }
|
||||
dalek-ff-group = { path = "patches/dalek-ff-group" }
|
||||
minimal-ed448 = { path = "crypto/ed448" }
|
||||
modular-frost = { path = "crypto/frost" }
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ sha2 = { version = "0.11.0-rc.0", default-features = false }
|
||||
prime-field = { path = "../prime-field", default-features = false }
|
||||
ciphersuite = { version = "0.4.2", path = "../ciphersuite", default-features = false }
|
||||
|
||||
crypto-bigint-05 = { package = "crypto-bigint", version = "0.5", default-features = false, features = ["zeroize"] }
|
||||
crypto-bigint = { version = "0.6", default-features = false, features = ["zeroize"] }
|
||||
|
||||
curve25519-dalek = { version = ">= 4.0, < 4.2", default-features = false, features = ["zeroize", "digest", "group", "precomputed-tables"] }
|
||||
@@ -39,6 +38,6 @@ rand_core = { version = "0.6", default-features = false, features = ["std"] }
|
||||
ff-group-tests = { path = "../ff-group-tests" }
|
||||
|
||||
[features]
|
||||
alloc = ["zeroize/alloc", "digest/alloc", "prime-field/alloc", "ciphersuite/alloc", "curve25519-dalek/alloc"]
|
||||
alloc = ["zeroize/alloc", "digest/alloc", "prime-field/alloc", "ciphersuite/alloc", "crypto-bigint/alloc", "curve25519-dalek/alloc"]
|
||||
std = ["alloc", "zeroize/std", "subtle/std", "rand_core/std", "digest/std", "prime-field/std", "ciphersuite/std"]
|
||||
default = ["std"]
|
||||
|
||||
@@ -494,31 +494,3 @@ prime_field::odd_prime_field_with_specific_repr!(
|
||||
false,
|
||||
crate::ThirtyTwoArray
|
||||
);
|
||||
|
||||
impl FieldElement {
|
||||
/// Create a FieldElement from a `crypto_bigint::U256`.
|
||||
///
|
||||
/// This will reduce the `U256` by the modulus, into a member of the field.
|
||||
#[deprecated]
|
||||
pub const fn from_u256(u256: &crypto_bigint_05::U256) -> Self {
|
||||
const MODULUS: crypto_bigint::U256 = crypto_bigint::U256::from_be_hex(
|
||||
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed",
|
||||
);
|
||||
let mut u256 = crypto_bigint::U256::from_words(*u256.as_words());
|
||||
loop {
|
||||
let result = FieldElement::from_bytes(&u256.to_le_bytes());
|
||||
if let Some(result) = result {
|
||||
return result;
|
||||
}
|
||||
u256 = u256.wrapping_sub(&MODULUS);
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a `FieldElement` from the reduction of a 512-bit number.
|
||||
///
|
||||
/// The bytes are interpreted in little-endian format.
|
||||
#[deprecated]
|
||||
pub fn wide_reduce(value: [u8; 64]) -> Self {
|
||||
<FieldElement as ::ciphersuite::group::ff::FromUniformBytes<_>>::from_uniform_bytes(&value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Ciphersuite
|
||||
|
||||
Patch for the `crates.io` ciphersuite to use the in-tree ciphersuite, resolving
|
||||
breaking changes made since.
|
||||
Patch for the `crates.io` `ciphersuite` to use the in-tree `ciphersuite`,
|
||||
resolving relevant breaking changes made since.
|
||||
|
||||
29
patches/dalek-ff-group/Cargo.toml
Normal file
29
patches/dalek-ff-group/Cargo.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[package]
|
||||
name = "dalek-ff-group"
|
||||
version = "0.4.99"
|
||||
description = "ff/group bindings around curve25519-dalek"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dalek-ff-group"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = ["curve25519", "ed25519", "ristretto", "dalek", "group"]
|
||||
edition = "2021"
|
||||
rust-version = "1.85"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false }
|
||||
|
||||
crypto-bigint-05 = { package = "crypto-bigint", version = "0.5", default-features = false, features = ["zeroize"] }
|
||||
crypto-bigint = { version = "0.6", default-features = false, features = ["zeroize"] }
|
||||
prime-field = { path = "../../crypto/prime-field", default-features = false }
|
||||
|
||||
[features]
|
||||
alloc = ["dalek-ff-group/alloc", "crypto-bigint-05/alloc", "crypto-bigint/alloc", "prime-field/alloc"]
|
||||
std = ["alloc", "dalek-ff-group/std", "prime-field/std"]
|
||||
default = ["std"]
|
||||
21
patches/dalek-ff-group/LICENSE
Normal file
21
patches/dalek-ff-group/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022-2025 Luke Parker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
4
patches/dalek-ff-group/README.md
Normal file
4
patches/dalek-ff-group/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Dalek FF/Group
|
||||
|
||||
Patch for the `crates.io` `dalek-ff-group` to use the in-tree `dalek-ff-group`,
|
||||
resolving relevant breaking changes made since.
|
||||
44
patches/dalek-ff-group/src/lib.rs
Normal file
44
patches/dalek-ff-group/src/lib.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
#![allow(deprecated)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#![no_std] // Prevents writing new code, in what should be a simple wrapper, which requires std
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![allow(clippy::redundant_closure_call)]
|
||||
|
||||
pub use dalek_ff_group::{Scalar, EdwardsPoint, RistrettoPoint, Ed25519, Ristretto};
|
||||
|
||||
type ThirtyTwoArray = [u8; 32];
|
||||
prime_field::odd_prime_field_with_specific_repr!(
|
||||
FieldElement,
|
||||
"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed",
|
||||
"02",
|
||||
false,
|
||||
crate::ThirtyTwoArray
|
||||
);
|
||||
|
||||
impl FieldElement {
|
||||
/// Create a FieldElement from a `crypto_bigint::U256`.
|
||||
///
|
||||
/// This will reduce the `U256` by the modulus, into a member of the field.
|
||||
#[deprecated]
|
||||
pub const fn from_u256(u256: &crypto_bigint_05::U256) -> Self {
|
||||
const MODULUS: crypto_bigint::U256 = crypto_bigint::U256::from_be_hex(
|
||||
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed",
|
||||
);
|
||||
let mut u256 = crypto_bigint::U256::from_words(*u256.as_words());
|
||||
loop {
|
||||
let result = FieldElement::from_bytes(&u256.to_le_bytes());
|
||||
if let Some(result) = result {
|
||||
return result;
|
||||
}
|
||||
u256 = u256.wrapping_sub(&MODULUS);
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a `FieldElement` from the reduction of a 512-bit number.
|
||||
///
|
||||
/// The bytes are interpreted in little-endian format.
|
||||
#[deprecated]
|
||||
pub fn wide_reduce(value: [u8; 64]) -> Self {
|
||||
<FieldElement as prime_field::ff::FromUniformBytes<_>>::from_uniform_bytes(&value)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user