Repository: facebook/opaque-ke (language: rust)

Issue:
Build fails
Hi, I'm trying to build this crate, version `2.0.0-pre 2`, inside a docker container and it fails to build. Building locally on a new project also fails. I created a demo repo with a Dockerfile: [Link to a demo repo](https://github.com/riley-ashton/opaque-ke-docker-failure)
The given error is pasted at the bottom. 

Building an existing local project does work. I am on Fedora 36 with Rust 1.62. The cargo lock files are different, namely:

Any help would be appreciated. Thanks!

## Cargo.lock

### Working (existing project)

```toml
[[package]]
name = "opaque-ke"
version = "2.0.0-pre.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9844f463f0a94ae962969f233bf7ebae4dc8dc6c0d1bf9f18dee3775b5ae01c"
dependencies = [
 "argon2",
 "curve25519-dalek 4.0.0-pre.1",
 "derive-where",
 "digest 0.10.3",
 "displaydoc",
 "elliptic-curve",
 "generic-array",
 "hkdf",
 "hmac",
 "rand 0.8.5",
 "serde",
 "subtle",
 "voprf",
 "zeroize",
]
```

### Not working (new project with only `opaque-ke` as dependency)
```toml
[[package]]
name = "opaque-ke"
version = "2.0.0-pre.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9844f463f0a94ae962969f233bf7ebae4dc8dc6c0d1bf9f18dee3775b5ae01c"
dependencies = [
 "curve25519-dalek",
 "derive-where",
 "digest 0.10.3",
 "displaydoc",
 "elliptic-curve",
 "generic-array",
 "hkdf",
 "hmac",
 "rand",
 "serde",
 "subtle",
 "voprf",
 "zeroize",
]
```

## Error

```
error[E0308]: mismatched types
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/opaque-ke-2.0.0-pre.2/src/opaque.rs:456:50
    |
456 |         let evaluation_element = server.evaluate(&message.blinded_element);
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found struct `BlindedElement`
    |
    = note: expected reference `&[u8]`
               found reference `&BlindedElement<<CS as ciphersuite::CipherSuite>::OprfCs>`

error[E0308]: mismatched types
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/opaque-ke-2.0.0-pre.2/src/opaque.rs:460:17
    |
460 |                 evaluation_element,
    |                 ^^^^^^^^^^^^^^^^^^ expected struct `EvaluationElement`, found enum `Result`
    |
    = note: expected struct `EvaluationElement<<CS as ciphersuite::CipherSuite>::OprfCs>`
                 found enum `Result<GenericArray<u8, _>, voprf::Error>`

error[E0308]: mismatched types
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/opaque-ke-2.0.0-pre.2/src/opaque.rs:763:50
    |
763 |         let evaluation_element = server.evaluate(&credential_request.blinded_element);
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found struct `BlindedElement`
    |
    = note: expected reference `&[u8]`
               found reference `&BlindedElement<<CS as ciphersuite::CipherSuite>::OprfCs>`

error[E0599]: no method named `value` found for enum `Result` in the current scope
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/opaque-ke-2.0.0-pre.2/src/opaque.rs:765:71
    |
765 |         let beta = OprfGroup::<CS>::serialize_elem(evaluation_element.value());
    |                                                                       ^^^^^ method not found in `Result<GenericArray<u8, _>, voprf::Error>`

error[E0308]: mismatched types
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/opaque-ke-2.0.0-pre.2/src/opaque.rs:782:13
    |
782 |             evaluation_element,
    |             ^^^^^^^^^^^^^^^^^^ expected struct `EvaluationElement`, found enum `Result`
    |
    = note: expected struct `EvaluationElement<_>`
                 found enum `Result<GenericArray<u8, _>, voprf::Error>`

Some errors have detailed explanations: E0308, E0599.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `opaque-ke` due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
Error: error building at STEP "RUN cargo build --release": error while running runtime: exit status 101
```



Discussion / hints:
Hmm, interesting. Which version of the "voprf" crate is the not working Cargo.lock file pulling in?

It should be `voprf 0.4.0-pre.2`

Edit: Oh, I see the issue. This line (https://github.com/novifinancial/opaque-ke/blob/v2.0.0-pre.2/Cargo.toml#L49) should have been `=0.4.0-pre.2`. That's an unfortunate miss by me, sorry!

I can put out a v2.0.0-pre.3 that fixes this, and yank the v2.0.0-pre.2. Does that work for you?
`voprf 0.4.0-pre.4`

Sounds good. I'll test everything with the new version


Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6fe86602..938c4a06 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Changelog
 
+## 2.0.0-pre.3 (July 11, 2022)
+* Synced implementation with draft-irtf-cfrg-opaque-10
+* Changed argon2 salt length to recommended value (16 bytes)
+* Fixed issue from 2.0.0-pre.2 not pinning voprf dependency correctly
+
 ## 2.0.0-pre.2 (April 22, 2022)
 * Synced implementation with draft-irtf-cfrg-opaque-08
 
diff --git a/Cargo.toml b/Cargo.toml
index 358dc2bc..917f816a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,7 +46,7 @@ serde_ = { version = "1", package = "serde", default-features = false, features
   "derive",
 ], optional = true }
 subtle = { version = "2.3", default-features = false }
-voprf = { version = "0.4.0-pre.3", default-features = false, features = [
+voprf = { version = "=0.4.0-pre.3", default-features = false, features = [
   "danger",
 ] }
 zeroize = { version = "1.5", features = ["zeroize_derive"] }
diff --git a/README.md b/README.md
index 876a25a1..270c0e67 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ Resources
 ---------
 
 - [OPAQUE academic publication](https://eprint.iacr.org/2018/163.pdf), including formal definitions and a proof of security
-- [draft-irtf-cfrg-opaque-08](https://datatracker.ietf.org/doc/draft-irtf-cfrg-opaque/08/), containing a detailed (byte-level) specification for OPAQUE
+- [draft-irtf-cfrg-opaque-10](https://datatracker.ietf.org/doc/draft-irtf-cfrg-opaque/10/), containing a detailed (byte-level) specification for OPAQUE
 - ["Let's talk about PAKE"](https://blog.cryptographyengineering.com/2018/10/19/lets-talk-about-pake/), an introductory blog post written by Matthew Green that covers OPAQUE
 - [opaque-wasm](https://github.com/marucjmar/opaque-wasm), a WebAssembly package for this library
 
diff --git a/src/lib.rs b/src/lib.rs
index 32a68c03..004977dc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,7 +8,7 @@
 //! An implementation of the OPAQUE asymmetric password authentication key
 //! exchange protocol
 //!
-//! Note: This implementation is in sync with [draft-irtf-cfrg-opaque-08](https://datatracker.ietf.org/doc/draft-irtf-cfrg-opaque/08/),
+//! Note: This implementation is in sync with [draft-irtf-cfrg-opaque-10](https://datatracker.ietf.org/doc/draft-irtf-cfrg-opaque/10/),
 //! but this specification is subject to change, until the final version
 //! published by the IETF.
 //!


Test patch: