#![deny(unused_attributes, unused_imports, unused_mut, unused_must_use)]
#![allow(non_snake_case)]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(trivial_casts, trivial_numeric_casts, unused, clippy::mod_module_files)]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#[cfg(all(feature = "alloc", not(feature = "std")))]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::{boxed::Box, vec::Vec};
#[cfg(feature = "std")]
use std::{boxed::Box, vec::Vec};
#[macro_use]
pub(crate) mod macros;
pub use elliptic_curve;
pub use rand_core;
pub use sha3;
pub use subtle;
pub mod x448;
pub(crate) mod constants;
pub(crate) mod curve;
pub(crate) mod decaf;
pub(crate) mod field;
pub(crate) mod ristretto;
#[cfg(feature = "signing")]
pub(crate) mod sign;
pub(crate) use field::{GOLDILOCKS_BASE_POINT, TWISTED_EDWARDS_BASE_POINT};
pub use curve::{
AffinePoint, CompressedEdwardsY, EdwardsPoint, MontgomeryPoint, ProjectiveMontgomeryPoint,
};
pub use decaf::{AffinePoint as DecafAffinePoint, CompressedDecaf, DecafPoint};
pub use field::{Scalar, ScalarBytes, WideScalarBytes, MODULUS_LIMBS, ORDER, WIDE_ORDER};
pub use ristretto::{CompressedRistretto, RistrettoPoint};
#[cfg(feature = "signing")]
pub use sign::*;
use elliptic_curve::{
bigint::{ArrayEncoding, U448},
generic_array::typenum::U57,
point::PointCompression,
Curve, FieldBytesEncoding, PrimeCurve,
};
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Ed448;
pub type Ed448FieldBytes = elliptic_curve::FieldBytes<Ed448>;
pub type Ed448ScalarBits = elliptic_curve::scalar::ScalarBits<Ed448>;
pub type Ed448NonZeroScalar = elliptic_curve::NonZeroScalar<Ed448>;
unsafe impl Send for Ed448 {}
unsafe impl Sync for Ed448 {}
impl Curve for Ed448 {
type FieldBytesSize = U57;
type Uint = U448;
const ORDER: U448 = ORDER;
}
impl PrimeCurve for Ed448 {}
impl PointCompression for Ed448 {
const COMPRESS_POINTS: bool = true;
}
impl FieldBytesEncoding<Ed448> for U448 {
fn decode_field_bytes(field_bytes: &Ed448FieldBytes) -> Self {
U448::from_le_slice(field_bytes)
}
fn encode_field_bytes(&self) -> Ed448FieldBytes {
let mut data = Ed448FieldBytes::default();
data.copy_from_slice(&self.to_le_byte_array()[..]);
data
}
}
#[cfg(feature = "zeroize")]
impl elliptic_curve::CurveArithmetic for Ed448 {
type AffinePoint = AffinePoint;
type ProjectivePoint = EdwardsPoint;
type Scalar = Scalar;
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Decaf448;
pub type Decaf448FieldBytes = elliptic_curve::FieldBytes<Decaf448>;
pub type Decaf448ScalarBits = elliptic_curve::scalar::ScalarBits<Decaf448>;
pub type Decaf448NonZeroScalar = elliptic_curve::NonZeroScalar<Decaf448>;
unsafe impl Send for Decaf448 {}
unsafe impl Sync for Decaf448 {}
impl Curve for Decaf448 {
type FieldBytesSize = U57;
type Uint = U448;
const ORDER: U448 = ORDER;
}
impl PrimeCurve for Decaf448 {}
impl PointCompression for Decaf448 {
const COMPRESS_POINTS: bool = true;
}
impl FieldBytesEncoding<Decaf448> for U448 {
fn decode_field_bytes(field_bytes: &Decaf448FieldBytes) -> Self {
U448::from_le_slice(field_bytes)
}
fn encode_field_bytes(&self) -> Decaf448FieldBytes {
let mut data = Decaf448FieldBytes::default();
data.copy_from_slice(&self.to_le_byte_array()[..]);
data
}
}
#[cfg(feature = "zeroize")]
impl elliptic_curve::CurveArithmetic for Decaf448 {
type AffinePoint = DecafAffinePoint;
type ProjectivePoint = DecafPoint;
type Scalar = Scalar;
}