From d44f678044530f9b453a0fcc40d2aaceb3c3f1ec Mon Sep 17 00:00:00 2001 From: Jun Kimura Date: Thu, 21 Nov 2024 17:30:04 +0900 Subject: [PATCH] bump crate versions * bump `tiny-keccak` to v2 * bump sha2 to v0.10.8 Signed-off-by: Jun Kimura --- Cargo.lock | 19 ++++---------- enclave/Cargo.lock | 39 +++++++++++----------------- enclave/Cargo.toml | 2 +- modules/commitments/Cargo.toml | 2 +- modules/crypto/Cargo.toml | 2 +- modules/crypto/src/key.rs | 4 +-- modules/crypto/src/traits.rs | 4 +-- modules/lcp-client/Cargo.toml | 2 +- modules/lcp-client/src/client_def.rs | 8 +++--- 9 files changed, 32 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 369c5cfb..fc23299e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,7 +124,7 @@ dependencies = [ "itoa", "paste", "ruint", - "tiny-keccak 2.0.2", + "tiny-keccak", ] [[package]] @@ -156,7 +156,7 @@ dependencies = [ "quote", "syn 2.0.88", "syn-solidity", - "tiny-keccak 2.0.2", + "tiny-keccak", ] [[package]] @@ -1140,7 +1140,7 @@ dependencies = [ "sgx_trts", "sgx_tseal", "sgx_types", - "tiny-keccak 1.5.0", + "tiny-keccak", "zeroize", ] @@ -2428,7 +2428,7 @@ dependencies = [ "tendermint-rpc", "thiserror", "tiny-bip39", - "tiny-keccak 2.0.2", + "tiny-keccak", "tokio", "toml", "tonic 0.8.3", @@ -2977,7 +2977,7 @@ dependencies = [ "serde_json", "sgx_types", "store", - "tiny-keccak 1.5.0", + "tiny-keccak", ] [[package]] @@ -5742,15 +5742,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "tiny-keccak" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" -dependencies = [ - "crunchy", -] - [[package]] name = "tiny-keccak" version = "2.0.2" diff --git a/enclave/Cargo.lock b/enclave/Cargo.lock index 5d5e1f48..8eb4b926 100644 --- a/enclave/Cargo.lock +++ b/enclave/Cargo.lock @@ -28,7 +28,7 @@ dependencies = [ "itoa", "paste", "ruint", - "tiny-keccak 2.0.2", + "tiny-keccak", ] [[package]] @@ -60,7 +60,7 @@ dependencies = [ "quote", "syn 2.0.89", "syn-solidity", - "tiny-keccak 2.0.2", + "tiny-keccak", ] [[package]] @@ -273,7 +273,7 @@ dependencies = [ "lcp-types", "prost", "serde", - "sha2 0.10.6", + "sha2 0.10.8", ] [[package]] @@ -326,7 +326,7 @@ dependencies = [ "sgx_trts", "sgx_tseal", "sgx_types", - "tiny-keccak 1.5.0", + "tiny-keccak", "zeroize", ] @@ -441,9 +441,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -776,7 +776,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "sha2 0.10.6", + "sha2 0.10.8", "subtle-encoding", "tendermint", "tendermint-light-client-verifier", @@ -815,7 +815,7 @@ dependencies = [ "hex", "prost", "ripemd", - "sha2 0.10.6", + "sha2 0.10.8", "sha3", ] @@ -1262,7 +1262,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.5", + "digest 0.10.7", ] [[package]] @@ -1517,12 +1517,12 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" -source = "git+https://github.com/bluele/hashes?branch=0.10.6-sha256-hwa-disabled#d7be7095f363f7710570815cda8cbde24903f1b3" +version = "0.10.8" +source = "git+https://github.com/bluele/hashes?branch=0.10.8-sha256-hwa-disabled#64b5261e4e44d0e990564f959e982279a60187db" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.7", ] [[package]] @@ -1531,7 +1531,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.7", "keccak", ] @@ -1636,7 +1636,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda53c85447577769cdfc94c10a56f34afef2c00e4108badb57fce6b1a0c75eb" dependencies = [ "bytes", - "digest 0.10.5", + "digest 0.10.7", "ed25519", "ed25519-consensus", "flex-error", @@ -1649,7 +1649,7 @@ dependencies = [ "serde_bytes", "serde_json", "serde_repr", - "sha2 0.10.6", + "sha2 0.10.8", "signature", "subtle", "subtle-encoding", @@ -1729,15 +1729,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-keccak" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" -dependencies = [ - "crunchy", -] - [[package]] name = "tiny-keccak" version = "2.0.2" diff --git a/enclave/Cargo.toml b/enclave/Cargo.toml index 701282b7..5fb34d8d 100644 --- a/enclave/Cargo.toml +++ b/enclave/Cargo.toml @@ -20,7 +20,7 @@ tendermint-lc = { path = "../modules/tendermint-lc", default-features = false } [patch."crates-io"] # TODO these patches would be better as optional -sha2-0106 = { git = "https://github.com/bluele/hashes", branch = "0.10.6-sha256-hwa-disabled", package = "sha2" } +sha2-0106 = { git = "https://github.com/bluele/hashes", branch = "0.10.8-sha256-hwa-disabled", package = "sha2" } sha2-099 = { git = "https://github.com/bluele/hashes", branch = "0.9.9-sha256-hwa-disabled", package = "sha2" } [profile.release] diff --git a/modules/commitments/Cargo.toml b/modules/commitments/Cargo.toml index 05e24f91..88d815c6 100644 --- a/modules/commitments/Cargo.toml +++ b/modules/commitments/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" serde = { version = "1.0.184", default-features = false, features = ["alloc"] } prost = { version = "0.11", default-features = false } hex = { version = "0.4", default-features = false, features = ["alloc"] } -sha2 = { version = "0.10.6", default-features = false } +sha2 = { version = "0.10.8", default-features = false } flex-error = { version = "0.4.4", default-features = false } alloy-sol-types = { version = "0.8", default-features = false } diff --git a/modules/crypto/Cargo.toml b/modules/crypto/Cargo.toml index 839c5573..7c3e5604 100644 --- a/modules/crypto/Cargo.toml +++ b/modules/crypto/Cargo.toml @@ -9,7 +9,7 @@ sgx_trts = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave sgx_tseal = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk", optional = true } rand = { version = "0.8", default-features = false, optional = true } -tiny-keccak = "1.4" +tiny-keccak = "2.0" serde = { version = "1.0.184", default-features = false, features = ["alloc", "derive"] } serde-big-array = "0.5.1" hex = { version = "0.4", default-features = false, features = ["alloc"] } diff --git a/modules/crypto/src/key.rs b/modules/crypto/src/key.rs index 3bdd1c95..5648e626 100644 --- a/modules/crypto/src/key.rs +++ b/modules/crypto/src/key.rs @@ -11,7 +11,7 @@ use libsecp256k1::{ use serde::{Deserialize, Serialize}; use serde_big_array::BigArray; use sgx_types::sgx_sealed_data_t; -use tiny_keccak::Keccak; +use tiny_keccak::{Hasher, Keccak}; use zeroize::Zeroizing; pub struct EnclaveKey { @@ -223,7 +223,7 @@ pub fn verify_signature_address(sign_bytes: &[u8], signature: &[u8]) -> Result [u8; 32] { - let mut keccak = Keccak::new_keccak256(); + let mut keccak = Keccak::v256(); let mut result = [0u8; 32]; keccak.update(bz); keccak.finalize(result.as_mut()); diff --git a/modules/crypto/src/traits.rs b/modules/crypto/src/traits.rs index 96f5d688..7c4a1d75 100644 --- a/modules/crypto/src/traits.rs +++ b/modules/crypto/src/traits.rs @@ -2,7 +2,7 @@ use crate::prelude::*; use crate::EnclavePublicKey; use crate::Error; use crate::SealedEnclaveKey; -use tiny_keccak::Keccak; +use tiny_keccak::{Hasher, Keccak}; pub trait Verifier { fn verify(&self, msg: &[u8], signature: &[u8]) -> Result<(), Error>; @@ -27,7 +27,7 @@ pub trait Keccak256 { impl Keccak256 for [u8] { fn keccak256(&self) -> [u8; 32] { - let mut keccak = Keccak::new_keccak256(); + let mut keccak = Keccak::v256(); let mut result = [0u8; 32]; keccak.update(self); keccak.finalize(result.as_mut()); diff --git a/modules/lcp-client/Cargo.toml b/modules/lcp-client/Cargo.toml index ed664d07..c47043c1 100644 --- a/modules/lcp-client/Cargo.toml +++ b/modules/lcp-client/Cargo.toml @@ -8,7 +8,7 @@ prost = { version = "0.11", default-features = false } serde = { version = "1.0.184", default-features = false, features = ["alloc", "derive"] } serde_json = { version = "1.0", default-features = false } flex-error = { version = "0.4.4", default-features = false } -tiny-keccak = { version = "1.4" } +tiny-keccak = { version = "2.0" } hex-literal = { version = "0.4.1" } alloy-sol-types = { version = "0.8", default-features = false } diff --git a/modules/lcp-client/src/client_def.rs b/modules/lcp-client/src/client_def.rs index c15c5546..48bb0f3f 100644 --- a/modules/lcp-client/src/client_def.rs +++ b/modules/lcp-client/src/client_def.rs @@ -14,7 +14,7 @@ use light_client::commitments::{ }; use light_client::types::{ClientId, Height, Time}; use light_client::{HostClientKeeper, HostClientReader}; -use tiny_keccak::Keccak; +use tiny_keccak::{Hasher, Keccak}; pub const LCP_CLIENT_TYPE: &str = "0000-lcp"; @@ -438,7 +438,7 @@ impl LCPClient { pub fn compute_eip712_register_enclave_key(avr: &str) -> Vec { // 0x1901 | DOMAIN_SEPARATOR_REGISTER_ENCLAVE_KEY | keccak256(keccak256("RegisterEnclaveKey(string avr)") | keccak256(avr)) let type_hash = { - let mut h = Keccak::new_keccak256(); + let mut h = Keccak::v256(); h.update(&keccak256(b"RegisterEnclaveKey(string avr)")); h.update(&keccak256(avr.as_bytes())); let mut result = [0u8; 32]; @@ -491,7 +491,7 @@ pub fn compute_eip712_update_operators( thresholdNumerator: threshold_numerator, thresholdDenominator: threshold_denominator, }; - let mut h = Keccak::new_keccak256(); + let mut h = Keccak::v256(); let bz = eip712_update_operator.abi_encode(); h.update(&bz); let mut result = [0u8; 32]; @@ -566,7 +566,7 @@ fn enclave_key_path(client_id: &ClientId, ek: Address) -> Vec { } fn keccak256(bz: &[u8]) -> [u8; 32] { - let mut keccak = Keccak::new_keccak256(); + let mut keccak = Keccak::v256(); let mut result = [0u8; 32]; keccak.update(bz); keccak.finalize(result.as_mut());