Skip to content

Commit

Permalink
Update Rust dependencies to stable versions
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwillian0 committed Apr 10, 2023
1 parent 6152378 commit 5b18e54
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
15 changes: 8 additions & 7 deletions native/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions native/src/api.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,7 +14,7 @@ pub fn ecdh(public_key_blob : Vec<u8>, private_key : Vec<u8>) -> Vec<u8> {
let mut j = 0;

for _i in 0..num_keys {
let public_key = elliptic_curve::PublicKey::<NistP224>::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);
Expand Down

0 comments on commit 5b18e54

Please sign in to comment.