ethrex_crypto/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[cfg(not(feature = "std"))]
4extern crate alloc;
5
6pub mod blake2f;
7#[cfg(feature = "blst")]
8mod bls_blst;
9mod bn254;
10pub mod keccak;
11pub mod kzg;
12#[cfg(feature = "std")]
13mod modexp_montgomery;
14pub mod native;
15#[cfg(feature = "aws-lc-rs")]
16mod p256_awslc;
17pub mod provider;
18#[cfg(feature = "std")]
19mod safegcd;
20pub mod u256_div;
21pub use native::NativeCrypto;
22pub use provider::{Crypto, CryptoError};
23
24/// `true` when `NativeCrypto` routes `secp256r1_verify` through the native
25/// aws-lc-rs backend; `false` when it falls back to the portable `p256` trait
26/// default (e.g. zkVM guest builds). Differential tests assert this so they
27/// fail loudly instead of silently comparing the pure-Rust backend to itself.
28pub const NATIVE_P256_BACKEND: bool = cfg!(feature = "aws-lc-rs");
29
30/// `true` when `NativeCrypto` routes BLS12-381 through the native blst backend;
31/// `false` when it falls back to the portable `bls12_381` trait default (e.g.
32/// zkVM guest builds). Differential tests assert this so they fail loudly
33/// instead of silently comparing the pure-Rust backend to itself.
34pub const NATIVE_BLS_BACKEND: bool = cfg!(feature = "blst");