matrix-sdk: Upgrade our deps

This commit is contained in:
Damir Jelić 2021-06-21 16:42:38 +02:00
parent 43e213fd67
commit 17097f4d42
9 changed files with 94 additions and 80 deletions

View file

@ -19,6 +19,6 @@ base64 = "0.13.0"
byteorder = "1.4.3"
image = { version = "0.23.14", optional = true }
qrcode = { version = "0.12.0", default-features = false }
rqrr = { version = "0.3.2" , optional = true }
rqrr = { version = "0.3.2", optional = true }
ruma-identifiers = { version = "0.19.3", git = "https://github.com/ruma/ruma", rev = "d73ab8add" }
thiserror = "1.0.24"
thiserror = "1.0.25"

View file

@ -32,15 +32,15 @@ docs = ["encryption", "sled_cryptostore", "sled_state_store", "sso_login"]
[dependencies]
dashmap = "4.0.2"
futures = "0.3.12"
http = "0.2.3"
serde_json = "1.0.61"
thiserror = "1.0.23"
tracing = "0.1.22"
url = "2.2.0"
zeroize = "1.2.0"
futures = "0.3.15"
http = "0.2.4"
serde_json = "1.0.64"
thiserror = "1.0.25"
tracing = "0.1.26"
url = "2.2.2"
zeroize = "1.3.0"
mime = "0.3.16"
rand = { version = "0.8.2", optional = true }
rand = { version = "0.8.4", optional = true }
bytes = "1.0.1"
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
@ -51,7 +51,7 @@ path = "../matrix_sdk_base"
default_features = false
[dependencies.reqwest]
version = "0.11.0"
version = "0.11.3"
default_features = false
[dependencies.ruma]
@ -61,12 +61,12 @@ rev = "d73ab8add"
features = ["client-api-c", "compat", "unstable-pre-spec"]
[dependencies.tokio-stream]
version = "0.1.4"
version = "0.1.6"
features = ["net"]
optional = true
[dependencies.warp]
version = "0.3.0"
version = "0.3.1"
default-features = false
optional = true
@ -75,7 +75,7 @@ version = "0.3.0"
features = ["tokio"]
[dependencies.tracing-futures]
version = "0.2.4"
version = "0.2.5"
default-features = false
features = ["std", "std-future"]
@ -83,7 +83,7 @@ features = ["std", "std-future"]
futures-timer = "3.0.2"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
version = "1.1.0"
version = "1.7.1"
default-features = false
features = ["fs", "rt"]
@ -92,13 +92,13 @@ version = "3.0.2"
features = ["wasm-bindgen"]
[dev-dependencies]
dirs = "3.0.1"
dirs = "3.0.2"
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
serde_json = "1.0.61"
tracing-subscriber = "0.2.15"
tokio = { version = "1.7.1", default-features = false, features = ["rt-multi-thread", "macros"] }
serde_json = "1.0.64"
tracing-subscriber = "0.2.18"
tempfile = "3.2.0"
mockito = "0.29.0"
mockito = "0.30.0"
lazy_static = "1.4.0"
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }

View file

