matrix-sdk: Upgrade our deps
parent
43e213fd67
commit
17097f4d42
|
@ -21,4 +21,4 @@ image = { version = "0.23.14", optional = true }
|
||||||
qrcode = { version = "0.12.0", default-features = false }
|
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" }
|
ruma-identifiers = { version = "0.19.3", git = "https://github.com/ruma/ruma", rev = "d73ab8add" }
|
||||||
thiserror = "1.0.24"
|
thiserror = "1.0.25"
|
||||||
|
|
|
@ -32,15 +32,15 @@ docs = ["encryption", "sled_cryptostore", "sled_state_store", "sso_login"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dashmap = "4.0.2"
|
dashmap = "4.0.2"
|
||||||
futures = "0.3.12"
|
futures = "0.3.15"
|
||||||
http = "0.2.3"
|
http = "0.2.4"
|
||||||
serde_json = "1.0.61"
|
serde_json = "1.0.64"
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.25"
|
||||||
tracing = "0.1.22"
|
tracing = "0.1.26"
|
||||||
url = "2.2.0"
|
url = "2.2.2"
|
||||||
zeroize = "1.2.0"
|
zeroize = "1.3.0"
|
||||||
mime = "0.3.16"
|
mime = "0.3.16"
|
||||||
rand = { version = "0.8.2", optional = true }
|
rand = { version = "0.8.4", optional = true }
|
||||||
bytes = "1.0.1"
|
bytes = "1.0.1"
|
||||||
|
|
||||||
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
||||||
|
@ -51,7 +51,7 @@ path = "../matrix_sdk_base"
|
||||||
default_features = false
|
default_features = false
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.11.0"
|
version = "0.11.3"
|
||||||
default_features = false
|
default_features = false
|
||||||
|
|
||||||
[dependencies.ruma]
|
[dependencies.ruma]
|
||||||
|
@ -61,12 +61,12 @@ rev = "d73ab8add"
|
||||||
features = ["client-api-c", "compat", "unstable-pre-spec"]
|
features = ["client-api-c", "compat", "unstable-pre-spec"]
|
||||||
|
|
||||||
[dependencies.tokio-stream]
|
[dependencies.tokio-stream]
|
||||||
version = "0.1.4"
|
version = "0.1.6"
|
||||||
features = ["net"]
|
features = ["net"]
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies.warp]
|
[dependencies.warp]
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ version = "0.3.0"
|
||||||
features = ["tokio"]
|
features = ["tokio"]
|
||||||
|
|
||||||
[dependencies.tracing-futures]
|
[dependencies.tracing-futures]
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["std", "std-future"]
|
features = ["std", "std-future"]
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ features = ["std", "std-future"]
|
||||||
futures-timer = "3.0.2"
|
futures-timer = "3.0.2"
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
|
||||||
version = "1.1.0"
|
version = "1.7.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["fs", "rt"]
|
features = ["fs", "rt"]
|
||||||
|
|
||||||
|
@ -92,13 +92,13 @@ version = "3.0.2"
|
||||||
features = ["wasm-bindgen"]
|
features = ["wasm-bindgen"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
dirs = "3.0.1"
|
dirs = "3.0.2"
|
||||||
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
|
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
|
||||||
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"] }
|
||||||
serde_json = "1.0.61"
|
serde_json = "1.0.64"
|
||||||
tracing-subscriber = "0.2.15"
|
tracing-subscriber = "0.2.18"
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
mockito = "0.29.0"
|
mockito = "0.30.0"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@ edition = "2018"
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
url = "2.2.1"
|
url = "2.2.2"
|
||||||
wasm-bindgen = { version = "0.2.72", features = ["serde-serialize"] }
|
wasm-bindgen = { version = "0.2.74", features = ["serde-serialize"] }
|
||||||
wasm-bindgen-futures = "0.4.22"
|
wasm-bindgen-futures = "0.4.24"
|
||||||
console_error_panic_hook = "0.1.6"
|
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]
|
[dependencies.matrix-sdk]
|
||||||
path = "../.."
|
path = "../.."
|
||||||
|
|
|
@ -27,43 +27,43 @@ docs = ["encryption", "sled_cryptostore"]
|
||||||
dashmap = "4.0.2"
|
dashmap = "4.0.2"
|
||||||
lru = "0.6.5"
|
lru = "0.6.5"
|
||||||
ruma = { version = "0.1.2", features = ["client-api-c", "unstable-pre-spec"], git = "https://github.com/ruma/ruma", rev = "d73ab8add" }
|
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 = { version = "1.0.126", features = ["rc"] }
|
||||||
serde_json = "1.0.61"
|
serde_json = "1.0.64"
|
||||||
tracing = "0.1.22"
|
tracing = "0.1.26"
|
||||||
|
|
||||||
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
||||||
matrix-sdk-crypto = { version = "0.2.0", path = "../matrix_sdk_crypto", optional = true }
|
matrix-sdk-crypto = { version = "0.2.0", path = "../matrix_sdk_crypto", optional = true }
|
||||||
|
|
||||||
# Misc dependencies
|
# Misc dependencies
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.25"
|
||||||
futures = "0.3.12"
|
futures = "0.3.15"
|
||||||
zeroize = { version = "1.2.0", features = ["zeroize_derive"] }
|
zeroize = { version = "1.3.0", features = ["zeroize_derive"] }
|
||||||
|
|
||||||
# Deps for the sled state store
|
# Deps for the sled state store
|
||||||
sled = { version = "0.34.6", optional = true }
|
sled = { version = "0.34.6", optional = true }
|
||||||
chacha20poly1305 = { version = "0.7.1", optional = true }
|
chacha20poly1305 = { version = "0.8.0", optional = true }
|
||||||
pbkdf2 = { version = "0.6.0", default-features = false, optional = true }
|
pbkdf2 = { version = "0.8.0", default-features = false, optional = true }
|
||||||
hmac = { version = "0.10.1", optional = true }
|
hmac = { version = "0.11.0", optional = true }
|
||||||
sha2 = { version = "0.9.2", optional = true }
|
sha2 = { version = "0.9.5", optional = true }
|
||||||
rand = { version = "0.8.2", optional = true }
|
rand = { version = "0.8.4", optional = true }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
|
||||||
version = "1.1.0"
|
version = "1.7.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["sync", "fs"]
|
features = ["sync", "fs"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
|
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]
|
[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"
|
tempfile = "3.2.0"
|
||||||
rustyline = "7.1.0"
|
rustyline = "8.2.0"
|
||||||
rustyline-derive = "0.4.0"
|
rustyline-derive = "0.4.0"
|
||||||
atty = "0.2.14"
|
atty = "0.2.14"
|
||||||
clap = "2.33.3"
|
clap = "2.33.3"
|
||||||
syntect = "4.5.0"
|
syntect = "4.5.0"
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||||
wasm-bindgen-test = "0.3.19"
|
wasm-bindgen-test = "0.3.24"
|
||||||
|
|
|
@ -11,21 +11,21 @@ repository = "https://github.com/matrix-org/matrix-rust-sdk"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.42"
|
async-trait = "0.1.50"
|
||||||
instant = { version = "0.1.9", features = ["wasm-bindgen", "now"] }
|
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" }
|
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]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
uuid = { version = "0.8.2", default-features = false, features = ["v4", "serde"] }
|
uuid = { version = "0.8.2", default-features = false, features = ["v4", "serde"] }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
|
||||||
version = "1.1.0"
|
version = "1.7.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["rt", "sync"]
|
features = ["rt", "sync"]
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
futures = "0.3.12"
|
futures = "0.3.15"
|
||||||
futures-locks = { version = "0.6.0", default-features = false }
|
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"] }
|
uuid = { version = "0.8.2", default-features = false, features = ["v4", "wasm-bindgen"] }
|
||||||
|
|
|
@ -24,39 +24,39 @@ matrix-qrcode = { version = "0.1.0", path = "../matrix_qrcode" }
|
||||||
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
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" }
|
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"] }
|
olm-rs = { version = "1.0.1", features = ["serde"] }
|
||||||
getrandom = "0.2.2"
|
getrandom = "0.2.3"
|
||||||
serde = { version = "1.0.122", features = ["derive", "rc"] }
|
serde = { version = "1.0.126", features = ["derive", "rc"] }
|
||||||
serde_json = "1.0.61"
|
serde_json = "1.0.64"
|
||||||
zeroize = { version = "1.2.0", features = ["zeroize_derive"] }
|
zeroize = { version = "1.3.0", features = ["zeroize_derive"] }
|
||||||
|
|
||||||
# Misc dependencies
|
# Misc dependencies
|
||||||
futures = "0.3.12"
|
futures = "0.3.15"
|
||||||
sled = { version = "0.34.6", optional = true }
|
sled = { version = "0.34.6", optional = true }
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.25"
|
||||||
tracing = "0.1.22"
|
tracing = "0.1.26"
|
||||||
atomic = "0.5.0"
|
atomic = "0.5.0"
|
||||||
dashmap = "4.0.2"
|
dashmap = "4.0.2"
|
||||||
sha2 = "0.9.2"
|
sha2 = "0.9.5"
|
||||||
aes-gcm = "0.8.0"
|
aes-gcm = "0.9.2"
|
||||||
aes-ctr = "0.6.0"
|
aes = { version = "0.7.4", features = ["ctr"] }
|
||||||
pbkdf2 = { version = "0.6.0", default-features = false }
|
pbkdf2 = { version = "0.8.0", default-features = false }
|
||||||
hmac = "0.10.1"
|
hmac = "0.11.0"
|
||||||
base64 = "0.13.0"
|
base64 = "0.13.0"
|
||||||
byteorder = "1.4.2"
|
byteorder = "1.4.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[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"] }
|
||||||
proptest = "0.10.1"
|
proptest = "1.0.0"
|
||||||
serde_json = "1.0.61"
|
serde_json = "1.0.64"
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
http = "0.2.3"
|
http = "0.2.4"
|
||||||
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
|
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
|
||||||
indoc = "1.0.3"
|
indoc = "1.0.3"
|
||||||
criterion = { version = "0.3.4", features = ["async", "async_tokio", "html_reports"] }
|
criterion = { version = "0.3.4", features = ["async", "async_tokio", "html_reports"] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dev-dependencies]
|
[target.'cfg(target_os = "linux")'.dev-dependencies]
|
||||||
pprof = { version = "0.4.2", features = ["flamegraph"] }
|
pprof = { version = "0.4.3", features = ["flamegraph"] }
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "crypto_bench"
|
name = "crypto_bench"
|
||||||
|
|
|
@ -17,9 +17,9 @@ use std::{
|
||||||
io::{Error as IoError, ErrorKind, Read},
|
io::{Error as IoError, ErrorKind, Read},
|
||||||
};
|
};
|
||||||
|
|
||||||
use aes_ctr::{
|
use aes::{
|
||||||
cipher::{NewStreamCipher, SyncStreamCipher},
|
cipher::{generic_array::GenericArray, FromBlockCipher, NewBlockCipher, StreamCipher},
|
||||||
Aes256Ctr,
|
Aes256, Aes256Ctr,
|
||||||
};
|
};
|
||||||
use base64::DecodeError;
|
use base64::DecodeError;
|
||||||
use getrandom::getrandom;
|
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 hash = decode(info.hashes.get("sha256").ok_or(DecryptorError::MissingHash)?)?;
|
||||||
let key = Zeroizing::from(decode_url_safe(info.web_key.k)?);
|
let key = Zeroizing::from(decode_url_safe(info.web_key.k)?);
|
||||||
let iv = decode(info.iv)?;
|
let iv = decode(info.iv)?;
|
||||||
|
let iv = GenericArray::from_exact_iter(iv).ok_or(DecryptorError::KeyNonceLength)?;
|
||||||
|
|
||||||
let sha = Sha256::default();
|
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 })
|
Ok(AttachmentDecryptor { inner_reader: input, expected_hash: hash, sha, aes })
|
||||||
}
|
}
|
||||||
|
@ -209,8 +211,11 @@ impl<'a, R: Read + 'a> AttachmentEncryptor<'a, R> {
|
||||||
ext: true,
|
ext: true,
|
||||||
});
|
});
|
||||||
let encoded_iv = encode(&*iv);
|
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 {
|
AttachmentEncryptor {
|
||||||
finished: false,
|
finished: false,
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
use std::io::{Cursor, Read, Seek, SeekFrom};
|
use std::io::{Cursor, Read, Seek, SeekFrom};
|
||||||
|
|
||||||
use aes_ctr::{
|
use aes::{
|
||||||
cipher::{NewStreamCipher, SyncStreamCipher},
|
cipher::{generic_array::GenericArray, FromBlockCipher, NewBlockCipher, StreamCipher},
|
||||||
Aes256Ctr,
|
Aes256, Aes256Ctr,
|
||||||
};
|
};
|
||||||
use byteorder::{BigEndian, ReadBytesExt};
|
use byteorder::{BigEndian, ReadBytesExt};
|
||||||
use getrandom::getrandom;
|
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);
|
pbkdf2::<Hmac<Sha512>>(passphrase.as_bytes(), &salt, rounds, &mut derived_keys);
|
||||||
let (key, hmac_key) = derived_keys.split_at(KEY_SIZE);
|
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);
|
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(&VERSION.to_be_bytes());
|
||||||
payload.extend(&salt);
|
payload.extend(&salt);
|
||||||
payload.extend(&iv.to_be_bytes());
|
payload.extend(&*iv);
|
||||||
payload.extend(&rounds.to_be_bytes());
|
payload.extend(&rounds.to_be_bytes());
|
||||||
payload.extend_from_slice(plaintext);
|
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);
|
hmac.update(&payload);
|
||||||
let mac = hmac.finalize();
|
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);
|
pbkdf2::<Hmac<Sha512>>(passphrase.as_bytes(), &salt, rounds, &mut derived_keys);
|
||||||
let (key, hmac_key) = derived_keys.split_at(KEY_SIZE);
|
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.update(&decoded[0..ciphertext_end]);
|
||||||
hmac.verify(&mac).map_err(|_| KeyExportError::InvalidMac)?;
|
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 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);
|
aes.apply_keystream(&mut ciphertext);
|
||||||
|
|
||||||
Ok(String::from_utf8(ciphertext.to_owned())?)
|
Ok(String::from_utf8(ciphertext.to_owned())?)
|
||||||
|
|
|
@ -14,10 +14,10 @@ version = "0.2.0"
|
||||||
appservice = []
|
appservice = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
http = "0.2.3"
|
http = "0.2.4"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
||||||
matrix-sdk-test-macros = { version = "0.1.0", path = "../matrix_sdk_test_macros" }
|
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" }
|
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"
|
||||||
serde_json = "1.0.61"
|
serde_json = "1.0.64"
|
||||||
|
|
Loading…
Reference in New Issue