#![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.7.2"
)]
#![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;
#[cfg(feature = "arithmetic")]
pub use arithmetic::{
affine::AffinePoint,
projective::ProjectivePoint,
scalar::blinding::BlindedScalar,
scalar::{NonZeroScalar, Scalar, ScalarBits},
};
#[cfg(feature = "pkcs8")]
#[cfg_attr(docsrs, doc(cfg(feature = "pkcs8")))]
pub use elliptic_curve::pkcs8;
use elliptic_curve::consts::U32;
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord)]
pub struct NistP256;
impl elliptic_curve::Curve for NistP256 {
type FieldSize = U32;
}
impl elliptic_curve::weierstrass::Curve for NistP256 {}
impl elliptic_curve::weierstrass::point::Compression for NistP256 {
const COMPRESS_POINTS: bool = false;
}
#[cfg(feature = "pkcs8")]
impl elliptic_curve::AlgorithmParameters for NistP256 {
const OID: pkcs8::ObjectIdentifier = pkcs8::ObjectIdentifier::new(&[1, 2, 840, 10045, 3, 1, 7]);
}
pub type FieldBytes = elliptic_curve::FieldBytes<NistP256>;
pub type EncodedPoint = elliptic_curve::sec1::EncodedPoint<NistP256>;
#[cfg(feature = "arithmetic")]
pub type PublicKey = elliptic_curve::PublicKey<NistP256>;
#[cfg(feature = "zeroize")]
#[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))]
pub type SecretKey = elliptic_curve::SecretKey<NistP256>;
#[cfg(feature = "zeroize")]
#[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))]
pub type SecretBytes = elliptic_curve::secret_key::SecretBytes<NistP256>;
#[cfg(all(not(feature = "arithmetic"), feature = "zeroize"))]
impl elliptic_curve::secret_key::SecretValue for NistP256 {
type Secret = SecretBytes;
fn from_secret_bytes(bytes: &FieldBytes) -> Option<SecretBytes> {
Some(bytes.clone().into())
}
}