Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curve25519 test vectors #319

Merged
merged 7 commits into from
May 23, 2023
Merged

Curve25519 test vectors #319

merged 7 commits into from
May 23, 2023

Conversation

daxpedda
Copy link
Contributor

I was trying the test vectors supplied in cfrg/draft-irtf-cfrg-opaque#404 but very quickly ran into a roadblock.

@kevinlewi would appreciate it if you take a look.

@kevinlewi
Copy link
Contributor

@daxpedda Got the tests working (but am running into issues with pushing and updating this PR). See 72c4736, if you can copy the changes over to this PR here that would be great!

@daxpedda
Copy link
Contributor Author

daxpedda commented Apr 2, 2023

Amazing!

So there are two points still open:

@kevinlewi
Copy link
Contributor

@daxpedda
Copy link
Contributor Author

daxpedda commented Apr 2, 2023

I just tested it, doesn't seem to be the case. I want to point out that the latest commit did something with the code but didn't actually update the test vectors, the updated test vectors in the commit are the same as in the commits before, they were just not updated in some of the files. Maybe some oversight happened there.

Just to make sure, maybe there is a misunderstanding here, what I mean is that the private keys in the test vectors should already be clamped, instead of having to clamp them during deserialization.

  • I don't think a random oracle is required. See the "Computing secret keys" section of https://cr.yp.to/ecdh.html, which I believe is an authoritative source for this kind of stuff.

I see.

Out of curiosity, looking at the NIST curves, I couldn't find anything requiring such a random oracle as is currently used in OPAQUE: NIST FIPS 186-5.

Probably better to ask this in the IETF OPAQUE repo, but I couldn't really find an explanation why we need such a "heavy-handed" random oracle for P-256/P-384/P-521.

@kevinlewi
Copy link
Contributor

I just tested it, doesn't seem to be the case. I want to point out that the latest commit did something with the code but didn't actually update the test vectors, the updated test vectors in the commit are the same as in the commits before, they were just not updated in some of the files. Maybe some oversight happened there.

Just to make sure, maybe there is a misunderstanding here, what I mean is that the private keys in the test vectors should already be clamped, instead of having to clamp them during deserialization.

Ah, oops! I found an issue with the official test vectors which I thought were clamping properly... but looks like there is still a bug. Sorry, will get that sorted out! But yes, we are on the same page with what needs to happen :)

@daxpedda
Copy link
Contributor Author

Updated the test vectors.
Apparently randomized_pwd is missing on some, but otherwise looks good!

@daxpedda daxpedda marked this pull request as ready for review May 21, 2023 09:17
@daxpedda
Copy link
Contributor Author

daxpedda commented May 21, 2023

Alright, everything works now!
Thank you @kevinlewi for the amazing work in cfrg/draft-irtf-cfrg-opaque#404.

@kevinlewi
Copy link
Contributor

FYI, I think the test vectors had some variable names changed, in case this causes errors:
server_keyshare -> server_public_keyshare
client_keyshare -> client_public_keyshare
randomized_pwd -> randomized_password

@daxpedda
Copy link
Contributor Author

daxpedda commented May 21, 2023

Thanks, adjusted.

client_keyshare was completely removed from the test vectors in the latest commit of cfrg/draft-irtf-cfrg-opaque#404, it was not replaced with client_public_keyshare, I assume this was by accident?

@kevinlewi
Copy link
Contributor

kevinlewi commented May 22, 2023

client_keyshare was completely removed from the test vectors in the latest commit of cfrg/draft-irtf-cfrg-opaque#404, it was not replaced with client_public_keyshare, I assume this was by accident?

Ah, seems like client_keyshare / client_public_keyshare was mistakenly removed in cfrg/draft-irtf-cfrg-opaque#407 (which I incorporated after merging with the main branch). I will push another commit to add it back in, thanks for the catch!

@daxpedda
Copy link
Contributor Author

Alright, this is good to go now!

@daxpedda daxpedda requested a review from kevinlewi May 22, 2023 10:46
@kevinlewi
Copy link
Contributor

This is in sync with cfrg/draft-irtf-cfrg-opaque@a55d914, but after cfrg/draft-irtf-cfrg-opaque#411 there were a couple of more minor-ish edits to the test vectors which need to be incorporated. We can do so in a follow-up PR, as I'd like to merge this one first.

