Skip to main content

oxicrypto_core/
lib.rs

1#![forbid(unsafe_code)]
2#![no_std]
3
4//! `oxicrypto-core` -- pure-Rust trait surface, error types, and secure
5//! wrappers for the OxiCrypto stack.
6//!
7//! This crate is `no_std + alloc`.  It defines the trait objects, error enum,
8//! constant-time utilities, and secret-key wrappers shared by every other
9//! `oxicrypto-*` sub-crate.  No crypto implementation lives here.
10
11extern crate alloc;
12
13pub use alloc::boxed::Box;
14pub use alloc::string::String;
15pub use alloc::vec::Vec;
16
17// Re-export `subtle` so downstream crates use a single version.
18pub use subtle::ConstantTimeEq;
19pub use zeroize::{Zeroize, ZeroizeOnDrop};
20
21// ---------------------------------------------------------------------------
22// Submodules
23// ---------------------------------------------------------------------------
24
25mod algo_id;
26mod ct;
27mod error;
28mod secret;
29pub mod traits;
30
31// ---------------------------------------------------------------------------
32// Public re-exports
33// ---------------------------------------------------------------------------
34
35pub use algo_id::{AlgorithmCategory, AlgorithmId};
36pub use ct::{ct_eq, ct_is_zero, ct_select};
37pub use error::CryptoError;
38pub use secret::{KeyPair, SecretKey, SecretVec};
39pub use traits::{
40    Aead, Hash, Kdf, Kem, KeyAgreement, KeyGenerator, Mac, PasswordHash, PasswordHashParams, Rng,
41    Signer, StreamingAead, StreamingHash, StreamingMac, Verifier,
42};
43
44// ---------------------------------------------------------------------------
45// Tests
46// ---------------------------------------------------------------------------
47
48#[cfg(test)]
49mod tests;