1#![no_std]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3#![doc = include_str!("../README.md")]
4#![doc(
5 html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
6 html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
7)]
8
9#[cfg(feature = "alloc")]
10#[macro_use]
11extern crate alloc;
12#[cfg(feature = "std")]
13extern crate std;
14
15pub mod mul_backend;
16#[cfg(feature = "hash2curve")]
17pub mod osswu;
18pub mod point_arithmetic;
19
20mod affine;
21#[cfg(feature = "dev")]
22mod dev;
23mod projective;
24mod tables;
25
26pub use crate::{
27 affine::AffinePoint,
28 mul_backend::MulBackend,
29 projective::ProjectivePoint,
30 tables::{LookupTable, Radix16Decomposition, Radix16Digits},
31};
32pub use elliptic_curve::{
33 self, Field, FieldBytes, PrimeCurve, PrimeField, Scalar,
34 array::{self, ArraySize, sizes::U1},
35 bigint::{ByteOrder, modular::Retrieve},
36 hazmat::FieldArithmetic,
37 ops::Double,
38};
39pub use primefield::{FieldExt, PrimeFieldExt};
40pub use wnaf::{self, WnafSize};
41
42use elliptic_curve::{Curve, CurveArithmetic, sec1};
43
44#[cfg(feature = "basepoint-table")]
45pub use crate::tables::BasepointTable;
46
47pub trait PrimeCurveParams:
50 Curve<FieldBytesSize: sec1::ModulusSize>
51 + CurveArithmetic<
52 AffinePoint = AffinePoint<Self>,
53 ProjectivePoint = ProjectivePoint<Self>,
54 Scalar: PrimeFieldExt + WnafSize,
55 > + FieldArithmetic<FieldElement: PrimeFieldExt>
56 + PrimeCurve
57{
58 type PointArithmetic: point_arithmetic::PointArithmetic<Self>;
60
61 type Backend: MulBackend<Self>;
63
64 const EQUATION_A: Self::FieldElement;
66
67 const EQUATION_B: Self::FieldElement;
69
70 const GENERATOR: (Self::FieldElement, Self::FieldElement);
72}
73
74#[cfg(feature = "basepoint-table")]
76pub trait PrimeCurveWithBasepointTable<const WINDOW_SIZE: usize>:
77 PrimeCurve + CurveArithmetic
78{
79 const BASEPOINT_TABLE: &'static BasepointTable<
81 <Self as CurveArithmetic>::ProjectivePoint,
82 WINDOW_SIZE,
83 >;
84}