From 5b18e5449c2e774349e19d9142281597c09b171e Mon Sep 17 00:00:00 2001 From: Willian Wang Date: Mon, 10 Apr 2023 18:48:11 -0300 Subject: [PATCH] Update Rust dependencies to stable versions --- native/Cargo.lock | 15 ++++++++------- native/Cargo.toml | 5 ++--- native/src/api.rs | 5 ++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/native/Cargo.lock b/native/Cargo.lock index 9f5aa56..6889f6e 100644 --- a/native/Cargo.lock +++ b/native/Cargo.lock @@ -246,9 +246,9 @@ dependencies = [ [[package]] name = "elliptic-curve" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cdacd4d6ed3f9b98680b679c0e52a823b8a2c7a97358d508fe247f2180c282" +checksum = "75c71eaa367f2e5d556414a8eea812bc62985c879748d6403edabd9cb03f16e7" dependencies = [ "base16ct", "crypto-bigint", @@ -445,7 +445,6 @@ dependencies = [ name = "native" version = "0.1.0" dependencies = [ - "elliptic-curve", "flutter_rust_bridge", "getrandom", "p224", @@ -488,8 +487,9 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "p224" -version = "0.13.0" -source = "git+https://github.com/RustCrypto/elliptic-curves#8958c2f535cc973a7cf216bcbad1f797ae6f9cdd" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4218ee67d118cf7ce98ffff01a13c6712e729c969d300906558e11a884796878" dependencies = [ "elliptic-curve", "primeorder", @@ -539,8 +539,9 @@ dependencies = [ [[package]] name = "primeorder" -version = "0.13.0" -source = "git+https://github.com/RustCrypto/elliptic-curves#8958c2f535cc973a7cf216bcbad1f797ae6f9cdd" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8d3875361e28f7753baefef104386e7aa47642c93023356d97fdef4003bfb5" dependencies = [ "elliptic-curve", ] diff --git a/native/Cargo.toml b/native/Cargo.toml index 09747d3..1939bc7 100644 --- a/native/Cargo.toml +++ b/native/Cargo.toml @@ -8,12 +8,11 @@ crate-type = ["staticlib", "cdylib", "rlib"] [dependencies] flutter_rust_bridge = "1.72.1" -elliptic-curve = "0.13.3" -p224 = { git = "https://github.com/RustCrypto/elliptic-curves"} +p224 = "^0.13.1" getrandom = "0.2" [features] -default = ["p224/wip-arithmetic-do-not-use", "elliptic-curve/ecdh", "getrandom/js"] +default = ["p224/ecdh", "getrandom/js"] [profile.release] opt-level = 3 diff --git a/native/src/api.rs b/native/src/api.rs index f191539..67c8d1c 100644 --- a/native/src/api.rs +++ b/native/src/api.rs @@ -1,5 +1,4 @@ -use elliptic_curve::{self, ecdh::diffie_hellman}; -use p224::{NistP224, SecretKey}; +use p224::{SecretKey, PublicKey, ecdh::diffie_hellman}; const PRIVATE_LEN : usize = 28; const PUBLIC_LEN : usize = 57; @@ -15,7 +14,7 @@ pub fn ecdh(public_key_blob : Vec, private_key : Vec) -> Vec { let mut j = 0; for _i in 0..num_keys { - let public_key = elliptic_curve::PublicKey::::from_sec1_bytes(&public_key_blob[i..i+PUBLIC_LEN]).unwrap(); + let public_key = PublicKey::from_sec1_bytes(&public_key_blob[i..i+PUBLIC_LEN]).unwrap(); let public_affine = public_key.as_affine(); let shared_secret = diffie_hellman(secret_scalar, public_affine);