facebook / opaque-ke

An implementation of the OPAQUE password-authenticated key exchange protocol
Apache License 2.0
300 stars 46 forks source link

Build fails #279

Closed riley-ashton closed 2 years ago

riley-ashton commented 2 years ago

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 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)

[[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)

[[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
kevinlewi commented 2 years ago

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?

riley-ashton commented 2 years ago

voprf 0.4.0-pre.4

Sounds good. I'll test everything with the new version

kevinlewi commented 2 years ago

v2.0.0-pre.3 was published and v2.0.0-pre.2 was yanked. Please re-open this issue if you are still facing the problem, @riley-ashton. And thanks for the catch!

riley-ashton commented 2 years ago

Thanks for your help Kevin. Everything is working now.