diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/primeorder/src/lib.rs | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/primeorder/src/lib.rs')
-rw-r--r-- | vendor/primeorder/src/lib.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/primeorder/src/lib.rs b/vendor/primeorder/src/lib.rs new file mode 100644 index 000000000..0847a995a --- /dev/null +++ b/vendor/primeorder/src/lib.rs @@ -0,0 +1,46 @@ +#![no_std] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg", + html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg" +)] +#![forbid(unsafe_code)] +#![warn(missing_docs, rust_2018_idioms, unused_qualifications)] +#![doc = include_str!("../README.md")] + +#[cfg(feature = "dev")] +pub mod dev; +pub mod point_arithmetic; + +mod affine; +mod field; +mod projective; + +pub use crate::{affine::AffinePoint, projective::ProjectivePoint}; +pub use elliptic_curve::{self, point::Double, Field, FieldBytes, PrimeCurve, PrimeField}; + +use elliptic_curve::CurveArithmetic; + +/// Parameters for elliptic curves of prime order which can be described by the +/// short Weierstrass equation. +pub trait PrimeCurveParams: + PrimeCurve + + CurveArithmetic + + CurveArithmetic<AffinePoint = AffinePoint<Self>> + + CurveArithmetic<ProjectivePoint = ProjectivePoint<Self>> +{ + /// Base field element type. + type FieldElement: PrimeField<Repr = FieldBytes<Self>>; + + /// [Point arithmetic](point_arithmetic) implementation, might be optimized for this specific curve + type PointArithmetic: point_arithmetic::PointArithmetic<Self>; + + /// Coefficient `a` in the curve equation. + const EQUATION_A: Self::FieldElement; + + /// Coefficient `b` in the curve equation. + const EQUATION_B: Self::FieldElement; + + /// Generator point's affine coordinates: (x, y). + const GENERATOR: (Self::FieldElement, Self::FieldElement); +} |