Skip to content

Commit 4f40906

Browse files
committed
merge other upstream branches
4 parents 0b1b77b + 87c92f0 + cf61141 + 56599dc commit 4f40906

File tree

30 files changed

+668
-182
lines changed

30 files changed

+668
-182
lines changed

.github/workflows/workspace.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- uses: dtolnay/rust-toolchain@master
2222
with:
23-
toolchain: 1.85.0
23+
toolchain: 1.88.0
2424
components: clippy
2525
- run: cargo clippy --all --all-features -- -D warnings
2626

.github/workflows/x448.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: x448
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/x448.yml"
7+
- "ed448-goldilocks/**"
8+
- "x448/**"
9+
- "Cargo.*"
10+
push:
11+
branches: master
12+
13+
defaults:
14+
run:
15+
working-directory: x448
16+
17+
env:
18+
CARGO_INCREMENTAL: 0
19+
RUSTFLAGS: "-Dwarnings"
20+
RUSTDOCFLAGS: "-Dwarnings"
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
matrix:
27+
rust:
28+
- 1.85.0 # MSRV
29+
- stable
30+
target:
31+
- thumbv7em-none-eabi
32+
- wasm32-unknown-unknown
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: dtolnay/rust-toolchain@master
36+
with:
37+
toolchain: ${{ matrix.rust }}
38+
targets: ${{ matrix.target }}
39+
- run: cargo build --target ${{ matrix.target }} --release
40+
41+
test:
42+
runs-on: ubuntu-latest
43+
strategy:
44+
matrix:
45+
include:
46+
# 32-bit Linux
47+
- target: i686-unknown-linux-gnu
48+
rust: 1.85.0 # MSRV
49+
deps: sudo apt update && sudo apt install gcc-multilib
50+
- target: i686-unknown-linux-gnu
51+
rust: stable
52+
deps: sudo apt update && sudo apt install gcc-multilib
53+
54+
# 64-bit Linux
55+
- target: x86_64-unknown-linux-gnu
56+
rust: 1.85.0 # MSRV
57+
- target: x86_64-unknown-linux-gnu
58+
rust: stable
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: dtolnay/rust-toolchain@master
63+
with:
64+
toolchain: ${{ matrix.rust }}
65+
targets: ${{ matrix.target }}
66+
- uses: RustCrypto/actions/cargo-hack-install@master
67+
- run: ${{ matrix.deps }}
68+
- run: cargo test --release --target ${{ matrix.target }}
69+
70+
cross:
71+
strategy:
72+
matrix:
73+
include:
74+
# ARM32
75+
- target: armv7-unknown-linux-gnueabihf
76+
rust: 1.85.0 # MSRV (cross)
77+
- target: armv7-unknown-linux-gnueabihf
78+
rust: stable
79+
80+
# ARM64
81+
- target: aarch64-unknown-linux-gnu
82+
rust: 1.85.0 # MSRV (cross)
83+
- target: aarch64-unknown-linux-gnu
84+
rust: stable
85+
86+
# PPC32
87+
- target: powerpc-unknown-linux-gnu
88+
rust: 1.85.0 # MSRV (cross)
89+
- target: powerpc-unknown-linux-gnu
90+
rust: stable
91+
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: actions/checkout@v4
95+
- run: ${{ matrix.deps }}
96+
- uses: dtolnay/rust-toolchain@master
97+
with:
98+
toolchain: ${{ matrix.rust }}
99+
targets: ${{ matrix.target }}
100+
- uses: RustCrypto/actions/cross-install@master
101+
- run: cross test --release --target ${{ matrix.target }}
102+
103+
doc:
104+
runs-on: ubuntu-latest
105+
steps:
106+
- uses: actions/checkout@v4
107+
- uses: RustCrypto/actions/cargo-cache@master
108+
- uses: dtolnay/rust-toolchain@master
109+
with:
110+
toolchain: stable
111+
- run: cargo doc

Cargo.lock

Lines changed: 27 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ members = [
1414
"p521",
1515
"primefield",
1616
"primeorder",
17-
"sm2"
17+
"sm2",
18+
"x448"
1819
]
1920

2021
[profile.dev]
2122
opt-level = 2
2223

