From 54098160152223a07e68fa98ca372c008dca7815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 5 Aug 2021 09:42:16 +0100 Subject: [PATCH] Updated used sphinx dependency to the most recent revision --- Cargo.lock | 178 +++++++----------- common/nymsphinx/addressing/src/nodes.rs | 2 +- common/nymsphinx/types/Cargo.toml | 2 +- .../src/authentication/encrypted_address.rs | 2 +- gateway/gateway-requests/src/types.rs | 2 +- .../node/client_handling/clients_handler.rs | 14 +- gateway/src/node/storage/inboxes.rs | 6 +- gateway/src/node/storage/ledger.rs | 10 +- 8 files changed, 88 insertions(+), 128 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a01e495f93..d31cf8d9d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,15 +5,16 @@ version = 3 [[package]] -name = "aes-ctr" -version = "0.3.0" +name = "aes" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" +checksum = "495ee669413bfbe9e8cace80f4d3d78e6d8c8d99579f97fb93bde351b185f2d4" dependencies = [ - "aes-soft 0.3.3", - "aesni 0.6.0", - "ctr 0.3.2", - "stream-cipher", + "cfg-if 1.0.0", + "cipher 0.3.0", + "cpufeatures", + "ctr 0.7.0", + "opaque-debug 0.3.0", ] [[package]] @@ -22,51 +23,29 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7729c3cde54d67063be556aeac75a81330d802f0259500ca40cb52967f975763" dependencies = [ - "aes-soft 0.6.4", - "aesni 0.10.0", - "cipher", + "aes-soft", + "aesni", + "cipher 0.2.5", "ctr 0.6.0", ] -[[package]] -name = "aes-soft" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" -dependencies = [ - "block-cipher-trait", - "byteorder", - "opaque-debug 0.2.3", -] - [[package]] name = "aes-soft" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ - "cipher", + "cipher 0.2.5", "opaque-debug 0.3.0", ] -[[package]] -name = "aesni" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" -dependencies = [ - "block-cipher-trait", - "opaque-debug 0.2.3", - "stream-cipher", -] - [[package]] name = "aesni" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ - "cipher", + "cipher 0.2.5", "opaque-debug 0.3.0", ] @@ -279,15 +258,6 @@ dependencies = [ "generic-array 0.14.4", ] -[[package]] -name = "block-cipher-trait" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "block-padding" version = "0.1.5" @@ -390,6 +360,15 @@ dependencies = [ "generic-array 0.14.4", ] +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array 0.14.4", +] + [[package]] name = "clap" version = "2.33.3" @@ -629,10 +608,10 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" name = "crypto" version = "0.1.0" dependencies = [ - "aes-ctr 0.6.0", + "aes-ctr", "blake3", "bs58 0.4.0", - "cipher", + "cipher 0.2.5", "digest 0.9.0", "ed25519-dalek", "generic-array 0.14.4", @@ -676,13 +655,13 @@ dependencies = [ ] [[package]] -name = "ctr" -version = "0.3.2" +name = "crypto-mac" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "block-cipher-trait", - "stream-cipher", + "generic-array 0.14.4", + "subtle 2.4.0", ] [[package]] @@ -691,7 +670,16 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" dependencies = [ - "cipher", + "cipher 0.2.5", +] + +[[package]] +name = "ctr" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" +dependencies = [ + "cipher 0.3.0", ] [[package]] @@ -898,7 +886,7 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "sha2 0.9.5", + "sha2", "zeroize", ] @@ -912,7 +900,7 @@ dependencies = [ "hex", "rand_core 0.5.1", "serde", - "sha2 0.9.5", + "sha2", "thiserror", ] @@ -1349,16 +1337,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hkdf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" -dependencies = [ - "digest 0.8.1", - "hmac 0.7.1", -] - [[package]] name = "hkdf" version = "0.10.0" @@ -1370,13 +1348,13 @@ dependencies = [ ] [[package]] -name = "hmac" -version = "0.7.1" +name = "hkdf" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +checksum = "01706d578d5c281058480e673ae4086a9f4710d8df1ad80a5b03e39ece5f886b" dependencies = [ - "crypto-mac 0.7.0", - "digest 0.8.1", + "digest 0.9.0", + "hmac 0.11.0", ] [[package]] @@ -1399,6 +1377,16 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", +] + [[package]] name = "http" version = "0.2.4" @@ -1596,7 +1584,7 @@ dependencies = [ "cfg-if 1.0.0", "ecdsa", "elliptic-curve", - "sha2 0.9.5", + "sha2", ] [[package]] @@ -2110,7 +2098,7 @@ dependencies = [ "nymsphinx-params", "nymsphinx-types", "rand 0.7.3", - "rand_distr 0.3.0", + "rand_distr", "tokio", "topology", ] @@ -2625,15 +2613,6 @@ dependencies = [ "getrandom 0.2.3", ] -[[package]] -name = "rand_distr" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" -dependencies = [ - "rand 0.7.3", -] - [[package]] name = "rand_distr" version = "0.3.0" @@ -3208,18 +3187,6 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha2" version = "0.9.5" @@ -3322,22 +3289,24 @@ dependencies = [ [[package]] name = "sphinx" version = "0.1.0" -source = "git+https://github.com/nymtech/sphinx?rev=283dcc77dec8ee9ed3bed58c2b878e9c18320723#283dcc77dec8ee9ed3bed58c2b878e9c18320723" +source = "git+https://github.com/nymtech/sphinx?rev=c494250f2a78bed33a618d470792418eee932859#c494250f2a78bed33a618d470792418eee932859" dependencies = [ - "aes-ctr 0.3.0", + "aes", "arrayref", "blake2", - "bs58 0.3.1", + "bs58 0.4.0", "byteorder", "chacha", "curve25519-dalek", - "hkdf 0.8.0", - "hmac 0.7.1", + "digest 0.9.0", + "hkdf 0.11.0", + "hmac 0.11.0", "lioness", "log", "rand 0.7.3", - "rand_distr 0.2.2", - "sha2 0.8.2", + "rand_distr", + "sha2", + "subtle 2.4.0", ] [[package]] @@ -3405,7 +3374,7 @@ dependencies = [ "parking_lot", "percent-encoding", "rustls", - "sha2 0.9.5", + "sha2", "smallvec", "sqlformat", "sqlx-rt", @@ -3432,7 +3401,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "sha2 0.9.5", + "sha2", "sqlx-core", "sqlx-rt", "syn", @@ -3532,15 +3501,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" -[[package]] -name = "stream-cipher" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "stringprep" version = "0.1.2" diff --git a/common/nymsphinx/addressing/src/nodes.rs b/common/nymsphinx/addressing/src/nodes.rs index be2cf95c68..a01f7202bd 100644 --- a/common/nymsphinx/addressing/src/nodes.rs +++ b/common/nymsphinx/addressing/src/nodes.rs @@ -164,7 +164,7 @@ impl TryFrom for NymNodeRoutingAddress { type Error = NymNodeRoutingAddressError; fn try_from(value: NodeAddressBytes) -> Result { - Self::try_from_bytes(value.as_bytes()) + Self::try_from_bytes(value.as_bytes_ref()) } } diff --git a/common/nymsphinx/types/Cargo.toml b/common/nymsphinx/types/Cargo.toml index ac00a39fa5..34756709ec 100644 --- a/common/nymsphinx/types/Cargo.toml +++ b/common/nymsphinx/types/Cargo.toml @@ -7,5 +7,5 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sphinx = { git = "https://github.com/nymtech/sphinx", rev="283dcc77dec8ee9ed3bed58c2b878e9c18320723" } +sphinx = { git = "https://github.com/nymtech/sphinx", rev="c494250f2a78bed33a618d470792418eee932859" } #sphinx = { path = "../../../../sphinx"} \ No newline at end of file diff --git a/gateway/gateway-requests/src/authentication/encrypted_address.rs b/gateway/gateway-requests/src/authentication/encrypted_address.rs index fea5562aaf..73ae885dfd 100644 --- a/gateway/gateway-requests/src/authentication/encrypted_address.rs +++ b/gateway/gateway-requests/src/authentication/encrypted_address.rs @@ -27,7 +27,7 @@ impl EncryptedAddressBytes { let ciphertext = stream_cipher::encrypt::( key.encryption_key(), iv.inner(), - address.as_bytes(), + address.as_bytes_ref(), ); let mut enc_address = [0u8; ENCRYPTED_ADDRESS_SIZE]; diff --git a/gateway/gateway-requests/src/types.rs b/gateway/gateway-requests/src/types.rs index fb8b3fd690..1c751783e9 100644 --- a/gateway/gateway-requests/src/types.rs +++ b/gateway/gateway-requests/src/types.rs @@ -121,7 +121,7 @@ impl ClientControlRequest { iv: AuthenticationIV, ) -> Self { ClientControlRequest::Authenticate { - address: address.to_base58_string(), + address: address.as_base58_string(), enc_address: enc_address.to_base58_string(), iv: iv.to_base58_string(), } diff --git a/gateway/src/node/client_handling/clients_handler.rs b/gateway/src/node/client_handling/clients_handler.rs index 43d39907a7..110f056f30 100644 --- a/gateway/src/node/client_handling/clients_handler.rs +++ b/gateway/src/node/client_handling/clients_handler.rs @@ -110,7 +110,7 @@ impl ClientsHandler { Err(e) => { error!( "failed to retrieve client messages. {:?} inbox might be corrupted now - {:?}", - client_address.to_base58_string(), + client_address.as_base58_string(), e ); return; @@ -129,7 +129,7 @@ impl ClientsHandler { if let Err(e) = self.clients_inbox_storage.delete_files(paths).await { error!( "Failed to remove client ({:?}) files - {:?}", - client_address.to_base58_string(), + client_address.as_base58_string(), e ); } else { @@ -149,7 +149,7 @@ impl ClientsHandler { ) { debug!( "Processing register new client request: {:?}", - address.to_base58_string() + address.as_base58_string() ); if self.open_connections.get(&address).is_some() { @@ -168,7 +168,7 @@ impl ClientsHandler { { info!( "Client {:?} was already registered before!", - address.to_base58_string() + address.as_base58_string() ) } else if let Err(e) = self.clients_inbox_storage.create_storage_dir(address).await { error!("We failed to create inbox directory for the client -{:?}\nReverting stored shared key...", e); @@ -199,7 +199,7 @@ impl ClientsHandler { ) { debug!( "Processing authenticate client request: {:?}", - address.to_base58_string() + address.as_base58_string() ); if self.open_connections.get(&address).is_some() { @@ -239,7 +239,7 @@ impl ClientsHandler { fn handle_disconnect(&mut self, address: DestinationAddressBytes) { debug!( "Processing disconnect client request: {:?}", - address.to_base58_string() + address.as_base58_string() ); self.open_connections.remove(&address); } @@ -251,7 +251,7 @@ impl ClientsHandler { ) { debug!( "Processing is online request for: {:?}", - address.to_base58_string() + address.as_base58_string() ); let response_value = self.open_connections.get(&address).cloned(); diff --git a/gateway/src/node/storage/inboxes.rs b/gateway/src/node/storage/inboxes.rs index a58e46eda8..79971e84ff 100644 --- a/gateway/src/node/storage/inboxes.rs +++ b/gateway/src/node/storage/inboxes.rs @@ -88,7 +88,7 @@ impl ClientStorage { ) -> io::Result<()> { let inner_data = self.inner.lock().await; - let client_dir_name = client_address.to_base58_string(); + let client_dir_name = client_address.as_base58_string(); let full_store_dir = inner_data.main_store_path_dir.join(client_dir_name); fs::create_dir_all(full_store_dir).await } @@ -103,7 +103,7 @@ impl ClientStorage { pub(crate) async fn store_processed_data(&self, store_data: StoreData) -> io::Result<()> { let inner_data = self.inner.lock().await; - let client_dir_name = store_data.client_address.to_base58_string(); + let client_dir_name = store_data.client_address.as_base58_string(); let full_store_dir = inner_data.main_store_path_dir.join(client_dir_name); let full_store_path = full_store_dir.join(Self::generate_random_file_name( inner_data.filename_length as usize, @@ -124,7 +124,7 @@ impl ClientStorage { ) -> io::Result> { let inner_data = self.inner.lock().await; - let client_dir_name = client_address.to_base58_string(); + let client_dir_name = client_address.as_base58_string(); let full_store_dir = inner_data.main_store_path_dir.join(client_dir_name); trace!("going to lookup: {:?}!", full_store_dir); diff --git a/gateway/src/node/storage/ledger.rs b/gateway/src/node/storage/ledger.rs index 4aa80e9d7e..e5d6c5aec2 100644 --- a/gateway/src/node/storage/ledger.rs +++ b/gateway/src/node/storage/ledger.rs @@ -37,7 +37,7 @@ impl ClientLedger { "key: {:?}", ledger .read_destination_address_bytes(key.unwrap()) - .to_base58_string() + .as_base58_string() ); }); @@ -81,7 +81,7 @@ impl ClientLedger { encrypted_address: &EncryptedAddressBytes, iv: &AuthenticationIV, ) -> Result { - match self.db.get(&client_address.to_bytes()) { + match self.db.get(client_address.as_bytes_ref()) { Err(e) => Err(ClientLedgerError::Read(e)), Ok(existing_key) => match existing_key { Some(existing_key_ivec) => { @@ -97,7 +97,7 @@ impl ClientLedger { &self, client_address: &DestinationAddressBytes, ) -> Result, ClientLedgerError> { - match self.db.get(&client_address.to_bytes()) { + match self.db.get(client_address.as_bytes_ref()) { Err(e) => Err(ClientLedgerError::Read(e)), Ok(existing_key) => Ok(existing_key.map(|key_ivec| self.read_shared_key(key_ivec))), } @@ -110,7 +110,7 @@ impl ClientLedger { ) -> Result, ClientLedgerError> { let insertion_result = match self .db - .insert(&client_address.to_bytes(), shared_key.to_bytes()) + .insert(client_address.as_bytes_ref(), shared_key.to_bytes()) { Err(e) => Err(ClientLedgerError::Write(e)), Ok(existing_key) => { @@ -127,7 +127,7 @@ impl ClientLedger { &mut self, client_address: &DestinationAddressBytes, ) -> Result, ClientLedgerError> { - let removal_result = match self.db.remove(&client_address.to_bytes()) { + let removal_result = match self.db.remove(client_address.as_bytes_ref()) { Err(e) => Err(ClientLedgerError::Write(e)), Ok(existing_key) => { Ok(existing_key.map(|existing_key| self.read_shared_key(existing_key)))