diff --git a/extmod/foundation-rust/Cargo.lock b/extmod/foundation-rust/Cargo.lock index caf83ab1d..57c5248f8 100644 --- a/extmod/foundation-rust/Cargo.lock +++ b/extmod/foundation-rust/Cargo.lock @@ -434,9 +434,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ "rand", "secp256k1-sys", @@ -444,9 +444,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" dependencies = [ "cc", ] diff --git a/extmod/foundation-rust/Cargo.toml b/extmod/foundation-rust/Cargo.toml index 10232d4ba..9c29a0c8d 100644 --- a/extmod/foundation-rust/Cargo.toml +++ b/extmod/foundation-rust/Cargo.toml @@ -53,7 +53,7 @@ default-features = false features = ["critical-section"] [dependencies.secp256k1] -version = "0.27" +version = "0.29" default-features = false features = ["lowmemory", "rand"] diff --git a/extmod/foundation-rust/src/secp256k1.rs b/extmod/foundation-rust/src/secp256k1.rs index b436357c6..c3ec7b387 100644 --- a/extmod/foundation-rust/src/secp256k1.rs +++ b/extmod/foundation-rust/src/secp256k1.rs @@ -4,7 +4,7 @@ use core::ptr; use once_cell::sync::Lazy; use secp256k1::{ - ffi::types::AlignedType, AllPreallocated, KeyPair, Message, Secp256k1, + ffi::types::AlignedType, AllPreallocated, Keypair, Message, Secp256k1, SecretKey, }; @@ -35,7 +35,7 @@ pub extern "C" fn secp256k1_public_key_schnorr( secret_key: &[u8; 32], public_key: &mut [u8; 32], ) { - let keypair = KeyPair::from_seckey_slice(&PRE_ALLOCATED_CTX, secret_key) + let keypair = Keypair::from_seckey_slice(&PRE_ALLOCATED_CTX, secret_key) .expect("invalid secret key"); let compressed_key = keypair.public_key().serialize(); public_key.copy_from_slice(&compressed_key[1..]); @@ -55,7 +55,7 @@ pub extern "C" fn secp256k1_sign_ecdsa( let secret_key = SecretKey::from_slice(secret_key).expect("invalid secret key"); - let msg = Message::from_slice(data).unwrap(); + let msg = Message::from_digest_slice(data).unwrap(); let sig = PRE_ALLOCATED_CTX.sign_ecdsa(&msg, &secret_key); signature.copy_from_slice(&sig.serialize_compact()); } @@ -71,10 +71,10 @@ pub extern "C" fn secp256k1_sign_schnorr( secret_key: &[u8; 32], signature: &mut [u8; 64], ) { - let keypair = KeyPair::from_seckey_slice(&PRE_ALLOCATED_CTX, secret_key) + let keypair = Keypair::from_seckey_slice(&PRE_ALLOCATED_CTX, secret_key) .expect("invalid secret key"); - let msg = Message::from_slice(data).unwrap(); + let msg = Message::from_digest_slice(data).unwrap(); let sig = PRE_ALLOCATED_CTX.sign_schnorr_with_rng(&msg, &keypair, &mut rng()); signature.copy_from_slice(sig.as_ref());