#![no_std]
#![cfg_attr(docsrs, feature(doc_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",
html_root_url = "https://docs.rs/p256/0.11.0"
)]
#![forbid(unsafe_code)]
#![warn(missing_docs, rust_2018_idioms, unused_qualifications)]
#[cfg(feature = "arithmetic")]
mod arithmetic;
#[cfg(feature = "ecdh")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecdh")))]
pub mod ecdh;
#[cfg(feature = "ecdsa-core")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecdsa-core")))]
pub mod ecdsa;
#[cfg(any(feature = "test-vectors", test))]
#[cfg_attr(docsrs, doc(cfg(feature = "test-vectors")))]
pub mod test_vectors;
pub use elliptic_curve_flow::{self, bigint::U256};
#[cfg(feature = "arithmetic")]
pub use arithmetic::{
affine::AffinePoint,
projective::ProjectivePoint,
scalar::{blinded::BlindedScalar, Scalar},
};
#[cfg(feature = "pkcs8")]
#[cfg_attr(docsrs, doc(cfg(feature = "pkcs8")))]
pub use elliptic_curve_flow::pkcs8;
use elliptic_curve_flow::{consts::U33, generic_array::GenericArray};
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord)]
pub struct NistP256;
impl elliptic_curve_flow::Curve for NistP256 {
type UInt = U256;
const ORDER: U256 =
U256::from_be_hex("ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551");
}
impl elliptic_curve_flow::PrimeCurve for NistP256 {}
impl elliptic_curve_flow::PointCompression for NistP256 {
const COMPRESS_POINTS: bool = false;
}
impl elliptic_curve_flow::PointCompaction for NistP256 {
const COMPACT_POINTS: bool = false;
}
#[cfg(feature = "jwk")]
#[cfg_attr(docsrs, doc(cfg(feature = "jwk")))]
impl elliptic_curve_flow::JwkParameters for NistP256 {
const CRV: &'static str = "P-256";
}
#[cfg(feature = "pkcs8")]
impl elliptic_curve_flow::AlgorithmParameters for NistP256 {
const OID: pkcs8::ObjectIdentifier = pkcs8::ObjectIdentifier::new("1.2.840.10045.3.1.7");
}
pub type CompressedPoint = GenericArray<u8, U33>;
pub type FieldBytes = elliptic_curve_flow::FieldBytes<NistP256>;
pub type EncodedPoint = elliptic_curve_flow::sec1::EncodedPoint<NistP256>;
#[cfg(feature = "arithmetic")]
pub type NonZeroScalar = elliptic_curve_flow::NonZeroScalar<NistP256>;
#[cfg(feature = "arithmetic")]
pub type PublicKey = elliptic_curve_flow::PublicKey<NistP256>;
pub type SecretKey = elliptic_curve_flow::SecretKey<NistP256>;
#[cfg(not(feature = "arithmetic"))]
impl elliptic_curve_flow::sec1::ValidatePublicKey for NistP256 {}
#[cfg(feature = "bits")]
#[cfg_attr(docsrs, doc(cfg(feature = "bits")))]
pub type ScalarBits = elliptic_curve_flow::ScalarBits<NistP256>;