Skip to content

Commit

Permalink
Use curve25519_dalek_ng instead of curve25519_dalek
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulGrandperrin committed Feb 4, 2021
1 parent 4f591ab commit e261fa0
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 63 deletions.
37 changes: 21 additions & 16 deletions Cargo.lock

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

12 changes: 3 additions & 9 deletions Cargo.toml
Expand Up @@ -13,11 +13,11 @@ readme = "README.md"
default = ["u64_backend"]
slow-hash = ["scrypt"]
bench = []
u64_backend = ["curve25519-dalek/u64_backend"]
u32_backend = ["curve25519-dalek/u32_backend"]
u64_backend = ["curve25519-dalek-ng/u64_backend"]
u32_backend = ["curve25519-dalek-ng/u32_backend"]

[dependencies]
curve25519-dalek = { version = "3.0.0", default-features = false, features = ["std"] }
curve25519-dalek-ng = { version = "4", default-features = false, features = ["std"] }
digest = "0.9.0"
displaydoc = "0.1.7"
generic-array = "0.14.4"
Expand Down Expand Up @@ -48,9 +48,3 @@ rustyline = "7.0.0"
name = "oprf"
harness = false
required-features = ["bench"]

# TEMPORARY, DO NOT MERGE
[patch.crates-io]
x25519-dalek = { git = "https://github.com/PaulGrandperrin/x25519-dalek.git", branch="patch-1" }
curve25519-dalek = { git = "https://github.com/PaulGrandperrin/curve25519-dalek.git", branch="patch-1" }

2 changes: 1 addition & 1 deletion benches/oprf.rs
Expand Up @@ -7,7 +7,7 @@
extern crate criterion;

use criterion::Criterion;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek_ng::ristretto::RistrettoPoint;
use generic_array::arr;
use opaque_ke::{
group::Group,
Expand Down
6 changes: 3 additions & 3 deletions examples/digital_locker.rs
Expand Up @@ -44,7 +44,7 @@ use opaque_ke::{
#[allow(dead_code)]
struct Default;
impl CipherSuite for Default {
type Group = curve25519_dalek::ristretto::RistrettoPoint;
type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
type Hash = sha2::Sha512;
type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -81,7 +81,7 @@ fn decrypt(key: &[u8], ciphertext: &[u8]) -> Vec<u8> {

// Password-based registration and encryption of client secret message between a client and server
fn register_locker(
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek::ristretto::RistrettoPoint>,
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek_ng::ristretto::RistrettoPoint>,
password: String,
secret_message: String,
) -> Locker {
Expand Down Expand Up @@ -134,7 +134,7 @@ fn register_locker(

// Open the contents of a locker with a password between a client and server
fn open_locker(
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek::ristretto::RistrettoPoint>,
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek_ng::ristretto::RistrettoPoint>,
password: String,
locker: &Locker,
) -> Result<String, String> {
Expand Down
6 changes: 3 additions & 3 deletions examples/simple_login.rs
Expand Up @@ -39,15 +39,15 @@ use opaque_ke::{
#[allow(dead_code)]
struct Default;
impl CipherSuite for Default {
type Group = curve25519_dalek::ristretto::RistrettoPoint;
type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
type Hash = sha2::Sha512;
type SlowHash = opaque_ke::slow_hash::NoOpHash;
}

// Password-based registration between a client and server
fn account_registration(
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek::ristretto::RistrettoPoint>,
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek_ng::ristretto::RistrettoPoint>,
password: String,
) -> Vec<u8> {
let mut client_rng = OsRng;
Expand Down Expand Up @@ -89,7 +89,7 @@ fn account_registration(

// Password-based login between a client and server
fn account_login(
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek::ristretto::RistrettoPoint>,
server_kp: &opaque_ke::keypair::KeyPair<curve25519_dalek_ng::ristretto::RistrettoPoint>,
password: String,
password_file_bytes: &[u8],
) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/group.rs
Expand Up @@ -8,7 +8,7 @@

use crate::errors::InternalPakeError;

use curve25519_dalek::{
use curve25519_dalek_ng::{
constants::RISTRETTO_BASEPOINT_POINT,
ristretto::{CompressedRistretto, RistrettoPoint},
scalar::Scalar,
Expand Down
2 changes: 1 addition & 1 deletion src/keypair.rs
Expand Up @@ -147,7 +147,7 @@ impl SizedBytes for Key {
#[cfg(test)]
mod tests {
use super::*;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek_ng::ristretto::RistrettoPoint;

proptest! {
#[test]
Expand Down
30 changes: 15 additions & 15 deletions src/lib.rs
Expand Up @@ -23,7 +23,7 @@
//! use opaque_ke::ciphersuite::CipherSuite;
//! struct Default;
//! impl CipherSuite for Default {
//! type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! type Hash = sha2::Sha512;
//! type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand All @@ -43,7 +43,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -75,7 +75,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -105,7 +105,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -142,7 +142,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -180,7 +180,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -221,7 +221,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -254,7 +254,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -303,7 +303,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -350,7 +350,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -426,7 +426,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -503,7 +503,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -568,7 +568,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -603,7 +603,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down Expand Up @@ -651,7 +651,7 @@
//! # use opaque_ke::ciphersuite::CipherSuite;
//! # struct Default;
//! # impl CipherSuite for Default {
//! # type Group = curve25519_dalek::ristretto::RistrettoPoint;
//! # type Group = curve25519_dalek_ng::ristretto::RistrettoPoint;
//! # type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
//! # type Hash = sha2::Sha512;
//! # type SlowHash = opaque_ke::slow_hash::NoOpHash;
Expand Down
2 changes: 1 addition & 1 deletion src/map_to_curve.rs
Expand Up @@ -10,7 +10,7 @@ use crate::errors::InternalPakeError;
use crate::group::Group;
use crate::hash::Hash;
use crate::serialization::i2osp;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek_ng::ristretto::RistrettoPoint;
use digest::{BlockInput, Digest};
use generic_array::typenum::Unsigned;
use generic_array::GenericArray;
Expand Down

0 comments on commit e261fa0

Please sign in to comment.