]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Changes to make the rust crypto::mod tests compile
authorNick Mathewson <nickm@torproject.org>
Sat, 16 Jun 2018 17:22:44 +0000 (13:22 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 16 Jun 2018 17:22:44 +0000 (13:22 -0400)
The digest tests don't link yet, though.

src/rust/crypto/lib.rs
src/rust/crypto/rand/mod.rs
src/rust/crypto/rand/rng.rs

index b349664dbefa8f07fecf39fb4241100c90e02e83..b4250dec34118eef91c8c177cfd98a606ef2135b 100644 (file)
 // External crates from cargo or TOR_RUST_DEPENDENCIES.
 extern crate digest;
 extern crate libc;
+extern crate rand_core;
+
+// External dependencies for tests.
+#[cfg(test)]
+extern crate rand as rand_crate;
 
 // Our local crates.
 extern crate external;
+#[cfg(not(test))]
+#[macro_use]
+extern crate tor_log;
 
 pub mod digests;  // Unfortunately named "digests" plural to avoid name conflict with the digest crate
 pub mod rand;
index 6b3058ad5845e3ecc661b9c580101d2908fb2bd4..82d02a70bb5b287897b8caa0c8a3153e7e53835d 100644 (file)
@@ -2,15 +2,5 @@
 // Copyright (c) 2018, isis agora lovecruft
 // See LICENSE for licensing information
 
-// External dependencies
-#[cfg(test)]
-extern crate rand;
-extern crate rand_core;
-
 // Internal dependencies
-extern crate external;
-#[cfg(not(test))]
-#[macro_use]
-extern crate tor_log;
-
 pub mod rng;
index d5fae8a32eb6be410e409473465eda569d7332dd..07a0a7bdc70c3418f566679eb749309024d32bb4 100644 (file)
@@ -130,8 +130,8 @@ mod internal {
 #[cfg(test)]
 mod internal {
     // It doesn't matter if we pretend ChaCha is a CSPRNG in tests.
-    pub use rand::ChaChaRng as TorRng;
-    pub use rand::ChaChaRng as TorStrongestRng;
+    pub use rand_crate::ChaChaRng as TorRng;
+    pub use rand_crate::ChaChaRng as TorStrongestRng;
 }
 
 // Finally, expose the public functionality of whichever appropriate internal