@ -10,11 +10,11 @@ edition = "2018"
crate-type = ["cdylib"]
[dependencies]
url = "2.2.1"
wasm-bindgen = { version = "0.2.72", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4.22"
url = "2.2.2"
wasm-bindgen = { version = "0.2.74", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4.24"
console_error_panic_hook = "0.1.6"
web-sys = { version = "0.3.49", features = ["console"] }
web-sys = { version = "0.3.51", features = ["console"] }
[dependencies.matrix-sdk]
path = "../.."

View file

@ -27,43 +27,43 @@ docs = ["encryption", "sled_cryptostore"]
dashmap = "4.0.2"
lru = "0.6.5"
ruma = { version = "0.1.2", features = ["client-api-c", "unstable-pre-spec"], git = "https://github.com/ruma/ruma", rev = "d73ab8add" }
serde = { version = "1.0.122", features = ["rc"] }
serde_json = "1.0.61"
tracing = "0.1.22"
serde = { version = "1.0.126", features = ["rc"] }
serde_json = "1.0.64"
tracing = "0.1.26"
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
matrix-sdk-crypto = { version = "0.2.0", path = "../matrix_sdk_crypto", optional = true }
# Misc dependencies
thiserror = "1.0.23"
futures = "0.3.12"
zeroize = { version = "1.2.0", features = ["zeroize_derive"] }
thiserror = "1.0.25"
futures = "0.3.15"
zeroize = { version = "1.3.0", features = ["zeroize_derive"] }
# Deps for the sled state store
sled = { version = "0.34.6", optional = true }
chacha20poly1305 = { version = "0.7.1", optional = true }
pbkdf2 = { version = "0.6.0", default-features = false, optional = true }
hmac = { version = "0.10.1", optional = true }
sha2 = { version = "0.9.2", optional = true }
rand = { version = "0.8.2", optional = true }
chacha20poly1305 = { version = "0.8.0", optional = true }
pbkdf2 = { version = "0.8.0", default-features = false, optional = true }
hmac = { version = "0.11.0", optional = true }
sha2 = { version = "0.9.5", optional = true }
rand = { version = "0.8.4", optional = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
version = "1.1.0"
version = "1.7.1"
default-features = false
features = ["sync", "fs"]
[dev-dependencies]
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
http = "0.2.3"
http = "0.2.4"
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
tokio = { version = "1.7.1", default-features = false, features = ["rt-multi-thread", "macros"] }
tempfile = "3.2.0"
rustyline = "7.1.0"
rustyline = "8.2.0"
rustyline-derive = "0.4.0"
atty = "0.2.14"
clap = "2.33.3"
syntect = "4.5.0"
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.19"
wasm-bindgen-test = "0.3.24"

View file

@ -11,21 +11,21 @@ repository = "https://github.com/matrix-org/matrix-rust-sdk"
version = "0.2.0"
[dependencies]
async-trait = "0.1.42"
async-trait = "0.1.50"
instant = { version = "0.1.9", features = ["wasm-bindgen", "now"] }
ruma = { version = "0.1.2", features = ["client-api-c"], git = "https://github.com/ruma/ruma", rev = "d73ab8add" }
serde = "1.0.122"
serde = "1.0.126"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
uuid = { version = "0.8.2", default-features = false, features = ["v4", "serde"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
version = "1.1.0"
version = "1.7.1"
default-features = false
features = ["rt", "sync"]
[target.'cfg(target_arch = "wasm32")'.dependencies]
futures = "0.3.12"
futures = "0.3.15"
futures-locks = { version = "0.6.0", default-features = false }
wasm-bindgen-futures = "0.4"
wasm-bindgen-futures = "0.4.24"
uuid = { version = "0.8.2", default-features = false, features = ["v4", "wasm-bindgen"] }

View file

@ -24,39 +24,39 @@ matrix-qrcode = { version = "0.1.0", path = "../matrix_qrcode" }
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
ruma = { version = "0.1.2", features = ["client-api-c", "unstable-pre-spec"], git = "https://github.com/ruma/ruma", rev = "d73ab8add" }
olm-rs = { version = "1.0.0", features = ["serde"] }
getrandom = "0.2.2"
serde = { version = "1.0.122", features = ["derive", "rc"] }
serde_json = "1.0.61"
zeroize = { version = "1.2.0", features = ["zeroize_derive"] }
olm-rs = { version = "1.0.1", features = ["serde"] }
getrandom = "0.2.3"
serde = { version = "1.0.126", features = ["derive", "rc"] }
serde_json = "1.0.64"
zeroize = { version = "1.3.0", features = ["zeroize_derive"] }
# Misc dependencies
futures = "0.3.12"
futures = "0.3.15"
sled = { version = "0.34.6", optional = true }
thiserror = "1.0.23"
tracing = "0.1.22"
thiserror = "1.0.25"
tracing = "0.1.26"
atomic = "0.5.0"
dashmap = "4.0.2"
sha2 = "0.9.2"
aes-gcm = "0.8.0"
aes-ctr = "0.6.0"
pbkdf2 = { version = "0.6.0", default-features = false }
hmac = "0.10.1"
sha2 = "0.9.5"
aes-gcm = "0.9.2"
aes = { version = "0.7.4", features = ["ctr"] }
pbkdf2 = { version = "0.8.0", default-features = false }
hmac = "0.11.0"
base64 = "0.13.0"
byteorder = "1.4.2"
byteorder = "1.4.3"
[dev-dependencies]
tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
proptest = "0.10.1"
serde_json = "1.0.61"
tokio = { version = "1.7.1", default-features = false, features = ["rt-multi-thread", "macros"] }
proptest = "1.0.0"
serde_json = "1.0.64"
tempfile = "3.2.0"
http = "0.2.3"
http = "0.2.4"
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
indoc = "1.0.3"
criterion = { version = "0.3.4", features = ["async", "async_tokio", "html_reports"] }
[target.'cfg(target_os = "linux")'.dev-dependencies]
pprof = { version = "0.4.2", features = ["flamegraph"] }
pprof = { version = "0.4.3", features = ["flamegraph"] }
[[bench]]
name = "crypto_bench"

View file

@ -17,9 +17,9 @@ use std::{
io::{Error as IoError, ErrorKind, Read},
};
use aes_ctr::{
cipher::{NewStreamCipher, SyncStreamCipher},
Aes256Ctr,
use aes::{
cipher::{generic_array::GenericArray, FromBlockCipher, NewBlockCipher, StreamCipher},
Aes256, Aes256Ctr,
};
use base64::DecodeError;
use getrandom::getrandom;
@ -126,9 +126,11 @@ impl<'a, R: Read + 'a> AttachmentDecryptor<'a, R> {
let hash = decode(info.hashes.get("sha256").ok_or(DecryptorError::MissingHash)?)?;
let key = Zeroizing::from(decode_url_safe(info.web_key.k)?);
let iv = decode(info.iv)?;
let iv = GenericArray::from_exact_iter(iv).ok_or(DecryptorError::KeyNonceLength)?;
let sha = Sha256::default();
let aes = Aes256Ctr::new_var(&key, &iv).map_err(|_| DecryptorError::KeyNonceLength)?;
let aes = Aes256::new_from_slice(&key).map_err(|_| DecryptorError::KeyNonceLength)?;
let aes = Aes256Ctr::from_block_cipher(aes, &iv);
Ok(AttachmentDecryptor { inner_reader: input, expected_hash: hash, sha, aes })
}
@ -209,8 +211,11 @@ impl<'a, R: Read + 'a> AttachmentEncryptor<'a, R> {
ext: true,
});
let encoded_iv = encode(&*iv);
let iv = GenericArray::from_slice(&*iv);
let key = GenericArray::from_slice(&*key);
let aes = Aes256Ctr::new_var(&*key, &*iv).expect("Cannot create AES encryption object.");
let aes = Aes256::new(key);
let aes = Aes256Ctr::from_block_cipher(aes, iv);
AttachmentEncryptor {
finished: false,

View file

@ -14,9 +14,9 @@
use std::io::{Cursor, Read, Seek, SeekFrom};
use aes_ctr::{
cipher::{NewStreamCipher, SyncStreamCipher},
Aes256Ctr,
use aes::{
cipher::{generic_array::GenericArray, FromBlockCipher, NewBlockCipher, StreamCipher},
Aes256, Aes256Ctr,
};
use byteorder::{BigEndian, ReadBytesExt};
use getrandom::getrandom;
@ -161,7 +161,12 @@ fn encrypt_helper(mut plaintext: &mut [u8], passphrase: &str, rounds: u32) -> St
pbkdf2::<Hmac<Sha512>>(passphrase.as_bytes(), &salt, rounds, &mut derived_keys);
let (key, hmac_key) = derived_keys.split_at(KEY_SIZE);
let mut aes = Aes256Ctr::new_var(key, &iv.to_be_bytes()).expect("Can't create AES object");
let key = GenericArray::from_slice(key);
let iv = iv.to_be_bytes();
let iv = GenericArray::from_slice(&iv);
let aes = Aes256::new(key);
let mut aes = Aes256Ctr::from_block_cipher(aes, iv);
aes.apply_keystream(&mut plaintext);
@ -169,11 +174,11 @@ fn encrypt_helper(mut plaintext: &mut [u8], passphrase: &str, rounds: u32) -> St
payload.extend(&VERSION.to_be_bytes());
payload.extend(&salt);
payload.extend(&iv.to_be_bytes());
payload.extend(&*iv);
payload.extend(&rounds.to_be_bytes());
payload.extend_from_slice(plaintext);
let mut hmac = Hmac::<Sha256>::new_varkey(hmac_key).expect("Can't create HMAC object");
let mut hmac = Hmac::<Sha256>::new_from_slice(hmac_key).expect("Can't create HMAC object");
hmac.update(&payload);
let mac = hmac.finalize();
@ -213,12 +218,16 @@ fn decrypt_helper(ciphertext: &str, passphrase: &str) -> Result<String, KeyExpor
pbkdf2::<Hmac<Sha512>>(passphrase.as_bytes(), &salt, rounds, &mut derived_keys);
let (key, hmac_key) = derived_keys.split_at(KEY_SIZE);
let mut hmac = Hmac::<Sha256>::new_varkey(hmac_key).expect("Can't create an HMAC object");
let mut hmac = Hmac::<Sha256>::new_from_slice(hmac_key).expect("Can't create an HMAC object");
hmac.update(&decoded[0..ciphertext_end]);
hmac.verify(&mac).map_err(|_| KeyExportError::InvalidMac)?;
let key = GenericArray::from_slice(key);
let iv = GenericArray::from_slice(&iv);
let mut ciphertext = &mut decoded[ciphertext_start..ciphertext_end];
let mut aes = Aes256Ctr::new_var(key, &iv).expect("Can't create an AES object");
let aes = Aes256::new(key);
let mut aes = Aes256Ctr::from_block_cipher(aes, iv);
aes.apply_keystream(&mut ciphertext);
Ok(String::from_utf8(ciphertext.to_owned())?)

View file

@ -14,10 +14,10 @@ version = "0.2.0"
appservice = []
[dependencies]
http = "0.2.3"
http = "0.2.4"
lazy_static = "1.4.0"
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
matrix-sdk-test-macros = { version = "0.1.0", path = "../matrix_sdk_test_macros" }
ruma = { version = "0.1.2", features = ["client-api-c"], git = "https://github.com/ruma/ruma", rev = "d73ab8add" }
serde = "1.0.122"
serde_json = "1.0.61"
serde = "1.0.126"
serde_json = "1.0.64"