From 1283545b4b0a5a5624ed9ebeaeb5efe224011635 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Fri, 11 May 2018 15:46:54 +0200 Subject: [PATCH] Fix sync: ensure block hash gets read from the DB correctly (#152) * update bootnodes * fix block_hash loading * test block hash gets inserted correctly * specify revision to pull kvdb-memorydb from * update parity repo dep --- polkadot/keystore/Cargo.toml | 2 +- polkadot/keystore/src/lib.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/polkadot/keystore/Cargo.toml b/polkadot/keystore/Cargo.toml index 92026c9c8d..d5d5ec8afe 100644 --- a/polkadot/keystore/Cargo.toml +++ b/polkadot/keystore/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -ethcore-crypto = { git = "https://github.com/paritytech/parity", default_features = false } +ethcore-crypto = { git = "https://github.com/paritytech/parity.git", default_features = false } ed25519 = { path = "../../substrate/ed25519" } error-chain = "0.11" hex = "0.3" diff --git a/polkadot/keystore/src/lib.rs b/polkadot/keystore/src/lib.rs index 62268edf6e..0518875e74 100644 --- a/polkadot/keystore/src/lib.rs +++ b/polkadot/keystore/src/lib.rs @@ -91,7 +91,8 @@ impl EncryptedKey { let mut ciphertext = vec![0; PKCS_LEN]; // aes-128-ctr with initial vector of iv - crypto::aes::encrypt(&derived_left_bits, &iv, plain, &mut *ciphertext); + crypto::aes::encrypt_128_ctr(&derived_left_bits, &iv, plain, &mut *ciphertext) + .expect("input lengths of key and iv are both 16; qed"); // KECCAK(DK[16..31] ++ ), where DK[16..31] - derived_right_bits let mac = crypto::derive_mac(&derived_right_bits, &*ciphertext).keccak256(); @@ -116,7 +117,8 @@ impl EncryptedKey { } let mut plain = [0; PKCS_LEN]; - crypto::aes::decrypt(&derived_left_bits, &self.iv, &self.ciphertext, &mut plain[..]); + crypto::aes::decrypt_128_ctr(&derived_left_bits, &self.iv, &self.ciphertext, &mut plain[..]) + .expect("input lengths of key and iv are both 16; qed"); Ok(plain) } }