diff options
-rw-r--r-- | openpgp/src/crypto/backend/nettle.rs | 7 | ||||
-rw-r--r-- | openpgp/src/crypto/mod.rs | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/openpgp/src/crypto/backend/nettle.rs b/openpgp/src/crypto/backend/nettle.rs index 451774e2..5c0149fc 100644 --- a/openpgp/src/crypto/backend/nettle.rs +++ b/openpgp/src/crypto/backend/nettle.rs @@ -1 +1,8 @@ //! Implementation of Sequoia crypto API using the Nettle cryptographic library. + +use nettle::random::{Random, Yarrow}; + +/// Fills the given buffer with random data. +pub fn random<B: AsMut<[u8]>>(mut buf: B) { + Yarrow::default().random(buf.as_mut()); +} diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs index 8d2e04fd..37285c63 100644 --- a/openpgp/src/crypto/mod.rs +++ b/openpgp/src/crypto/mod.rs @@ -5,7 +5,6 @@ use std::ops::{Deref, DerefMut}; use std::fmt; use buffered_reader::BufferedReader; -use nettle::random::{Random, Yarrow}; use crate::types::HashAlgorithm; use crate::Result; @@ -14,6 +13,7 @@ pub(crate) mod aead; mod asymmetric; pub use self::asymmetric::{Signer, Decryptor, KeyPair}; mod backend; +pub use backend::random; pub(crate) mod ecdh; pub mod hash; mod keygrip; @@ -25,11 +25,6 @@ pub use s2k::S2K; pub mod sexp; pub(crate) mod symmetric; -/// Fills the given buffer with random data. -pub fn random<B: AsMut<[u8]>>(mut buf: B) { - Yarrow::default().random(buf.as_mut()); -} - /// Holds a session key. /// /// The session key is cleared when dropped. |