diff --git a/Cargo.toml b/Cargo.toml index ca9638e7..c85ec536 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk" -version = "3.2.1" +version = "3.3.0" authors = [ "Linfeng Qian ", "Nervos Core Dev " ] edition = "2018" license = "MIT" @@ -18,7 +18,7 @@ bech32 = "0.8.1" derive-getters = "0.2.1" log = "0.4.6" reqwest = { version = "0.11", default-features = false, features = [ "json", "blocking" ] } -secp256k1 = { version = "0.24", features = ["recovery"] } +secp256k1 = { version = "0.29.0", features = ["recovery"] } tokio-util = { version = "0.7.7", features = ["codec"] } tokio = { version = "1" } bytes = "1" @@ -29,22 +29,22 @@ lru = "0.7.1" dashmap = "5.4" dyn-clone = "1.0" -ckb-types = "0.116.1" -ckb-dao-utils = "0.116.1" -ckb-traits = "0.116.1" -ckb-jsonrpc-types = "0.116.1" -ckb-hash = "0.116.1" -ckb-resource = "0.116.1" -ckb-crypto = { version = "=0.116.1", features = ["secp"] } -ckb-script = "0.116.1" +ckb-types = "0.117.0" +ckb-dao-utils = "0.117.0" +ckb-traits = "0.117.0" +ckb-jsonrpc-types = "0.117.0" +ckb-hash = "0.117.0" +ckb-resource = "0.117.0" +ckb-crypto = { version = "=0.117.0", features = ["secp"] } +ckb-script = "0.117.0" bitflags = "1.3.2" sha3 = "0.10.1" enum-repr-derive = "0.2.0" # for feature test rand = { version = "0.7.3", optional = true } -ckb-mock-tx-types = { version = "0.116.1" } -ckb-chain-spec = "0.116.1" +ckb-mock-tx-types = { version = "0.117.0" } +ckb-chain-spec = "0.117.0" sparse-merkle-tree = "0.6.1" lazy_static = "1.3.0" diff --git a/src/traits/default_impls.rs b/src/traits/default_impls.rs index dfde0c54..826a795a 100644 --- a/src/traits/default_impls.rs +++ b/src/traits/default_impls.rs @@ -630,7 +630,8 @@ impl Signer for SecpCkbRawKeySigner { message.len() ))); } - let msg = secp256k1::Message::from_slice(message).expect("Convert to message failed"); + let msg = + secp256k1::Message::from_digest_slice(message).expect("Convert to message failed"); let key = self.keys.get(&H160::from_slice(id).unwrap()).unwrap(); if recoverable { let sig = SECP256K1.sign_ecdsa_recoverable(&msg, key); diff --git a/src/util.rs b/src/util.rs index ecb3ce1b..9148f4ab 100644 --- a/src/util.rs +++ b/src/util.rs @@ -12,9 +12,11 @@ use sha3::{Digest, Keccak256}; use crate::rpc::CkbRpcClient; use crate::traits::LiveCell; +use secp256k1::ffi::CPtr; + pub fn zeroize_privkey(key: &mut secp256k1::SecretKey) { - let key_ptr = key.as_mut_ptr(); - for i in 0..key.len() as isize { + let key_ptr = key.as_mut_c_ptr(); + for i in 0..key.as_ref().len() as isize { unsafe { ptr::write_volatile(key_ptr.offset(i), Default::default()) } atomic::compiler_fence(atomic::Ordering::SeqCst); }