Closed Bug 2064306 Opened 1 month ago Closed 21 days ago

HPKE P-256 and P-384 KEMs

Categories

(NSS :: Libraries, enhancement, P2)

enhancement

Tracking

(nss 3.130)

RESOLVED FIXED
Tracking Status
nss --- 3.130

People

(Reporter: mt, Assigned: mt)

Details

Attachments

(2 files)

The P-256 and P-384 DH KEM variants of HPKE are somewhat widely used. Implementation is also fairly straightforward. The code was generally structured in a way that was easy to extend with a new (DH) KEM.

For the mainline code, the only problem was that the HPKE code was not consistently using the right key types for X25519. In the interests of backward/ABI compatibility, the code now tolerates keys that are created with ecKey AND ecMontKey as their type. A new test is added that confirms this. This results in about a third of the overall diff.

The bulk of the changes here are tests. Test vectors, sourced from HPKE updates, are added. These don't include the secret key used by the sender, which meant that slight restructuring was necessary. This produces most of the rest of the diff.

This adds support for the two common NIST EC curves as DH KEMs in HPKE.

This also ensures that it is possible to generate an X25519 key using
either CKM_EC_KEY_PAIR_GEN and CKM_EC_MONTGOMERY_KEY_PAIR_GEN.
That will be tagged as an ecKey or ecMontKey respectively.
Prior to this, only the first (ecKey) form was accepted.
As PK11_GenerateKeyPair is properly invoked with the latter in
many places, including the nss-rs crate, this was causing issues.

Severity: -- → N/A
Priority: -- → P2

There is an r+ patch which didn't land and no activity in this bug for 1 week.
:mt, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(mt)
Flags: needinfo?(jschanck)
Attachment #9627706 - Attachment description: Bug 2064306 - HPKE P-256 and P-384 KEMs r=#nss-reviewers → Bug 2064306 - HPKE P-256 and P-384 KEMs r=jschanck
Flags: needinfo?(mt)
Flags: needinfo?(jschanck)

Pushed by jschanck@mozilla.com:
https://hg.mozilla.org/projects/nss/rev/e29c1ed7efa8
HPKE P-256 and P-384 KEMs r=nss-reviewers,jschanck

Status: NEW → RESOLVED
Closed: 21 days ago
Resolution: --- → FIXED
Pushed by jschanck@mozilla.com: https://hg.mozilla.org/projects/nss/rev/ceab23409b6d avoid VLA in tls_ech_unittest.cc. r=mt
status-nss: --- → 3.130
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: