Skip to content

Commit ad295b3

Browse files
Add decompression hints for ed25519 and rewrite curve config
A bug involving opcode collisions between short Weierstrass and twisted Edwards curves was found. To fix this, CurveConfig was rewritten and separate opcodes were given to the two types of curves.
1 parent 4710379 commit ad295b3

File tree

17 files changed

+499
-288
lines changed

17 files changed

+499
-288
lines changed

Cargo.lock

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

extensions/ecc/circuit/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ openvm-ecc-guest = { workspace = true, features = [
4444
"halo2curves",
4545
"k256",
4646
"p256",
47+
"ed25519",
4748
] }
4849
openvm-algebra-guest = { workspace = true }

extensions/ecc/circuit/src/config.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,26 @@ pub struct Rv32EccConfig {
2828
}
2929

3030
impl Rv32EccConfig {
31-
pub fn new(curves: Vec<CurveConfig>) -> Self {
32-
let primes: Vec<_> = curves
31+
pub fn new(
32+
sw_curves: Vec<CurveConfig<SwCurveCoeffs>>,
33+
te_curves: Vec<CurveConfig<TeCurveCoeffs>>,
34+
) -> Self {
35+
let sw_primes: Vec<_> = sw_curves
3336
.iter()
3437
.flat_map(|c| [c.modulus.clone(), c.scalar.clone()])
3538
.collect();
39+
let te_primes: Vec<_> = te_curves
40+
.iter()
41+
.flat_map(|c| [c.modulus.clone(), c.scalar.clone()])
42+
.collect();
43+
let primes = sw_primes.into_iter().chain(te_primes).collect();
3644
Self {
3745
system: SystemConfig::default().with_continuations(),
3846
base: Default::default(),
3947
mul: Default::default(),
4048
io: Default::default(),
4149
modular: ModularExtension::new(primes),
42-
ecc: EccExtension::new(curves),
50+
ecc: EccExtension::new(sw_curves, te_curves),
4351
}
4452
}
4553
}

0 commit comments

Comments
 (0)