Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.

Upgrades version of ed25519-dalek #104

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 68 additions & 71 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions libursa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ecdsa_secp256k1 = ["amcl", "arrayref", "failure", "hex", "rand", "rand_chacha",
ecdsa_secp256k1_native = ["arrayref", "failure", "hex", "log", "rand", "secp256k1", "rand_chacha", "sha2/std", "zeroize"]
ecdsa_secp256k1_asm = ["arrayref", "failure", "hex", "log", "rand", "secp256k1", "rand_chacha", "sha2/asm", "zeroize"]
ed25519 = ["arrayref", "ed25519-dalek/std", "ed25519-dalek/u64_backend", "hex", "rand", "rand_chacha", "sha2/std", "zeroize"]
ed25519_asm = ["arrayref", "ed25519-dalek/nightly", "ed25519-dalek/avx2_backend", "hex", "rand", "rand_chacha", "sha2/asm", "zeroize"]
ed25519_asm = ["arrayref", "ed25519-dalek/nightly", "ed25519-dalek/simd_backend", "hex", "rand", "rand_chacha", "sha2/asm", "zeroize"]
encryption = ["aescbc", "aesgcm", "chacha20poly1305"]
encryption_asm = ["aescbc_native", "aesgcm_native", "chacha20poly1305_native"]
ffi = ["failure", "ffi-support", "logger", "serde", "serde_json", "time"]
Expand Down Expand Up @@ -118,25 +118,25 @@ block-padding = { version = "0.1", optional = true }
clear_on_drop = { version = "0.2.3", optional = true }
console_error_panic_hook = { version = "0.1.5", optional = true }
curve25519-dalek = { version = "=1.2.3", default-features = false, optional = true }
ed25519-dalek = { version = "=1.0.0-pre.2", default-features = false, optional = true }
ed25519-dalek = { version = "=1.0.0-pre.3", default-features = false, optional = true }
env_logger = { version = "0.7.0", optional = true }
failure = { version = "0.1.6", optional = true }
ffi-support = { version = "0.4", optional = true }
glass_pumpkin = { version = "0.3", optional = true }
glass_pumpkin = { version = "0.4", optional = true }
hex = { version = "0.4.0", optional = true }
hmac = { version = "0.7", optional = true }
int_traits = { version = "0.1.1", optional = true }
js-sys = { version = "0.3.13", optional = true }
lazy_static = { version = "1.4", optional = true }
libsodium-ffi = { version = "0.2.2", optional = true }
log = { version = "0.4.8", optional = true }
num-bigint = { version = "0.2", features = ["rand"], optional = true }
num-integer = { version = "0.1", optional = true }
num-traits = { version = "0.2", optional = true }
num-bigint = { version = "0.3.0", features = ["rand"], optional = true}
num-integer = { version = "=0.1.42", optional = true }
num-traits = { version = "=0.2.11", optional = true }
openssl = { version = "0.10", optional = true }
# TODO: Find out if the wasm-bindgen feature can be made dependent on our own wasm feature
rand = { version = "=0.6.5", features = ["wasm-bindgen"], optional = true }
rand_chacha = { version = "=0.1.1", optional = true }
rand = { version = "=0.7", features = ["wasm-bindgen"], optional = true }
rand_chacha = { version = "=0.2.0", optional = true }
rustchacha20poly1305 = { version = "0.5.0", package = "chacha20poly1305", optional = true }
rustlibsecp256k1 = { version = "0.3", package = "libsecp256k1", optional = true }
secp256k1 = { version = "0.17", optional = true, features = ["rand", "serde"]}
Expand All @@ -147,7 +147,7 @@ sha3 = { version = "0.8", optional = true }
subtle = { version = "2.2.1", optional = true }
time = { version = "0.1", optional = true }
wasm-bindgen = { version = "0.2", optional = true, features = ["serde-serialize"] }
x25519-dalek = { version = "=0.5.2", optional = true, default-features = false }
x25519-dalek = { version = "=0.6.0", optional = true, default-features = false }
zeroize = { version = "1.1", features = ["zeroize_derive"], optional = true }

[dev-dependencies]
Expand Down
10 changes: 5 additions & 5 deletions libursa/src/bn/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl BigNumber {
) -> UrsaCryptoResult<BigNumber> {
let mut res;
let mut iteration = 0;
let mut rng = OsRng::new()?;
let mut rng = OsRng::default();
let mut start = match start.bn.to_biguint() {
Some(bn) => bn,
None => {
Expand Down Expand Up @@ -127,13 +127,13 @@ impl BigNumber {
}

pub fn rand(size: usize) -> UrsaCryptoResult<BigNumber> {
let mut rng = OsRng::new()?;
let res = rng.gen_biguint(size).to_bigint();
let mut rng = OsRng::default();
let res = rng.gen_biguint(size as u64).to_bigint();
Ok(BigNumber { bn: res.unwrap() })
}

pub fn rand_range(&self) -> UrsaCryptoResult<BigNumber> {
let mut rng = OsRng::new()?;
let mut rng = OsRng::default();
let res = rng.gen_bigint_range(&BigInt::zero(), &self.bn);
match res.to_bigint() {
Some(bn) => Ok(BigNumber { bn }),
Expand Down Expand Up @@ -356,7 +356,7 @@ impl BigNumber {

match a.bn.to_u64() {
Some(num) => Ok(BigNumber {
bn: self.bn.pow(num),
bn: self.bn.clone().pow(num),
}),
None => Err(UrsaCryptoError::from_msg(
UrsaCryptoErrorKind::InvalidState,
Expand Down
Loading