Crypto primitives removed from ethkey (#11174)

* Crypto utils removed from ethkey

* Fix ethkey lib

* Switch ethsore to new crypto

* Accounts crate fixed

* Secret store crate switched to new crypto

* Ethcore builtin fixed

* Accounts crate fixed

* Ethcore crate fixed

* Util network fixed

* Util network-devp2p fixed

* Private tx fixed

* Ethcore sync fixed

* Secret store fixed

* Rpc fixed

* Parity fixed

* Ethkey cli fixed

* Local store fixed

* Ethcore blockchain fixed

* Cargo.lock pushed; doc comment added for reversed nonce

* Ethstore tests fixed

* Ethstore cli fixed

* Miner fixed

* Snapshot tests are fixed

* Single brackets removed

* Machine fixed

* Verification fixed

* Executive state fixed

* More single brackets removed

* Update version of parity-crypto

* Use published version 0.4.2 of parity-crypto

* New test in tx_filter fixed
This commit is contained in:
Anton Gavrilov
2019-10-23 13:03:46 +02:00
committed by GitHub
parent 81ca599f2a
commit 834585d61b
176 changed files with 579 additions and 2376 deletions

View File

@@ -21,7 +21,8 @@ use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
use std::time::Duration;
use bytes::{Buf, BufMut};
use crypto::aes::{AesCtr256, AesEcb256};
use parity_crypto::aes::{AesCtr256, AesEcb256};
use parity_crypto::publickey::Secret;
use ethereum_types::{H128, H256, H512};
use keccak_hash::{keccak, write_keccak};
use log::{debug, trace, warn};
@@ -33,7 +34,6 @@ use rlp::{Rlp, RlpStream};
use tiny_keccak::Keccak;
use ethcore_io::{IoContext, StreamToken};
use ethkey::{crypto as ethcrypto, Secret};
use network::Error;
use crate::handshake::Handshake;
@@ -302,7 +302,7 @@ const NULL_IV : [u8; 16] = [0;16];
impl EncryptedConnection {
/// Create an encrypted connection out of the handshake.
pub fn new(handshake: &mut Handshake) -> Result<EncryptedConnection, Error> {
let shared = ethcrypto::ecdh::agree(handshake.ecdhe.secret(), &handshake.remote_ephemeral)?;
let shared = parity_crypto::publickey::ecdh::agree(handshake.ecdhe.secret(), &handshake.remote_ephemeral)?;
let mut nonce_material = H512::default();
if handshake.originated {
(&mut nonce_material[0..32]).copy_from_slice(handshake.remote_nonce.as_bytes());
@@ -328,7 +328,7 @@ impl EncryptedConnection {
let decoder = AesCtr256::new(&key_material[32..64], &NULL_IV)?;
let key_material_keccak = keccak(&key_material);
(&mut key_material[32..64]).copy_from_slice(key_material_keccak.as_bytes());
let mac_encoder_key: Secret = Secret::from_slice(&key_material[32..64]).expect("can create Secret from 32 bytes; qed");
let mac_encoder_key: Secret = Secret::copy_from_slice(&key_material[32..64]).expect("can create Secret from 32 bytes; qed");
let mut egress_mac = Keccak::new_keccak256();
let mut mac_material = H256::from_slice(&key_material[32..64]) ^ handshake.remote_nonce;

View File

@@ -27,7 +27,7 @@ use lru_cache::LruCache;
use parity_bytes::Bytes;
use rlp::{Rlp, RlpStream};
use ethkey::{KeyPair, recover, Secret, sign};
use parity_crypto::publickey::{KeyPair, recover, Secret, sign};
use network::Error;
use network::IpFilter;
@@ -901,7 +901,7 @@ mod tests {
use rustc_hex::FromHex;
use ethkey::{Generator, Random};
use parity_crypto::publickey::{Generator, Random};
use crate::node_table::{Node, NodeEndpoint, NodeId};

View File

@@ -25,8 +25,7 @@ use rand::random;
use rlp::{Rlp, RlpStream};
use ethcore_io::{IoContext, StreamToken};
use ethkey::{Generator, KeyPair, Public, Random, recover, Secret, sign};
use ethkey::crypto::{ecdh, ecies};
use parity_crypto::publickey::{Generator, KeyPair, Public, Random, recover, Secret, sign, ecdh, ecies};
use network::Error;
use crate::connection::Connection;
@@ -329,7 +328,7 @@ mod test {
use rustc_hex::FromHex;
use ethcore_io::*;
use ethkey::Public;
use parity_crypto::publickey::Public;
use super::*;

View File

@@ -40,7 +40,7 @@ use rlp::{Encodable, RlpStream};
use rustc_hex::ToHex;
use ethcore_io::{IoContext, IoHandler, IoManager, StreamToken, TimerToken};
use ethkey::{Generator, KeyPair, Random, Secret};
use parity_crypto::publickey::{Generator, KeyPair, Random, Secret};
use network::{
client_version::ClientVersion, ConnectionDirection, ConnectionFilter, DisconnectReason, Error,
NetworkConfiguration, NetworkContext as NetworkContextTrait, NetworkIoMessage, NetworkProtocolHandler,