Skip to content

Commit 561b60e

Browse files
authored
Merge pull request #17 from SatsBridge/deps-bump-sec-audit
Deps bump sec audit
2 parents c933b46 + a940942 commit 561b60e

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ log = "0.4"
3838
num-bigint = "0.4"
3939
once_cell = "1.12.0"
4040
parking_lot = "0.12.0"
41-
pbkdf2 = { version = "0.9.0", optional = true }
41+
pbkdf2 = { version = "0.12.2", optional = true }
4242
quick_cache = "0.4.1"
4343
rand = { version = "0.8", features = ["getrandom"] , optional = true }
4444
secstr = { version = "0.5.0", features = ["serde"], optional = true }
4545
serde = { version = "1.0", features = ["derive"] }
4646
serde_json = "1.0"
47-
sha2 = { version = "0.9.9", optional = true }
47+
sha2 = { version = "0.10.8", optional = true }
4848
thiserror = "1.0"
4949
tiny-jsonrpc = { version = "0.6.0", default-features = false, optional = true }
5050
tokio = { version = "1", default-features = false, features = ["sync"] }

nekoton-utils/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ chacha20poly1305 = { version = "0.10.1", optional = true }
1616
hex = "0.4"
1717
hmac = "0.11.0"
1818
js-sys = { version = "0.3", optional = true }
19-
pbkdf2 = { version = "0.9.0", optional = true }
19+
pbkdf2 = { version = "0.12.2", optional = true }
2020
secstr = { version = "0.5.0", features = ["serde"], optional = true }
2121
serde = { version = "1.0", features = ["derive"] }
22-
sha2 = "0.9.9"
22+
sha2 = "0.10.8"
2323
thiserror = "1.0"
2424
zeroize = { version = "1", optional = true }
2525

nekoton-utils/src/encryption.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use chacha20poly1305::aead::Aead;
22
use chacha20poly1305::{ChaCha20Poly1305, Key, Nonce};
3-
use pbkdf2::pbkdf2;
3+
use pbkdf2::pbkdf2_hmac;
44
use secstr::{SecUtf8, SecVec};
55
use zeroize::Zeroize;
66

@@ -56,7 +56,7 @@ pub fn encrypt(
5656
// Calculates symmetric key from user password, using pbkdf2
5757
pub fn symmetric_key_from_password(password: &str, salt: &[u8]) -> Key {
5858
let mut pbkdf2_hash = SecVec::new(vec![0; CREDENTIAL_LEN]);
59-
pbkdf2::<hmac::Hmac<sha2::Sha256>>(
59+
pbkdf2_hmac::<sha2::Sha256>(
6060
password.as_bytes(),
6161
salt,
6262
N_ITER,

src/crypto/mnemonic/legacy.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use anyhow::Error;
22
use ed25519_dalek::Keypair;
3-
use hmac::{Mac, NewMac};
4-
use pbkdf2::pbkdf2;
3+
use pbkdf2::{
4+
hmac::{Hmac, Mac},
5+
pbkdf2_hmac,
6+
};
57

68
use super::LANGUAGE;
79

@@ -23,14 +25,13 @@ pub fn derive_from_phrase(phrase: &str) -> Result<Keypair, Error> {
2325
anyhow::bail!("Expected 24 words")
2426
}
2527

26-
let password = hmac::Hmac::<sha2::Sha512>::new_from_slice(phrase.as_bytes())
28+
let password = Hmac::<sha2::Sha512>::new_from_slice(phrase.as_bytes())
2729
.unwrap()
2830
.finalize()
2931
.into_bytes();
3032

3133
let mut res = [0; 512 / 8];
32-
pbkdf2::<hmac::Hmac<sha2::Sha512>>(&password, SALT, PBKDF_ITERATIONS, &mut res);
33-
34+
pbkdf2_hmac::<sha2::Sha512>(&password, SALT, PBKDF_ITERATIONS, &mut res);
3435
let secret = ed25519_dalek::SecretKey::from_bytes(&res[0..32])?;
3536
let public = ed25519_dalek::PublicKey::from(&secret);
3637
Ok(Keypair { secret, public })

0 commit comments

Comments
 (0)