@kevinlewi kevinlewi merged commit 98b42d6 into facebook:main May 23, 2023
kevinlewi added a commit that referenced this pull request Oct 10, 2024
* Fix Clippy (#289)

* Add Dependabot (#287)

* Fix Clippy

* Add Dependabot

* Bump actions/checkout from 2 to 3 (#291)

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/cache from 2 to 3 (#292)

Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update dependencies (#288)

* Fix Clippy

* Update dependencies

* Fix CI (#298)

* Rename X25519 to Curve25519 (#302)

* Update `curve25519-dalek` to 4.0.0-pre.5 (#301)

* Update `curve25519-dalek`

* Improve documentation

* Update `voprf` to 0.5.0-pre.1

* Bump `voprf` to v0.5.0-pre.2 (#304)

* Only use explicit crate features (#306)

* Publishing v3.0.0-pre.1 (#309)

* Update `rustyline` to v0.11 (#313)

* Update VOPRF to draft 19 (#307)

* Update `argon2` to v0.5 (#314)

* Test P-384 (#290)

* Update scrypt requirement from 0.10 to 0.11 (#315)

Updates the requirements on [scrypt](https://github.com/RustCrypto/password-hashes) to permit the latest version.
- [Release notes](https://github.com/RustCrypto/password-hashes/releases)
- [Commits](RustCrypto/password-hashes@scrypt-v0.10.0...scrypt-v0.11.0)

---
updated-dependencies:
- dependency-name: scrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Publishing v3.0.0-pre.2 (#318)

* Bump `voprf` to v0.5.0-pre.4 (#322)

* Correctly clamp Curve25519 secret keys (#323)

* Curve25519 test vectors (#319)

* Curve25519 test vectors

* Adjust `derive_auth_keypair()` for Curve25519

* Update test vectors

* Fix Curve25519 random scalar generation

Co-Authored-By: Kevin Lewi <[email protected]>

* Update test vectors

* Update test vectors

* Update test vectors

---------

Co-authored-by: Kevin Lewi <[email protected]>

* Updating dual-license language (#324)

* Update criterion requirement from 0.4 to 0.5 (#325)

Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](bheisler/criterion.rs@0.4.0...0.5.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update keypair generation to use derive_auth_keypair (#326)

* Fixing simple_login test to enable argon2 feature (#328)

* Publishing v3.0.0-pre.3 (#327)

* Update rustyline requirement from 11 to 12 (#332)

Updates the requirements on [rustyline](https://github.com/kkawakam/rustyline) to permit the latest version.
- [Release notes](https://github.com/kkawakam/rustyline/releases)
- [Changelog](https://github.com/kkawakam/rustyline/blob/master/History.md)
- [Commits](kkawakam/rustyline@v11.0.0...v12.0.0)

---
updated-dependencies:
- dependency-name: rustyline
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update parameter from sk to private_key (#329)

* Bump `curve25519-dalek` to v4.0.0-rc.3 (#330)

* add more resources (WebAssembly and React Native) (#335)

* add more resources (WebAssembly and React Native)

* Fixing clippy

---------

Co-authored-by: Kevin Lewi <[email protected]>

* Publishing v3.0.0-pre.4 (#337)

* update docs: clarify export_key and session_key length (#338)

* Increase MSRV to 1.70 and update workflow dependencies (#342)

* Clarifying the persisting of server setup (#344)

* Add `clippy::doc_markdown` (#346)

* Fixing clippy errors (#347)

* Test P-521 (#349)

* Test P-521

* De-duplicate generic calls

* Simplify full test vectors generation

* Adding copyright header to generated test file (#351)

* Update rustyline requirement from 12 to 13 (#352)

Updates the requirements on [rustyline](https://github.com/kkawakam/rustyline) to permit the latest version.
- [Release notes](https://github.com/kkawakam/rustyline/releases)
- [Changelog](https://github.com/kkawakam/rustyline/blob/master/History.md)
- [Commits](kkawakam/rustyline@v12.0.0...v13.0.0)

---
updated-dependencies:
- dependency-name: rustyline
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/cache from 3 to 4 (#354)

Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Updating dependencies (#360)

* docs: add details for client login final step (#358)

This tweaks the documentation on the main module, in order to
add some details on the outcome of the client login final step.
In particular, it clarifies the result of `ClientLogin::finish()`
both on success and on errors and it adds some intra-crate links
to the relevant structures and fields.

* Publishing v3.0.0-pre.5 (#364)

* Revert "Update keypair generation to use derive_auth_keypair (#326)"

This reverts commit deb7ca3.

* Fixups to keep in sync with draft-10

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: daxpedda <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nik Graf <[email protected]>
Co-authored-by: Luca Bruno <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants