#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc = include_str!("../README.md")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg"
)]
#![deny(unsafe_code)] #![warn(clippy::panic, clippy::panic_in_result_fn)]
#[cfg(feature = "alloc")]
#[allow(unused_imports)]
#[macro_use]
extern crate alloc;
#[cfg(feature = "dev")]
pub mod dev;
#[cfg(feature = "ecdh")]
pub mod ecdh;
pub mod field;
#[cfg(feature = "arithmetic")]
pub mod hazmat;
#[cfg(feature = "arithmetic")]
pub mod ops;
pub mod point;
pub mod scalar;
#[cfg(feature = "sec1")]
pub mod sec1;
#[cfg(feature = "arithmetic")]
mod arithmetic;
mod error;
mod macros;
#[cfg(feature = "arithmetic")]
mod public_key;
mod secret_key;
pub use crate::{
error::{Error, Result},
field::{FieldBytes, FieldBytesSize},
scalar::ScalarValue,
secret_key::SecretKey,
};
pub use array;
pub use array::typenum::consts;
pub use bigint::{self, ByteOrder, ctutils};
pub use common;
pub use common::Generate;
pub use rand_core;
pub use subtle;
pub use zeroize;
#[cfg(any(feature = "pkcs8", feature = "sec1"))]
pub use crate::error::{DecodeError, DecodeResult};
#[cfg(feature = "pkcs8")]
pub use pkcs8;
#[cfg(feature = "arithmetic")]
pub use {
crate::{
arithmetic::{CurveArithmetic, PrimeCurveArithmetic},
point::{AffinePoint, BatchNormalize, ProjectivePoint},
public_key::PublicKey,
scalar::{NonZeroScalar, Scalar},
},
ff::{self, Field, PrimeField},
group::{self, Curve as CurveGroup, CurveAffine, Group},
};
use array::{ArraySize, sizes::U1};
use bigint::Odd;
use core::{
fmt::Debug,
ops::{Add, ShrAssign},
};
#[cfg(feature = "pkcs8")]
pub const ALGORITHM_OID: pkcs8::ObjectIdentifier =
pkcs8::ObjectIdentifier::new_unwrap("1.2.840.10045.2.1");
pub trait Curve: 'static + Copy + Clone + Debug + Default + Eq + Ord + Send + Sync {
type FieldBytesSize: ArraySize<ArrayType<u8>: Copy>
+ Add<Output: Add<U1, Output: ArraySize<ArrayType<u8>: Copy>>>
+ Add<U1, Output: ArraySize<ArrayType<u8>: Copy>>
+ Eq;
type Uint: bigint::ArrayEncoding
+ bigint::Encoding
+ bigint::FixedInteger
+ bigint::Random
+ bigint::RandomMod
+ bigint::Unsigned
+ zeroize::Zeroize
+ ShrAssign<usize>;
const ORDER: Odd<Self::Uint>;
const FIELD_ENDIANNESS: ByteOrder = ByteOrder::BigEndian;
}
pub trait PrimeCurve: Curve {}