2324
[patch.crates-io]
25+
ed448-goldilocks = { path = "ed448-goldilocks" }
26+
elliptic-curve = { git = "https://github.com/RustCrypto/traits.git" }
2427
hash2curve = { path = "hash2curve" }
2528
primefield = { path = "primefield" }
2629
primeorder = { path = "primeorder" }

bign256/src/ecdsa.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl Debug for Signature {
166166
write!(f, "bignp256::dsa::Signature(")?;
167167

168168
for byte in self.to_bytes() {
169-
write!(f, "{:02X}", byte)?;
169+
write!(f, "{byte:02X}")?;
170170
}
171171

172172
write!(f, ")")

ed448-goldilocks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ THIS CODE HAS NOT BEEN AUDITED OR REVIEWED. USE AT YOUR OWN RISK.
1111

1212
## About
1313

14-
This crate provides a pure Rust implementation of Curve448, Edwards, Decaf, and Ristretto.
14+
This crate provides a pure Rust implementation of Curve448, Edwards, and Decaf.
1515
It is intended to be portable, fast, and safe.
1616

1717
## Usage

ed448-goldilocks/src/constants.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ pub const DECAF_BASEPOINT: DecafPoint = DecafPoint(curve::twedwards::extended::E
1313
/// $$
1414
pub const EDWARDS_BASEPOINT_ORDER: EdwardsScalar = EdwardsScalar::new(ORDER);
1515

16-
/// `BASEPOINT_ORDER` is the order of the Decaf448 basepoint, i.e.,
17-
/// $$
18-
/// \ell = 2^\{446\} + 0x8335dc163bb124b65129c96fde933d8d723a70aadc873d6d54a7bb0d.
19-
/// $$
20-
pub const DECAF_BASEPOINT_ORDER: DecafScalar = DecafScalar::new(ORDER);
21-
2216
/// `BASEPOINT_ORDER` is the order of the Curve448 basepoint, i.e.,
2317
/// $$
2418
/// \ell = 2^\{446\} + 0x8335dc163bb124b65129c96fde933d8d723a70aadc873d6d54a7bb0d.

ed448-goldilocks/src/curve/twedwards.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// This module will contain the EC arithmetic for the Twisted Edwards form of Goldilocks.
22
/// with the following affine equation : -x^2 + y^2 = 1 - 39082x^2y^2
3-
/// This curve will be used as a backend for the Goldilocks, Ristretto and Decaf through the use of isogenies.
3+
/// This curve will be used as a backend for the Goldilocks and Decaf through the use of isogenies.
44
/// It will not be exposed in the public API.
55
pub(crate) mod affine;
66
pub(crate) mod extended;

ed448-goldilocks/src/decaf/points.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::constants::{DECAF_BASEPOINT, DECAF_BASEPOINT_ORDER};
1+
use crate::constants::DECAF_BASEPOINT;
22
use crate::curve::twedwards::extended::ExtendedPoint;
33
use crate::field::FieldElement;
44
use crate::*;
@@ -226,7 +226,7 @@ impl CofactorGroup for DecafPoint {
226226
}
227227

228228
fn is_torsion_free(&self) -> Choice {
229-
(self * DECAF_BASEPOINT_ORDER).ct_eq(&Self::IDENTITY)
229+
self.ct_eq(&Self::IDENTITY)
230230
}
231231
}
232232

@@ -594,7 +594,7 @@ mod test {
594594
use crate::TWISTED_EDWARDS_BASE_POINT;
595595

596596
#[test]
597-
fn test_edwards_ristretto_operations() {
597+
fn test_edwards_decaf_operations() {
598598
// Basic test that if P1 + P2 = P3
599599
// Then Decaf(P1) + Decaf(P2) = Decaf(P3)
600600

ed448-goldilocks/src/edwards.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// This isogeny strategy does not clear the cofactor on the Goldilocks curve unless the Scalar is a multiple of 4.
99
/// or the point is known to be in the q-torsion subgroup.
1010
/// Hence, one will need to multiply by the cofactor to ensure it is cleared when using the Goldilocks curve.
11-
/// If this is a problem, one can use a different isogeny strategy (Decaf/Ristretto)
11+
/// If this is a problem, one can use a different isogeny strategy (Decaf)
1212
pub(crate) mod affine;
1313
pub(crate) mod extended;
1414
mod scalar;

0 commit comments

Comments
 (0)