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