update tiny-keccak (#4093)

* update tiny-keccak

* fix

* Update Cargo.toml

* update Cargo.lock

* remove keccak-hasher
This commit is contained in:
Weiliang Li
2019-11-12 17:35:46 +09:00
committed by Gavin Wood
parent f1427d51f8
commit bff16d906d
9 changed files with 34 additions and 21 deletions
+1 -2
View File
@@ -21,8 +21,7 @@ runtime-interface = { package = "substrate-runtime-interface", path = "../runtim
externalities = { package = "substrate-externalities", path = "../externalities" }
parking_lot = "0.9.0"
log = "0.4.8"
libsecp256k1 = "0.3.0"
tiny-keccak = "1.5.0"
libsecp256k1 = "0.3.2"
cranelift-codegen = { version = "0.46.1", optional = true }
cranelift-entity = { version = "0.46.1", optional = true }
@@ -19,7 +19,7 @@
use codec::Encode;
use std::{convert::TryFrom, str};
use primitives::{
blake2_128, blake2_256, twox_64, twox_128, twox_256, ed25519, sr25519, Blake2Hasher, Pair,
blake2_128, blake2_256, twox_64, twox_128, twox_256, ed25519, sr25519, keccak_256, Blake2Hasher, Pair,
crypto::KeyTypeId, offchain,
};
use trie::{TrieConfiguration, trie_types::Layout};
@@ -538,11 +538,11 @@ impl_wasm_host_interface! {
ext_keccak_256(data: Pointer<u8>, len: WordSize, out: Pointer<u8>) {
let result: [u8; 32] = if len == 0 {
tiny_keccak::keccak256(&[0u8; 0])
keccak_256(&[0u8; 0])
} else {
let mem = context.read_memory(data, len)
.map_err(|_| "Invalid attempt to get data in ext_keccak_256")?;
tiny_keccak::keccak256(&mem)
keccak_256(&mem)
};
context.write_memory(out, &result)
.map_err(|_| "Invalid attempt to set result in ext_keccak_256")?;