Browse Source

Merge remote-tracking branch 'isis-github/bug26106'

Nick Mathewson 6 years ago
parent
commit
1442e818b6

+ 9 - 18
src/rust/Cargo.lock

@@ -5,7 +5,11 @@ dependencies = [
  "digest 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "external 0.0.1",
  "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.5.0-pre.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand_core 0.2.0-pre.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "smartlist 0.0.1",
+ "tor_allocate 0.0.1",
+ "tor_log 0.1.0",
 ]
 
 [[package]]
@@ -51,28 +55,15 @@ dependencies = [
 
 [[package]]
 name = "rand"
-version = "0.0.1"
-dependencies = [
- "external 0.0.1",
- "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand 0.5.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand_core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "tor_allocate 0.0.1",
- "tor_log 0.1.0",
- "tor_util 0.0.1",
-]
-
-[[package]]
-name = "rand"
-version = "0.5.0-pre.1"
+version = "0.5.0-pre.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "rand_core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand_core 0.2.0-pre.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "rand_core"
-version = "0.1.0"
+version = "0.2.0-pre.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -123,6 +114,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum digest 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "00a49051fef47a72c9623101b19bd71924a45cca838826caae3eaa4d00772603"
 "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
 "checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff"
-"checksum rand 0.5.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7d7a7728c20bfd9fcc6e713e748e787c3d00e5ffd139b3ad1b5be92c5dfbaad5"
-"checksum rand_core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0224284424a4b818387b58d59336c288f99b48f69681aa60cc681fe038bbca5d"
+"checksum rand 0.5.0-pre.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3795e4701d9628a63a84d0289e66279883b40df165fca7caed7b87122447032a"
+"checksum rand_core 0.2.0-pre.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7255ffbdb188d5be1a69b6f9f3cf187de4207430b9e79ed5b76458a6b20de9a"
 "checksum typenum 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a99dc6780ef33c78780b826cf9d2a78840b72cae9474de4bcaf9051e60ebbd"

+ 0 - 1
src/rust/Cargo.toml

@@ -3,7 +3,6 @@ members = [
     "crypto",
     "external",
     "protover",
-    "rand",
     "smartlist",
     "tor_allocate",
     "tor_log",

+ 11 - 4
src/rust/crypto/Cargo.toml

@@ -13,9 +13,16 @@ crate_type = ["rlib", "staticlib"]
 [dependencies]
 libc = "=0.2.39"
 digest = "=0.7.2"
+rand_core = "=0.2.0-pre.0"
 
-[dependencies.external]
-path = "../external"
+external = { path = "../external" }
+smartlist = { path = "../smartlist" }
+tor_allocate = { path = "../tor_allocate" }
+tor_log = { path = "../tor_log" }
+
+[dev-dependencies]
+rand = { version = "=0.5.0-pre.2", default-features = false }
+
+[features]
+testing = ["tor_log/testing"]
 
-[dependencies.smartlist]
-path = "../smartlist"

+ 0 - 0
src/rust/rand/lib.rs → src/rust/crypto/rand/mod.rs


+ 2 - 2
src/rust/rand/rng.rs → src/rust/crypto/rand/rng.rs

@@ -43,7 +43,7 @@ mod internal {
     impl TorRng {
         // C_RUST_COUPLED: `crypto_seed_rng()` /src/common/crypto_rand.c
         #[allow(dead_code)]
-        fn new() -> Self {
+        pub fn new() -> Self {
             if !c_tor_crypto_seed_rng() {
                 tor_log_msg!(LogSeverity::Warn, LogDomain::General,
                              "TorRng::from_seed()",
@@ -90,7 +90,7 @@ mod internal {
     impl TorStrongestRng {
         // C_RUST_COUPLED: `crypto_seed_rng()` /src/common/crypto_rand.c
         #[allow(dead_code)]
-        fn new() -> Self {
+        pub fn new() -> Self {
             if !c_tor_crypto_seed_rng() {
                 tor_log_msg!(LogSeverity::Warn, LogDomain::General,
                              "TorStrongestRng::from_seed()",

+ 2 - 3
src/rust/include.am

@@ -8,6 +8,8 @@ EXTRA_DIST +=\
 	src/rust/crypto/lib.rs \
 	src/rust/crypto/digests/mod.rs \
 	src/rust/crypto/digests/sha2.rs \
+	src/rust/crypto/rand/mod.rs \
+	src/rust/crypto/rand/rng.rs \
 	src/rust/external/Cargo.toml \
 	src/rust/external/crypto_digest.rs \
 	src/rust/external/crypto_rand.rs \
@@ -20,9 +22,6 @@ EXTRA_DIST +=\
 	src/rust/protover/lib.rs \
 	src/rust/protover/protover.rs \
 	src/rust/protover/tests/protover.rs \
-	src/rust/rand/Cargo.toml \
-	src/rust/rand/lib.rs \
-	src/rust/rand/rng.rs \
 	src/rust/smartlist/Cargo.toml \
 	src/rust/smartlist/lib.rs \
 	src/rust/smartlist/smartlist.rs \

+ 0 - 27
src/rust/rand/Cargo.toml

@@ -1,27 +0,0 @@
-# TODO: Note that this package should be merged into the "crypto" crate after #24659 is merged.
-
-[package]
-authors = ["The Tor Project"]
-version = "0.0.1"
-name = "rand"
-publish = false
-
-[features]
-testing = ["tor_log/testing"]
-
-[dependencies]
-libc = "=0.2.39"
-rand_core = "=0.1.0"
-
-external = { path = "../external" }
-tor_allocate = { path = "../tor_allocate" }
-tor_log = { path = "../tor_log" }
-tor_util = { path = "../tor_util" }
-
-[dev-dependencies]
-rand = { version = "=0.5.0-pre.1", default-features = false }
-
-[lib]
-name = "rand"
-path = "lib.rs"
-crate_type = ["rlib", "staticlib"]