diff --git a/src/lib.rs b/src/lib.rs index e40336c..bbcf2b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,6 +49,9 @@ //! ``` #![cfg_attr(not(test), no_std)] +#[cfg(not(feature = "alloc"))] +compile_error!("This crate does not yet support environments without liballoc. See https://github.com/RustCrypto/RSA/issues/51."); + #[cfg(feature = "alloc")] extern crate alloc; #[cfg(feature = "std")] @@ -67,40 +70,55 @@ extern crate hex; #[cfg(all(test, feature = "serde"))] extern crate serde_test; +#[cfg(feature = "alloc")] pub use num_bigint::BigUint; /// Useful algorithms. +#[cfg(feature = "alloc")] pub mod algorithms; /// Error types. +#[cfg(feature = "alloc")] pub mod errors; /// Supported hash functions. +#[cfg(feature = "alloc")] pub mod hash; /// Supported padding schemes. +#[cfg(feature = "alloc")] pub mod padding; #[cfg(feature = "pem")] pub use pem; +#[cfg(feature = "alloc")] mod key; +#[cfg(feature = "alloc")] mod oaep; #[cfg(feature = "std")] mod parse; +#[cfg(feature = "alloc")] mod pkcs1v15; +#[cfg(feature = "alloc")] mod pss; +#[cfg(feature = "alloc")] mod raw; +#[cfg(feature = "alloc")] pub use self::hash::Hash; +#[cfg(feature = "alloc")] pub use self::key::{PublicKey, PublicKeyParts, RSAPrivateKey, RSAPublicKey}; +#[cfg(feature = "alloc")] pub use self::padding::PaddingScheme; // Optionally expose internals if requested via feature-flag. #[cfg(not(feature = "expose-internals"))] +#[cfg(feature = "alloc")] mod internals; /// Internal raw RSA functions. #[cfg(feature = "expose-internals")] +#[cfg(feature = "alloc")] pub mod internals;