ffsend_api/crypto/
mod.rs

1pub(crate) mod api;
2pub mod b64;
3pub mod hkdf;
4pub mod key_set;
5pub mod sig;
6
7// Re-export the cryptographically secure random bytes generator
8#[cfg(feature = "crypto-openssl")]
9pub use openssl::rand::rand_bytes;
10
11/// Cryptographically secure random bytes generator.
12#[cfg(feature = "crypto-ring")]
13pub fn rand_bytes(buf: &mut [u8]) -> Result<(), ring::error::Unspecified> {
14    use ring::rand::{SecureRandom, SystemRandom};
15    SystemRandom::new().fill(buf)
16}