Skip to content

Commit

Permalink
Update curve25519-dalek
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Feb 3, 2023
1 parent 98c8f69 commit badfde3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rust-version = "1.60"
version = "2.0.0"

[features]
curve25519 = ["curve25519-dalek"]
curve25519 = ["curve25519-dalek/precomputed-tables"]
default = ["ristretto255-voprf", "serde"]
ristretto255 = ["curve25519-dalek", "voprf/ristretto255"]
ristretto255-voprf = ["ristretto255", "voprf/ristretto255-ciphersuite"]
Expand All @@ -23,8 +23,9 @@ std = ["getrandom"]
argon2 = { version = "0.4", default-features = false, features = [
"alloc",
], optional = true }
curve25519-dalek = { version = "=4.0.0-pre.5", default-features = false, features = [
curve25519-dalek = { version = "=4.0.0-rc.1", default-features = false, features = [
"rand_core",
"zeroize",
], optional = true }
derive-where = { version = "1", features = ["zeroize-on-drop"] }
digest = "0.10"
Expand Down Expand Up @@ -78,4 +79,4 @@ name = "simple_login"
required-features = ["argon2"]

[patch.crates-io]
voprf = { git = "https://github.com/facebook/voprf" }
voprf = { git = "https://github.com/khonsulabs/voprf", branch = "curve25519-dalek-4.0.0-rc.1"}
2 changes: 1 addition & 1 deletion src/key_exchange/group/curve25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl KeGroup for Curve25519 {
}

fn public_key(sk: Self::Sk) -> Self::Pk {
(&ED25519_BASEPOINT_TABLE * &sk).to_montgomery()
(ED25519_BASEPOINT_TABLE * &sk).to_montgomery()
}

fn diffie_hellman(pk: Self::Pk, sk: Self::Sk) -> GenericArray<u8, Self::PkLen> {
Expand Down
5 changes: 1 addition & 4 deletions src/key_exchange/group/ristretto255.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ impl KeGroup for Ristretto255 {
}

fn deserialize_pk(bytes: &[u8]) -> Result<Self::Pk, InternalError> {
if bytes.len() != 32 {
return Err(InternalError::PointError);
}

CompressedRistretto::from_slice(bytes)
.map_err(|_| InternalError::PointError)?
.decompress()
.filter(|point| point != &RistrettoPoint::identity())
.ok_or(InternalError::PointError)
Expand Down

0 comments on commit badfde3

Please sign in to comment.