Skip to content

Conversation

@kkoyung
Copy link
Member

@kkoyung kkoyung commented Nov 1, 2025

Finish adding ECDH support to WebCrypto API. This patch implements derive bits operation of ECDH.

Testing: Pass some WPT tests that were expected to fail.
Fixes: Part of #39060

@kkoyung kkoyung requested a review from gterzian as a code owner November 1, 2025 05:54
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 1, 2025
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 3, 2025
@arihant2math arihant2math added the S-awaiting-review There is new code that needs to be reviewed. label Nov 3, 2025
let secret_length = secret.len();
secret[secret_length - 1] &= mask;
}
Ok(secret[..length.div_ceil(8) as usize].to_vec())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This be de-duplicated from the previous occurrence.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. The resizing of secret at L267 is redundant since it has been done before.

Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, but I'd like to understand the remaining test failure.

[P-521 mismatched curves]
expected: FAIL

[P-521 public property of algorithm is not an ECDSA public key]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we still fail this subtest?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test tries to derive a key with an ECDSA public key rather than an ECDH public key, and expects step 4 throw an InvalidAccessError. However, we have not yet implemented key import operation of ECDSA, so this test cannot reach step 4 to get an InvalidAccessError.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 4, 2025
@jdm jdm added this pull request to the merge queue Nov 5, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Nov 5, 2025
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Nov 5, 2025
@kkoyung
Copy link
Member Author

kkoyung commented Nov 5, 2025

I rebased on the main branch, and added the CanGc argument introduced in recent PR #40404

@jdm jdm added this pull request to the merge queue Nov 5, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 5, 2025
Merged via the queue into servo:main with commit ffe9c45 Nov 5, 2025
35 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 5, 2025
@kkoyung kkoyung deleted the ecdh-derive-bits branch November 5, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants