openvm_ecc_guest/
lib.rs

1#![no_std]
2extern crate self as openvm_ecc_guest;
3#[macro_use]
4extern crate alloc;
5
6pub use once_cell;
7pub use openvm_algebra_guest as algebra;
8pub use openvm_ecc_sw_macros as sw_macros;
9use strum_macros::FromRepr;
10
11mod affine_point;
12pub use affine_point::*;
13mod group;
14pub use group::*;
15mod msm;
16pub use msm::*;
17
18/// Optimized ECDSA implementation with the same functional interface as the `ecdsa` crate
19pub mod ecdsa;
20/// Weierstrass curve traits
21pub mod weierstrass;
22
23/// This is custom-1 defined in RISC-V spec document
24pub const OPCODE: u8 = 0x2b;
25pub const SW_FUNCT3: u8 = 0b001;
26
27/// Short Weierstrass curves are configurable.
28/// The funct7 field equals `curve_idx * SHORT_WEIERSTRASS_MAX_KINDS + base_funct7`.
29#[derive(Debug, Copy, Clone, PartialEq, Eq, FromRepr)]
30#[repr(u8)]
31pub enum SwBaseFunct7 {
32    SwAddNe = 0,
33    SwDouble,
34    SwSetup,
35}
36
37impl SwBaseFunct7 {
38    pub const SHORT_WEIERSTRASS_MAX_KINDS: u8 = 8;
39}