From bd7273061e3f13f53fdd2fa91dc641a83bcc47f0 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 10 Apr 2018 13:56:56 +0200 Subject: [PATCH] ethcrypto renamed to ethcore-crypto and moved to ethcore dir (#8340) * ethcrypto renamed to ethcore-crypto and moved to ethcore dir * fixed renaming --- Cargo.lock | 38 +++++++++---------- {ethcrypto => ethcore/crypto}/Cargo.toml | 4 +- {ethcrypto => ethcore/crypto}/README.md | 0 {ethcrypto => ethcore/crypto}/src/lib.rs | 0 ethcore/private-tx/Cargo.toml | 2 +- ethcore/private-tx/src/encryptor.rs | 8 ++-- ethcore/private-tx/src/lib.rs | 6 +-- ethstore/Cargo.toml | 2 +- ethstore/src/lib.rs | 2 +- rpc/Cargo.toml | 2 +- rpc/src/lib.rs | 2 +- secret_store/Cargo.toml | 4 +- secret_store/src/key_server.rs | 32 ++++++++-------- .../client_sessions/decryption_session.rs | 8 ++-- .../src/key_server_cluster/io/handshake.rs | 2 +- .../src/key_server_cluster/io/message.rs | 4 +- .../key_server_cluster/jobs/decryption_job.rs | 4 +- secret_store/src/key_server_cluster/mod.rs | 6 +-- secret_store/src/lib.rs | 2 +- secret_store/src/node_key_pair.rs | 2 +- util/network-devp2p/Cargo.toml | 4 +- util/network-devp2p/src/lib.rs | 2 +- util/network/Cargo.toml | 6 +-- util/network/src/lib.rs | 2 +- whisper/Cargo.toml | 2 +- whisper/src/lib.rs | 2 +- whisper/src/rpc/crypto.rs | 5 ++- 27 files changed, 77 insertions(+), 76 deletions(-) rename {ethcrypto => ethcore/crypto}/Cargo.toml (81%) rename {ethcrypto => ethcore/crypto}/README.md (100%) rename {ethcrypto => ethcore/crypto}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index f802b863e..71ad5fc0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -566,6 +566,18 @@ dependencies = [ name = "ethcore-bytes" version = "0.1.0" +[[package]] +name = "ethcore-crypto" +version = "0.1.0" +dependencies = [ + "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", + "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethkey 0.3.0", + "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ethcore-devtools" version = "1.11.0" @@ -671,8 +683,8 @@ name = "ethcore-network" version = "1.11.0" dependencies = [ "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-crypto 0.1.0", "ethcore-io 1.11.0", - "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -688,10 +700,10 @@ dependencies = [ "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bytes 0.1.0", + "ethcore-crypto 0.1.0", "ethcore-io 1.11.0", "ethcore-logger 1.11.0", "ethcore-network 1.11.0", - "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", "igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -725,11 +737,11 @@ dependencies = [ "ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.11.0", "ethcore-bytes 0.1.0", + "ethcore-crypto 0.1.0", "ethcore-io 1.11.0", "ethcore-logger 1.11.0", "ethcore-miner 1.11.0", "ethcore-transaction 0.1.0", - "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethjson 0.1.0", "ethkey 0.3.0", @@ -760,10 +772,10 @@ dependencies = [ "ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.11.0", "ethcore-bytes 0.1.0", + "ethcore-crypto 0.1.0", "ethcore-logger 1.11.0", "ethcore-sync 1.11.0", "ethcore-transaction 0.1.0", - "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -868,18 +880,6 @@ dependencies = [ "unexpected 0.1.0", ] -[[package]] -name = "ethcrypto" -version = "0.1.0" -dependencies = [ - "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", - "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethkey 0.3.0", - "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ethereum-types" version = "0.3.0" @@ -950,7 +950,7 @@ name = "ethstore" version = "0.2.0" dependencies = [ "dir 0.1.0", - "ethcrypto 0.1.0", + "ethcore-crypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2157,6 +2157,7 @@ dependencies = [ "ethash 1.11.0", "ethcore 1.11.0", "ethcore-bytes 0.1.0", + "ethcore-crypto 0.1.0", "ethcore-devtools 1.11.0", "ethcore-io 1.11.0", "ethcore-light 1.11.0", @@ -2166,7 +2167,6 @@ dependencies = [ "ethcore-private-tx 1.0.0", "ethcore-sync 1.11.0", "ethcore-transaction 0.1.0", - "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethjson 0.1.0", "ethkey 0.3.0", @@ -2341,8 +2341,8 @@ version = "0.1.0" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-crypto 0.1.0", "ethcore-network 1.11.0", - "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ethcrypto/Cargo.toml b/ethcore/crypto/Cargo.toml similarity index 81% rename from ethcrypto/Cargo.toml rename to ethcore/crypto/Cargo.toml index 887b44ab4..c3a2191b5 100644 --- a/ethcrypto/Cargo.toml +++ b/ethcore/crypto/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethcrypto" +name = "ethcore-crypto" version = "0.1.0" authors = ["Parity Technologies "] @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] rust-crypto = "0.2.36" tiny-keccak = "1.3" eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1", optional = true } -ethkey = { path = "../ethkey", optional = true } +ethkey = { path = "../../ethkey", optional = true } ethereum-types = "0.3" subtle = "0.5" diff --git a/ethcrypto/README.md b/ethcore/crypto/README.md similarity index 100% rename from ethcrypto/README.md rename to ethcore/crypto/README.md diff --git a/ethcrypto/src/lib.rs b/ethcore/crypto/src/lib.rs similarity index 100% rename from ethcrypto/src/lib.rs rename to ethcore/crypto/src/lib.rs diff --git a/ethcore/private-tx/Cargo.toml b/ethcore/private-tx/Cargo.toml index ff37f20ab..0fa11aec8 100644 --- a/ethcore/private-tx/Cargo.toml +++ b/ethcore/private-tx/Cargo.toml @@ -12,11 +12,11 @@ ethabi-contract = "5.0" ethabi-derive = "5.0" ethcore = { path = ".." } ethcore-bytes = { path = "../../util/bytes" } +ethcore-crypto = { path = "../crypto" } ethcore-io = { path = "../../util/io" } ethcore-logger = { path = "../../logger" } ethcore-miner = { path = "../../miner" } ethcore-transaction = { path = "../transaction" } -ethcrypto = { path = "../../ethcrypto" } ethereum-types = "0.3" ethjson = { path = "../../json" } ethkey = { path = "../../ethkey" } diff --git a/ethcore/private-tx/src/encryptor.rs b/ethcore/private-tx/src/encryptor.rs index fd7eaa680..5d592de60 100644 --- a/ethcore/private-tx/src/encryptor.rs +++ b/ethcore/private-tx/src/encryptor.rs @@ -27,7 +27,7 @@ use ethcore::account_provider::AccountProvider; use ethereum_types::{H128, H256, Address}; use ethjson; use ethkey::{Signature, Public}; -use ethcrypto; +use crypto; use futures::Future; use fetch::{Fetch, Client as FetchClient, Method, BodyReader, Request}; use bytes::{Bytes, ToPretty}; @@ -151,7 +151,7 @@ impl SecretStoreEncryptor { let password = find_account_password(&self.config.passwords, &*accounts, &requester); // decrypt Public - let decrypted_bytes = accounts.decrypt(requester, password, ðcrypto::DEFAULT_MAC, &encrypted_bytes)?; + let decrypted_bytes = accounts.decrypt(requester, password, &crypto::DEFAULT_MAC, &encrypted_bytes)?; let decrypted_key = Public::from_slice(&decrypted_bytes); // and now take x coordinate of Public as a key @@ -217,7 +217,7 @@ impl Encryptor for SecretStoreEncryptor { // encrypt data let mut cypher = Vec::with_capacity(plain_data.len() + initialisation_vector.len()); cypher.extend(repeat(0).take(plain_data.len())); - ethcrypto::aes::encrypt(&key, initialisation_vector, plain_data, &mut cypher); + crypto::aes::encrypt(&key, initialisation_vector, plain_data, &mut cypher); cypher.extend_from_slice(&initialisation_vector); Ok(cypher) @@ -243,7 +243,7 @@ impl Encryptor for SecretStoreEncryptor { let (cypher, iv) = cypher.split_at(cypher_len - INIT_VEC_LEN); let mut plain_data = Vec::with_capacity(cypher_len - INIT_VEC_LEN); plain_data.extend(repeat(0).take(cypher_len - INIT_VEC_LEN)); - ethcrypto::aes::decrypt(&key, &iv, cypher, &mut plain_data); + crypto::aes::decrypt(&key, &iv, cypher, &mut plain_data); Ok(plain_data) } diff --git a/ethcore/private-tx/src/lib.rs b/ethcore/private-tx/src/lib.rs index 5b7a62b7c..ef97c6e2e 100644 --- a/ethcore/private-tx/src/lib.rs +++ b/ethcore/private-tx/src/lib.rs @@ -26,11 +26,11 @@ mod messages; mod error; extern crate ethcore; -extern crate ethcore_io as io; extern crate ethcore_bytes as bytes; -extern crate ethcore_transaction as transaction; +extern crate ethcore_crypto as crypto; +extern crate ethcore_io as io; extern crate ethcore_miner; -extern crate ethcrypto; +extern crate ethcore_transaction as transaction; extern crate ethabi; extern crate ethereum_types; extern crate ethkey; diff --git a/ethstore/Cargo.toml b/ethstore/Cargo.toml index 34f61a8f7..d0524baea 100755 --- a/ethstore/Cargo.toml +++ b/ethstore/Cargo.toml @@ -17,7 +17,7 @@ tiny-keccak = "1.3" time = "0.1.34" itertools = "0.5" parking_lot = "0.5" -ethcrypto = { path = "../ethcrypto" } +ethcore-crypto = { path = "../ethcore/crypto" } ethereum-types = "0.3" dir = { path = "../util/dir" } smallvec = "0.4" diff --git a/ethstore/src/lib.rs b/ethstore/src/lib.rs index 3422a5ff7..75df0953c 100755 --- a/ethstore/src/lib.rs +++ b/ethstore/src/lib.rs @@ -33,7 +33,7 @@ extern crate time; extern crate tiny_keccak; extern crate tempdir; -extern crate ethcrypto as crypto; +extern crate ethcore_crypto as crypto; extern crate ethereum_types; extern crate ethkey as _ethkey; extern crate parity_wordlist; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 7f975ca9d..c467f0553 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -39,6 +39,7 @@ jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = " ethash = { path = "../ethash" } ethcore = { path = "../ethcore" } ethcore-bytes = { path = "../util/bytes" } +ethcore-crypto = { path = "../ethcore/crypto" } ethcore-devtools = { path = "../devtools" } ethcore-io = { path = "../util/io" } ethcore-light = { path = "../ethcore/light" } @@ -49,7 +50,6 @@ ethcore-sync = { path = "../ethcore/sync" } ethcore-transaction = { path = "../ethcore/transaction" } ethereum-types = "0.3" -ethcrypto = { path = "../ethcrypto" } ethjson = { path = "../json" } ethkey = { path = "../ethkey" } ethstore = { path = "../ethstore" } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 13e700375..1a0989d4a 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -46,6 +46,7 @@ extern crate jsonrpc_pubsub; extern crate ethash; extern crate ethcore; extern crate ethcore_bytes as bytes; +extern crate ethcore_crypto as crypto; extern crate ethcore_devtools as devtools; extern crate ethcore_io as io; extern crate ethcore_light as light; @@ -54,7 +55,6 @@ extern crate ethcore_miner as miner; extern crate ethcore_private_tx; extern crate ethcore_sync as sync; extern crate ethcore_transaction as transaction; -extern crate ethcrypto as crypto; extern crate ethereum_types; extern crate ethkey; extern crate ethstore; diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index b9dee7303..fcd022f7d 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -24,14 +24,14 @@ tokio-proto = "0.1" url = "1.0" ethcore = { path = "../ethcore" } ethcore-bytes = { path = "../util/bytes" } +ethcore-crypto = { path = "../ethcore/crypto" } +ethcore-logger = { path = "../logger" } ethcore-sync = { path = "../ethcore/sync" } ethcore-transaction = { path = "../ethcore/transaction" } ethereum-types = "0.3" kvdb = { path = "../util/kvdb" } kvdb-rocksdb = { path = "../util/kvdb-rocksdb" } keccak-hash = { path = "../util/hash" } -ethcore-logger = { path = "../logger" } -ethcrypto = { path = "../ethcrypto" } ethkey = { path = "../ethkey" } lazy_static = "1.0" ethabi = "5.1" diff --git a/secret_store/src/key_server.rs b/secret_store/src/key_server.rs index 02d19eede..783e76045 100644 --- a/secret_store/src/key_server.rs +++ b/secret_store/src/key_server.rs @@ -21,7 +21,7 @@ use std::sync::mpsc; use futures::{self, Future}; use parking_lot::Mutex; use tokio_core::reactor::Core; -use ethcrypto; +use crypto; use super::acl_storage::AclStorage; use super::key_storage::KeyStorage; use super::key_server_set::KeyServerSet; @@ -105,7 +105,7 @@ impl DocumentKeyServer for KeyServerImpl { self.store_document_key(key_id, author, encrypted_document_key.common_point, encrypted_document_key.encrypted_point)?; // encrypt document key with requestor public key - let document_key = ethcrypto::ecies::encrypt(&public, ðcrypto::DEFAULT_MAC, &document_key) + let document_key = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &document_key) .map_err(|err| Error::Internal(format!("Error encrypting document key: {}", err)))?; Ok(document_key) } @@ -122,7 +122,7 @@ impl DocumentKeyServer for KeyServerImpl { .decrypted_secret; // encrypt document key with requestor public key - let document_key = ethcrypto::ecies::encrypt(&public, ðcrypto::DEFAULT_MAC, &document_key) + let document_key = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &document_key) .map_err(|err| Error::Internal(format!("Error encrypting document key: {}", err)))?; Ok(document_key) } @@ -152,7 +152,7 @@ impl MessageSigner for KeyServerImpl { combined_signature[32..].clone_from_slice(&**message_signature.1); // encrypt combined signature with requestor public key - let message_signature = ethcrypto::ecies::encrypt(&public, ðcrypto::DEFAULT_MAC, &combined_signature) + let message_signature = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &combined_signature) .map_err(|err| Error::Internal(format!("Error encrypting message signature: {}", err)))?; Ok(message_signature) } @@ -167,7 +167,7 @@ impl MessageSigner for KeyServerImpl { let message_signature = signing_session.wait()?; // encrypt combined signature with requestor public key - let message_signature = ethcrypto::ecies::encrypt(&public, ðcrypto::DEFAULT_MAC, &*message_signature) + let message_signature = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &*message_signature) .map_err(|err| Error::Internal(format!("Error encrypting message signature: {}", err)))?; Ok(message_signature) } @@ -229,7 +229,7 @@ pub mod tests { use std::sync::Arc; use std::net::SocketAddr; use std::collections::BTreeMap; - use ethcrypto; + use crypto; use ethkey::{self, Secret, Random, Generator, verify_public}; use acl_storage::DummyAclStorage; use key_storage::KeyStorage; @@ -358,12 +358,12 @@ pub mod tests { let secret = Random.generate().unwrap().secret().clone(); let signature = ethkey::sign(&secret, &document).unwrap(); let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), threshold).unwrap(); - let generated_key = ethcrypto::ecies::decrypt(&secret, ðcrypto::DEFAULT_MAC, &generated_key).unwrap(); + let generated_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &generated_key).unwrap(); // now let's try to retrieve key back for key_server in key_servers.iter() { let retrieved_key = key_server.restore_document_key(&document, &signature.clone().into()).unwrap(); - let retrieved_key = ethcrypto::ecies::decrypt(&secret, ðcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); + let retrieved_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap(); assert_eq!(retrieved_key, generated_key); } } @@ -380,12 +380,12 @@ pub mod tests { let secret = Random.generate().unwrap().secret().clone(); let signature = ethkey::sign(&secret, &document).unwrap(); let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), *threshold).unwrap(); - let generated_key = ethcrypto::ecies::decrypt(&secret, ðcrypto::DEFAULT_MAC, &generated_key).unwrap(); + let generated_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &generated_key).unwrap(); // now let's try to retrieve key back for (i, key_server) in key_servers.iter().enumerate() { let retrieved_key = key_server.restore_document_key(&document, &signature.clone().into()).unwrap(); - let retrieved_key = ethcrypto::ecies::decrypt(&secret, ðcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); + let retrieved_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap(); assert_eq!(retrieved_key, generated_key); let key_share = key_storages[i].get(&document).unwrap().unwrap(); @@ -419,7 +419,7 @@ pub mod tests { // now let's try to retrieve key back for key_server in key_servers.iter() { let retrieved_key = key_server.restore_document_key(&server_key_id, &signature.clone().into()).unwrap(); - let retrieved_key = ethcrypto::ecies::decrypt(&requestor_secret, ðcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); + let retrieved_key = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap(); let retrieved_key = Public::from_slice(&retrieved_key); assert_eq!(retrieved_key, generated_key); } @@ -442,7 +442,7 @@ pub mod tests { // sign message let message_hash = H256::from(42); let combined_signature = key_servers[0].sign_message_schnorr(&server_key_id, &signature.into(), message_hash.clone()).unwrap(); - let combined_signature = ethcrypto::ecies::decrypt(&requestor_secret, ðcrypto::DEFAULT_MAC, &combined_signature).unwrap(); + let combined_signature = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &combined_signature).unwrap(); let signature_c = Secret::from_slice(&combined_signature[..32]); let signature_s = Secret::from_slice(&combined_signature[32..]); @@ -462,14 +462,14 @@ pub mod tests { let secret = Random.generate().unwrap().secret().clone(); let signature = ethkey::sign(&secret, &document).unwrap(); let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), threshold).unwrap(); - let generated_key = ethcrypto::ecies::decrypt(&secret, ðcrypto::DEFAULT_MAC, &generated_key).unwrap(); + let generated_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &generated_key).unwrap(); // remove key from node0 key_servers[0].cluster().key_storage().remove(&document).unwrap(); // now let's try to retrieve key back by requesting it from node0, so that session must be delegated let retrieved_key = key_servers[0].restore_document_key(&document, &signature.into()).unwrap(); - let retrieved_key = ethcrypto::ecies::decrypt(&secret, ðcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); + let retrieved_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap(); assert_eq!(retrieved_key, generated_key); } @@ -491,7 +491,7 @@ pub mod tests { // sign message let message_hash = H256::from(42); let combined_signature = key_servers[0].sign_message_schnorr(&server_key_id, &signature.into(), message_hash.clone()).unwrap(); - let combined_signature = ethcrypto::ecies::decrypt(&requestor_secret, ðcrypto::DEFAULT_MAC, &combined_signature).unwrap(); + let combined_signature = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &combined_signature).unwrap(); let signature_c = Secret::from_slice(&combined_signature[..32]); let signature_s = Secret::from_slice(&combined_signature[32..]); @@ -517,7 +517,7 @@ pub mod tests { // sign message let message_hash = H256::random(); let signature = key_servers[0].sign_message_ecdsa(&server_key_id, &signature.into(), message_hash.clone()).unwrap(); - let signature = ethcrypto::ecies::decrypt(&requestor_secret, ðcrypto::DEFAULT_MAC, &signature).unwrap(); + let signature = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &signature).unwrap(); let signature: H520 = signature[0..65].into(); // check signature diff --git a/secret_store/src/key_server_cluster/client_sessions/decryption_session.rs b/secret_store/src/key_server_cluster/client_sessions/decryption_session.rs index 49c4e26d6..3343652c2 100644 --- a/secret_store/src/key_server_cluster/client_sessions/decryption_session.rs +++ b/secret_store/src/key_server_cluster/client_sessions/decryption_session.rs @@ -1269,8 +1269,8 @@ mod tests { assert!(decrypted_secret.common_point.is_some()); assert!(decrypted_secret.decrypt_shadows.is_some()); // check that KS client is able to restore original secret - use ethcrypto::DEFAULT_MAC; - use ethcrypto::ecies::decrypt; + use crypto::DEFAULT_MAC; + use crypto::ecies::decrypt; let decrypt_shadows: Vec<_> = decrypted_secret.decrypt_shadows.unwrap().into_iter() .map(|c| Secret::from_slice(&decrypt(key_pair.secret(), &DEFAULT_MAC, &c).unwrap())) .collect(); @@ -1413,8 +1413,8 @@ mod tests { assert_eq!(1, sessions.iter().skip(1).filter(|s| s.broadcast_shadows().is_none()).count()); // 4 nodes must be able to recover original secret - use ethcrypto::DEFAULT_MAC; - use ethcrypto::ecies::decrypt; + use crypto::DEFAULT_MAC; + use crypto::ecies::decrypt; let result = sessions[0].decrypted_secret().unwrap().unwrap(); assert_eq!(3, sessions.iter().skip(1).filter(|s| s.decrypted_secret() == Some(Ok(result.clone()))).count()); let decrypt_shadows: Vec<_> = result.decrypt_shadows.unwrap().into_iter() diff --git a/secret_store/src/key_server_cluster/io/handshake.rs b/secret_store/src/key_server_cluster/io/handshake.rs index c48ed27da..838e48e1f 100644 --- a/secret_store/src/key_server_cluster/io/handshake.rs +++ b/secret_store/src/key_server_cluster/io/handshake.rs @@ -37,7 +37,7 @@ use std::sync::Arc; use std::collections::BTreeSet; use futures::{Future, Poll, Async}; use tokio_io::{AsyncRead, AsyncWrite}; -use ethcrypto::ecdh::agree; +use crypto::ecdh::agree; use ethkey::{Random, Generator, KeyPair, Public, Signature, verify_public, sign, recover}; use ethereum_types::H256; use key_server_cluster::{NodeId, Error, NodeKeyPair}; diff --git a/secret_store/src/key_server_cluster/io/message.rs b/secret_store/src/key_server_cluster/io/message.rs index 94030ef41..784b0b2b6 100644 --- a/secret_store/src/key_server_cluster/io/message.rs +++ b/secret_store/src/key_server_cluster/io/message.rs @@ -19,7 +19,7 @@ use std::u16; use std::ops::Deref; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use serde_json; -use ethcrypto::ecies; +use crypto::ecies; use ethkey::{Secret, KeyPair}; use ethkey::math::curve_order; use ethereum_types::{H256, U256}; @@ -306,7 +306,7 @@ pub mod tests { use futures::Poll; use tokio_io::{AsyncRead, AsyncWrite}; use ethkey::{Random, Generator, KeyPair}; - use ethcrypto::ecdh::agree; + use crypto::ecdh::agree; use key_server_cluster::Error; use key_server_cluster::message::Message; use super::{MESSAGE_HEADER_SIZE, CURRENT_HEADER_VERSION, MessageHeader, fix_shared_key, encrypt_message, diff --git a/secret_store/src/key_server_cluster/jobs/decryption_job.rs b/secret_store/src/key_server_cluster/jobs/decryption_job.rs index 7bf1a294a..6864665f3 100644 --- a/secret_store/src/key_server_cluster/jobs/decryption_job.rs +++ b/secret_store/src/key_server_cluster/jobs/decryption_job.rs @@ -17,8 +17,8 @@ use std::collections::{BTreeSet, BTreeMap}; use ethereum_types::H256; use ethkey::{Public, Secret}; -use ethcrypto::ecies::encrypt; -use ethcrypto::DEFAULT_MAC; +use crypto::ecies::encrypt; +use crypto::DEFAULT_MAC; use key_server_cluster::{Error, NodeId, DocumentKeyShare, EncryptedDocumentKeyShadow}; use key_server_cluster::math; use key_server_cluster::jobs::job_session::{JobPartialRequestAction, JobPartialResponseAction, JobExecutor}; diff --git a/secret_store/src/key_server_cluster/mod.rs b/secret_store/src/key_server_cluster/mod.rs index 804c85e31..94386d051 100644 --- a/secret_store/src/key_server_cluster/mod.rs +++ b/secret_store/src/key_server_cluster/mod.rs @@ -17,7 +17,7 @@ use std::fmt; use std::io::Error as IoError; use ethkey; -use ethcrypto; +use crypto; use super::types::all::ServerKeyId; pub use super::traits::NodeKeyPair; @@ -124,8 +124,8 @@ impl From for Error { } } -impl From for Error { - fn from(err: ethcrypto::Error) -> Self { +impl From for Error { + fn from(err: crypto::Error) -> Self { Error::EthKey(err.into()) } } diff --git a/secret_store/src/lib.rs b/secret_store/src/lib.rs index c087d6651..9a7310b11 100644 --- a/secret_store/src/lib.rs +++ b/secret_store/src/lib.rs @@ -18,10 +18,10 @@ extern crate byteorder; extern crate ethabi; extern crate ethcore; extern crate ethcore_bytes as bytes; +extern crate ethcore_crypto as crypto; extern crate ethcore_logger as logger; extern crate ethcore_sync as sync; extern crate ethcore_transaction as transaction; -extern crate ethcrypto; extern crate ethereum_types; extern crate ethkey; extern crate futures_cpupool; diff --git a/secret_store/src/node_key_pair.rs b/secret_store/src/node_key_pair.rs index 75c840185..55c2a8a28 100644 --- a/secret_store/src/node_key_pair.rs +++ b/secret_store/src/node_key_pair.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use std::sync::Arc; -use ethcrypto::ecdh::agree; +use crypto::ecdh::agree; use ethkey::{KeyPair, Public, Signature, Error as EthKeyError, sign, public_to_address}; use ethcore::account_provider::AccountProvider; use ethereum_types::{H256, Address}; diff --git a/util/network-devp2p/Cargo.toml b/util/network-devp2p/Cargo.toml index 466ff9516..f6718d6b5 100644 --- a/util/network-devp2p/Cargo.toml +++ b/util/network-devp2p/Cargo.toml @@ -21,13 +21,13 @@ ansi_term = "0.10" rustc-hex = "1.0" ethcore-io = { path = "../io" } ethcore-bytes = { path = "../bytes" } +ethcore-crypto = { path = "../../ethcore/crypto" } +ethcore-logger = { path ="../../logger" } ethcore-network = { path = "../network" } ethereum-types = "0.3" ethkey = { path = "../../ethkey" } -ethcrypto = { path = "../../ethcrypto" } rlp = { path = "../rlp" } path = { path = "../path" } -ethcore-logger = { path ="../../logger" } ipnetwork = "0.12.6" keccak-hash = { path = "../hash" } snappy = { git = "https://github.com/paritytech/rust-snappy" } diff --git a/util/network-devp2p/src/lib.rs b/util/network-devp2p/src/lib.rs index fc3e66e3a..f326ff4b1 100644 --- a/util/network-devp2p/src/lib.rs +++ b/util/network-devp2p/src/lib.rs @@ -61,6 +61,7 @@ extern crate ethcore_io as io; extern crate ethcore_bytes; +extern crate ethcore_crypto as crypto; extern crate ethereum_types; extern crate parking_lot; extern crate mio; @@ -73,7 +74,6 @@ extern crate igd; extern crate libc; extern crate slab; extern crate ethkey; -extern crate ethcrypto as crypto; extern crate rlp; extern crate bytes; extern crate path; diff --git a/util/network/Cargo.toml b/util/network/Cargo.toml index 7d3d48b5a..f98cd9e93 100644 --- a/util/network/Cargo.toml +++ b/util/network/Cargo.toml @@ -7,11 +7,11 @@ version = "1.11.0" authors = ["Parity Technologies "] [dependencies] +error-chain = { version = "0.11", default-features = false } +ethcore-crypto = { path = "../../ethcore/crypto" } ethcore-io = { path = "../io" } ethereum-types = "0.3" ethkey = { path = "../../ethkey" } -ethcrypto = { path = "../../ethcrypto" } -rlp = { path = "../rlp" } ipnetwork = "0.12.6" +rlp = { path = "../rlp" } snappy = { git = "https://github.com/paritytech/rust-snappy" } -error-chain = { version = "0.11", default-features = false } diff --git a/util/network/src/lib.rs b/util/network/src/lib.rs index 7bd13d1f3..55c31dd2e 100644 --- a/util/network/src/lib.rs +++ b/util/network/src/lib.rs @@ -16,8 +16,8 @@ #![recursion_limit="128"] +extern crate ethcore_crypto as crypto; extern crate ethcore_io as io; -extern crate ethcrypto as crypto; extern crate ethereum_types; extern crate ethkey; extern crate rlp; diff --git a/whisper/Cargo.toml b/whisper/Cargo.toml index b972bf5cf..49d4dffed 100644 --- a/whisper/Cargo.toml +++ b/whisper/Cargo.toml @@ -9,7 +9,7 @@ bitflags = "0.9" byteorder = "1.0.0" ethereum-types = "0.3" ethcore-network = { path = "../util/network" } -ethcrypto = { path = "../ethcrypto" } +ethcore-crypto = { path = "../ethcore/crypto" } ethkey = { path = "../ethkey" } hex = "0.2" log = "0.3" diff --git a/whisper/src/lib.rs b/whisper/src/lib.rs index 1f8449604..bcee122ec 100644 --- a/whisper/src/lib.rs +++ b/whisper/src/lib.rs @@ -18,8 +18,8 @@ //! interface. extern crate byteorder; +extern crate ethcore_crypto as crypto; extern crate ethcore_network as network; -extern crate ethcrypto; extern crate ethereum_types; extern crate ethkey; extern crate hex; diff --git a/whisper/src/rpc/crypto.rs b/whisper/src/rpc/crypto.rs index 8dcfed88a..e7782a077 100644 --- a/whisper/src/rpc/crypto.rs +++ b/whisper/src/rpc/crypto.rs @@ -16,6 +16,7 @@ //! Encryption schemes supported by RPC layer. +use crypto; use ethereum_types::H256; use ethkey::{self, Public, Secret}; use ring::aead::{self, AES_256_GCM, SealingKey, OpeningKey}; @@ -117,7 +118,7 @@ impl EncryptionInstance { } } EncryptionInner::ECIES(valid_public) => { - ::ethcrypto::ecies::encrypt(&valid_public, &[], plain) + crypto::ecies::encrypt(&valid_public, &[], plain) .expect("validity of public key an invariant of the type; qed") } } @@ -213,7 +214,7 @@ impl DecryptionInstance { } DecryptionInner::ECIES(secret) => { // secret is checked for validity, so only fails on invalid message. - ::ethcrypto::ecies::decrypt(&secret, &[], ciphertext).ok() + crypto::ecies::decrypt(&secret, &[], ciphertext).ok() } } }