Skip to main content

dcrypt_internal/
lib.rs

1//! Internal utility functions for the dcrypt library
2//!
3//! This crate provides low-level shared utilities. The dcrypt facade publicly
4//! re-exports its caller-supplied RNG traits; other items are
5//! implementation-oriented and have no separate stability promise.
6
7#![cfg_attr(not(feature = "std"), no_std)]
8#![forbid(unsafe_code)]
9
10#[cfg(any(feature = "alloc", feature = "std"))]
11extern crate alloc;
12
13pub mod constant_time;
14pub mod endian;
15pub mod random;
16pub mod zeroing;
17
18pub use constant_time::*;
19pub use endian::*;
20pub use random::*;
21pub use zeroing::*;
22
23#[cfg(feature = "simd")]
24pub mod simd {
25    //! SIMD utility functions
26
27    /// Check if SIMD is available
28    pub fn is_available() -> bool {
29        #[cfg(target_feature = "sse2")]
30        {
31            true
32        }
33
34        #[cfg(not(target_feature = "sse2"))]
35        {
36            false
37        }
38    }
39}