summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNora Widdecke <nora@sequoia-pgp.org>2021-12-03 14:39:38 +0100
committerNora Widdecke <nora@sequoia-pgp.org>2021-12-13 19:01:14 +0100
commit22390768f9812ae5d46214fcb8621dbad526cd87 (patch)
tree25676b060282280319b27bc643401a1074d5785b
parent321b0cc381f3c44f81cfc4a9cf502be169262d14 (diff)
openpgp: Ensure rand:0.7 for rust-crypto.
- ed25519-dalek requires rand:0.7 types, so make sure they are used, and not the ones form rand:0.8.
-rw-r--r--openpgp/Cargo.toml6
-rw-r--r--openpgp/src/crypto/backend/rust.rs4
-rw-r--r--openpgp/src/crypto/backend/rust/asymmetric.rs2
-rw-r--r--openpgp/src/crypto/backend/rust/ecdh.rs2
4 files changed, 7 insertions, 7 deletions
diff --git a/openpgp/Cargo.toml b/openpgp/Cargo.toml
index 29a553b2..bf6fe916 100644
--- a/openpgp/Cargo.toml
+++ b/openpgp/Cargo.toml
@@ -63,7 +63,7 @@ idea = { version = "0.3.0", optional = true }
md-5 = { version = "0.9.1", optional = true }
num-bigint-dig = { version = "0.6", default-features = false, optional = true }
p256 = { version = "0.8", optional = true, features = ["ecdh", "ecdsa"] }
-rand = { version = "0.7.3", optional = true }
+rand07 = { package = "rand", version = "0.7.3", optional = true }
rand_core = { version = "0.6", optional = true }
ripemd160 = { version = "0.9.1", optional = true }
rsa = { version = "0.3.0", optional = true }
@@ -80,7 +80,7 @@ winapi = { version = "0.3.8", default-features = false, features = ["bcrypt"], o
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
chrono = { version = "0.4.10", default-features = false, features = ["std", "wasmbind"] }
getrandom = { version = "0.2", features = ["js"] }
-rand = { version = "0.7", features = ["wasm-bindgen"] }
+rand07 = { package = "rand", version = "0.7", features = ["wasm-bindgen"] }
[build-dependencies]
lalrpop = ">=0.17"
@@ -98,7 +98,7 @@ default = ["compression", "crypto-nettle"]
crypto-nettle = ["nettle"]
crypto-rust = [
"aes", "block-modes", "block-padding", "blowfish", "cast5", "cipher", "des",
- "digest", "eax", "ed25519-dalek", "generic-array", "idea", "md-5", "num-bigint-dig", "rand",
+ "digest", "eax", "ed25519-dalek", "generic-array", "idea", "md-5", "num-bigint-dig", "rand07",
"ripemd160", "rsa", "sha-1", "sha2", "twofish", "typenum", "x25519-dalek", "p256",
"rand_core", "rand_core/getrandom", "ecdsa"
]
diff --git a/openpgp/src/crypto/backend/rust.rs b/openpgp/src/crypto/backend/rust.rs
index cf08f26d..1bc6bf05 100644
--- a/openpgp/src/crypto/backend/rust.rs
+++ b/openpgp/src/crypto/backend/rust.rs
@@ -16,8 +16,8 @@ pub mod symmetric;
/// The output may be used as session keys or to derive long-term
/// cryptographic keys from.
pub fn random<B: AsMut<[u8]>>(mut buf: B) {
- use rand::rngs::OsRng;
- use rand::RngCore;
+ use rand07::rngs::OsRng;
+ use rand07::RngCore;
OsRng.fill_bytes(buf.as_mut())
}
diff --git a/openpgp/src/crypto/backend/rust/asymmetric.rs b/openpgp/src/crypto/backend/rust/asymmetric.rs
index 43a53dbc..5ca2cce8 100644
--- a/openpgp/src/crypto/backend/rust/asymmetric.rs
+++ b/openpgp/src/crypto/backend/rust/asymmetric.rs
@@ -8,7 +8,7 @@ use std::convert::TryFrom;
use std::time::SystemTime;
use num_bigint_dig::{traits::ModInverse, BigUint};
-use rand::rngs::OsRng;
+use rand07::rngs::OsRng;
use rsa::{PaddingScheme, RSAPublicKey, RSAPrivateKey, PublicKey, PublicKeyParts, Hash};
use crate::{Error, Result};
diff --git a/openpgp/src/crypto/backend/rust/ecdh.rs b/openpgp/src/crypto/backend/rust/ecdh.rs
index ac306ff7..8531013d 100644
--- a/openpgp/src/crypto/backend/rust/ecdh.rs
+++ b/openpgp/src/crypto/backend/rust/ecdh.rs
@@ -2,7 +2,7 @@
use std::convert::TryInto;
-use rand::rngs::OsRng;
+use rand07::rngs::OsRng;
use crate::{Error, Result};
use crate::crypto::SessionKey;